Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb@sourceware.org, Mark Kettenis <kettenis@gnu.org>
Subject: Re: [RFC] Using values to handle unwinding
Date: Fri, 19 Oct 2007 12:40:00 -0000	[thread overview]
Message-ID: <20071019124026.GA30095@caradoc.them.org> (raw)
In-Reply-To: <200710191210.l9JCA71T027874@d12av02.megacenter.de.ibm.com>

On Fri, Oct 19, 2007 at 02:10:07PM +0200, Ulrich Weigand wrote:
> I think this is an excellent idea.  I'm wondering how this plays with
> special conversions needed for certain registers, see e.g. the
> discussion we had last December that led to introduction of the
> value_from_register gdbarch callback.
> 
> For example, while we do have ways of performing special conversions
> on the registers themselves, there is no straightforward way to do so
> for unwound register contents.  Maybe if we're going to using values
> to represent those, we could allow the architecture to perform type-
> specific conversions on those (this should e.g. allow me to eliminate
> a specical pseudo on the SPU that I'm using to hold the properly
> converted unwound stack pointer register contents).

I see we ended up with both "gdbarch_value_from_register" and
"gdbarch_register_to_value".  That's unfortunately confusing :-(

The patch I posted should make things neither better nor worse,
because reading a variable from a register (hardware or saved in a
frame) will still call value_from_register.  We'll get the raw bytes
by using the value method but call gdbarch_value_from_register and
get_frame_register_bytes for the final value.  So everything works
the same as before.

Perhaps we can adjust value_from_register to convert one struct value
* representing a register's contents to another representing its value
in a particular type?  It's a machine-dependent variant of a cast.

> B.t.w. there's another change in the patch: the elimination of the
> prev_pc unwinder method.  Could you explain the reason why this is
> now no longer necessary?

Sorry, I should have separated that out.  There is only one definition
of prev_pc anywhere.  Here it is:

static CORE_ADDR
sentinel_frame_prev_pc (struct frame_info *next_frame,
                        void **this_prologue_cache)
{
  struct gdbarch *gdbarch = get_frame_arch (next_frame);
  return gdbarch_unwind_pc (gdbarch, next_frame);
}

And here's the call, with comments removed for brevity:

      if (this_frame->unwind->prev_pc != NULL)
        /* A per-frame unwinder, prefer it.  */
        pc = this_frame->unwind->prev_pc (this_frame->next,
                                          &this_frame->prologue_cache);
      else if (gdbarch_unwind_pc_p (get_frame_arch (this_frame)))
        pc = gdbarch_unwind_pc (get_frame_arch (this_frame), this_frame);

So, as you can see, there's no longer any need for the hook in current
targets.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2007-10-19 12:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-17 16:04 Daniel Jacobowitz
2007-10-17 22:09 ` Daniel Jacobowitz
2007-10-19 11:42   ` Ulrich Weigand
2007-10-19 11:49     ` Daniel Jacobowitz
2007-10-19  4:30 ` Joel Brobecker
2007-10-19 11:43   ` Daniel Jacobowitz
2007-10-19 12:10 ` Ulrich Weigand
2007-10-19 12:40   ` Daniel Jacobowitz [this message]
2008-03-31 23:41 ` Daniel Jacobowitz
2008-04-04 17:53   ` Joel Brobecker
2008-04-05 15:56     ` Daniel Jacobowitz

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=20071019124026.GA30095@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb@sourceware.org \
    --cc=kettenis@gnu.org \
    --cc=uweigand@de.ibm.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