mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-26 09:08:59 +00:00
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'.
This commit is contained in:
@@ -47,16 +47,6 @@
|
||||
#include "i386-tdep.h"
|
||||
#include "i387-tdep.h"
|
||||
|
||||
/* Register numbers of various important registers. */
|
||||
|
||||
#define I386_EAX_REGNUM 0 /* %eax */
|
||||
#define I386_EDX_REGNUM 2 /* %edx */
|
||||
#define I386_ESP_REGNUM 4 /* %esp */
|
||||
#define I386_EBP_REGNUM 5 /* %ebp */
|
||||
#define I386_EIP_REGNUM 8 /* %eip */
|
||||
#define I386_EFLAGS_REGNUM 9 /* %eflags */
|
||||
#define I386_ST0_REGNUM 16 /* %st(0) */
|
||||
|
||||
/* Names of the registers. The first 10 registers match the register
|
||||
numbering scheme used by GCC for stabs and DWARF. */
|
||||
|
||||
@@ -248,7 +238,7 @@ i386_breakpoint_from_pc (CORE_ADDR *pc, int *len)
|
||||
|
||||
/* The maximum number of saved registers. This should include all
|
||||
registers mentioned above, and %eip. */
|
||||
#define I386_NUM_SAVED_REGS 9
|
||||
#define I386_NUM_SAVED_REGS I386_NUM_GREGS
|
||||
|
||||
struct i386_frame_cache
|
||||
{
|
||||
@@ -884,8 +874,21 @@ i386_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
|
||||
cache->base = extract_unsigned_integer (buf, 4) - 4;
|
||||
|
||||
addr = tdep->sigcontext_addr (next_frame);
|
||||
cache->saved_regs[I386_EIP_REGNUM] = addr + tdep->sc_pc_offset;
|
||||
cache->saved_regs[I386_ESP_REGNUM] = addr + tdep->sc_sp_offset;
|
||||
if (tdep->sc_reg_offset)
|
||||
{
|
||||
int i;
|
||||
|
||||
gdb_assert (tdep->sc_num_regs <= I386_NUM_SAVED_REGS);
|
||||
|
||||
for (i = 0; i < tdep->sc_num_regs; i++)
|
||||
if (tdep->sc_reg_offset[i] != -1)
|
||||
cache->saved_regs[i] = addr + tdep->sc_reg_offset[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
cache->saved_regs[I386_EIP_REGNUM] = addr + tdep->sc_pc_offset;
|
||||
cache->saved_regs[I386_ESP_REGNUM] = addr + tdep->sc_sp_offset;
|
||||
}
|
||||
|
||||
*this_cache = cache;
|
||||
return cache;
|
||||
@@ -1621,6 +1624,7 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
||||
tdep->sigtramp_start = 0;
|
||||
tdep->sigtramp_end = 0;
|
||||
tdep->sigcontext_addr = NULL;
|
||||
tdep->sc_reg_offset = NULL;
|
||||
tdep->sc_pc_offset = -1;
|
||||
tdep->sc_sp_offset = -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user