Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
To: Pedro Alves <palves@redhat.com>, Simon Marchi <simark@simark.ca>,
	Stefan Hajnoczi <stefanha@gmail.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>,
	"qemu-devel@nongnu.org"	<qemu-devel@nongnu.org>,
	"gdb@sourceware.org" <gdb@sourceware.org>
Subject: Re: [Qemu-devel] [PATCH] scripts/qemugdb: support coroutine backtrace in coredumps
Date: Thu, 27 Dec 2018 17:36:00 -0000	[thread overview]
Message-ID: <0ebf0044-d45c-74b4-d323-2391daa12a0c@virtuozzo.com> (raw)
In-Reply-To: <788e662d-0fb6-8db8-a049-3714eaa32869@redhat.com>

23.04.2018 16:28, Pedro Alves wrote:
> On 04/23/2018 02:37 AM, Simon Marchi wrote:
>> On 2018-04-09 10:08 PM, Stefan Hajnoczi wrote:
>>> I wonder what the point of select-frame is then...
>>>
>>> I have CCed the GDB mailing list.  Maybe someone can help us.  Context:
>>>
>>> QEMU implements coroutines using jmpbuf.  We'd like to print coroutine
>>> call stacks in GDB and have a script that works when a process is being
>>> debugged (it sets the registers).
>>>
>>> Now we'd like to extend the script to work on core dumps where it's not
>>> possible to set registers (since there is no process being debugged).
>>>
>>> Is there a way to backtrace an arbitrary call stack in a core dump?
>>
>> Not that I know of.  The "frame <stack-addr> <pc-addr>" form of the frame
>> command sounds like it should be usable to achieve that, but it doesn't
>> seem to work in that way.  I really wonder if it's working as it was
>> intended initially.  I guess using that form of the frame command should
>> override/mask the real current values of $sp and $pc?
> 
> Yeah, "frame <args>" has a lot of problems.
> 
> This series was working toward sorting out the "frame" command:
> 
>    https://sourceware.org/ml/gdb-patches/2015-09/msg00248.html
> 
> Follow the urls there for more background.
> 
> To me, the important questions to answer are here:
>   https://sourceware.org/ml/gdb-patches/2015-09/msg00658.html
> 
> Unfortunately, I don't think the series moved past that point.
> 
> Thanks,
> Pedro Alves
> 


Hi Pedro!

Hmm, returned to this topic. I've spent this day digging in gdb code, and found it much
more difficult than qemu)..

I've failed to find something like

create_frame_with_registers, or create_thread_with_registers.. Looks like registers comes
from some register caches, backed by different sources of registers or something like this.

So, I'd like to ask several questions:

1. Any news on the topic since April?

2. Can you propose a simple (maybe hacky) way (with or without patching gdb) to achieve the behavior like

set $rsp = ...
set $rbp = ...
set $rip = ...

bt #prints bt, starting from the frame corresponding to register values set
fr 5 #goes to frame in this bt, and allow to examine local variables

for debugging core-dumps?

***

May be, we can allow set registers while debugging core-dump? Why we can't set them? We have
same register caches, and anyway we can move between threads and frames and registers are changed...

May be, we can somehow add separate thread with given registers from user, like they are created from
coredump file..

Anything else?

***

For me, still, the simplest way is to add additional note segments to coredump file, to specify needed frames..
But it is not very comfortable, to recreate and reopen core file, when found new coroutine.

-- 
Best regards,
Vladimir


  reply	other threads:[~2018-12-27 17:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20180404103440.19546-1-stefanha@redhat.com>
     [not found] ` <008ac6e8-1e68-b0f6-7e75-77453721d031@virtuozzo.com>
2018-04-10  2:08   ` Stefan Hajnoczi
2018-04-23  9:33     ` Simon Marchi
2018-04-23  9:48       ` Stefan Hajnoczi
2018-04-23 13:28         ` Vladimir Sementsov-Ogievskiy
2018-04-23 13:45       ` Pedro Alves
2018-12-27 17:36         ` Vladimir Sementsov-Ogievskiy [this message]
2019-01-02 14:01           ` Stefan Hajnoczi

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=0ebf0044-d45c-74b4-d323-2391daa12a0c@virtuozzo.com \
    --to=vsementsov@virtuozzo.com \
    --cc=gdb@sourceware.org \
    --cc=palves@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=simark@simark.ca \
    --cc=stefanha@gmail.com \
    --cc=stefanha@redhat.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