public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: Michael Woerister <michaelwoerister@posteo.net>, gdb@sourceware.org
Subject: Re: Executing code if debuggee is a crash dump?
Date: Tue, 24 Aug 2021 09:50:24 -0400	[thread overview]
Message-ID: <405ba691-bac2-8eb4-aa8c-ec13ef59fceb@polymtl.ca> (raw)
In-Reply-To: <e0b2f159b26a4d53b4d01bcbddbcd755@posteo.de>

On 2021-08-24 6:07 a.m., Michael Woerister via Gdb wrote:> Hi everyone,
> 
> I'm looking into implementing debugger extensions that help with debugging crash dumps of "async" Rust executables. Such an extension would need to inspect the complex internals of several async runtime implementations. We could potentially make the extension more robust and easier to maintain if we provided a standardized inspection API in the various runtimes and have the debugger interact with that. The functions behind this API would be restricted to not interact with the environment (e.g. not allocate memory, etc).
> 
> However, my research so far indicates that neither GDB nor any other debugger is capable of executing code in a crash dump. Is that true or am I overlooking something?
> Would anybody here be able give me a definite answer to this question?
> 
> Thanks a lot for your help!
> 
> -Michael
> 

Hi Michael,

Indeed, when inspecting a crash dump in GDB, there's no live process,
so you can't do function calls in it.  That's one of the downsides of
relying on function calls to build pretty printers and other tools that
extract data from debugged programs.

I've sometimes heard the idea of creating a live process from a crash
dump state, but I have never seen it implemented.  In theory, if that
existed, that would allow you to do function calls.  But there is some
state that can't really be restored, like file descriptors, so that
limits what you can do.  Another downside of that is that you wouldn't
be able to inspect a core dump on a different architecture than what the
core dump was created on (something that is useful for embedded
devices).

So people often end up using some GDB / Python code that has the
knowledge of the program's internal data structures.  For example, the
Linux kernel:

    https://github.com/torvalds/linux/blob/master/scripts/gdb/vmlinux-gdb.py

Simon

  reply	other threads:[~2021-08-24 13:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 10:07 Michael Woerister
2021-08-24 13:50 ` Simon Marchi [this message]
2021-08-25  8:56   ` Michael Woerister
2021-08-24 16:09 ` Christian Biesinger
2021-08-25  9:02   ` Michael Woerister

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=405ba691-bac2-8eb4-aa8c-ec13ef59fceb@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=gdb@sourceware.org \
    --cc=michaelwoerister@posteo.net \
    /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).