From: Aleksandar Ristovski <aristovski@qnx.com>
To: gdb@sources.redhat.com
Subject: Re: PowerPC prologue analysis
Date: Tue, 29 Jul 2008 16:52:00 -0000 [thread overview]
Message-ID: <g6ngs0$mg5$1@ger.gmane.org> (raw)
In-Reply-To: <20080729154243.GA29510@caradoc.them.org>
[-- Attachment #1: Type: text/plain, Size: 737 bytes --]
Daniel Jacobowitz wrote:
> On Tue, Jul 29, 2008 at 11:42:29AM -0400, Aleksandar Ristovski wrote:
>> And for the reference: Daniel's patch (
>> http://sourceware.org/ml/gdb-patches/2007-12/msg00111.html ) does
>> solve the problem with not all registers saved.
>>
>> Why is the patch not in HEAD gdb?
>
> There's a couple of questions in the posting and I never figured out
> the answers to them. I'll be back to them at some point.
>
May I suggest that you break the patch in two patches: one dealing with not-all-registers-saved (i.e. gpr_mask) and the rest?
I extracted the gpr_mask part here with the testsuite changes and I believe this part of the patch is safe to apply.
Attached: Fragment extracted from Daniel's patch.
[-- Attachment #2: rs6000-tdep.c.Daniel-gpr_mask-part.diff --]
[-- Type: text/plain, Size: 2154 bytes --]
Index: gdb/rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.318
diff -u -p -r1.318 rs6000-tdep.c
--- gdb/rs6000-tdep.c 15 Jul 2008 18:32:06 -0000 1.318
+++ gdb/rs6000-tdep.c 29 Jul 2008 16:27:53 -0000
@@ -117,6 +117,7 @@ struct rs6000_framedata
by which we decrement sp to allocate
the frame */
int saved_gpr; /* smallest # of saved gpr */
+ unsigned int gpr_mask; /* Each bit is an individual saved GPR. */
int saved_fpr; /* smallest # of saved fpr */
int saved_vr; /* smallest # of saved vr */
int saved_ev; /* smallest # of saved ev */
@@ -1275,6 +1276,10 @@ skip_prologue (struct gdbarch *gdbarch,
{
reg = GET_SRC_REG (op);
+ if ((op & 0xfc1f0000) == 0xbc010000)
+ fdata->gpr_mask |= ~((1U << reg) - 1);
+ else
+ fdata->gpr_mask |= 1U << reg;
if (fdata->saved_gpr == -1 || fdata->saved_gpr > reg)
{
fdata->saved_gpr = reg;
@@ -1678,11 +1683,15 @@ skip_prologue (struct gdbarch *gdbarch,
else
{
+ unsigned int all_mask = ~((1U << fdata->saved_gpr) - 1);
+
/* Not a recognized prologue instruction.
Handle optimizer code motions into the prologue by continuing
the search if we have no valid frame yet or if the return
- address is not yet saved in the frame. */
- if (fdata->frameless == 0 && fdata->nosavedpc == 0)
+ address is not yet saved in the frame. Also skip instructions
+ if some of the GPRs expected to be saved are not yet saved. */
+ if (fdata->frameless == 0 && fdata->nosavedpc == 0
+ && (fdata->gpr_mask & all_mask) == all_mask)
break;
if (op == 0x4e800020 /* blr */
@@ -2573,7 +2582,8 @@ rs6000_frame_cache (struct frame_info *t
CORE_ADDR gpr_addr = cache->base + fdata.gpr_offset;
for (i = fdata.saved_gpr; i < ppc_num_gprs; i++)
{
- cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = gpr_addr;
+ if (fdata.gpr_mask & (1U << i))
+ cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = gpr_addr;
gpr_addr += wordsize;
}
}
[-- Attachment #3: gdb_arch_powerpc-prologue.exp.Daniel-gpr_mask-part.diff --]
[-- Type: text/plain, Size: 745 bytes --]
Index: gdb/testsuite/gdb.arch/powerpc-prologue.exp
===================================================================
--- gdb/testsuite/gdb.arch/powerpc-prologue.exp (revision 197)
+++ gdb/testsuite/gdb.arch/powerpc-prologue.exp (working copy)
@@ -64,7 +64,7 @@ gdb_test "backtrace 10" \
"backtrace in PIC"
gdb_test "info frame" \
- ".*Saved registers:.*r30 at.*r31 at.*pc at.*lr at.*" \
+ ".*Saved registers:.*r30 at.*pc at.*lr at.*" \
"saved registers in PIC"
# Testcase for scheduled prologue.
@@ -84,5 +84,5 @@ gdb_test "backtrace 10" \
"backtrace in optimized"
gdb_test "info frame" \
- ".*Saved registers:.*r30 at.*r31 at.*pc at.*lr at.*" \
+ ".*Saved registers:.*r30 at.*pc at.*lr at.*" \
"saved registers in optimized"
prev parent reply other threads:[~2008-07-29 16:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-28 20:13 Aleksandar Ristovski
2008-07-28 20:29 ` Daniel Jacobowitz
2008-07-28 21:08 ` Aleksandar Ristovski
2008-07-29 1:46 ` Daniel Jacobowitz
2008-07-29 14:10 ` Aleksandar Ristovski
2008-07-29 15:42 ` Aleksandar Ristovski
2008-07-29 15:47 ` Daniel Jacobowitz
2008-07-29 16:52 ` Aleksandar Ristovski [this message]
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='g6ngs0$mg5$1@ger.gmane.org' \
--to=aristovski@qnx.com \
--cc=gdb@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