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 upPackage gdb with Rust #34457
Comments
This comment has been minimized.
This comment has been minimized.
|
Sounds great to me, I'm all for it! |
This comment has been minimized.
This comment has been minimized.
|
I can see where you are coming from, but long term, I'd rather see LLDB standardized for Rust. I've investigated both while developing my vscode debugger front-end and here's why I chose to go with LLDB:
|
This comment has been minimized.
This comment has been minimized.
|
LLDB being standardized for rust can happen independently of this. I was thinking of working on it; but not sure of I will (won't have time; C++ is draining). |
This comment has been minimized.
This comment has been minimized.
|
Also, until we figure out a story for DWARF in rust things are unstable anyway. We already hit the situation once where marking our binaries as DW_LANG_RUST broke lldb but was necessary for gdb to work. |
This comment has been minimized.
This comment has been minimized.
|
I agree with the things that @vadimcn says but I don't think that these observations necessarily speak against providing a Rust-specific GDB version. Here are some more questions:
Here are some thoughts, but I'd also like to hear how other people would answer these questions:
So, I think, I'm generally in favor of this if we can pull it off with reasonable effort. |
This comment has been minimized.
This comment has been minimized.
I agree LLDB is more promising in the long-run, but think we should take the opportunity to do what we can now with gdb. It's true though that if we run ahead with our own DWARF formats while favoring GDB then the LLDB support will get worse. Perhaps we'll need to leave some option to stay LLDB compatible.
I'd expect we can do something where you type
For us it would mean updating the gdb build we produce at least once per quarter and remediating any issues that reveals.
Yeah, seems like we would need to be able to emit at least two variations of DWARF. This would present some problems with the debuginfo in std.
The quality of Windows support worries me too. It would be a shame if we couldn't support gdb there. |
This comment has been minimized.
This comment has been minimized.
|
My primary motivation for doing this is to be able to make more radical changes to our DWARF output. I'm only assuming that we need to make such changes, or have the resources to do it. |
Manishearth
added
A-tools
labels
Jun 25, 2016
This comment has been minimized.
This comment has been minimized.
It's already merged.
Probably not for gdb, but maybe for lldb.
Yes, there's a need. There are a number of issues open about both errors in the generated debuginfo and also spots where more information is needed. Importing gdb into the tree isn't needed to make progress here (though you may want to do this for other reasons). I'm happy to write the gdb side upstream in parallel with rustc fixes. The main issue I see is that there are few guards in place against rustc debuginfo regressions. 1.9 already regressed gdb's Rust support. |
This comment has been minimized.
This comment has been minimized.
|
We could set up a build step that runs the gdb rust tests. Build steps are straightforward and shouldn't take long:
|
This comment has been minimized.
This comment has been minimized.
|
Alternatively we could get a gdb fork to use http://nightli.es/ with a rust-specific travis test |
This comment has been minimized.
This comment has been minimized.
Are these things spelled out anywhere? |
This comment has been minimized.
This comment has been minimized.
Yes, I filed bugs for all the problems I found. Looking at open debuginfo bugs will show them all. Looking at this, though, I see that the most important regression was closed (for some reason I thought the patch hadn't landed); so I'll have to re-test gdb with nightly and see if it's doing better now. Some of the remaining holes require some work on DWARF or on detailing the Rust/DWARF binding. I've been planning to write a proposal for this, though I wasn't sure if this should just be a discourse post or a full-fledged RFC. Alternatively if someone gets to this before I do, I'd be happy to comment on it. |
This comment has been minimized.
This comment has been minimized.
|
Still some failures with nightly -- better than 1.9, but 1.8 was clean. I'll diagnose soon, you can follow along here. |
This comment has been minimized.
This comment has been minimized.
|
The methods failures are due to |
This comment has been minimized.
This comment has been minimized.
That is a problem. Can we somehow provide two versions of the debuginfo and make the wrapper scripts add the right one to the search path?
That's a good point. We definitely would have to include the Rust version of GDB into autotests. But that's also something that should actually become easier if we distribute our own version, right?
I absolutely agree with @tromey. We are basically stuck if we don't co-evolve the compiler and debuginfo consumers.
@tromey I'd be interested in this too. What would be the best place to allow multiple people working on it? |
This comment has been minimized.
This comment has been minimized.
|
BTW, there might be a pretty big shift in the way LLVM handles debuginfo: TL;DR; DWARF or any other debuginfo might be emitted directly to LLVM IR instead of as LLVM metadata. The good thing about that is that we would have total control about what we emit and would not have to rely on LLVM merging any custom |
This comment has been minimized.
This comment has been minimized.
|
I'm in favour of doing this. I think lowering the bar for getting good debugger support for Rust on at least one platform is very worthwhile. There is too much friction right now for a user to get to a good debugging experience. My major worry is that we don't have the long term resources to keep this in a good place. Debuginfo in the compiler is already under-resourced and slowly bit-rotting, I fear that our gdb fork would end up in the same place, or worse. |
This comment has been minimized.
This comment has been minimized.
|
The gdb fork probably won't stay a fork, patches will keep getting upstreamed. We just maintain a fork so that we can iterate faster, and the only commits that live in the fork would be things like this special function (which could also live in rust-gdb) On the note of rust-gdb, what is the proposed future for rust-gdb? I left a comment here, but that seems to be something better discussed in this thread. |
This comment has been minimized.
This comment has been minimized.
I have been working on a google doc. Contact me in email and I'll share it with you. It's not nearly done yet. |
This comment has been minimized.
This comment has been minimized.
blanham
commented
Jun 28, 2016
|
One issue with packaging GDB for macOS is that the binary needs to be codesigned in order to function. |
This comment has been minimized.
This comment has been minimized.
|
The tools team discussed this issue during triage yesterday and the main conclusion was that we're probably not quite in a position just yet to actively ship gdb. That being said, we're very willing to actively test newer versions of gdb to ensure that our support does not regress. In other words, we're always willing to have more automation! The major blockers we think need to be overcome before making progress on this are:
|
Manishearth
referenced this issue
Jun 30, 2016
Closed
Find strategy for evolving debuginfo format without breaking everything #34560
This comment has been minimized.
This comment has been minimized.
|
Do we need to worry about man-in-the-middle attacks on the insecure |
This comment has been minimized.
This comment has been minimized.
|
Presumably we'd have a fork on github, so no. |
This comment has been minimized.
This comment has been minimized.
|
@Manishearth how will that fork be cloned/updated? |
This comment has been minimized.
This comment has been minimized.
|
There are two of us with access to ssh gdb sources. Though this is a very narrow threat model which I don't expect to happen, really. |
This comment has been minimized.
This comment has been minimized.
|
Update: HTTPS access to GDB was broken due to a bug; this has now been fixed (at least I managed to check out the sources). |
This comment has been minimized.
This comment has been minimized.
locka99
commented
Jan 21, 2017
|
I'm trying to debug on Windows and I still can't do it well. TDM GDB sort of works in VSCode but step debugging is broken. At this point its easier to debug code by plastering logging all over the place and trying to pinpoint the issue. I think shipping gdb with the stable-gcc would take a lot of guesswork out of making it work. TDM's gdb standalone is a 12MB zip so that's we're talking about sizewise |
steveklabnik
removed
the
A-tools
label
Mar 24, 2017
Mark-Simulacrum
added
T-dev-tools
and removed
T-tools
labels
May 24, 2017
Mark-Simulacrum
added
C-feature-request
T-infra
labels
Jul 25, 2017
This comment has been minimized.
This comment has been minimized.
|
As part of my work on the Rust language plugin, I talked about shipping the plugin on the upstream list. There are two threads:
My conclusion from all of this is that we'll need some way to ship some lldb-related thing via rustup. In the short- and medium-term, this is likely to be all of lldb. In the longer term, maybe we can either ship just the Rust plugin (if lldb ever provides a way to build a language plugin out-of-tree), or just the Rust expression parser helper library/executable. |
This comment has been minimized.
This comment has been minimized.
|
I've come around on this and I think it would make sense to get gdb into rustup. This would let us ship Rust improvements more quickly to users. The main issues are around library dependencies. There's some discussion in #48168. There may also be some path issues, like finding system separate debuginfo or system gdb scripts. |
This comment has been minimized.
This comment has been minimized.
|
I'm looking into this a bit. A couple possible issues:
|
This comment has been minimized.
This comment has been minimized.
I think a runtime wrapper will be better - especially if/when we move rustup into Cargo, we won't want to support that kind of check (although there are also vague plans for things like post-install scripts which could do this). cc @joshtriplett for any potential distro interactions. |
tromey
added a commit
to tromey/rust
that referenced
this issue
Dec 18, 2018
tromey
added a commit
to tromey/rust
that referenced
this issue
Dec 18, 2018
tromey
added a commit
to tromey/rust
that referenced
this issue
Dec 18, 2018
bors
added a commit
that referenced
this issue
Dec 21, 2018
bors
added a commit
that referenced
this issue
Dec 21, 2018
This comment has been minimized.
This comment has been minimized.
|
Some state here: The PR may not be merged, as it puts gdb into the overall rust build; and this build is already quite slow, etc. Instead Alex said he'd be investigating whether gdb could be built separately and then the artifacts still distributed via rustup. This would definitely be nicer. The PR is still of use though. It shows how to make a Dockerfile that installs the needed static dependencies. And, it patches the There's a fork of gdb here: https://github.com/rust-dev-tools/gdb. My plan for this was to treat it like we do LLVM: keep some Rust-specific patches here (e.g., there is one to deal with the Python issue there), but otherwise keep it close to upstream. In particular, anything that would be generically useful should go upstream first, with the only divergences being things needed for the peculiarities of rustup and/or the build setup. |
brson commentedJun 24, 2016
gdb has first-class support for Rust now, and two active maintainers (@tromey @Manishearth). Let's package it with Rust. This will have lots of advantages:
Steps:
cc @michaelwoerister @rust-lang/tools What you think?