Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb@sourceware.org
Subject: Re: Specify frame by address
Date: Sat, 29 Oct 2011 18:03:00 -0000	[thread overview]
Message-ID: <20111029174638.GA27749@host1.jankratochvil.net> (raw)
In-Reply-To: <83k47n90xn.fsf@gnu.org>

Hi Eli,

On Sat, 29 Oct 2011 19:12:36 +0200, Eli Zaretskii wrote:
>   An argument specifies the frame to select.
>   It can be a stack frame number or the address of the frame.  <<<<<<<<<<
>   With argument, nothing is printed if input is coming from
>   a command file or a user-defined command.
> 
> But what is "the address of the frame"?  I thought that using an
> address of a function (the one shown by "info address") or some
> address shown by the "backtrace" command would do, but none of them
> seems to work.

See the bottom of parse_frame_specification_1.

"address of the frame" is frame_id.stack_addr.  For DWARF it is CFA
(dwarf2_frame_cfa), which is for most arches just unwound SP (not PC!), that
is SP as shown by GDB in the caller.

(gdb) info frame
Stack level 5, frame at 0x7fffffffd880:
[...]
(gdb) up
#6  0x0000000000486e82 in captured_command_loop (data=0x0) at ./main.c:234
(gdb) p/x $sp
$1 = 0x7fffffffd880
(gdb) frame 0
(gdb) frame 0x7fffffffd880
#5  0x00000000006f1421 in current_interp_command_loop () at interps.c:309


> The context of this is that I would like to write a command that
> automatically goes to a frame within a call to a specific function,
> because that command needs to access variables local to that function.

Such command really needs to iterate the frames and compare PC there.


Regards,
Jan


  reply	other threads:[~2011-10-29 17:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-29 17:47 Eli Zaretskii
2011-10-29 18:03 ` Jan Kratochvil [this message]
2011-10-29 18:04   ` Eli Zaretskii
2011-10-29 18:48     ` Mark Kettenis
2011-10-29 20:46       ` Jan Kratochvil
2011-10-30 13:21         ` Mark Kettenis
2011-11-02  9:14           ` Yao Qi
2011-10-30  6:39       ` Eli Zaretskii
2011-10-29 18:43 ` Andreas Schwab
2011-10-29 20:49   ` Eli Zaretskii
2011-11-01 18:58 ` Tom Tromey
2011-11-01 19:23   ` Eli Zaretskii

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=20111029174638.GA27749@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=eliz@gnu.org \
    --cc=gdb@sourceware.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