aboutsummaryrefslogtreecommitdiff
path: root/gdb/i386obsd-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/i386obsd-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/i386obsd-tdep.c')
-rw-r--r--gdb/i386obsd-tdep.c58
1 files changed, 19 insertions, 39 deletions
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index 740bae3..17f2f5e 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -23,9 +23,12 @@
#include "defs.h"
#include "arch-utils.h"
+#include "frame.h"
#include "gdbcore.h"
#include "regcache.h"
#include "regset.h"
+#include "symtab.h"
+#include "objfiles.h"
#include "osabi.h"
#include "target.h"
@@ -48,11 +51,13 @@
/* Default page size. */
static const int i386obsd_page_size = 4096;
-/* Return whether PC is in an OpenBSD sigtramp routine. */
+/* Return whether the frame preciding NEXT_FRAME corresponds to an
+ OpenBSD sigtramp routine. */
static int
-i386obsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
+i386obsd_sigtramp_p (struct frame_info *next_frame)
{
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
CORE_ADDR start_pc = (pc & ~(i386obsd_page_size - 1));
const char sigreturn[] =
{
@@ -60,13 +65,17 @@ i386obsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
0x67, 0x00, 0x00, 0x00, /* movl $SYS_sigreturn, %eax */
0xcd, 0x80 /* int $0x80 */
};
- char *buf;
+ char *name, *buf;
- /* Avoid reading memory from the target if possible. If we're in a
- named function, we're certainly not in a sigtramp routine
- provided by the kernel. Take synthetic function names into
- account though. */
- if (name && name[0] != '<')
+ /* If the function has a valid symbol name, it isn't a
+ trampoline. */
+ find_pc_partial_function (pc, &name, NULL, NULL);
+ if (name != NULL)
+ return 0;
+
+ /* If the function lives in a valid section (even without a starting
+ point) it isn't a trampoline. */
+ if (find_pc_section (pc) != NULL)
return 0;
/* If we can't read the instructions at START_PC, return zero. */
@@ -78,34 +87,7 @@ i386obsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
if (memcmp (buf, sigreturn, sizeof sigreturn) == 0)
return 1;
- /* Check for a traditional BSD sigtramp routine. */
- return i386bsd_pc_in_sigtramp (pc, name);
-}
-
-/* Return the start address of the sigtramp routine. */
-
-static CORE_ADDR
-i386obsd_sigtramp_start (CORE_ADDR pc)
-{
- CORE_ADDR start_pc = (pc & ~(i386obsd_page_size - 1));
-
- if (i386bsd_pc_in_sigtramp (pc, NULL))
- return i386bsd_sigtramp_start (pc);
-
- return start_pc;
-}
-
-/* Return the end address of the sigtramp routine. */
-
-static CORE_ADDR
-i386obsd_sigtramp_end (CORE_ADDR pc)
-{
- CORE_ADDR start_pc = (pc & ~(i386obsd_page_size - 1));
-
- if (i386bsd_pc_in_sigtramp (pc, NULL))
- return i386bsd_sigtramp_end (pc);
-
- return start_pc + 0x22;
+ return 0;
}
/* Mapping between the general-purpose registers in `struct reg'
@@ -215,9 +197,7 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* OpenBSD uses a different memory layout. */
tdep->sigtramp_start = i386obsd_sigtramp_start_addr;
tdep->sigtramp_end = i386obsd_sigtramp_end_addr;
- set_gdbarch_deprecated_pc_in_sigtramp (gdbarch, i386obsd_pc_in_sigtramp);
- set_gdbarch_deprecated_sigtramp_start (gdbarch, i386obsd_sigtramp_start);
- set_gdbarch_deprecated_sigtramp_end (gdbarch, i386obsd_sigtramp_end);
+ tdep->sigtramp_p = i386obsd_sigtramp_p;
/* OpenBSD has a `struct sigcontext' that's different from the
original 4.3 BSD. */