debugging coredumps with the help of libraries (for example to pretty-print)

Simon Sobisch
Thu May 6 19:00:58 GMT 2021

I currently think there is no way, but before "giving up" I've wanted to 
double-check, maybe I've missed something.

To pretty-print some data types it seems quite feasible to use whatever 
library handles the typedefs normally and use its string functions to 
get the developer-view of the data and let gdb output that.
And this actually works quite well, just `gdb.execute("call 
libfunc(...)") and you're done.

But when I now create a core-dump (gcore dumpfile) and then start gdb 
with to debug that I see the full state and local variables - but none 
of those pretty printers work, resulting in "You can't do that without a 
process to debug." messages.

Is it possible to let GDB itself load the libraries and pass resolve the 
string values that way (or somehow start a "new" process along with the 
coredump only for letting it print the values from the coredump data)?

If not then it is either "disable the pretty printing when a coredump is 
processed" [what is the best check for that in a python extension btw?] 
or try to re-implement the string function completely in python.

Note: I actually can also change the library in question if that helps, 
but I'd (also) be interested to know the answer of this question in general.

Any hints welcome,
Simon Sobisch

More information about the Gdb mailing list