aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-10-30 22:25:54 +0000
committerMark Kettenis <kettenis@gnu.org>2003-10-30 22:25:54 +0000
commite9f1aad5b50eaa3167ae22c305cf25348d25959f (patch)
tree0f1cf51589793e8144496f8e4417d55f3547a964 /gdb
parent2382c03f5ad9ff28087ef73c79b1e1d64c9e9e04 (diff)
downloadgdb-e9f1aad5b50eaa3167ae22c305cf25348d25959f.zip
gdb-e9f1aad5b50eaa3167ae22c305cf25348d25959f.tar.gz
gdb-e9f1aad5b50eaa3167ae22c305cf25348d25959f.tar.bz2
* 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.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/i386-linux-tdep.c48
2 files changed, 52 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 302823c..7e08e30 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2003-10-30 Mark Kettenis <kettenis@gnu.org>
+ * 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 97845bf..f75a41c 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 <sys/reg.h>. */
+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 <asm/sigcontext.h>. */
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 <bits/setjmp.h>. */
tdep->sigcontext_addr = i386_linux_sigcontext_addr;