Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upShip a custom LLDB with Rust support #48168
Comments
pietroalbini
added
A-LLVM
C-tracking-issue
labels
Feb 12, 2018
This comment was marked as resolved.
This comment was marked as resolved.
|
cc me |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
The first item is done. I'm testing the second item now. I had thought that the third item would be covered by the |
This comment has been minimized.
This comment has been minimized.
|
@tromey I think we'll need to wait for a new nightly to see whether or not rustup works, at that point we should have a look at the manifest and it ay already work! |
This comment has been minimized.
This comment has been minimized.
|
Thanks. Also, a local |
This comment has been minimized.
This comment has been minimized.
I don't think so. |
This comment has been minimized.
This comment has been minimized.
|
This reports that it didn't work: https://internals.rust-lang.org/t/rust-debugging-quest/6753/13?u=tromey I haven't looked into it yet. |
This comment has been minimized.
This comment has been minimized.
|
lldb isn't mentioned in |
This comment has been minimized.
This comment has been minimized.
|
@tromey I am not familiar with the code but if I follow the code correctly, there might be an issue here: rust/src/tools/build-manifest/src/main.rs Lines 461 to 467 in afd0a2f
rust/src/tools/build-manifest/src/main.rs Lines 534 to 535 in afd0a2f
rust/src/tools/build-manifest/src/main.rs Line 276 in afd0a2f So I think the problem here is that call to |
This comment has been minimized.
This comment has been minimized.
|
Thanks for your note. That's a good find! |
This comment has been minimized.
This comment has been minimized.
|
I have the obvious patch here: https://github.com/tromey/rust/tree/lldb-manifest-fix - but I don't know how to test it locally. |
This comment has been minimized.
This comment has been minimized.
|
I see that #52716 is building LLDB for macOS. What's the (long term) plan for Windows and Linux? Will we also ship LLDB on those two OSes? At some point I heard that we might ship GDB on Linux (because GDB is better, or maybe easier to ship, than LLDB on Linux?) and then that we'll probably not do that (because system GDB is good enough?). For the embedded use case having a debugger with support for architectures other than x86 (notably ARM and RISCV) shipped with the compiler would be godsend as the user would have one less tool to install (e.g. In that regard, an cc @dvc94ch |
This comment has been minimized.
This comment has been minimized.
|
The main reason lldb is only built for macOS is that on other platforms, the Python dependency is hard to satisfy. On Windows I guess we'd have to ship Python. On Linux, ideally you'd use the system Python, but I think there is no compatibility across distros, due to the Python 2/3 schism, and perhaps also due to differences in filesystem layout (? I can't recall). On Linux, there may be an additional difficulty setting the path for the system's separate debuginfo. However I haven't really looked to see what distros other than Fedora do here. It's possible there are also other dependency-related issues. The upstream situations with gdb and lldb are different. gdb accepted all the Rust code, and I'm the maintainer for that, so it is very easy for us to add rust-related improvements there. The main issue with gdb is that it is on a twice-per-year release schedule, so there is some lag relative to rustc. This is one reason that it would be good to ship a gdb -- we could synchronize rust improvements better. lldb, on the other hand, did not want the rust plugin until it has been proven. I put this info in the rust lldb wiki but here's the message: http://lists.llvm.org/pipermail/lldb-dev/2018-January/013213.html (IIRC there are some other notes that month including some discussion of rust specifically). So, we have to ship a fork and I have no concrete plans to upstream anything. In a sense this is good because it avoids the synchronization problem. |
This comment has been minimized.
This comment has been minimized.
|
I sent the PR: #53452 |
tromey
referenced this issue
Aug 17, 2018
Merged
Change target triple used to check for lldb in build-manifest #53452
This comment has been minimized.
This comment has been minimized.
I think every distro supports both python2 and python3. What python simlinks to may be different. If you have a specific issue can you provide more info so that I can help debug it?
I think users can set this in their .gdbinit in their home directory. I'm sure we can figure this one out too... Are there any concrete steps that can be taken to get lldb distributed with rust on linux? |
This comment has been minimized.
This comment has been minimized.
If we ship an lldb that is linked against some system Python, then that version of Python has to exist on the user's machine. But AFAIK we can't influence whether this is true or not. Perhaps it's even possible to have an install without Python. Also, library paths differ between distros (IIRC Debian and Fedora handle multi-arch differently), though perhaps this could be worked around in rustup. If the dependency problems can be solved somehow then we should also ship gdb on Linux. Less sure about shipping either debugger on Windows. |
This comment has been minimized.
This comment has been minimized.
|
How about building gdb statically? It seems to be supported https://stackoverflow.com/questions/9364685/how-i-can-static-build-gdb-from-source |
This comment has been minimized.
This comment has been minimized.
Will that work if Python code loads a C extension? I wouldn't think so but I am not 100% certain. |
This comment has been minimized.
This comment has been minimized.
Is that necessary for the rust gdb part? I think that 99% of users will use a ide for debugging. I currently use a python gdb gui which is a huge improvement over just using the cli, but I'll be adding lldb/gdb support to https://github.com/theia-ide/theia-rust-extension after theia-ide/theia#2447 lands. |
This comment has been minimized.
This comment has been minimized.
It isn't necessary in the sense that gdb will still work without it. However, I'd rather not limit what users can do. For example I use this facility all the time.
OOC what is it? One idea I had is that maybe we could have rustup check for required dependencies before installing. Then, if the dependencies were missing, it could point users to a wiki page explaining how to install the dependencies for their distro. It isn't just Python, for best results gdb also needs zlib, expat, curses, and lzma (and maybe mpfr as well). The second part of this idea would be to pick sufficiently old versions of these libraries to build against so that the dependencies can be satisfied on all the target distros, whatever those are. Also, we'd modify gdb to find the distro's separate debug directory and installed gdb python code. At runtime the dependencies would be satisfied by having rustup (continue to) set lldb would work similarly, though I think there are fewer dependencies, since it doesn't support some of the Linux-specific things that gdb does. |
This comment has been minimized.
This comment has been minimized.
|
This comment has been minimized.
This comment has been minimized.
One problem with that is that some distros (fedora) don't provide symlinks to old libs. So if I compile a lib with a dependency on libreadline with travis which uses libreadline.so.6 the dep isn't found on fedora which only has libreadline.so.7. A possible solution would be to change the lib names to libreadline.so in the binary before distributing. I currently am working around this on my machine by adding the appropriate symlinks. Distributing software on Linux in a distro independent way is a PITA. |
This comment has been minimized.
This comment has been minimized.
|
We'd have to survey the dependencies on the distros we care about to see if it's possible. Note that readline in particular needn't be an issue because gdb vendors it (distros tend to disable this but we don't have to). |
This comment has been minimized.
This comment has been minimized.
|
Let's move the gdb discussion to #34457. |
This comment has been minimized.
This comment has been minimized.
|
rustup PR is here: rust-lang/rustup.rs#1492 |
tromey
added a commit
to tromey/rust
that referenced
this issue
Sep 5, 2018
This was referenced Sep 5, 2018
tromey
added a commit
to tromey/rust
that referenced
this issue
Sep 7, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Sep 7, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Sep 7, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Sep 8, 2018
kennytm
added a commit
to kennytm/rust
that referenced
this issue
Sep 8, 2018
This comment has been minimized.
This comment has been minimized.
|
Latest problem is #54126. |
This comment has been minimized.
This comment has been minimized.
|
Regarding Python dependency on Linux: I doubt that any distro will drop Python 2.7 before 2020, even if it might not be the default. So for the next year we could ship LLDB linked to Python 2.7. Some time after that, Python 2 will start going extinct, so we'll need to switch to Python 3. Which is going to be a headache, because a new version comes every once in a while. At that point, one of the following needs to happen:
|
This comment has been minimized.
This comment has been minimized.
One question is whether we can rely on it being installed. But maybe we could teach
I don't think this will change anything here, because even if lldb accepts the Rust plugin, we will probably still want to ship lldb, so that we aren't blocked on making debuginfo improvements. There's an analogous case for shipping gdb, see #34457. I'm generally agreed on the other points. |
This comment has been minimized.
This comment has been minimized.
|
On http://lldb.llvm.org/build.html it mentions that python dependency(and some other dependencies) can be opt-out by adding The full list:
|
This comment has been minimized.
This comment has been minimized.
I think we want Python, because it is how the pretty-printers in |
alexcrichton commentedFeb 12, 2018
•
edited
I hear that @tromey has been doing some awesome work with Rust-specific support in LLDB, and we should enable easily shipping that work to users! This is intended to be a checklist/tracking issue of sorts of the work needed to be done to enable this.
release_60branch.sccacheand is being cached properly when using sccache. The change here would basically be ensuring that--enable-ccacheworks for LLDB locally.rustup component add lldb(or whatever the name is), but this is much farther down the line!