This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Fix for Tilera TILE-Gx SIGTRAMP_FRAME unwinding
- From: Jeff Kenton <jkenton at tilera dot com>
- To: <gdb-patches at sourceware dot org>
- Date: Fri, 6 Jul 2012 14:59:19 -0400
- Subject: [PATCH] Fix for Tilera TILE-Gx SIGTRAMP_FRAME unwinding
This is a fix for SIGTRAMP_FRAME unwinding for TILE-Gx. It now
calculates offsets into the stack frame to properly locate saved
registers. This eliminates all remaining testsuite failures from the
sigstep test.
gdb/
* tilegx-linux-tdep.c (tilegx_linux_sigframe_init): Fix
SIGTRAMP_FRAME unwinding.
Comments?
Thanks.
--jeff kenton
diff -r -u -N /home/packages/gdb-7.4x/gdb/tilegx-linux-tdep.c ./gdb/tilegx-linux-tdep.c
--- /home/packages/gdb-7.4x/gdb/tilegx-linux-tdep.c 2012-06-01 10:43:30.000000000 -0400
+++ ./gdb/tilegx-linux-tdep.c 2012-07-05 10:41:31.279626000 -0400
@@ -39,13 +39,23 @@
{
CORE_ADDR pc = get_frame_register_unsigned (this_frame, 64);
CORE_ADDR sp = get_frame_register_unsigned (this_frame, 54);
- CORE_ADDR base = sp + 16;
+
+ /* Base address of register save area. */
+ CORE_ADDR base = sp
+ + 16 /* Skip ABI_SAVE_AREA. */
+ + 128 /* Skip SIGINFO. */
+ + 40; /* Skip UCONTEXT. */
+
+ /* Address of saved LR register (R56) which holds previous PC. */
+ CORE_ADDR prev_pc = base + 56 * 8;
+
int i;
for (i = 0; i < 56; i++)
trad_frame_set_reg_addr (this_cache, i, base + i * 8);
- trad_frame_set_reg_value (this_cache, 64, pc);
+ trad_frame_set_reg_value (this_cache, 64,
+ get_frame_memory_unsigned (this_frame, prev_pc, 8));
/* Save a frame ID. */
trad_frame_set_id (this_cache, frame_id_build (base, func));
@@ -107,7 +117,7 @@
static void
tilegx_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
- int arch_size = gdbarch_addr_bit (gdbarch);
+ int arch_size;
linux_init_abi (info, gdbarch);
@@ -117,6 +127,7 @@
tilegx_regset_from_core_section);
/* GNU/Linux uses SVR4-style shared libraries. */
+ arch_size = gdbarch_addr_bit (gdbarch);
if (arch_size == 32)
set_solib_svr4_fetch_link_map_offsets (gdbarch,
svr4_ilp32_fetch_link_map_offsets);