From: Mark Kettenis Date: Sat, 11 Oct 2003 14:54:24 +0000 (+0000) Subject: * amd64fbsd-tdep.c (amd64fbsd_r_reg_offset): New variable. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=477f40d1aef74d9b120920517f90663e4c173cf2;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 20e05f37741..0a4665aa909 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2003-10-11 Mark Kettenis + * 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. + * x86-64-tdep.c (x86_64_regset_from_core_section): New function. (x86_64_init_abi): Initialize regset_from_core_section if appropriate. diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c index 9f6c2172328..b2c3108b978 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 . */ +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); }