aboutsummaryrefslogtreecommitdiff
path: root/gdb/amd64fbsd-tdep.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2003-10-11 14:54:24 +0000
committerMark Kettenis <kettenis@gnu.org>2003-10-11 14:54:24 +0000
commit477f40d1aef74d9b120920517f90663e4c173cf2 (patch)
treed5cba995a5c90afa974d490615d962183ebb99bc /gdb/amd64fbsd-tdep.c
parentc6b33596909ddd557a49fe34816b2a887e228d10 (diff)
downloadgdb-477f40d1aef74d9b120920517f90663e4c173cf2.zip
gdb-477f40d1aef74d9b120920517f90663e4c173cf2.tar.gz
gdb-477f40d1aef74d9b120920517f90663e4c173cf2.tar.bz2
* amd64fbsd-tdep.c (amd64fbsd_r_reg_offset): New variable.
(amd64fbsd_init_abi): Set TDEP->gregset_reg_offset, TDEP->gregset_num_regs and TDEP->sizeof_gregset. Use ARRAY_SIZE in initialization of TDEP->sc_num_regs.
Diffstat (limited to 'gdb/amd64fbsd-tdep.c')
-rw-r--r--gdb/amd64fbsd-tdep.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c
index 9f6c217..b2c3108 100644
--- a/gdb/amd64fbsd-tdep.c
+++ b/gdb/amd64fbsd-tdep.c
@@ -1,4 +1,5 @@
/* Target-dependent code for FreeBSD/amd64.
+
Copyright 2003 Free Software Foundation, Inc.
This file is part of GDB.
@@ -48,6 +49,26 @@ amd64fbsd_sigcontext_addr (struct frame_info *next_frame)
/* FreeBSD 5.1-RELEASE or later. */
+/* Mapping between the general-purpose registers in `struct reg'
+ format and GDB's register cache layout.
+
+ Note that some registers are 32-bit, but since we're little-endian
+ we get away with that. */
+
+/* From <machine/reg.h>. */
+static int amd64fbsd_r_reg_offset[] =
+{
+ 14 * 8, 11 * 8, /* %rax, %rbx */
+ 13 * 8, 12 * 8, /* %rcx, %rdx */
+ 9 * 8, 8 * 8, /* %rsi, %rdi */
+ 10 * 8, 20 * 8, /* %rbp, %rsp */
+ 7 * 8, 6 * 8, 5 * 8, 4 * 8, /* %r8 ... */
+ 3 * 8, 2 * 8, 1 * 8, 0 * 8, /* ... %r15 */
+ 17 * 8, 19 * 8, /* %rip, %eflags */
+ -1, -1, /* %ds, %es */
+ -1, -1 /* %fs, %gs */
+};
+
/* Location of the signal trampoline. */
CORE_ADDR amd64fbsd_sigtramp_start = 0x7fffffffffc0;
CORE_ADDR amd64fbsd_sigtramp_end = 0x7fffffffffe0;
@@ -87,13 +108,17 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
/* Obviously FreeBSD is BSD-based. */
i386bsd_init_abi (info, gdbarch);
+ tdep->gregset_reg_offset = amd64fbsd_r_reg_offset;
+ tdep->gregset_num_regs = ARRAY_SIZE (amd64fbsd_r_reg_offset);
+ tdep->sizeof_gregset = 22 * 8;
+
x86_64_init_abi (info, gdbarch);
tdep->sigtramp_start = amd64fbsd_sigtramp_start;
tdep->sigtramp_end = amd64fbsd_sigtramp_end;
tdep->sigcontext_addr = amd64fbsd_sigcontext_addr;
tdep->sc_reg_offset = amd64fbsd_sc_reg_offset;
- tdep->sc_num_regs = X86_64_NUM_GREGS;
+ tdep->sc_num_regs = ARRAY_SIZE (amd64fbsd_sc_reg_offset);
}