public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Pedro Alves <pedro@palves.net>
Cc: Tom Tromey <tom@tromey.com>,
	gdb@sourceware.org, qemu-devel@nongnu.org,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: Re: How to backtrace an separate stack?
Date: Tue, 8 Mar 2022 08:43:27 +0000	[thread overview]
Message-ID: <YicXL7hKnDy0SzfU@stefanha-x1.localdomain> (raw)
In-Reply-To: <950cc915-d5dd-dbcb-67a2-9186792af8fe@palves.net>

[-- Attachment #1: Type: text/plain, Size: 1569 bytes --]

On Mon, Mar 07, 2022 at 05:18:12PM +0000, Pedro Alves wrote:
> On 2022-03-07 16:58, Tom Tromey wrote:
> >>>>>> "Stefan" == Stefan Hajnoczi <stefanha@redhat.com> writes:
> > 
> > Stefan> I hoped that "select-frame address ADDRESS" could be used instead so
> > Stefan> this would work on coredumps too. Unfortunately "select-frame" only
> > Stefan> searches stack frames that GDB is already aware of, so it cannot be used
> > Stefan> to backtrace coroutine stacks.
> > 
> > I wonder if "select-frame view" is closer to what you want.
> > 
> > I can't attest to how well it works or doesn't work.  I've never tried
> > it.
> 
> A backtrace after "select-frame view" will still start at the
> current (machine register's) frame.  Maybe it's sufficient to emulate it with
> a sequence of "up" + "frame", though.  Keep in mind that you'll lose the view
> with "info threads" or any command that flushes the frame cache internally,
> as I mentioned in that ancient discussion.

I tried the following with gdb (11.2-1.fc35):

  select-frame view STACK_ADDR PC
  frame <-- this displays the top coroutine stack frame
  up
  frame <-- this displays the secondmost main stack frame

Unfortunately "up" returns to the main stack instead of unwinding the
coroutine stack.

"i r" and "i lo" still show values from the main stack frame after
"select-frame view". This makes sense since "select-frame view" only
sets the stack and PC addresses, not the register contents.

Alas, "select-frame view" isn't quite enough from what I can tell.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  reply	other threads:[~2022-03-08  8:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-03 11:22 Stefan Hajnoczi
2022-03-07 10:49 ` Pedro Alves
2022-03-08  9:47   ` Stefan Hajnoczi
2022-03-07 14:49 ` Florian Weimer
2022-03-07 17:30   ` Tom Tromey
2022-03-09 10:06     ` Florian Weimer
2022-03-09 19:50       ` Tom Tromey
2022-03-07 16:58 ` Tom Tromey
2022-03-07 17:18   ` Pedro Alves
2022-03-08  8:43     ` Stefan Hajnoczi [this message]
2022-03-14 20:30   ` Tom Tromey
2022-03-15 14:17     ` Stefan Hajnoczi
2022-03-18 21:13       ` 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=YicXL7hKnDy0SzfU@stefanha-x1.localdomain \
    --to=stefanha@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=gdb@sourceware.org \
    --cc=pedro@palves.net \
    --cc=qemu-devel@nongnu.org \
    --cc=tom@tromey.com \
    /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).