public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: David Blaikie <dblaikie@gmail.com>
To: Simon Sobisch <simonsobisch@gnu.org>
Cc: gdb@sourceware.org
Subject: Re: debugging coredumps with the help of libraries (for example to pretty-print)
Date: Thu, 6 May 2021 14:45:34 -0700	[thread overview]
Message-ID: <CAENS6Esr1mawe+0nXV4PghCo1CVJiHBTMYDzxFDtvHeWzib6pA@mail.gmail.com> (raw)
In-Reply-To: <bc6c217c-59d4-55c8-a517-da24be2b8763@gnu.org>

Not sure about other answers/details, but generally it's encouraged to
do the latter - pretty printers that do not invoke any code in the
process, both for debugging cores, but also in general to avoid any
risk that the pretty printer might taint the process under test by
executing code that could risk changing the state of the process, etc.

On Thu, May 6, 2021 at 1:48 PM Simon Sobisch via Gdb <gdb@sourceware.org> wrote:
>
> 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

  reply	other threads:[~2021-05-06 21:45 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 [this message]
2021-05-10 16:38 ` Tom Tromey

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=CAENS6Esr1mawe+0nXV4PghCo1CVJiHBTMYDzxFDtvHeWzib6pA@mail.gmail.com \
    --to=dblaikie@gmail.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).