From: Mark Kettenis Date: Thu, 30 Oct 2003 22:25:54 +0000 (+0000) Subject: * i386-linux-tdep.c (i386_linux_gregset_reg_offset): New variable. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e9f1aad5b50eaa3167ae22c305cf25348d25959f;p=binutils-gdb.git * i386-linux-tdep.c (i386_linux_gregset_reg_offset): New variable. (i386_linux_init_abi): Initialize TDEP->gregset_reg_offset, TDEP->gregset_num_regs and tdep->sizeof_gregset. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 302823cfe88..7e08e30a91a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,9 @@ 2003-10-30 Mark Kettenis + * i386-linux-tdep.c (i386_linux_gregset_reg_offset): New variable. + (i386_linux_init_abi): Initialize TDEP->gregset_reg_offset, + TDEP->gregset_num_regs and tdep->sizeof_gregset. + * i386-linux-tdep.c (i386_linux_sc_reg_offset): Don't explicitly specify size of array. (i386_linux_init_abi): Remove initialization of diff --git a/gdb/i386-linux-tdep.c b/gdb/i386-linux-tdep.c index 97845bf1638..f75a41c61f0 100644 --- a/gdb/i386-linux-tdep.c +++ b/gdb/i386-linux-tdep.c @@ -439,6 +439,50 @@ i386_linux_svr4_fetch_link_map_offsets (void) } +/* The register sets used in GNU/Linux ELF core-dumps are identical to + the register sets in `struct user' that are used for a.out + core-dumps. These are also used by ptrace(2). The corresponding + types are `elf_gregset_t' for the general-purpose registers (with + `elf_greg_t' the type of a single GP register) and `elf_fpregset_t' + for the floating-point registers. + + Those types used to be available under the names `gregset_t' and + `fpregset_t' too, and GDB used those names in the past. But those + names are now used for the register sets used in the `mcontext_t' + type, which have a different size and layout. */ + +/* Mapping between the general-purpose registers in `struct user' + format and GDB's register cache layout. */ + +/* From . */ +static int i386_linux_gregset_reg_offset[] = +{ + 6 * 4, /* %eax */ + 1 * 4, /* %ecx */ + 2 * 4, /* %edx */ + 0 * 4, /* %ebx */ + 15 * 4, /* %esp */ + 5 * 4, /* %ebp */ + 3 * 4, /* %esi */ + 4 * 4, /* %edi */ + 12 * 4, /* %eip */ + 14 * 4, /* %eflags */ + 13 * 4, /* %cs */ + 16 * 4, /* %ss */ + 7 * 4, /* %ds */ + 8 * 4, /* %es */ + 9 * 4, /* %fs */ + 10 * 4, /* %gs */ + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, + -1, + 11 * 4 /* "orig_eax" */ +}; + +/* Mapping between the general-purpose registers in `struct + sigcontext' format and GDB's register cache layout. */ + /* From . */ static int i386_linux_sc_reg_offset[] = { @@ -476,6 +520,10 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) set_gdbarch_register_name (gdbarch, i386_linux_register_name); set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p); + tdep->gregset_reg_offset = i386_linux_gregset_reg_offset; + tdep->gregset_num_regs = ARRAY_SIZE (i386_linux_gregset_reg_offset); + tdep->sizeof_gregset = 17 * 4; + tdep->jb_pc_offset = 20; /* From . */ tdep->sigcontext_addr = i386_linux_sigcontext_addr;