public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Sobisch via Gdb <gdb@sourceware.org>
Cc: Simon Sobisch <simonsobisch@gnu.org>
Subject: Re: debugging coredumps with the help of libraries (for example to pretty-print)
Date: Mon, 10 May 2021 10:38:34 -0600	[thread overview]
Message-ID: <877dk68rxx.fsf@tromey.com> (raw)
In-Reply-To: <bc6c217c-59d4-55c8-a517-da24be2b8763@gnu.org> (Simon Sobisch via Gdb's message of "Thu, 6 May 2021 21:00:58 +0200")

>>>>> "Simon" == Simon Sobisch via Gdb <gdb@sourceware.org> 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.

Tom

      parent reply	other threads:[~2021-05-10 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 19:00 Simon Sobisch
2021-05-06 21:45 ` David Blaikie
2021-05-10 16:38 ` Tom Tromey [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dk68rxx.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb@sourceware.org \
    --cc=simonsobisch@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).