This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix PPC scan_prologue for code generated with -mno-update
- From: Fred Fish <fnf at specifix dot com>
- To: gdb-patches at sources dot redhat dot com
- Cc: fnf at specifix dot com
- Date: Thu, 15 Feb 2007 18:07:06 -0700
- Subject: [PATCH] Fix PPC scan_prologue for code generated with -mno-update
- Reply-to: fnf at specifix dot com
If the PPC gcc is used with the -mno-update option, it generates a
prologue instruction to allocate cache that gdb does not recognize.
Gdb disassembles it as "addi r1,r1,NUM".
If you run the gdb testsuite for powerpc-eabi and add -mno-update to
the list of compilation options, you get a huge increase in failures,
most due to problems doing backtraces. Without using -mno-update
you get:
# of expected passes 36024
# of unexpected failures 756
With -mno-update you get:
# of expected passes 33220
# of unexpected failures 3928
After applying the attached patch, the results with -mno-update
become:
# of expected passes 36028
# of unexpected failures 752
This also fixes an existing failure (1 for each multilib):
4448c4446
< FAIL: gdb.base/recurse.exp: next over b = 0 in second instance
---
> PASS: gdb.base/recurse.exp: next over b = 0 in second instance
I didn't examine why that failure was fixed by the patch.
-Fred
2007-02-15 Fred Fish <fnf@specifix.com>
* rs6000-tdep.c (skip_prologue): Recognize addi instructions that
directly decrement the stack pointer, accumulate their operand into
the stack offset, and mark the function as not being frameless.
Index: rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.262
diff -u -p -r1.262 rs6000-tdep.c
--- rs6000-tdep.c 8 Feb 2007 18:05:23 -0000 1.262
+++ rs6000-tdep.c 16 Feb 2007 00:54:07 -0000
@@ -1219,6 +1219,13 @@ skip_prologue (CORE_ADDR pc, CORE_ADDR l
offset = fdata->offset;
continue;
}
+ else if ((op & 0xffff0000) == 0x38210000)
+ { /* addi r1,r1,SIMM */
+ fdata->frameless = 0;
+ fdata->offset += SIGNED_SHORT (op);
+ offset = fdata->offset;
+ continue;
+ }
/* Load up minimal toc pointer */
else if (((op >> 22) == 0x20f || /* l r31,... or l r30,... */
(op >> 22) == 0x3af) /* ld r31,... or ld r30,... */