Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDB Usage unnecessarily requires rust-gdb (PR Provided) #111961

Closed
theIDinside opened this issue May 25, 2023 · 1 comment · Fixed by #111962
Closed

GDB Usage unnecessarily requires rust-gdb (PR Provided) #111961

theIDinside opened this issue May 25, 2023 · 1 comment · Fixed by #111962
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)

Comments

@theIDinside
Copy link
Contributor

For UI:s that wrap GDB, the current design of the pretty printer loading library makes it cumbersome and very unergonomic to debug rust applications. This is highly unfortunate.

The problem is the rust-gdb wrapper script and the design of the python pretty printers; one can't simply do

> gdb fooapp
> gdb> source PATH/TO/gdb_load_rust_pretty_printers.py

This basically means that, for instance a GUI needs to know what language is being debugged before actually starting debugging.

Instead, for a GUI, once the debuggee has been loaded it can query the language (via the DWARF debug info) and then take action on what to do. But this requires that gdb_load_rust_pretty_printers.py is "source'able" from GDB, after GDB has been spawned - which it currently is not. An upcoming PR will solve this issue.

@jyn514 jyn514 added the A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) label May 26, 2023
@tromey
Copy link
Contributor

tromey commented May 27, 2023

gdb generally has a problem with static linking and pretty-printer registration. There's no really good solution we've found.

For Rust I think a way to move away from rust-gdb would be to change cargo to create an appropriately-named gdbinit file next to the executables it creates. The gdbinit it creates could source ones from the various libraries that go into the final product, including the toolchain's. Then with the appropriate auto-load safety setting, plain gdb would pick this up automatically.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 6, 2023
…ulacrum

Make GDB Python Pretty Printers loadable after spawning GDB, avoiding required `rust-gdb`

Fixes rust-lang#111961

Makes the Python pretty printer library source'able from within GDB after spawn, making the wrapper script `rust-gdb` become not the required approach to use the pretty printer library.

Allows for integration into GUI:s that wrap GDB extremely easy. The previous design complicates this feature.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 6, 2023
…ulacrum

Make GDB Python Pretty Printers loadable after spawning GDB, avoiding required `rust-gdb`

Fixes rust-lang#111961

Makes the Python pretty printer library source'able from within GDB after spawn, making the wrapper script `rust-gdb` become not the required approach to use the pretty printer library.

Allows for integration into GUI:s that wrap GDB extremely easy. The previous design complicates this feature.
@bors bors closed this as completed in c5145dc Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.)
Projects
None yet
3 participants