+2007-06-05 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * gdb.arch/thumb-prologue.c: Record the breakpoint address in
+ tpcs_offset. Restore lr after the call.
+ * gdb.arch/thumb-prologue.exp: Use tpcs_offset.
+
2007-05-23 Daniel Jacobowitz <dan@codesourcery.com>
* lib/gdbserver-support.exp (gdbserver_spawn): Only match full_buffer.
}
/* Normally Thumb functions use r7 as the frame pointer. However,
- with the GCC option -mtpcs-frame, they may use fp instead. */
+ with the GCC option -mtpcs-frame, they may use fp instead. Make
+ sure that the prologue analyzer can handle this. */
asm(".text\n"
" .align 2\n"
" mov r7, sl\n"
" push {r7}\n"
- /* Trap. */
- " .short 0xdffe\n"
+ /* We'll set a breakpoint at this call. We can't hardcode a trap
+ instruction; the right instruction to use varies too much. And
+ we can't use a global label, because GDB will think that's the
+ start of a new function. So, this slightly convoluted
+ technique. */
+ ".Ltpcs:\n"
+ " nop\n"
" pop {r2}\n"
" mov sl, r2\n"
" mov sp, r2\n"
" bx lr\n"
+ " .align 2\n"
+ " .type tpcs_offset, %object\n"
+ "tpcs_offset:\n"
+ " .word .Ltpcs - tpcs_frame_1\n"
+
" .align 2\n"
" .thumb_func\n"
" .code 16\n"
" mov r7, sl\n"
" push {r7}\n"
- /* Clobber saved regs. */
+ /* Clobber saved regs around the call. */
" mov r7, #0\n"
" mov lr, r7\n"
" bl tpcs_frame_1\n"
" pop {r2}\n"
" mov sl, r2\n"
" pop {r7}\n"
- " pop {r1, r2}\n"
+ " pop {r1, r2, r3}\n"
" mov fp, r1\n"
" mov sp, r2\n"
+ " mov lr, r3\n"
" bx lr\n"
);
# Testcase for TPCS prologue.
-gdb_test "continue" "Program received signal SIG.*" "continue to TPCS"
+gdb_breakpoint "* *(int *)tpcs_offset + (int) &tpcs_frame_1"
+gdb_test "continue" "Breakpoint .*, $hex in tpcs_frame_1 \\(\\)" \
+ "continue to TPCS"
gdb_test "backtrace 10" \
"#0\[ \t\]*$hex in tpcs_frame_1 .*\r\n#1\[ \t\]*$hex in tpcs_frame .*\r\n#2\[ \t\]*$hex in main.*" \