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

Tom Tromey
Mon May 10 16:38:34 GMT 2021

>>>>> "Simon" == Simon Sobisch via Gdb <> writes:

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

These are also somewhat dangerous to use.  I think there have been
reports of gdb crashes when calling inferior functions from
pretty-printers.  So, normally I recommend against doing this kind of
thing; though if it works for you, great.

It's possible some code in the Python layer isn't careful about using
frame-ids instead of frames.  That would cause bugs.  Also inferior
calls can cause other threads to run, which can be super confusing.

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

There was a old wish list item to resurrect a core file and turn it into
a running process.  Maybe this is possible, maybe not.  As far as I
know, nobody has ever really tried.  Anyway, it doesn't exist, so the
current answer is 'no'.

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

I would normally just reimplement it in Python.


More information about the Gdb mailing list