mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-03 04:12:10 +08:00
8f0435f75e
This adds the 'regset' parameter to the iterator callback. Consequently the 'regset_from_core_section' method is dropped for all targets that provide the iterator method. This change prepares for replacing regset_from_core_section everywhere, thereby eliminating one gdbarch interface. Since the iterator is usually no more complex than regset_from_core_section alone, targets that previously didn't define core_regset_sections will then gain multi-arch capable core file generation support without increased complexity. gdb/ChangeLog: * gdbarch.sh (iterate_over_regset_sections_cb): Add regset parameter. * gdbarch.h: Regenerate. * corelow.c (sniff_core_bfd): Don't sniff if gdbarch has a regset iterator. (get_core_register_section): Add parameter 'regset' and use it, if set. Add parameter 'min_size' and verify the bfd section size against it. (get_core_registers_cb): Add parameter 'regset' and pass it to get_core_register section. For the "standard" register sections ".reg" and ".reg2", set an appropriate default for human_name. (get_core_registers): Don't abort when the gdbarch has an iterator but no regset_from_core_section. Add NULL/0 for parameters 'regset'/'min_size' in calls to get_core_register_section. * linux-tdep.c (linux_collect_regset_section_cb): Add parameter 'regset' and use it instead of calling the regset_from_core_section gdbarch method. * i386-tdep.h (struct gdbarch_tdep): Add field 'fpregset'. * i386-tdep.c (i386_supply_xstateregset) (i386_collect_xstateregset, i386_xstateregset): Moved to i386-linux-tdep.c. (i386_regset_from_core_section): Drop handling for .reg-xfp and .reg-xstate. (i386_gdbarch_init): Set tdep field 'fpregset'. Enable generic core file support only if the regset iterator hasn't been set. * i386-linux-tdep.c (i386_linux_supply_xstateregset) (i386_linux_collect_xstateregset, i386_linux_xstateregset): New. Moved from i386-tdep.c and renamed to *_linux*. (i386_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. Allow any .reg-xstate size when reading from a core file. * amd64-tdep.c (amd64_supply_xstateregset) (amd64_collect_xstateregset, amd64_xstateregset): Moved to amd64-linux-tdep.c. (amd64_regset_from_core_section): Remove. (amd64_init_abi): Set new tdep field 'fpregset'. No longer install an amd64-specific regset_from_core_section gdbarch method. * amd64-linux-tdep.c (amd64_linux_supply_xstateregset) (amd64_linux_collect_xstateregset, amd64_linux_xstateregset): New. Moved from amd64-tdep.c and renamed to *_linux*. (amd64_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. Allow any .reg-xstate size when reading from a core file. * arm-linux-tdep.c (arm_linux_regset_from_core_section): Remove. (arm_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. (arm_linux_init_abi): No longer set the regset_from_core_section gdbarch method. * ppc-linux-tdep.c (ppc_linux_regset_from_core_section): Remove. (ppc_linux_iterate_over_regset_sections): Add regset parameter to each callback invocation. (ppc_linux_init_abi): No longer set the regset_from_core_section gdbarch method. * s390-linux-tdep.c (struct gdbarch_tdep): Remove the fields gregset, sizeof_gregset, fpregset, and sizeof_fpregset. (s390_regset_from_core_section): Remove. (s390_iterate_over_regset_sections): Add regset parameter to each callback invocation. (s390_gdbarch_init): No longer set the regset_from_core_section gdbarch method. Drop initialization of deleted tdep fields.
140 lines
4.7 KiB
C
140 lines
4.7 KiB
C
/* Target-dependent definitions for AMD64.
|
||
|
||
Copyright (C) 2001-2014 Free Software Foundation, Inc.
|
||
Contributed by Jiri Smid, SuSE Labs.
|
||
|
||
This file is part of GDB.
|
||
|
||
This program is free software; you can redistribute it and/or modify
|
||
it under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation; either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||
|
||
#ifndef AMD64_TDEP_H
|
||
#define AMD64_TDEP_H
|
||
|
||
struct gdbarch;
|
||
struct frame_info;
|
||
struct regcache;
|
||
|
||
#include "i386-tdep.h"
|
||
|
||
/* Register numbers of various important registers. */
|
||
|
||
enum amd64_regnum
|
||
{
|
||
AMD64_RAX_REGNUM, /* %rax */
|
||
AMD64_RBX_REGNUM, /* %rbx */
|
||
AMD64_RCX_REGNUM, /* %rcx */
|
||
AMD64_RDX_REGNUM, /* %rdx */
|
||
AMD64_RSI_REGNUM, /* %rsi */
|
||
AMD64_RDI_REGNUM, /* %rdi */
|
||
AMD64_RBP_REGNUM, /* %rbp */
|
||
AMD64_RSP_REGNUM, /* %rsp */
|
||
AMD64_R8_REGNUM, /* %r8 */
|
||
AMD64_R9_REGNUM, /* %r9 */
|
||
AMD64_R10_REGNUM, /* %r10 */
|
||
AMD64_R11_REGNUM, /* %r11 */
|
||
AMD64_R12_REGNUM, /* %r12 */
|
||
AMD64_R13_REGNUM, /* %r13 */
|
||
AMD64_R14_REGNUM, /* %r14 */
|
||
AMD64_R15_REGNUM, /* %r15 */
|
||
AMD64_RIP_REGNUM, /* %rip */
|
||
AMD64_EFLAGS_REGNUM, /* %eflags */
|
||
AMD64_CS_REGNUM, /* %cs */
|
||
AMD64_SS_REGNUM, /* %ss */
|
||
AMD64_DS_REGNUM, /* %ds */
|
||
AMD64_ES_REGNUM, /* %es */
|
||
AMD64_FS_REGNUM, /* %fs */
|
||
AMD64_GS_REGNUM, /* %gs */
|
||
AMD64_ST0_REGNUM = 24, /* %st0 */
|
||
AMD64_ST1_REGNUM, /* %st1 */
|
||
AMD64_FCTRL_REGNUM = AMD64_ST0_REGNUM + 8,
|
||
AMD64_FSTAT_REGNUM = AMD64_ST0_REGNUM + 9,
|
||
AMD64_FTAG_REGNUM = AMD64_ST0_REGNUM + 10,
|
||
AMD64_XMM0_REGNUM = 40, /* %xmm0 */
|
||
AMD64_XMM1_REGNUM, /* %xmm1 */
|
||
AMD64_MXCSR_REGNUM = AMD64_XMM0_REGNUM + 16,
|
||
AMD64_YMM0H_REGNUM, /* %ymm0h */
|
||
AMD64_YMM15H_REGNUM = AMD64_YMM0H_REGNUM + 15,
|
||
AMD64_BND0R_REGNUM = AMD64_YMM15H_REGNUM + 1,
|
||
AMD64_BND3R_REGNUM = AMD64_BND0R_REGNUM + 3,
|
||
AMD64_BNDCFGU_REGNUM,
|
||
AMD64_BNDSTATUS_REGNUM,
|
||
AMD64_XMM16_REGNUM,
|
||
AMD64_XMM31_REGNUM = AMD64_XMM16_REGNUM + 15,
|
||
AMD64_YMM16H_REGNUM,
|
||
AMD64_YMM31H_REGNUM = AMD64_YMM16H_REGNUM + 15,
|
||
AMD64_K0_REGNUM,
|
||
AMD64_K7_REGNUM = AMD64_K0_REGNUM + 7,
|
||
AMD64_ZMM0H_REGNUM,
|
||
AMD64_ZMM31H_REGNUM = AMD64_ZMM0H_REGNUM + 31
|
||
};
|
||
|
||
/* Number of general purpose registers. */
|
||
#define AMD64_NUM_GREGS 24
|
||
|
||
#define AMD64_NUM_REGS (AMD64_ZMM31H_REGNUM + 1)
|
||
|
||
extern struct displaced_step_closure *amd64_displaced_step_copy_insn
|
||
(struct gdbarch *gdbarch, CORE_ADDR from, CORE_ADDR to,
|
||
struct regcache *regs);
|
||
extern void amd64_displaced_step_fixup (struct gdbarch *gdbarch,
|
||
struct displaced_step_closure *closure,
|
||
CORE_ADDR from, CORE_ADDR to,
|
||
struct regcache *regs);
|
||
|
||
extern void amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch);
|
||
extern void amd64_x32_init_abi (struct gdbarch_info info,
|
||
struct gdbarch *gdbarch);
|
||
|
||
/* Fill register REGNUM in REGCACHE with the appropriate
|
||
floating-point or SSE register value from *FXSAVE. If REGNUM is
|
||
-1, do this for all registers. This function masks off any of the
|
||
reserved bits in *FXSAVE. */
|
||
|
||
extern void amd64_supply_fxsave (struct regcache *regcache, int regnum,
|
||
const void *fxsave);
|
||
|
||
/* Similar to amd64_supply_fxsave, but use XSAVE extended state. */
|
||
extern void amd64_supply_xsave (struct regcache *regcache, int regnum,
|
||
const void *xsave);
|
||
|
||
/* Fill register REGNUM (if it is a floating-point or SSE register) in
|
||
*FXSAVE with the value from REGCACHE. If REGNUM is -1, do this for
|
||
all registers. This function doesn't touch any of the reserved
|
||
bits in *FXSAVE. */
|
||
|
||
extern void amd64_collect_fxsave (const struct regcache *regcache, int regnum,
|
||
void *fxsave);
|
||
/* Similar to amd64_collect_fxsave, but use XSAVE extended state. */
|
||
extern void amd64_collect_xsave (const struct regcache *regcache,
|
||
int regnum, void *xsave, int gcore);
|
||
|
||
/* Floating-point register set. */
|
||
extern const struct regset amd64_fpregset;
|
||
|
||
/* Variables exported from amd64-linux-tdep.c. */
|
||
extern int amd64_linux_gregset_reg_offset[];
|
||
|
||
/* Variables exported from amd64nbsd-tdep.c. */
|
||
extern int amd64nbsd_r_reg_offset[];
|
||
|
||
/* Variables exported from amd64obsd-tdep.c. */
|
||
extern int amd64obsd_r_reg_offset[];
|
||
|
||
/* Variables exported from amd64fbsd-tdep.c. */
|
||
extern CORE_ADDR amd64fbsd_sigtramp_start_addr;
|
||
extern CORE_ADDR amd64fbsd_sigtramp_end_addr;
|
||
extern int amd64fbsd_sc_reg_offset[];
|
||
|
||
#endif /* amd64-tdep.h */
|