5 ms·
GNU Toolchain Update – GDB now supports Rust
- dikaiosune 10y agogdb has technically supported Rust for some time, although Rust has distributed a pretty-printing wrapper (rust-gdb) to fix variable naming and some other items, but having upstream support is pretty awesome.
- Manishearth 10y agoWell, gdb used to "support" rust in that we pretended to be C and it supports C :) Upstream support gets us: - Native pretty print - Expression evaluation. You can now `print foo(bar).baz().1` and it works
- Ericson2314 10y agoHow smart is the evaluation?
- Manishearth 10y agoWhat do you mean by "smart"? It doesn't support running arbitrary rust code. But you can access fields and make calls and use indexing/ranges/etc. You can't do things like use an if block.
- Ericson2314 10y agoI mean what sorts of expressions it supports, and how lax are the typing rules of them, basically. Ok indexing and function calls, makes sense. It won't dispatch on types at all for polymorphic functions I assume.
- Manishearth 10y agoRight, types aren't involved much. IIRC method dispatch on preexisting monomorphizations work. Gdb will not monomorphize for you. Trait methods don't work, though you can call them directly as functions if you wish.
- ZephyrP 10y agoWWUUUWUWUWUWUWUU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! (This is praise)
- dang 10y agoUrl changed from https://www.protocol96.com/blog/gdb-debugger-now-supports-the-rust-language-other-gnu-toolchain-improvements/ https://www.protocol96.com/blog/gdb-debugger-now-supports-th..., which points to this.
- steveklabnik 10y agoSeems good. Just as a random note: I tried to submit this URL, and so just upvoted. But the reason I originally chose that URL over the one the story is now about was because it focused on the Rust bit, whereas linking to the general notes and only pointing out Rust felt wrong. So good call, but just thought I'd mention that...
- nialv7 10y agoI wish GDB is modular, and language supports are just plugins. This way adding language support doesn't have to go through upstream GDB developers
- deleted 10y ago[deleted]
- ComputerGuru 10y agoThat's pretty much what lldb is (or will be, for some reason it's not yet final though it's been out for a while) for. lldb is to llvm/clang what gdb is to gcc and co.
- ori_b 10y agoI wish GDB was a bit more like Acid, in that the debugger was really just a scripting language* that let you do things like set breakpoints at an address, read the symbol table and parse DWARF debug info, set watchpoints, and not much else. Basically everything else that you would use at the source level could be built on top of those. Maybe this is the start of a new underwear project: A debugger in [part of] the spirit of Acid, but built on top of the lldb library.
- pekk 10y agoDo we really need yet another special ad hoc scripting language?
- abiox 10y agodoes it matter how many there are?
- current_call 10y agoOnly if your time is valuable.
- abiox 10y agowhat's the correlation?
- dman 10y agoFor reference => http://plan9.bell-labs.com/sys/doc/acidpaper.html http://plan9.bell-labs.com/sys/doc/acidpaper.html
- Manishearth 10y agoI believe this is true already? Rust used to pretend to be C, and got breakpoints/debuginfo for free. Python scripts could help with pretty printing. I'm not sure of subexpression evaluation is something a gdb Python script can do, but I see no technical barrier to this. Having it in gdb itself means less work for people who want to use it. Rust ships with gdb/lldb pretty printers, but not everyone knows about them.
- goodplay 10y agoI hope this is indicative of plans to revive the rust gcc frontend. The existence of that frontend was a major plus for the language as a stable standard.
- Manishearth 10y agoI don't think it is, this was an effort by Tom Tromey and me on the side, not something the gcc/gdb community decided to do. Also, without a stable abi I'd caution against having a separate frontend. The language "standard" isn't ready yet, either; it doesn't exist as a single document.
- pjmlp 10y agoA stable standard will only really happen when people stop using nightly for what should be common stuff. Latest example being Spyglass that was recently posted in HN.
- fithisux 10y agoThis is why I always dowload mingw runtime of rust on windows.