aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-04-09 16:28:50 +0000
committerMark Kettenis <kettenis@gnu.org>2004-04-09 16:28:50 +0000
commit911bc6ee3f36711ed37e8b829ff1c5622a8b2082 (patch)
treeba085d92d9c29753d0cc9653c095ed79c6c8c208 /gdb/i386-tdep.c
parente083e6ec57ce717ef39cddd78bc3287606274f6f (diff)
downloadgdb-911bc6ee3f36711ed37e8b829ff1c5622a8b2082.zip
gdb-911bc6ee3f36711ed37e8b829ff1c5622a8b2082.tar.gz
gdb-911bc6ee3f36711ed37e8b829ff1c5622a8b2082.tar.bz2
* amd64-tdep.c (amd64_sigtramp_frame_sniffer): Rewrite to use new
sigtramp_p member of `struct gdbarch_tdep'. Also check whether the program counter is in the range specified by `struct gdbarch_tdep'. * amd64-linux-tdep.c: Include "symtab.h". (amd64_linux_pc_in_sigtramp): Remove function. (amd64_linux_sigtramp_p): New function. (amd64_linux_init_abi): Initialize TDEP->sigtramp_p. Don't set deprecated_pc_in_sigtramp. * amd64nbsd-tdep.c: Include "symtab.h". (amd64nbsd_sigtramp_p): New function. (amd64nbsd_init_abi): Initialize TDEP->sigtramp_p. Don't set deprecated_pc_in_sigtramp. * amd64obsd-tdep.c: Include "symtab.h" and "objfiles.h". Add a few comments. (amd64obsd_pc_in_sigtramp): Remove function. (amd64obsd_sigtramp_p): New function. (amd64obsd_init_abi): Initialize TDEP->sigtramp_p. Don't set deprecated_pc_in_sigtramp. * i386-tdep.h (struct gdbarch_tdep): Add sigtramp_p member. (i386bsd_pc_ins_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove prototypes. * i386-tdep.c (i386_sigtramp_frame_sniffer): Rewrite to use new sigtramp_p member of `struct gdbarch_tdep'. Also check whether the program counter is in the range specified by `struct gdbarch_tdep'. (i386_pc_in_sigtramp, i386_svr4_pc_in_sigtramp): Remove functions. (i386_sigtramp_p, i386_svr4_sigtramp_p): New functions. (i386_go32_pc_in_sigtramp): Remove function. (i386_svr4_init_abi): Don't set deprecated_pc_in_sigtramp. Initialize TDEP->sigtramp_p. (i386_go32_init_abi): Initialize TDEP->sigtramp_p to NULL. (i386_gdbarch_init): Initialize TDEP->sigtramp_p. Don't set deprecated_pc_in_sigtramp. * i386-linux-tdep.c: Adjust comments. (i386_linux_pc_in_sigtramp): Remove function. (i386_linux_sigtramp_p): New function. (i386_linux_init_abi): Initialize TDEP->sigtramp_p. Don't set deprecated_pc_in_sigtramp. * i386-nto-tdep.c: Update copyright year. (i386nto_pc_in_sigtramp): Remove function. (i386nto_sigtramp_p): New function. (i386nto_sigcontext_addr): Use I386_ESP_REGNUM instead of SP_REGNUM. (i386nto_init_abi): Initialize TDEP->sigtramp_p. Don't set deprecated_pc_in_sigtramp. * i386-sol2-tdep.c: Update copyright year. (i386_sol2_pc_in_sigtramp): Remove function. (i386_sol2_sigtramp_p): New function. (i386_sol2_init_abi): Initialize TDEP->sigtramp_p. Don't set deprecated_pc_in_sigtramp. * i386bsd-tdep.c (i386bsd_pc_in_sigtramp): Remove function. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove functions. (i386bsd_init_abi): Don't set deprecated_pc_in_sigtramp, deprecated_sigtramp_start and deprecated_sigtramp_end. * i386nbsd-tdep.c: Include "frame.h" and "symtab.h". (i386nbsd_pc_in_sigtramp): Remove function. (i386nbsd_sigtramp_p): New function. (i386nbsd_init_abi): Don't set deprecated_pc_in_sigtramp, deprecated_sigtramp_start, deprecated_sigtramp_end. Initialize TDEP->sigtramp_start, TDEP->sigtramp_end and TDEP->sigtramp_p. * i386obsd-tdep.c: Include "frame.h", "symtab.h" and "objfiles.h". (i386obsd_pc_in_sigtramp): Remove function. (i386obsd_sigtramp_p): New function. (i386obsd_sigtramp_start, i386obsd_sigtramp_end): Remove functions. (i386bsd_init_abi): Don't set deprecated_pc_in_sigtramp, deprecated_sigtramp_start, deprecated_sigtramp_end. Initialize TDEP->sigtramp_p. * Makefile.in (amd64-linux-tdep.o, amd64nbsd-tdep.o, amd64obsd-tdep.o, i386nbsd-tdep.o, i386obsd-tdep.o): Update dependencies.
Diffstat (limited to 'gdb/i386-tdep.c')
-rw-r--r--gdb/i386-tdep.c62
1 files changed, 37 insertions, 25 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index cfe426d..a4f6fc1 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -1051,17 +1051,27 @@ static const struct frame_unwind i386_sigtramp_frame_unwind =
static const struct frame_unwind *
i386_sigtramp_frame_sniffer (struct frame_info *next_frame)
{
- CORE_ADDR pc = frame_pc_unwind (next_frame);
- char *name;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
- /* We shouldn't even bother to try if the OSABI didn't register
- a sigcontext_addr handler. */
- if (!gdbarch_tdep (current_gdbarch)->sigcontext_addr)
+ /* We shouldn't even bother if we don't have a sigcontext_addr
+ handler. */
+ if (tdep->sigcontext_addr == NULL)
return NULL;
- find_pc_partial_function (pc, &name, NULL, NULL);
- if (DEPRECATED_PC_IN_SIGTRAMP (pc, name))
- return &i386_sigtramp_frame_unwind;
+ if (tdep->sigtramp_p != NULL)
+ {
+ if (tdep->sigtramp_p (next_frame))
+ return &i386_sigtramp_frame_unwind;
+ }
+
+ if (tdep->sigtramp_start != 0)
+ {
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+
+ gdb_assert (tdep->sigtramp_end != 0);
+ if (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end)
+ return &i386_sigtramp_frame_unwind;
+ }
return NULL;
}
@@ -1731,12 +1741,16 @@ i386_pe_skip_trampoline_code (CORE_ADDR pc, char *name)
}
-/* Return non-zero if PC and NAME show that we are in a signal
- trampoline. */
+/* Return whether the frame preciding NEXT_FRAME corresponds to a
+ sigtramp routine. */
static int
-i386_pc_in_sigtramp (CORE_ADDR pc, char *name)
+i386_sigtramp_p (struct frame_info *next_frame)
{
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+ char *name;
+
+ find_pc_partial_function (pc, &name, NULL, NULL);
return (name && strcmp ("_sigtramp", name) == 0);
}
@@ -1766,11 +1780,18 @@ i386_print_insn (bfd_vma pc, struct disassemble_info *info)
/* System V Release 4 (SVR4). */
+/* Return whether the frame preciding NEXT_FRAME corresponds to a SVR4
+ sigtramp routine. */
+
static int
-i386_svr4_pc_in_sigtramp (CORE_ADDR pc, char *name)
+i386_svr4_sigtramp_p (struct frame_info *next_frame)
{
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+ char *name;
+
/* UnixWare uses _sigacthandler. The origin of the other symbols is
currently unknown. */
+ find_pc_partial_function (pc, &name, NULL, NULL);
return (name && (strcmp ("_sigreturn", name) == 0
|| strcmp ("_sigacthandler", name) == 0
|| strcmp ("sigvechandler", name) == 0));
@@ -1793,16 +1814,6 @@ i386_svr4_sigcontext_addr (struct frame_info *next_frame)
}
-/* DJGPP. */
-
-static int
-i386_go32_pc_in_sigtramp (CORE_ADDR pc, char *name)
-{
- /* DJGPP doesn't have any special frames for signal handlers. */
- return 0;
-}
-
-
/* Generic ELF. */
void
@@ -1826,7 +1837,7 @@ i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
set_gdbarch_in_solib_call_trampoline (gdbarch, in_plt_section);
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
- set_gdbarch_deprecated_pc_in_sigtramp (gdbarch, i386_svr4_pc_in_sigtramp);
+ tdep->sigtramp_p = i386_svr4_sigtramp_p;
tdep->sigcontext_addr = i386_svr4_sigcontext_addr;
tdep->sc_pc_offset = 36 + 14 * 4;
tdep->sc_sp_offset = 36 + 17 * 4;
@@ -1841,7 +1852,8 @@ i386_go32_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- set_gdbarch_deprecated_pc_in_sigtramp (gdbarch, i386_go32_pc_in_sigtramp);
+ /* DJGPP doesn't have any special frames for signal handlers. */
+ tdep->sigtramp_p = NULL;
tdep->jb_pc_offset = 36;
}
@@ -1973,6 +1985,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->struct_return = pcc_struct_return;
tdep->sigtramp_start = 0;
tdep->sigtramp_end = 0;
+ tdep->sigtramp_p = i386_sigtramp_p;
tdep->sigcontext_addr = NULL;
tdep->sc_reg_offset = NULL;
tdep->sc_pc_offset = -1;
@@ -2034,7 +2047,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_decr_pc_after_break (gdbarch, 1);
set_gdbarch_frame_args_skip (gdbarch, 8);
- set_gdbarch_deprecated_pc_in_sigtramp (gdbarch, i386_pc_in_sigtramp);
/* Wire in the MMX registers. */
set_gdbarch_num_pseudo_regs (gdbarch, i386_num_mmx_regs);