2 ms·
Just want to give a shout out to the people who have been improving GDB's Python API over the years (I think it first appeared about 10 years ago). It seems li
by chubot 6y ago
Just want to give a shout out to the people who have been improving GDB's Python API over the years (I think it first appeared about 10 years ago). It seems like a lot of it is due to Tom Tromey? [1]
This is a super useful feature that I just used. I have a DSL for algebraic data types in C++ called ASDL [2], and I wrote a very small Python plugin that pretty prints the types.
Basically it automates the process of looking at the runtime type tag, and downcasting to the right variant, so you can see all the fields in the debugger. (Variants are naturally modeled with inheritance, and you still have type safety)
This makes debugging the code way easier. I basically enhanced C++'s type system and now the debugger also understands it!
It works on the command line and the Eclipse GUI. Although I should get around to requesting an open source license for CLion, because I think it is significantly more polished.
-----
GDB is very old, and has sort of a bad reputation for usability, but it's getting better after all these years! This scripting power can make up for the usability in some cases (and maybe CLion will give the best of both worlds)
https://lobste.rs/s/h7f6qk/what_debugging_technique_did_it_take_you#c_pqoh28 https://lobste.rs/s/h7f6qk/what_debugging_technique_did_it_t...
[1] https://tromey.com/blog/?m=201809 https://tromey.com/blog/?m=201809
https://tromey.com/blog/?p=927 https://tromey.com/blog/?p=927
[2] What is Zephyr ASDL? https://www.oilshell.org/blog/2016/12/11.html https://www.oilshell.org/blog/2016/12/11.html
ASDL is mentioned in the post about Ungrammar, on the front page now: https://news.ycombinator.com/item?id=24878098 https://news.ycombinator.com/item?id=24878098