summaryrefslogtreecommitdiff
path: root/gdb/i386obsd-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-05-31 16:08:06 +0000
committerMark Kettenis <kettenis@gnu.org>2003-05-31 16:08:06 +0000
commit0bf83b150201adeb663c193c5d183fc7c37875b1 (patch)
tree32772c4d5f36763f7adf05ff0b67e53cfb9bd34d /gdb/i386obsd-tdep.c
parent1922a7da9585abfe5cb94ea4545f6ff812f136d8 (diff)
downloadgdb-0bf83b150201adeb663c193c5d183fc7c37875b1.tar.gz
From Michal Ludvig <mludvig@suse.cz>:
* i386-tdep.h (struct gdbarch_tdep): Add members `sc_reg_offset' and `sc_num_regs'. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): Move here from... * i386-tdep.c: ... here. (I386_NUM_SAVED_REGS): Define to I386_NUM_REGS. (i386_sigtramp_frame_cache): Use `sc_reg_offset' to find saved registers if possible. (i386_gdbarch_init): Initialize TDEP->sc_reg_offset. * i386bsd-tdep.c (i386bsd_sc_pc_offset, i386bsd_sc_sp_offset): Remove variables. (i386bsd_sc_reg_offset): New variable. (i386bsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386fbsd_sc_reg_offset): New variable. (i386fbsdaout_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs. (i386fbsd4_sc_pc_offset, i386fbsd4_sc_sp_offset): Remove variables. (i386fbsd4_sc_reg_offset): New variable. (i3864bsd4_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386-linux-tdep.c (i386_linux_sc_reg_offset): New variable. (i386_linux_init_abi): Set TDEP->sc_reg_offset and TDEP->sc_num_regs. * i386nbsd-tdep.c (i386nbsd_sc_pc_offset, i386nbsd_sc_sp_offset): Remove variables. (i386nbsd_sc_reg_offset): New variable. (i386nbsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386obsd-tdep.c (i386obsd_sc_pc_offset, i386obsd_sc_sp_offset): Remove variables. (i386obsd_sc_reg_offset): New variable. (i386obsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386bsd-nat.c (_initialize_i386bsd_nat): Adjust for changes in i386bsd-tdep.c, i386nbsd-tdep.c and i386obsd-tdep.c. Add check for frame pointer offset in `struct sigcontext'.
Diffstat (limited to 'gdb/i386obsd-tdep.c')
-rw-r--r--gdb/i386obsd-tdep.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/gdb/i386obsd-tdep.c b/gdb/i386obsd-tdep.c
index be0c674493b..7db076d3a3e 100644
--- a/gdb/i386obsd-tdep.c
+++ b/gdb/i386obsd-tdep.c
@@ -83,8 +83,25 @@ CORE_ADDR i386obsd_sigtramp_start = 0xbfbfdf20;
CORE_ADDR i386obsd_sigtramp_end = 0xbfbfdff0;
/* From <machine/signal.h>. */
-int i386obsd_sc_pc_offset = 44;
-int i386obsd_sc_sp_offset = 56;
+int i386obsd_sc_reg_offset[I386_NUM_GREGS] =
+{
+ 10 * 4, /* %eax */
+ 9 * 4, /* %ecx */
+ 8 * 4, /* %edx */
+ 7 * 4, /* %ebx */
+ 14 * 4, /* %esp */
+ 6 * 4, /* %ebp */
+ 5 * 4, /* %esi */
+ 4 * 4, /* %edi */
+ 11 * 4, /* %eip */
+ 13 * 4, /* %eflags */
+ 12 * 4, /* %cs */
+ 15 * 4, /* %ss */
+ 3 * 4, /* %ds */
+ 2 * 4, /* %es */
+ 1 * 4, /* %fs */
+ 0 * 4 /* %gs */
+};
static void
i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
@@ -103,8 +120,8 @@ i386obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* OpenBSD has a `struct sigcontext' that's different from the
origional 4.3 BSD. */
- tdep->sc_pc_offset = i386obsd_sc_pc_offset;
- tdep->sc_sp_offset = i386obsd_sc_sp_offset;
+ tdep->sc_reg_offset = i386obsd_sc_reg_offset;
+ tdep->sc_num_regs = I386_NUM_GREGS;
}
void