From: Philippe Waroquiers <philippe.waroquiers@skynet.be>
To: psmith@gnu.org, gdb@sourceware.org
Subject: Re: Tools to debug multiple cores/processes at the same time?
Date: Thu, 19 Aug 2021 12:56:42 +0200 [thread overview]
Message-ID: <774408cfd5398ab01814341b1e22194170fec354.camel@skynet.be> (raw)
In-Reply-To: <e4cddda40744058c216fb4373ede3ec3f0a0cbb5.camel@gnu.org>
On Wed, 2021-08-18 at 17:09 -0400, Paul Smith via Gdb wrote:
> On Wed, 2021-08-18 at 16:53 -0400, Paul Koning wrote:
> > There is multiple target support, which I haven't had a chance to try
> > yet but from what I remember reading is a recently added GDB
> > feature. It should handle your case plus even stranger ones, such as
> > multiple processes running different code, or even running on
> > different instruction sets. It's just what you need for debugging
> > distributed applications.
>
> Yeah, I saw that, and it might be the kernel of something that could
> support what I'm talking about, except I don't think it manages
> different "convenience variable namespaces" per inferior.
>
> But the main thing is it doesn't seem like it supports running the same
> command in all inferiors, other than by manually setting each one and
> running the command. Maybe some kind of embedded Python facility could
> be created to do this, such as John mentions... I'm not sure what the
> python support is currently for multiple inferiors.
>
> Let me give an example of a debugging session:
>
> * start a session with 3 core files
>
> * run a command that shows info about each core (assume a python
> "showinfo" command that show all threads with some details about each
> one). Maybe a command like:
> (gdb) all: showinfo
> i1: <info>
> i2: <info>
> i3: <info>
info threads should show the threads of all inferiors.
>
> * For each core, go to a certain thread (of course the thread numbers
> will be different in each core):
> (gdb) i1: thr 7
> (gdb) i2: thr 9
> (gdb) i3: thr 23
thread INFERIORNR.THREADNR
will switch to the listed thread.
>
> * Run a command that returns some value and stores it in a convenience
> variable, on all cores:
> (gdb) all: set $v = $findstuff()
>
> * Run a command that shows some value, on all cores:
> (gdb) all: p $v->someDetail
> i1: $1 = 7
> i2: $1 = 44
> i3: $1 = 165
>
> I dunno, something like that. Alternatively maybe it would be simpler
> for output for each inferior to go to a separate terminal or whatever.
The command 'thread apply' can apply a command to all threads
or to a selected list of threads.
If you have multiple inferiors, the command can then be run for all threads
of all inferiors.
I do not see an (easy) way to run a command only once per inferior,
when an inferior has multiple threads.
For this, likely, the best would be to have a new gdb command such as
inferior apply all | INFERIOR-LIST
Note that the command 'show convenience' lists a convenience variable $_inferior.
Philippe
next prev parent reply other threads:[~2021-08-19 10:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-18 19:55 Paul Smith
2021-08-18 20:25 ` John Baldwin
2021-08-18 20:53 ` Paul Koning
2021-08-18 21:09 ` Paul Smith
2021-08-19 10:56 ` Philippe Waroquiers [this message]
2021-08-20 6:28 ` Aktemur, Tankut Baris
2021-08-19 11:04 ` Andrew Burgess
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=774408cfd5398ab01814341b1e22194170fec354.camel@skynet.be \
--to=philippe.waroquiers@skynet.be \
--cc=gdb@sourceware.org \
--cc=psmith@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).