So which GDB supports Rust?


#1

I downloaded the latest release and also even compiled from git but neither worked to show strings or structs when debugging Rust code (in qtcreator).


#2

The rust installer ships a “rust-gdb” script which boots GDB up with rust-specific stuff injected in. I think some of that may be getting pushed upstream but I don’t think any of it has hit a release yet.


#3

There are multiple issues lurking here.

The Rust language support is in git gdb. The next gdb release (7.12) will have it. This support provides a number of features, perhaps primarily Rust expression parsing.

Rust also ships a rust-gdb script. This script runs gdb with some parameters to ensure that gdb can load some Rust-specific pretty-printers, written in Python. These provide a nicer debugging experience, and work with more versions of gdb than just 7.12, but don’t address all the things the built-in support addresses.

However, my recollection is that qtcreator doesn’t use the normal pretty-printing approach, in favor of its own. So, it doesn’t benefit from the things that rust-gdb supplies. (This was certainly true in the past, but I don’t follow qtcreator, so perhaps they’ve changed this – in any case I’d recommend asking in a qtcreator forum.)