2 ms·
Why is it such a problem? Can't debuggers use `Debug` trait if defined? Or do they already?
by pkolaczk 3y ago
Why is it such a problem? Can't debuggers use `Debug` trait if defined? Or do they already?
- mark_undoio 3y agoI'm not sure they'd do so automatically but, given the ability to call functions (which it sounds like, for Rust, GDB lacks) it should be possible to plumb together. But debuggers like GDB have built in infrastructure for expressing how to display structured, potentially nested data structures - it's built for the purpose and powerful, so it's nice to bring it to bear if you've not already got something equivalent in they program. The other important thing is that the debugger's pretty printers work on a core file, without needing a live process.
- iudqnolq 3y agoIf you hunt around for the debugging working group and related issues there's some interesting reading on exactly that. (I'm on my phone and it's been a while since I looked into this). The issue is that a debugger generally can't assume your code doesn't have bugs. This would make bugs around state in Debug impls much more complicated, for example. This can creep in under a few layers of indirection - ultimately calling a function that gets the value of an interned string would be one example.