with sigcontext_addr. Add sc_sp_offset.
(i386bsd_sigtramp_saved_pc): Remove prototype.
(i386bsd_sicontext_addr): Add prototype.
* i386-tdep.c (i386_sigtramp_saved_pc): New function.
(i386_frame_saved_pc): Rewrite to call i386_sigtramp_saved_pc.
(i386_svr4_sigtramp_saved_pc): Removed.
(i386_svr4_sigcontext_addr): New function.
(i386_svr4_init_abi): Don't initialize tdep->sigtramp_saved_pc.
Initialize tdep->sigcontext_addr instead. Initialize
tdep->sc_pc_offset and tdep->sc_sp_offset.
(i386_gdbarch_init): Likewise.
* i386bsd-tdep.c (i386bsd_sigcontext_addr): Don't make it static
any more.
(i386bsd_sigtramp_saved_pc): Remove function.
(i386bsd_init_abi): Don't initialize tdep->sigtramp_saved_pc.
Initialize tdep->sigcontext_addr instead. Initialize
tdep->sc_pc_offset.
* i386-linux-tdep.c (i386_linux_init_abi): Remove initialization
of tdep->sigtramp_saved_pc.
* i386-sol2-tdep.c (i386_sol2_init_abi): Don't initialize
tdep->sigtramp_saved_pc. Initialize tdep->sigcontext_addr
instead.
2002-07-01 Mark Kettenis <kettenis@gnu.org>
+ * i386-tdep.h (struct gdbarch_tdep): Replace sigtramp_saved_pc
+ with sigcontext_addr. Add sc_sp_offset.
+ (i386bsd_sigtramp_saved_pc): Remove prototype.
+ (i386bsd_sicontext_addr): Add prototype.
+ * i386-tdep.c (i386_sigtramp_saved_pc): New function.
+ (i386_frame_saved_pc): Rewrite to call i386_sigtramp_saved_pc.
+ (i386_svr4_sigtramp_saved_pc): Removed.
+ (i386_svr4_sigcontext_addr): New function.
+ (i386_svr4_init_abi): Don't initialize tdep->sigtramp_saved_pc.
+ Initialize tdep->sigcontext_addr instead. Initialize
+ tdep->sc_pc_offset and tdep->sc_sp_offset.
+ (i386_gdbarch_init): Likewise.
+ * i386bsd-tdep.c (i386bsd_sigcontext_addr): Don't make it static
+ any more.
+ (i386bsd_sigtramp_saved_pc): Remove function.
+ (i386bsd_init_abi): Don't initialize tdep->sigtramp_saved_pc.
+ Initialize tdep->sigcontext_addr instead. Initialize
+ tdep->sc_pc_offset.
+ * i386-linux-tdep.c (i386_linux_init_abi): Remove initialization
+ of tdep->sigtramp_saved_pc.
+ * i386-sol2-tdep.c (i386_sol2_init_abi): Don't initialize
+ tdep->sigtramp_saved_pc. Initialize tdep->sigcontext_addr
+ instead.
+
* i386-tdep.c (i386_frameless_function_invocation,
i386_frame_num_args, i386_frame_init_saved_regs,
i386_skip_prologue, i386_push_dummy_frame, i386_fix_call_dummy,
set_gdbarch_frame_chain (gdbarch, i386_linux_frame_chain);
set_gdbarch_frame_saved_pc (gdbarch, i386_linux_frame_saved_pc);
set_gdbarch_saved_pc_after_call (gdbarch, i386_linux_saved_pc_after_call);
- tdep->sigtramp_saved_pc = i386_linux_sigtramp_saved_pc;
set_solib_svr4_fetch_link_map_offsets (gdbarch,
i386_linux_svr4_fetch_link_map_offsets);
/* Signal trampolines are different from SVR4, in fact they're
rather similar to BSD. */
set_gdbarch_pc_in_sigtramp (gdbarch, i386_sol2_pc_in_sigtramp);
- tdep->sigtramp_saved_pc = i386bsd_sigtramp_saved_pc;
+ tdep->sigcontext_addr = i386bsd_sigcontext_addr;
tdep->sc_pc_offset = 36 + 14 * 4;
/* Assume that the prototype flag can be trusted. */
return frameless_look_for_prologue (frame);
}
+/* Assuming FRAME is for a sigtramp routine, return the saved program
+ counter. */
+
+static CORE_ADDR
+i386_sigtramp_saved_pc (struct frame_info *frame)
+{
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+ CORE_ADDR addr;
+
+ addr = tdep->sigcontext_addr (frame);
+ return read_memory_unsigned_integer (addr + tdep->sc_pc_offset, 4);
+}
+
/* Return the saved program counter for FRAME. */
static CORE_ADDR
i386_frame_saved_pc (struct frame_info *frame)
{
if (frame->signal_handler_caller)
- {
- CORE_ADDR (*sigtramp_saved_pc) (struct frame_info *);
- sigtramp_saved_pc = gdbarch_tdep (current_gdbarch)->sigtramp_saved_pc;
-
- gdb_assert (sigtramp_saved_pc != NULL);
- return sigtramp_saved_pc (frame);
- }
+ return i386_sigtramp_saved_pc (frame);
return read_memory_unsigned_integer (frame->frame + 4, 4);
}
|| strcmp ("sigvechandler", name) == 0));
}
-/* Get saved user PC for sigtramp from the pushed ucontext on the
- stack for all three variants of SVR4 sigtramps. */
+/* Get address of the pushed ucontext (sigcontext) on the stack for
+ all three variants of SVR4 sigtramps. */
static CORE_ADDR
-i386_svr4_sigtramp_saved_pc (struct frame_info *frame)
+i386_svr4_sigcontext_addr (struct frame_info *frame)
{
- CORE_ADDR saved_pc_offset = 4;
+ int sigcontext_offset = -1;
char *name = NULL;
find_pc_partial_function (frame->pc, &name, NULL, NULL);
if (name)
{
if (strcmp (name, "_sigreturn") == 0)
- saved_pc_offset = 132 + 14 * 4;
+ sigcontext_offset = 132;
else if (strcmp (name, "_sigacthandler") == 0)
- saved_pc_offset = 80 + 14 * 4;
+ sigcontext_offset = 80;
else if (strcmp (name, "sigvechandler") == 0)
- saved_pc_offset = 120 + 14 * 4;
+ sigcontext_offset = 120;
}
+ gdb_assert (sigcontext_offset != -1);
+
if (frame->next)
- return read_memory_integer (frame->next->frame + saved_pc_offset, 4);
- return read_memory_integer (read_register (SP_REGNUM) + saved_pc_offset, 4);
+ return frame->next->frame + sigcontext_offset;
+ return read_register (SP_REGNUM) + sigcontext_offset;
}
\f
set_gdbarch_frame_chain_valid (gdbarch, func_frame_chain_valid);
set_gdbarch_pc_in_sigtramp (gdbarch, i386_svr4_pc_in_sigtramp);
- tdep->sigtramp_saved_pc = i386_svr4_sigtramp_saved_pc;
+ tdep->sigcontext_addr = i386_svr4_sigcontext_addr;
+ tdep->sc_pc_offset = 14 * 4;
+ tdep->sc_sp_offset = 7 * 4;
tdep->jb_pc_offset = 20;
}
tdep->jb_pc_offset = -1;
tdep->struct_return = pcc_struct_return;
- tdep->sigtramp_saved_pc = NULL;
tdep->sigtramp_start = 0;
tdep->sigtramp_end = 0;
+ tdep->sigcontext_addr = NULL;
tdep->sc_pc_offset = -1;
+ tdep->sc_sp_offset = -1;
/* The format used for `long double' on almost all i386 targets is
the i387 extended floating-point format. In fact, of all targets
in the GCC 2.95 tree, only OSF/1 does it different, and insists
on having a `long double' that's not `long' at all. */
set_gdbarch_long_double_format (gdbarch, &floatformat_i387_ext);
-
+
/* Although the i386 extended floating-point has only 80 significant
bits, a `long double' actually takes up 96, probably to enforce
alignment. */
/* NOTE: tm-i386aix.h, tm-i386bsd.h, tm-i386os9k.h, tm-ptx.h,
tm-symmetry.h currently override this. Sigh. */
set_gdbarch_num_regs (gdbarch, I386_NUM_GREGS + I386_NUM_FREGS);
-
+
set_gdbarch_sp_regnum (gdbarch, 4);
set_gdbarch_fp_regnum (gdbarch, 5);
set_gdbarch_pc_regnum (gdbarch, 8);
/* Convention for returning structures. */
enum struct_return struct_return;
- /* Get saved PC for sigtramp. */
- CORE_ADDR (*sigtramp_saved_pc) (struct frame_info *);
-
/* Address range where sigtramp lives. */
CORE_ADDR sigtramp_start;
CORE_ADDR sigtramp_end;
- /* Offset of saved PC in `struct sigcontext'. */
+ /* Get address of sigcontext for sigtramp. */
+ CORE_ADDR (*sigcontext_addr) (struct frame_info *);
+
+ /* Offset of saved PC and SP in `struct sigcontext'. */
int sc_pc_offset;
+ int sc_sp_offset;
};
/* Floating-point registers. */
/* Functions exported from i386bsd-tdep.c. */
-extern CORE_ADDR i386bsd_sigtramp_saved_pc (struct frame_info *frame);
+extern CORE_ADDR i386bsd_sigcontext_addr (struct frame_info *frame);
#endif /* i386-tdep.h */
}
/* Assuming FRAME is for a BSD sigtramp routine, return the address of
- the associated sigcontext structure. */
+ the associated sigcontext structure.
-static CORE_ADDR
+ Note: This function is used for Solaris 2 too, so don't make it
+ static. */
+
+CORE_ADDR
i386bsd_sigcontext_addr (struct frame_info *frame)
{
if (frame->next)
return read_memory_unsigned_integer (read_register (SP_REGNUM) + 8, 4);
}
-/* Assuming FRAME is for a BSD sigtramp routine, return the saved
- program counter.
-
- Note: This function is used for Solaris 2 too, so don't make it
- static. */
-
-CORE_ADDR
-i386bsd_sigtramp_saved_pc (struct frame_info *frame)
-{
- int sc_pc_offset = gdbarch_tdep (current_gdbarch)->sc_pc_offset;
- CORE_ADDR addr;
-
- addr = i386bsd_sigcontext_addr (frame);
- return read_memory_unsigned_integer (addr + sc_pc_offset, 4);
-}
-
/* Return the start address of the sigtramp routine. */
CORE_ADDR
tdep->jb_pc_offset = 0;
- tdep->sigtramp_saved_pc = i386bsd_sigtramp_saved_pc;
tdep->sigtramp_start = 0xfdbfdfc0;
tdep->sigtramp_end = 0xfdbfe000;
+ tdep->sigcontext_addr = i386bsd_sigcontext_addr;
tdep->sc_pc_offset = i386bsd_sc_pc_offset;
}