This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Provide register set information for FreeBSD/amd64


This adds the necessary register set information for FreeBSD/amd64.

Committed,

Mark


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>
 
	* 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.

Index: amd64fbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64fbsd-tdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 amd64fbsd-tdep.c
--- amd64fbsd-tdep.c 12 Sep 2003 19:27:38 -0000 1.2
+++ amd64fbsd-tdep.c 11 Oct 2003 14:27:46 -0000
@@ -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_
 
 /* 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 
   /* 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);
 }
 
 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]