Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@red-bean.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: ngustavson@emacinc.com, gdb-patches@sourceware.org
Subject: Re: gdb code review, pointer madness
Date: Wed, 25 Jan 2006 18:49:00 -0000	[thread overview]
Message-ID: <8f2776cb0601251049h742c3a20rf7f5f3f062888a1c@mail.gmail.com> (raw)
In-Reply-To: <u3bjcfcv6.fsf@gnu.org>

On 1/25/06, Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Tue, 24 Jan 2006 21:25:44 -0800
> > From: Jim Blandy <jimb@red-bean.com>
> > Cc: ngustavson@emacinc.com, gdb-patches@sourceware.org
> >
> > I'm being lazy.  How's this?
>
> Almost perfect.  If you add a "@cindex sentinel frame" and a
> "@findex frame_register_unwind", it will be _just_ perfect.
>
> Actually, maybe also "@cindex frame, unwind".

I've committed the below, adding @vindex SENTINEL_FRAME:

gdb/doc/ChangeLog:
2006-01-24  Jim Blandy  <jimb@redhat.com>

	* gdbint.texinfo (Frames): Document the basics of GDB's register
	unwinding model, and explain the existence of the "sentinel" frame.

Index: gdb/doc/gdbint.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
retrieving revision 1.235
diff -c -p -r1.235 gdbint.texinfo
*** gdb/doc/gdbint.texinfo	20 Jan 2006 21:58:16 -0000	1.235
--- gdb/doc/gdbint.texinfo	25 Jan 2006 18:45:33 -0000
*************** they use.
*** 231,236 ****
--- 231,266 ----
  A frame is a construct that @value{GDBN} uses to keep track of calling
  and called functions.

+ @cindex frame, unwind
+ @value{GDBN}'s current frame model is the result of an incremental
+ cleanup of working code, not a fresh design, so it's a little weird.
+
+ The natural model would have a frame object, with methods that read
+ and write that frame's registers.  Reading or writing the youngest
+ frame's registers would simply read or write the processor's current
+ registers, since the youngest frame is running directly on the
+ processor.  Older frames might have some registers saved on the stack
+ by younger frames, so accessing the older frames' registers would do a
+ mix of memory accesses and register accesses, as appropriate.
+
+ @findex frame_register_unwind
+ Instead, @value{GDBN}'s model is that you find a frame's registers by
+ ``unwinding'' them from the next younger frame.  That is, to access
+ the registers of frame #1 (the next-to-youngest frame), you actually
+ apply @code{frame_register_unwind} to frame #0 (the youngest frame).
+ But then the obvious question is: how do you access the registers of
+ the youngest frame itself?  How do you ``unwind'' them when they're
+ not wound up?
+
+ @cindex sentinel frame
+ @findex get_frame_type
+ @vindex SENTINEL_FRAME
+ To answer this question, GDB has the @dfn{sentinel} frame, the
+ ``-1st'' frame.  Unwinding registers from the sentinel frame gives you
+ the current values of the youngest real frame's registers.  If @var{f}
+ is a sentinel frame, then @code{get_frame_type (@var{f}) ==
+ SENTINEL_FRAME}.
+
  @findex create_new_frame
  @vindex FRAME_FP
  @code{FRAME_FP} in the machine description has no meaning to the


  reply	other threads:[~2006-01-25 18:49 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-23 20:39 NZG
2006-01-23 20:48 ` Daniel Jacobowitz
2006-01-23 20:51 ` Jim Blandy
2006-01-24 17:19   ` NZG
2006-01-24 19:29     ` NZG
2006-01-24 21:27       ` Jim Blandy
2006-01-24 21:58         ` NZG
2006-01-24 22:11           ` Daniel Jacobowitz
2006-01-25  0:01           ` Jim Blandy
2006-01-25  4:41             ` Eli Zaretskii
2006-01-25  4:59               ` Jim Blandy
2006-01-25  5:25                 ` Jim Blandy
2006-01-25 17:21                   ` Eli Zaretskii
2006-01-25 18:49                     ` Jim Blandy [this message]
2006-01-25 19:58                       ` Eli Zaretskii
2006-01-25 17:15                 ` Eli Zaretskii
2006-01-26 16:19             ` NZG
2006-01-26 16:43               ` Daniel Jacobowitz
2006-01-26 19:55                 ` frame theory, was " NZG
2006-01-26 19:59                   ` Daniel Jacobowitz
2006-01-26 20:17                     ` NZG
2006-01-26 20:22                       ` Daniel Jacobowitz
2006-01-26 21:21                   ` Mark Kettenis
2006-01-26 21:54                     ` NZG
2006-01-26 22:40                       ` Mark Kettenis
2006-01-26 22:44                         ` Daniel Jacobowitz
2006-01-26 23:27                           ` remote connection crash, was frame theory NZG
2006-01-26 23:32                             ` Daniel Jacobowitz
2006-01-26 23:42                             ` Jim Blandy
2006-01-26 23:45                               ` Daniel Jacobowitz
2006-01-26 23:57                                 ` Jim Blandy
2006-01-27  0:04                                   ` NZG
2006-01-30 17:02                                     ` 5282 gdb Eclipse MI support, was remote connection crash NZG
2006-01-26 23:47                           ` frame theory, was pointer madness Accounts
2006-01-26 23:16                   ` Jim Blandy
2006-01-26 23:39                     ` Jim Blandy
2006-01-27  7:19                     ` 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=8f2776cb0601251049h742c3a20rf7f5f3f062888a1c@mail.gmail.com \
    --to=jimb@red-bean.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=ngustavson@emacinc.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