This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix PPC non-CFI + CFI unwinding (incomplete in HEAD)
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: drow at false dot org
- Cc: jan dot kratochvil at redhat dot com, gdb-patches at sourceware dot org, schwab at suse dot de, mark dot kettenis at xs4all dot nl, brobecker at adacore dot com
- Date: Sat, 13 Jan 2007 17:31:32 +0100 (CET)
- Subject: Re: [PATCH] Fix PPC non-CFI + CFI unwinding (incomplete in HEAD)
- References: <20070113093052.GA27383@host0.dyn.jankratochvil.net> <20070113160420.GB28179@nevyn.them.org>
> Date: Sat, 13 Jan 2007 11:04:20 -0500
> From: Daniel Jacobowitz <drow@false.org>
>
> On Sat, Jan 13, 2007 at 10:30:52AM +0100, Jan Kratochvil wrote:
> > 2007-01-01 Jan Kratochvil <jan.kratochvil@redhat.com>
> >
> > * rs6000-tdep.c (skip_prologue): Handle bl->brlr used by PIC code.
>
> IIRC Joel was working on a patch for this case too. I'd been hoping one of
> our PPC experts would look at it...
I've completely lost track of the various powerpc prologue scanner
fixes floating around. Is this patch supposed to fix the same problem
as the test below exposes?
Mark
Index: powerpc-prologue.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/powerpc-prologue.c,v
retrieving revision 1.2
diff -u -p -r1.2 powerpc-prologue.c
--- powerpc-prologue.c 9 Jan 2007 17:59:09 -0000 1.2
+++ powerpc-prologue.c 13 Jan 2007 16:30:18 -0000
@@ -31,23 +31,54 @@ int
main (void)
{
gdb2029 ();
+ optimized_1 ();
return 0;
}
+void
+optimized_1_marker (void)
+{
+}
+
+void
+gdb2029_marker (void)
+{
+}
+
/* A typical PIC prologue from GCC. */
asm(".text\n"
- " .align 8\n"
+ " .p2align 3\n"
SYMBOL (gdb2029) ":\n"
- " stw %r1, -32(%r1)\n"
+ " stwu %r1, -32(%r1)\n"
" mflr %r0\n"
" bcl- 20,31,.+4\n"
" stw %r30, 24(%r1)\n"
" mflr %r30\n"
" stw %r0, 36(%r1)\n"
- " twge %r2, %r2\n"
+ " bl gdb2029_marker\n"
" lwz %r0, 36(%r1)\n"
" lwz %r30, 24(%r1)\n"
" mtlr %r0\n"
- " addi %r0, %r0, 32\n"
+ " addi %r1, %r1, 32\n"
+ " blr");
+
+/* A heavily scheduled prologue. */
+asm(".text\n"
+ " .p2align 3\n"
+ SYMBOL (optimized_1) ":\n"
+ " stwu %r1,-32(%r1)\n"
+ " lis %r9,-16342\n"
+ " lis %r11,-16342\n"
+ " mflr %r0\n"
+ " addi %r11,%r11,3776\n"
+ " stmw %r27,12(%r1)\n"
+ " addi %r31,%r9,3152\n"
+ " cmplw %cr7,%r31,%r11\n"
+ " stw %r0,36(%r1)\n"
+ " mr %r30,%r3\n"
+ " bl optimized_1_marker\n"
+ " lwz %r0,36(%r1)\n"
+ " lmw %r27,12(%r1)\n"
+ " addi %r1,%r1,32\n"
" blr");
Index: powerpc-prologue.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/powerpc-prologue.exp,v
retrieving revision 1.2
diff -u -p -r1.2 powerpc-prologue.exp
--- powerpc-prologue.exp 9 Jan 2007 17:59:09 -0000 1.2
+++ powerpc-prologue.exp 13 Jan 2007 16:30:18 -0000
@@ -50,12 +50,40 @@ if ![runto_main] then {
# Testcase for PIC prologue.
-gdb_test "continue" "Program received signal SIGTRAP.*" "continue to PIC"
+gdb_breakpoint "gdb2029_marker"
+gdb_test "continue" "Breakpoint $decimal, $hex in gdb2029_marker \\(\\)" \
+ "continue to PIC"
gdb_test "backtrace 10" \
- "#0\[ \t\]*$hex in gdb2029.*\r\n#1\[ \t\]*$hex in main.*" \
+ "#0\[ \t\]*$hex in gdb2029_marker.*\r\n#1\[ \t\]*$hex in gdb2029.*\r\n#2\[ \t\]*$hex in main.*" \
+ "backtrace in PIC marker"
+
+gdb_test "finish" ".*$hex in gdb2029 .*" "finish from PIC"
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in gdb2029 .*\r\n#1\[ \t\]*$hex in main.*" \
"backtrace in PIC"
gdb_test "info frame" \
".*Saved registers:.*r30 at.*r31 at.*pc at.*lr at.*" \
"saved registers in PIC"
+
+# Testcase for scheduled prologue.
+
+gdb_breakpoint "optimized_1_marker"
+gdb_test "continue" "Breakpoint $decimal, $hex in optimized_1_marker \\(\\)" \
+ "continue to optimized"
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in optimized_1_marker.*\r\n#1\[ \t\]*$hex in optimized_1.*\r\n#2\[ \t\]*$hex in main.*" \
+ "backtrace in optimized marker"
+
+gdb_test "finish" ".*$hex in optimized_1 .*" "finish from optimized"
+
+gdb_test "backtrace 10" \
+ "#0\[ \t\]*$hex in optimized_1 .*\r\n#1\[ \t\]*$hex in main.*" \
+ "backtrace in optimized"
+
+gdb_test "info frame" \
+ ".*Saved registers:.*r30 at.*r31 at.*pc at.*lr at.*" \
+ "saved registers in optimized"