Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Bruno Larsen via Gdb-patches <gdb-patches@sourceware.org>
To: Andrew Burgess <aburgess@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: new 'maint print frame-id' command
Date: Wed, 17 Aug 2022 11:21:07 +0200	[thread overview]
Message-ID: <3e6931c5-6ec3-4672-475e-a7cd3e5399dd@redhat.com> (raw)
In-Reply-To: <20220816171822.3315660-1-aburgess@redhat.com>


On 16/08/2022 19:18, Andrew Burgess via Gdb-patches wrote:
> When debugging a certain class of GDB bug, I often end up wanting to
> know what GDB thinks the frame-id is in a particular frame.  It's
> not too hard to pull this from some debug output, but I thought it
> might be nice if there was a maintenance command that could tell us.
>
> This commit adds 'maint print frame-id' which prints the frame-id of
> the currently selected frame.  You can also pass a frame level number
> to find the frame-id for a specific frame.
>
> There's a new test too.

Hi Andrew,

Thanks for this, it coincidentally really helps my current situation! 
All the C code looks fine to me, but the texinfo failed to compile 
(details below). Fixing that, this patch looks great, I'd encourage you 
to approve your patch!

> ---
>   gdb/NEWS                                      |  4 ++
>   gdb/doc/gdb.texinfo                           | 17 +++++
>   gdb/frame.c                                   | 28 ++++++++
>   gdb/testsuite/gdb.base/maint-print-frame-id.c | 40 +++++++++++
>   .../gdb.base/maint-print-frame-id.exp         | 68 +++++++++++++++++++
>   5 files changed, 157 insertions(+)
>   create mode 100644 gdb/testsuite/gdb.base/maint-print-frame-id.c
>   create mode 100644 gdb/testsuite/gdb.base/maint-print-frame-id.exp
>
> diff --git a/gdb/NEWS b/gdb/NEWS
> index f2040e26c0c..49ac714efda 100644
> --- a/gdb/NEWS
> +++ b/gdb/NEWS
> @@ -91,6 +91,10 @@ show style disassembler symbol
>     The 'disassembler address' and 'disassembler symbol' styles are
>     aliases for the 'address' and 'function' styles respectively.
>   
> +maintenance print frame-id [ LEVEL ]
> +  Print GDB's internal frame-id for the frame at LEVEL.  If LEVEL is
> +  not given, then print the frame-id for the currently selected frame.
> +
>   * Changed commands
>   
>   maintenance info line-table
> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
> index 82cb1c8d668..ca958173b57 100644
> --- a/gdb/doc/gdb.texinfo
> +++ b/gdb/doc/gdb.texinfo
> @@ -40142,6 +40142,23 @@
>   
>   Takes an optional file parameter.
>   
> +@kindex maint print frame-id
> +@item maint print frame-id
> +@itemx maint print frame-id @var{level}
> +Print @value{GDBN}'s internal frame-id for the frame at relative
> +@var{level}, or for the currently selected frame when @var{level} is
> +not given.
> +
> +If used, @var{level} should be an integer, as displayed in the
> +@command{backtrace} output.
> +
> +@smallexample
> +(@value{GDBP}) maint print frame-id
> +frame-id for frame #0: {stack=0x7fffffffac70,code=0x0000000000401106,!special}
> +(@value{GDBP}) maint print frame-id 2
> +frame-id for frame #2: {stack=0x7fffffffac90,code=0x000000000040111c,!special}

In this line and 2 lines above, makeinfo was complaining about misplaced 
{ and };

Looking at the example above, it looks like it should be

frame-id for frame #2: 
@{stack=0x7fffffffac90,code=0x000000000040111c,!special@}

-- 
Cheers,
Bruno


  reply	other threads:[~2022-08-17  9:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 17:18 Andrew Burgess via Gdb-patches
2022-08-17  9:21 ` Bruno Larsen via Gdb-patches [this message]
2022-08-17 13:20   ` Andrew Burgess via Gdb-patches
2022-08-17 11:07 ` Eli Zaretskii via Gdb-patches
2022-08-17 14:11 ` Luis Machado via Gdb-patches
2022-08-24 13:45 ` Andrew Burgess via Gdb-patches

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=3e6931c5-6ec3-4672-475e-a7cd3e5399dd@redhat.com \
    --to=gdb-patches@sourceware.org \
    --cc=aburgess@redhat.com \
    --cc=blarsen@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