public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Andrew Burgess <andrew.burgess@embecosm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCHv2 2/2] gdb: Change how frames are selected for 'frame' and 'info frame'.
Date: Mon, 21 May 2018 17:46:00 -0000	[thread overview]
Message-ID: <83y3gddl5q.fsf@gnu.org> (raw)
In-Reply-To: <20180521115357.GS3797@embecosm.com> (message from Andrew Burgess	on Mon, 21 May 2018 12:53:57 +0100)

> Date: Mon, 21 May 2018 12:53:57 +0100
> From: Andrew Burgess <andrew.burgess@embecosm.com>
> Cc: gdb-patches@sourceware.org
> 
> I don't really understand what it is you're asking here, but I think
> it might be related to overloading of the word "frame", and possibly
> the keyword "create" not being a good choice.
> 
> Sure, within the inferior there are a set of frames, some of these
> form the current stack, and some might exist on some alternative
> stack.  Those frames exist regardless of GDB's ability to visualise
> them.
> 
> However, there's a second use of the word frame, which we use for
> GDB's representation of a stack-frame.  Under this second meaning the
> only frames that exist are those GDB can derive from the current
> machine state.  So, if the user asks for a backtrace and is told about
> #0 A, #1 B, #2 C, then GDB only knows about those 3 frames.
> 
> If the user knows of #3 D that called C (but the unwind failed for
> some reason) then they can use: 'frame create STACK-ADDR PC-ADDR' to
> "create" a suitable frame and examine the machine state.  The frame
> being "created" here is really a GDB frame, that is, a representation
> of a preexisting inferior frame.

The old text was this:

> > > -@item frame @var{stack-addr} [ @var{pc-addr} ]
> > > -@itemx f @var{stack-addr} [ @var{pc-addr} ]
> > > -Select the frame at address @var{stack-addr}.  This is useful mainly if the
> > > -chaining of stack frames has been damaged by a bug, making it
> > > -impossible for @value{GDBN} to assign numbers properly to all frames.  In
> > > -addition, this can be useful when your program has multiple stacks and
> > > -switches between them.  The optional @var{pc-addr} can also be given to
> > > -specify the value of PC for the stack frame.

This seems to imply that if the frame #3 D existed, but the unwind
failed to find it, the user could say "frame STACK-ADDR PC-ADDR" to
refer to that frame.

By contrast, your new text:

> > > +@kindex frame create
> > > +@item create @var{stack-address} @r{[} @var{pc-addr} @r{]}
> > > +Create and then select a new frame at stack address @var{stack-addr}.
> > > +This is useful mainly if the chaining of stack frames has been damaged
> > > +by a bug, making it impossible for @value{GDBN} to assign numbers
> > > +properly to all frames.  In addition, this can be useful when your
> > > +program has multiple stacks and switches between them.  The optional
> > > +@var{pc-addr} can also be given to specify the value of PC for the
> > > +stack frame.

forces the use of "create", which is confusing, since the frame does
exist on the stack, albeit unbeknownst to GDB.

IOW, I always thought of stack frames as existing or not independently
of whether the GDB unwinder succeeded to find them, so it's strange
for me to talk about "creating" a frame in this use case.  For that
matter, I don't understand why we need to force the user to type
"create" explicitly.

> Anyway, I'm happy to rework the text if you can suggest some
> improvements.  Alternatively, maybe it was my choice of "create" as
> the keyword that was confusing... again, if you have any better
> suggestions I'm happy to change it, I'm not tied to "create".

Why do we need an extra keyword, again?

If we do need a keyword, how about "frame add"?

  reply	other threads:[~2018-05-21 16:32 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08 16:58 [PATCHv2 0/2] Changes to frame selection Andrew Burgess
2018-05-08 16:58 ` [PATCHv2 1/2] gdb: Split func_command into two parts Andrew Burgess
2018-05-18 19:57   ` Pedro Alves
2018-05-21 15:52     ` Andrew Burgess
2018-05-21 16:06       ` Pedro Alves
2018-05-08 16:59 ` [PATCHv2 2/2] gdb: Change how frames are selected for 'frame' and 'info frame' Andrew Burgess
2018-05-11 15:44   ` Eli Zaretskii
2018-05-21 12:16     ` Andrew Burgess
2018-05-21 17:46       ` Eli Zaretskii [this message]
2018-06-05 18:53         ` Andrew Burgess
2018-06-05 21:16           ` Philippe Waroquiers
2018-06-06  8:22             ` Andrew Burgess
2018-06-06 14:56               ` Eli Zaretskii
2018-06-07 16:19   ` [PATCHv3] " Andrew Burgess
2018-06-29 12:23     ` Andrew Burgess
2018-07-17 15:58     ` [PATCHv4] " Andrew Burgess
2018-07-23 20:46       ` Philippe Waroquiers
2018-07-25 18:14         ` Andrew Burgess
2018-08-13 22:20           ` [PATCHv5_A 1/2] " Andrew Burgess
     [not found]           ` <cover.1534197765.git.andrew.burgess@embecosm.com>
2018-08-13 22:20             ` [PATCHv5_B 2/2] " Andrew Burgess
2018-08-13 22:20           ` [PATCHv5 0/2] " Andrew Burgess
2018-08-14 10:31             ` Philippe Waroquiers
2018-08-21 13:10               ` Joel Brobecker
2018-08-27 11:04             ` Andrew Burgess
2018-08-27 15:23               ` Eli Zaretskii
2018-08-28  8:43                 ` Andrew Burgess
2018-08-28  9:08                   ` Eli Zaretskii
2018-08-28 18:03                     ` [PATCHv6] " Andrew Burgess
2018-08-28 18:20                       ` Eli Zaretskii
2018-09-05  7:46                       ` PING: " Andrew Burgess
2018-09-13 18:02                       ` Pedro Alves
2018-09-18 23:01                         ` Andrew Burgess
2018-09-19 16:26                           ` Pedro Alves
2018-09-26 23:06                             ` Andrew Burgess
2018-09-27 20:58                               ` Pedro Alves

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=83y3gddl5q.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).