From e2a86a90afcc3e54ce799ac96664125bc723918d Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Wed, 10 Jul 2002 07:48:45 +0000 Subject: [PATCH] Make our i386 hacks in a less vendor file disturbing manner. --- contrib/gdb/gdb/config/i386/tm-fbsd.h | 50 ++++++++++------------- gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h | 25 ++++++++++++ 2 files changed, 46 insertions(+), 29 deletions(-) diff --git a/contrib/gdb/gdb/config/i386/tm-fbsd.h b/contrib/gdb/gdb/config/i386/tm-fbsd.h index dc82d0e426b3..85b648027c3a 100644 --- a/contrib/gdb/gdb/config/i386/tm-fbsd.h +++ b/contrib/gdb/gdb/config/i386/tm-fbsd.h @@ -26,10 +26,6 @@ #define HAVE_I387_REGS #include "i386/tm-i386.h" -#ifdef HAVE_SYS_PARAM_H -#include -#endif - /* FreeBSD/ELF uses stabs-in-ELF with the DWARF register numbering scheme by default, so we must redefine STAB_REG_TO_REGNUM. This messes up the floating-point registers for a.out, but there is not @@ -47,42 +43,38 @@ /* Support for longjmp. */ /* Details about jmp_buf. It's supposed to be an array of integers. */ + +#define JB_ELEMENT_SIZE 4 /* Size of elements in jmp_buf. */ +#define JB_PC 0 /* Array index of saved PC. */ + +/* Figure out where the longjmp will land. Store the address that + longjmp will jump to in *ADDR, and return non-zero if successful. */ + #define GET_LONGJMP_TARGET(addr) get_longjmp_target (addr) +extern int get_longjmp_target (CORE_ADDR *addr); -/* On FreeBSD, sigtramp has size 0x18 and is immediately below the - ps_strings struct which has size 0x10 and is at the top of the - user stack. */ +/* Support for signal handlers. */ -#undef SIGTRAMP_START -#undef SIGTRAMP_END -#define SIGTRAMP_START(pc) 0xbfbfdfd8 -#define SIGTRAMP_END(pc) 0xbfbfdff0 +#define IN_SIGTRAMP(pc, name) i386bsd_in_sigtramp (pc, name) +extern int i386bsd_in_sigtramp (CORE_ADDR pc, char *name); +/* These defines allow the recognition of sigtramps as a function name + . + + FIXME: kettenis/2001-07-13: These should be added to the target + vector and turned into functions when we go "multi-arch". */ + +#define SIGTRAMP_START(pc) i386bsd_sigtramp_start +#define SIGTRAMP_END(pc) i386bsd_sigtramp_end extern CORE_ADDR i386bsd_sigtramp_start; extern CORE_ADDR i386bsd_sigtramp_end; -extern CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *fr); /* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */ #undef FRAME_SAVED_PC -#if __FreeBSD_version >= 500032 -#define FRAME_SAVED_PC(FRAME) \ - (kernel_debugging ? fbsd_kern_frame_saved_pc(FRAME) : \ - (((FRAME)->signal_handler_caller \ - ? sigtramp_saved_pc (FRAME) \ - : read_memory_integer ((FRAME)->frame + 4, 4)) \ - )) -#else -#define FRAME_SAVED_PC(FRAME) \ - (((FRAME)->signal_handler_caller \ - ? sigtramp_saved_pc (FRAME) \ - : read_memory_integer ((FRAME)->frame + 4, 4)) \ - ) -#endif - -/* Offset to saved PC in sigcontext, from . */ -#define SIGCONTEXT_PC_OFFSET 20 +#define FRAME_SAVED_PC(frame) i386bsd_frame_saved_pc (frame) +extern CORE_ADDR i386bsd_frame_saved_pc (struct frame_info *frame); /* Shared library support. */ diff --git a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h index 45fae7db3097..044b71fc63e7 100644 --- a/gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h +++ b/gnu/usr.bin/binutils/gdb/fbsd-kgdb-i386.h @@ -3,4 +3,29 @@ #ifndef FBSD_KGDB_I386_H #define FBSD_KGDB_I386_H +/* On FreeBSD, sigtramp has size 0x18 and is immediately below the + ps_strings struct which has size 0x10 and is at the top of the + user stack. */ + +#undef SIGTRAMP_START +#define SIGTRAMP_START(pc) 0xbfbfdfd8 +#undef SIGTRAMP_END +#define SIGTRAMP_END(pc) 0xbfbfdff0 + + +/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */ + +extern CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *fr); + +#undef FRAME_SAVED_PC +#define FRAME_SAVED_PC(FRAME) \ + (kernel_debugging \ + ? fbsd_kern_frame_saved_pc(FRAME) : \ + (FRAME)->signal_handler_caller \ + ? sigtramp_saved_pc (FRAME) \ + : read_memory_integer ((FRAME)->frame + 4, 4)) + +/* Offset to saved PC in sigcontext, from . */ +#define SIGCONTEXT_PC_OFFSET 20 + #endif /* FBSD_KGDB_I386_H */