From: Jim Blandy <jimb@redhat.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: general prologue analysis framework
Date: Mon, 17 Oct 2005 20:28:00 -0000 [thread overview]
Message-ID: <vt2zmp7vqfs.fsf@theseus.home.> (raw)
In-Reply-To: <200510171852.j9HIq3r7009705@53v30g15.boeblingen.de.ibm.com> (Ulrich Weigand's message of "Mon, 17 Oct 2005 20:52:02 +0200 (CEST)")
Ulrich Weigand <uweigand@de.ibm.com> writes:
> I'll see how I can adapt the s390 code to use the new interface.
> There's one point I'm not quite sure how to handle: it can happen that
> the same register is saved multiple times to the stack (e.g. %r6 once in
> the save area and once as incoming argument register). In this case,
> the s390 heuristic is that the slot at the highest address is the real
> save area slot. I'm not sure how to fit this into the generic routine ...
pv_area_find_reg doesn't give you any way to express a preference
between one location and another. But it does a linear search of the
area, so if you're building up a table of all saved registers, you
probably don't want to use it anyway.
I think pv_area_scan would work better. Here's the function I use in
the m32c port.
/* Function for finding saved registers in a 'struct pv_area'; we pass
this to pv_area_scan.
If VALUE is a saved register, ADDR says it was saved at a constant
offset from the frame base, and SIZE indicates that the whole
register was saved, record its offset in the reg_offset table in
PROLOGUE_UNTYPED. */
static void
check_for_saved (void *prologue_untyped, pv_t addr, CORE_ADDR size, pv_t value)
{
struct m32c_prologue *prologue = (struct m32c_prologue *) prologue_untyped;
struct gdbarch *arch = prologue->arch;
struct gdbarch_tdep *tdep = gdbarch_tdep (arch);
/* Is this the unchanged value of some register being saved on the
stack? */
if (value.kind == pvk_register
&& value.k == 0
&& pv_is_register (addr, tdep->sp->num))
{
/* Some registers require special handling: they're saved as a
larger value than the register itself. */
CORE_ADDR saved_size = register_size (arch, value.reg);
if (value.reg == tdep->pc->num)
saved_size = tdep->ret_addr_bytes;
else if (gdbarch_register_type (arch, value.reg)
== tdep->data_addr_reg_type)
saved_size = tdep->push_addr_bytes;
if (size == saved_size)
{
/* Find which end of the saved value corresponds to our
register. */
if (gdbarch_byte_order (arch) == BFD_ENDIAN_BIG)
prologue->reg_offset[value.reg]
= (addr.k + saved_size - register_size (arch, value.reg));
else
prologue->reg_offset[value.reg] = addr.k;
}
}
}
next prev parent reply other threads:[~2005-10-17 20:28 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-10-07 20:39 Jim Blandy
2005-10-07 21:25 ` Nathan J. Williams
2005-10-07 21:30 ` Daniel Jacobowitz
2005-10-07 21:41 ` Nathan J. Williams
2005-10-08 7:02 ` Jim Blandy
2005-10-08 7:01 ` Jim Blandy
2005-10-08 16:00 ` Daniel Jacobowitz
2005-10-09 20:27 ` Daniel Jacobowitz
2005-10-13 0:20 ` Jim Blandy
2005-10-13 1:04 ` Daniel Jacobowitz
2005-10-13 13:50 ` Ulrich Weigand
2005-10-13 17:17 ` Jim Blandy
2005-10-13 17:48 ` Ulrich Weigand
2005-10-13 18:03 ` Daniel Jacobowitz
2005-10-14 18:13 ` Jim Blandy
2005-10-17 18:52 ` Ulrich Weigand
2005-10-17 20:28 ` Jim Blandy [this message]
2005-11-23 2:56 ` Ulrich Weigand
2005-10-15 12:12 ` Eli Zaretskii
2005-10-17 20:32 ` Jim Blandy
2005-10-19 8:55 ` 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=vt2zmp7vqfs.fsf@theseus.home. \
--to=jimb@redhat.com \
--cc=gdb-patches@sourceware.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