llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.92k stars 11.52k forks source link

lldb-9 doesn't work after installation #43585

Open 1f54fedf-f4a7-4336-96b0-7de133fe6593 opened 4 years ago

1f54fedf-f4a7-4336-96b0-7de133fe6593 commented 4 years ago
Bugzilla Link 44240
Version unspecified
OS Linux
CC @JDevlieghere,@jmarrec,@pedro-w

Extended Description

Environment: $ uname -a Linux mbedesk 4.19.0-6-amd64 #​1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux

$ python --version Python 2.7.16

Installed from apt.llvm.org

$ apt-cache show lldb-9 Package: lldb-9 Source: llvm-toolchain-9 Version: 1:9~+20191125110536+62a16ca77d6-1~exp1~20191125221139.91 Architecture: amd64 Maintainer: LLVM Packaging Team pkg-llvm-team@lists.alioth.debian.org Installed-Size: 28064 Depends: libc6 (>= 2.15), libedit2 (>= 2.11-20080614-0), libgcc1 (>= 1:3.0), liblldb-9 (>= 1:9~svn298832-1~), libllvm9 (= 1:9~+20191125110536+62a16ca77d6-1~exp1~20191125221139.91), libncurses6 (>= 6), libstdc++6 (>= 7), libtinfo6 (>= 6), llvm-9-dev, python-lldb-9 Homepage: https://www.llvm.org/ Priority: optional Section: devel Filename: pool/main/l/llvm-toolchain-9/lldb-9_9~+20191125110536+62a16ca77d6-1~exp1~20191125221139.91_amd64.deb Size: 7231112 SHA256: 9f4a03baa60d3635e6a02f16631d0caef33e35f933654eb03ac9f15cad97db5f SHA1: f7c133ea8d9c4f7244e2822720d4636f8b0c3380 MD5sum: 36292919a2698a61e2a9b1954ce5def4 Description: Next generation, high-performance debugger LLDB is a next generation, high-performance debugger. It is built as a set of reusable components which highly leverage existing libraries in the larger LLVM Project, such as the Clang expression parser and LLVM disassembler. Description-md5: 45d52d0209cd7953d2f2bc4d1a99170f

$ lldb-9 (lldb) script Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'lldb' Traceback (most recent call last): File "", line 1, in NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "", line 1, in NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "", line 1, in NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "", line 1, in NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "", line 1, in NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "", line 1, in NameError: name 'run_one_line' is not defined Traceback (most recent call last): File "", line 1, in NameError: name 'run_python_interpreter' is not defined

(lldb) script print(123) Traceback (most recent call last): File "", line 1, in NameError: name 'run_one_line' is not defined error: python failed attempting to evaluate 'print(123)'

jmarrec commented 4 years ago

Peter's workaround was working fine until today, where I got prompted for update (and did):

lldb-9/bionic-updates 1:9-2~ubuntu18.04.1 amd64 [upgradable from: 1:9~+20191211102125+c1a0a213378-1~exp1~20191211212701.104] llvm-9/bionic-updates 1:9-2~ubuntu18.04.1 amd64 [upgradable from: 1:9~+20191211102125+c1a0a213378-1~exp1~20191211212701.104] llvm-9-dev/bionic-updates 1:9-2~ubuntu18.04.1 amd64 [upgradable from: 1:9~+20191211102125+c1a0a213378-1~exp1~20191211212701.104] llvm-9-runtime/bionic-updates 1:9-2~ubuntu18.04.1 amd64 [upgradable from: 1:9~+20191211102125+c1a0a213378-1~exp1~20191211212701.104] llvm-9-tools/bionic-updates 1:9-2~ubuntu18.04.1 amd64 [upgradable from: 1:9~+20191211102125+c1a0a213378-1~exp1~20191211212701.104] python-lldb-9/bionic-updates 1:9-2~ubuntu18.04.1 amd64 [upgradable from: 1:9~+20191211102125+c1a0a213378-1~exp1~20191211212701.104] python3-lldb-9/bionic-updates 1:9-2~ubuntu18.04.1 amd64 [upgradable from: 1:9~+20191211102125+c1a0a213378-1~exp1~20191211212701.104]

PYTHONPATH=/usr/lib/llvm-9/lib/python3.6/site-packages/ lldb-9 will appear to work at first, but if I try to load formatters it crashes. Also, without loading formatters, I get pretty much a segfault all the time when trying to print stl containers and stuff.

pedro-w commented 4 years ago

I had this and was able to work-around by: export PYTHONPATH=/usr/lib/llvm-9/lib/python3.7/site-packages and recently (today!) it changed to export PYTHONPATH=/usr/lib/llvm-9/lib/python3/dist-packages

(note that, at least on my system, LLDB used Python 3) $ uname -a Linux debian 4.19.0-6-amd64 #​1 SMP Debian 4.19.67-2+deb10u2 (2019-11-11) x86_64 GNU/Linux $ lldb (lldb) script print(sys.version) 3.7.3 (default, Apr 3 2019, 05:39:12) [GCC 8.3.0]

Regarding the other thing (symlink to lldb-server-9.0.1) I filed a bug on that as bug #​44104 , though it has not received any attention so far!

Hope that helps.

jmarrec commented 4 years ago

Forgot:

$ uname -a

Linux julien-bionic 5.0.0-37-generic #​40~18.04.1-Ubuntu SMP Thu Nov 14 12:06:39 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

jmarrec commented 4 years ago

I reported the same on the mailing list. I have the same problem with multiple machines on Ubuntu 18.04.

With lldb-9/now 1:9~+20191120043737+0f34f1b9318-1~exp1~20191120154310.86, lldb -P was /usr/lib/x86_64-linux-gnu/python3.6/site-packages.

With Version: 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103, lldb -P is now /usr/lib/lib/python3/dist-packages.

Neither exist obviously.

$ sudo apt list --installed | /bin/grep "ll[d|v]"

liblldb-9/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed,automatic] libllvm8/now 1:8.0.1~svn369350-1~exp1~20190820121219.79 amd64 [installed,local] libllvm9/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed,automatic] lldb-9/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed] llvm-9/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed,automatic] llvm-9-dev/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed,automatic] llvm-9-runtime/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed,automatic] llvm-9-tools/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed,automatic] python-lldb-9/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed,automatic] python3-lldb-9/unknown,now 1:9~+20191205075722+432bf48c08d-1~exp1~20191205190324.103 amd64 [installed]


Side note: on a fresh install of lldb-9, it doesn't even work due to error: process launch failed: unable to locate lldb-server-9.0.1. I have to go create a proper symlink manually.

$ ls -la /usr/lib/llvm-9/bin/lldb-server* -rwxr-xr-x 1 root root 6222096 Nov 22 04:51 /usr/lib/llvm-9/bin/lldb-server lrwxrwxrwx 1 root root 11 Nov 22 04:51 /usr/lib/llvm-9/bin/lldb-server-9 -> lldb-server lrwxrwxrwx 1 root root 11 Nov 22 04:51 /usr/lib/llvm-9/bin/lldb-server-9.0.0 -> lldb-server

This fixes it:

$ cd /usr/lib/llvm-9/bin $ sudo ln -sf lldb-server lldb-server-9.0.1