Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: Andrew Cagney <ac131313@redhat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: NULL selected/current frame; Was: [patch/rfc] Add frame_read_signed/unsigned_register(); convert h8300 to print_registers_info()
Date: Wed, 23 Oct 2002 09:50:00 -0000	[thread overview]
Message-ID: <20021023165114.GA13352@nevyn.them.org> (raw)
In-Reply-To: <3DB6D2BD.3040708@redhat.com>

On Wed, Oct 23, 2002 at 12:47:57PM -0400, Andrew Cagney wrote:
> 
> >> void
> >>+frame_read_unsigned_register (struct frame_info *frame, int regnum,
> >>+			      ULONGEST *val)
> >>+{
> >>+  frame_unwind_unsigned_register (get_next_frame (frame), regnum, val);
> >>+}
> >
> >
> >So, the register belonging to this frame.
> 
> Yes.  The old roughly equivalent function was get_saved_register.
> 
> >That means the register
> >which would be in the hardware registers if this frame were current,
> >right?
> 
> To be pedantic, no.  A frame's registers are ALWAYS found by unwinding 
> get_next_frame(FRAME).  It just so happens that registers unwound from 
> get_next_frame(current_frame) come from the register cache.
> 
> The difference is subtle but important.  current_frame isn't the special 
> case, get_next_frame(current_frame) is.  Unfortunatly much of the GDB 
> code treated ``current_frame'' as special creating unnecessary 
> complexity and ongoing confusion.  Per generic_unwind_get_saved_register():
> 
>   /* Reached the the bottom (youngest, inner most) of the frame chain
>      (youngest, inner most) frame, go direct to the hardware register
>      cache (do not pass go, do not try to cache the value, ...).  The
>      unwound value would have been cached in frame->next but that
>      doesn't exist.  This doesn't matter as the hardware register
>      cache is stopping any unnecessary accesses to the target.  */
> 
>   /* NOTE: cagney/2002-04-14: It would be nice if, instead of a
>      special case, there was always an inner frame dedicated to the
>      hardware registers.  Unfortunatly, there is too much unwind code
>      around that looks up/down the frame chain while making the
>      assumption that each frame level is using the same unwind code.  */
> 
> >Should we allow NULL to imply the current frame?
> 
> Definitly no :-)
> 
> There  is a bit of dogma here - there is always a frame.  The above 
> should not be called with NULL.  Code that calls this checks that 
> selected_frame != NULL.  I'll add a ``gdb_assert (frame != NULL)'' and a 
> comment to that effect.
> 
> As for get_next_frame(FRAME), if that returns NULL, we've fallen off the 
> inner most frame and should get the register value from the register 
> cache.  (Oh, while get_next_frame(current_frame) will always return 
> NULL, there may come a time when current_frame->next does not :-).

OK, I see where you're going, vis some of the comments about a "frame"
for the hardware registers.  I can buy that.  I like these new
functions...

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


  reply	other threads:[~2002-10-23 16:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-22 20:00 Andrew Cagney
2002-10-23  8:21 ` Daniel Jacobowitz
2002-10-23  9:48   ` NULL selected/current frame; Was: " Andrew Cagney
2002-10-23  9:50     ` Daniel Jacobowitz [this message]
2002-10-31 12:11 ` [patch/rfc] Add frame_read_signed/unsigned_register() Andrew Cagney
2002-10-31 12:24 ` [patch] Convert h8300 to print_registers_info() Andrew Cagney

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=20021023165114.GA13352@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=ac131313@redhat.com \
    --cc=gdb-patches@sources.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