summaryrefslogtreecommitdiff
path: root/gdb/alpha-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-07-11 21:49:04 +0000
committerMark Kettenis <kettenis@gnu.org>2003-07-11 21:49:04 +0000
commitc039518ceb423fb8e659794742a3f5be4d0639cc (patch)
treebeb69e355ca65c6ade3995bebca45f777965766f /gdb/alpha-tdep.c
parentfca013c6f65f5d50502a1e043f5a66fb2c616c0a (diff)
downloadgdb-c039518ceb423fb8e659794742a3f5be4d0639cc.tar.gz
* alpha-tdep.h (struct gdbarch_tdep): Add members `sc_pc_offset',
`sc_regs_offset' and `sc_fpregs_offset'. * alpha-tdep.c (SIGFRAME_PC_OFF, SIGFRAME_REGSAVE_OFF, SIGFRAME_FPREGSAVE_OFF): Remove defines. (alpha_sigtramp_register_address): Rewrite to use new members of `struct gdbarch_tdep'. (alpha_gdbarch_init): Initialize new members of struct gdbarch_tdep'. * alphafbsd-tdep.c (alphafbsd_use_struct_convention): Use ALPHA_REGISTER_SIZE instead of DEPRECATED_REGISTER_SIZE. (alphafbsd_sigtramp_start, alphafbsd_sigtramp_end): Nre variables. (alphafbsd_pc_in_sigtramp): Implement. (alphafbsd_sigtramp_offset): New function. (alphafbsd_sigcontext_addr): New function. (alphafbsd_init_abi): Initialize signal trampoline related members of `struct gdbarch_tdep'. (_initialize_alphafbsd_tdep): Add prototype.
Diffstat (limited to 'gdb/alpha-tdep.c')
-rw-r--r--gdb/alpha-tdep.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index fb2ca1851b5..0a3185fd890 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -753,24 +753,20 @@ alpha_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
return info;
}
-/* Return the address of REGNO in a sigtramp frame. Since this is all
- arithmetic, it doesn't seem worthwhile to cache it. */
-
-#ifndef SIGFRAME_PC_OFF
-#define SIGFRAME_PC_OFF (2 * 8)
-#define SIGFRAME_REGSAVE_OFF (4 * 8)
-#define SIGFRAME_FPREGSAVE_OFF (SIGFRAME_REGSAVE_OFF + 32 * 8 + 8)
-#endif
+/* Return the address of REGNUM in a sigtramp frame. Since this is
+ all arithmetic, it doesn't seem worthwhile to cache it. */
static CORE_ADDR
-alpha_sigtramp_register_address (CORE_ADDR sigcontext_addr, unsigned int regno)
+alpha_sigtramp_register_address (CORE_ADDR sigcontext_addr, int regnum)
{
- if (regno < 32)
- return sigcontext_addr + SIGFRAME_REGSAVE_OFF + regno * 8;
- if (regno >= ALPHA_FP0_REGNUM && regno < ALPHA_FP0_REGNUM + 32)
- return sigcontext_addr + SIGFRAME_FPREGSAVE_OFF + regno * 8;
- if (regno == ALPHA_PC_REGNUM)
- return sigcontext_addr + SIGFRAME_PC_OFF;
+ struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
+
+ if (regnum >= 0 && regnum < 32)
+ return sigcontext_addr + tdep->sc_regs_offset + regnum * 8;
+ else if (regnum >= ALPHA_FP0_REGNUM && regnum < ALPHA_FP0_REGNUM + 32)
+ return sigcontext_addr + tdep->sc_fpregs_offset + regnum * 8;
+ else if (regnum == ALPHA_PC_REGNUM)
+ return sigcontext_addr + tdep->sc_pc_offset;
return 0;
}
@@ -1495,6 +1491,9 @@ alpha_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep->dynamic_sigtramp_offset = NULL;
tdep->sigcontext_addr = NULL;
+ tdep->sc_pc_offset = 2 * 8;
+ tdep->sc_regs_offset = 4 * 8;
+ tdep->sc_fpregs_offset = tdep->sc_regs_offset + 32 * 8 + 8;
tdep->jb_pc = -1; /* longjmp support not enabled by default */