From 5868c862e2d178996aa66bf3553a6f59d1516e2e Mon Sep 17 00:00:00 2001 From: Jason Thorpe Date: Fri, 26 Apr 2002 07:05:35 +0000 Subject: [PATCH] * alpha-tdep.h (gdbarch_tdep): Add sigcontext_addr member. * alpha-tdep.c (alpha_sigcontext_addr): New function. (alpha_find_saved_regs): Use alpha_sigcontext_addr. (alpha_gdbarch_init): Initialize tdep->sigcontext_addr. * alpha-linux-tdep.c: Include frame.h. (alpha_linux_sigcontext_addr): New function. (alpha_linux_init_abi): Set tdep->sigcontext_addr to alpha_linux_sigcontext_addr. * alpha-osf1-tdep.c: Include gdbcore.h. (alpha_osf1_sigcontext_addr): New function. (alpha_osf1_init_abi): Set tdep->sigcontext_addr to alpha_osf1_sigcontext_addr. * config/alpha/tm-alpha.h (SIGCONTEXT_ADDR): Remove. * config/alpha/tm-alphalinux.h (SIGCONTEXT_ADDR): Remove. --- gdb/ChangeLog | 17 +++++++++++++++++ gdb/alpha-linux-tdep.c | 8 ++++++++ gdb/alpha-osf1-tdep.c | 9 +++++++++ gdb/alpha-tdep.c | 19 ++++++++++++++++++- gdb/alpha-tdep.h | 4 ++++ gdb/config/alpha/tm-alpha.h | 6 ------ gdb/config/alpha/tm-alphalinux.h | 6 ------ 7 files changed, 56 insertions(+), 13 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 362b366d0b7..6084d5e0762 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,20 @@ +2002-04-26 Jason Thorpe + + * alpha-tdep.h (gdbarch_tdep): Add sigcontext_addr member. + * alpha-tdep.c (alpha_sigcontext_addr): New function. + (alpha_find_saved_regs): Use alpha_sigcontext_addr. + (alpha_gdbarch_init): Initialize tdep->sigcontext_addr. + * alpha-linux-tdep.c: Include frame.h. + (alpha_linux_sigcontext_addr): New function. + (alpha_linux_init_abi): Set tdep->sigcontext_addr to + alpha_linux_sigcontext_addr. + * alpha-osf1-tdep.c: Include gdbcore.h. + (alpha_osf1_sigcontext_addr): New function. + (alpha_osf1_init_abi): Set tdep->sigcontext_addr to + alpha_osf1_sigcontext_addr. + * config/alpha/tm-alpha.h (SIGCONTEXT_ADDR): Remove. + * config/alpha/tm-alphalinux.h (SIGCONTEXT_ADDR): Remove. + 2002-04-26 Andrew Cagney * stack.c (selected_frame_level): diff --git a/gdb/alpha-linux-tdep.c b/gdb/alpha-linux-tdep.c index 05a954457f5..d467840e920 100644 --- a/gdb/alpha-linux-tdep.c +++ b/gdb/alpha-linux-tdep.c @@ -19,6 +19,7 @@ Boston, MA 02111-1307, USA. */ #include "defs.h" +#include "frame.h" #include "gdbcore.h" #include "value.h" @@ -91,6 +92,12 @@ alpha_linux_pc_in_sigtramp (CORE_ADDR pc, char *func_name) return (alpha_linux_sigtramp_offset (pc) >= 0); } +static CORE_ADDR +alpha_linux_sigcontext_addr (struct frame_info *frame) +{ + return (frame->frame - 0x298); /* sizeof(struct sigcontext) */ +} + static void alpha_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -100,6 +107,7 @@ alpha_linux_init_abi (struct gdbarch_info info, set_gdbarch_pc_in_sigtramp (gdbarch, alpha_linux_pc_in_sigtramp); tdep->dynamic_sigtramp_offset = alpha_linux_sigtramp_offset; + tdep->sigcontext_addr = alpha_linux_sigcontext_addr; tdep->jb_pc = 2; tdep->jb_elt_size = 8; diff --git a/gdb/alpha-osf1-tdep.c b/gdb/alpha-osf1-tdep.c index be8f7042bf0..67c56cf9d36 100644 --- a/gdb/alpha-osf1-tdep.c +++ b/gdb/alpha-osf1-tdep.c @@ -20,6 +20,7 @@ #include "defs.h" #include "frame.h" +#include "gdbcore.h" #include "value.h" #include "alpha-tdep.h" @@ -43,6 +44,13 @@ alpha_osf1_pc_in_sigtramp (CORE_ADDR pc, char *func_name) return (func_name != NULL && STREQ ("__sigtramp", func_name)); } +static CORE_ADDR +alpha_osf1_sigcontext_addr (struct frame_info *frame) +{ + return (read_memory_integer (frame->next ? frame->next->frame + : frame->frame, 8)); +} + static void alpha_osf1_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) @@ -52,6 +60,7 @@ alpha_osf1_init_abi (struct gdbarch_info info, set_gdbarch_pc_in_sigtramp (gdbarch, alpha_osf1_pc_in_sigtramp); tdep->skip_sigtramp_frame = alpha_osf1_skip_sigtramp_frame; + tdep->sigcontext_addr = alpha_osf1_sigcontext_addr; tdep->jb_pc = 2; tdep->jb_elt_size = 8; diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c index 6145e91f2db..6f5209782fa 100644 --- a/gdb/alpha-tdep.c +++ b/gdb/alpha-tdep.c @@ -344,6 +344,17 @@ alpha_register_virtual_size (int regno) } +static CORE_ADDR +alpha_sigcontext_addr (struct frame_info *fi) +{ + struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + + if (tdep->sigcontext_addr) + return (tdep->sigcontext_addr (fi)); + + return (0); +} + /* Guaranteed to set frame->saved_regs to some values (it never leaves it NULL). */ @@ -372,7 +383,12 @@ alpha_find_saved_regs (struct frame_info *frame) { CORE_ADDR sigcontext_addr; - sigcontext_addr = SIGCONTEXT_ADDR (frame); + sigcontext_addr = alpha_sigcontext_addr (frame); + if (sigcontext_addr == 0) + { + /* Don't know where the sigcontext is; just bail. */ + return; + } for (ireg = 0; ireg < 32; ireg++) { reg_position = sigcontext_addr + SIGFRAME_REGSAVE_OFF + ireg * 8; @@ -1997,6 +2013,7 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches) tdep->dynamic_sigtramp_offset = NULL; tdep->skip_sigtramp_frame = NULL; + tdep->sigcontext_addr = NULL; tdep->jb_pc = -1; /* longjmp support not enabled by default */ diff --git a/gdb/alpha-tdep.h b/gdb/alpha-tdep.h index 8b1cf3ece6b..c3ee007c6ac 100644 --- a/gdb/alpha-tdep.h +++ b/gdb/alpha-tdep.h @@ -106,6 +106,10 @@ struct gdbarch_tdep frame. */ CORE_ADDR (*skip_sigtramp_frame) (struct frame_info *, CORE_ADDR); + /* Translate a signal handler frame into the address of the sigcontext + structure for that signal handler. */ + CORE_ADDR (*sigcontext_addr) (struct frame_info *); + int jb_pc; /* Offset to PC value in jump buffer. If htis is negative, longjmp support will be disabled. */ diff --git a/gdb/config/alpha/tm-alpha.h b/gdb/config/alpha/tm-alpha.h index b8bcb397ce6..feb752a1495 100644 --- a/gdb/config/alpha/tm-alpha.h +++ b/gdb/config/alpha/tm-alpha.h @@ -83,10 +83,4 @@ extern void alpha_print_extra_frame_info (struct frame_info *); alpha_setup_arbitrary_frame (argc, argv) extern struct frame_info *alpha_setup_arbitrary_frame (int, CORE_ADDR *); -/* Translate a signal handler frame into the address of the sigcontext - structure. */ - -#define SIGCONTEXT_ADDR(frame) \ - (read_memory_integer ((frame)->next ? frame->next->frame : frame->frame, 8)) - #endif /* TM_ALPHA_H */ diff --git a/gdb/config/alpha/tm-alphalinux.h b/gdb/config/alpha/tm-alphalinux.h index fae17438300..27ff45722af 100644 --- a/gdb/config/alpha/tm-alphalinux.h +++ b/gdb/config/alpha/tm-alphalinux.h @@ -40,12 +40,6 @@ extern LONGEST alpha_linux_sigtramp_offset (CORE_ADDR); #undef START_INFERIOR_TRAPS_EXPECTED #define START_INFERIOR_TRAPS_EXPECTED 2 -/* Translate a signal handler frame into the address of the sigcontext - structure. */ - -#undef SIGCONTEXT_ADDR -#define SIGCONTEXT_ADDR(frame) ((frame)->frame - 0x298) - #include "tm-linux.h" #endif /* TM_LINUXALPHA_H */ -- 2.30.2