binutils-gdb/gdb/amd64-linux-tdep.c

226 lines
6.4 KiB
C
Raw Normal View History

/* Target-dependent code for GNU/Linux x86-64.
2002-02-24 23:14:33 +01:00
Copyright 2001, 2003, 2004 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 2 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "defs.h"
#include "frame.h"
#include "gdbcore.h"
#include "regcache.h"
#include "osabi.h"
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
#include "gdb_string.h"
* amd64-tdep.h: Renamed from x86-64-tdep.h. * amd64-tdep.c: Renamed from x86-64-tdep.c. Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64-nat.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64-linux-tdep.h: Renamed from x86-64-linux.h. * amd64-linux-tdep.c: Renamed from x86-64-linux-tdep.c. Include "amd64-tdep.h" and "amd64-linux-tdep.h" instead of "x86-64-tdep.h" and "x86-64-tdep.c". * amd64-linux-nat.c: Renamed from x86-64-linux-nat.c. Include "amd64-tdep.h" and "amd64-linux-tdep.h" instead of "x86-64-tdep.h" and "x86-64-tdep.c". * amd64bsd-nat.c: Update copyright year. Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64fbsd-tdep.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64fbsd-nat.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64nbsd-tdep.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64nbsd-nat.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64obsd-tdep.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * amd64obsd-nat.c: Include "amd64-tdep.h" instead of "x86-64-tdep.h". * configure.host: (x86_64-*-linux*): Set gdb_target to linux64. * configure.tgt (x86_64-*-linux*): Set gdb_target to linux64. * Makefile.in (amd64_linux_tdep_h): Renamed from x86_64_linux_tdep_h. (amd64_tdep_h): Renamed from x86_64_tdep_h. (amd64bsd-nat.o, amd64fbsd-nat.o, amd64fbsd-tdep.o, amd64-nat.o) (amd64nbsd-nat.o, amd64nbsd-tdep.o, amd64obsd-nat.o) (amd64obsd-tdep.o): Update dependencies. (amd64-tdep.o, amd64-linux-nat.o, amd64-linux-tdep.o): New dependencies. (x86-64-linux-nat.o, x86-64-linux-tdep.o, x86-64-tdep.o): Remove dependencies. (ALLDEPFILES): Add amd64-tdep.c, amd64obsd-nat.c, amd64obsd-nat.c, amd64-linux-nat.c amd64-linux-tdep.c. * config/i386/tm-linux64.h: Renamed from tm-x86-64linux.h * config/i386/nm-linux64.h: Renamed from nm-x86-64linux.h. * config/i386/linux64.mt: Renamed from x86-64linux.mt. (TDEPFILES): Replace x86-64-tdep.o and x86-64-linux-tdep.o with amd64-tdep.o and amd64-linux-tdep.o. (TM_FILE): Set to tm-linux64.h. * config/i386/linux64.mh: Renamed from x86-64linux.mh. (NAT_FILE): Set to nm-linux64.h. (NATDEPFILES): Replace x86-64-linux-nat.o with amd64-linux-nat.o. * config/i386/fbsd64.mt (TDEPFILES): Replace x86-64-tdep.o with amd64-tdep.o. * config/i386/nbsd64.mt (TDEPFILES): Replace x86-64-tdep.o with amd64-tdep.o. * config/i386/obsd64.mt (TDEPFILES): Replace x86-64-tdep.o with amd64-tdep.o.
2004-02-25 21:45:31 +01:00
#include "amd64-tdep.h"
#include "solib-svr4.h"
/* Mapping between the general-purpose registers in `struct user'
format and GDB's register cache layout. */
/* From <sys/reg.h>. */
static int amd64_linux_gregset_reg_offset[] =
{
10 * 8, /* %rax */
5 * 8, /* %rbx */
11 * 8, /* %rcx */
12 * 8, /* %rdx */
13 * 8, /* %rsi */
14 * 8, /* %rdi */
4 * 8, /* %rbp */
19 * 8, /* %rsp */
9 * 8, /* %r8 ... */
8 * 8,
7 * 8,
6 * 8,
3 * 8,
2 * 8,
1 * 8,
0 * 8, /* ... %r15 */
16 * 8, /* %rip */
18 * 8, /* %eflags */
17 * 8, /* %cs */
20 * 8, /* %ss */
23 * 8, /* %ds */
24 * 8, /* %es */
25 * 8, /* %fs */
26 * 8 /* %gs */
};
/* Support for signal handlers. */
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
#define LINUX_SIGTRAMP_INSN0 0x48 /* mov $NNNNNNNN, %rax */
#define LINUX_SIGTRAMP_OFFSET0 0
#define LINUX_SIGTRAMP_INSN1 0x0f /* syscall */
#define LINUX_SIGTRAMP_OFFSET1 7
static const unsigned char linux_sigtramp_code[] =
{
/* mov $__NR_rt_sigreturn, %rax */
LINUX_SIGTRAMP_INSN0, 0xc7, 0xc0, 0x0f, 0x00, 0x00, 0x00,
/* syscall */
LINUX_SIGTRAMP_INSN1, 0x05
};
#define LINUX_SIGTRAMP_LEN (sizeof linux_sigtramp_code)
/* If PC is in a sigtramp routine, return the address of the start of
the routine. Otherwise, return 0. */
static CORE_ADDR
amd64_linux_sigtramp_start (CORE_ADDR pc)
{
unsigned char buf[LINUX_SIGTRAMP_LEN];
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
/* We only recognize a signal trampoline if PC is at the start of
one of the two instructions. We optimize for finding the PC at
the start, as will be the case when the trampoline is not the
first frame on the stack. We assume that in the case where the
PC is not at the start of the instruction sequence, there will be
a few trailing readable bytes on the stack. */
if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0)
return 0;
if (buf[0] != LINUX_SIGTRAMP_INSN0)
{
if (buf[0] != LINUX_SIGTRAMP_INSN1)
return 0;
pc -= LINUX_SIGTRAMP_OFFSET1;
if (read_memory_nobpt (pc, (char *) buf, LINUX_SIGTRAMP_LEN) != 0)
return 0;
}
if (memcmp (buf, linux_sigtramp_code, LINUX_SIGTRAMP_LEN) != 0)
return 0;
return pc;
}
/* Return whether PC is in a GNU/Linux sigtramp routine. */
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
static int
amd64_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
{
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
/* If we have NAME, we can optimize the search. The trampoline is
named __restore_rt. However, it isn't dynamically exported from
the shared C library, so the trampoline may appear to be part of
the preceding function. This should always be sigaction,
__sigaction, or __libc_sigaction (all aliases to the same
function). */
if (name == NULL || strstr (name, "sigaction") != NULL)
return (amd64_linux_sigtramp_start (pc) != 0);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
return (strcmp ("__restore_rt", name) == 0);
}
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
#define AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 40
2002-10-24 03:37:40 +02:00
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
routine, return the address of the associated sigcontext structure. */
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
static CORE_ADDR
amd64_linux_sigcontext_addr (struct frame_info *next_frame)
{
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
CORE_ADDR sp;
char buf[8];
frame_unwind_register (next_frame, SP_REGNUM, buf);
sp = extract_unsigned_integer (buf, 8);
/* The sigcontext structure is part of the user context. A pointer
to the user context is passed as the third argument to the signal
handler, i.e. in %rdx. Unfortunately %rdx isn't preserved across
function calls so we can't use it. Fortunately the user context
is part of the signal frame and the unwound %rsp directly points
at it. */
return sp + AMD64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
}
/* From <asm/sigcontext.h>. */
static int amd64_linux_sc_reg_offset[] =
{
13 * 8, /* %rax */
11 * 8, /* %rbx */
14 * 8, /* %rcx */
12 * 8, /* %rdx */
9 * 8, /* %rsi */
8 * 8, /* %rdi */
10 * 8, /* %rbp */
15 * 8, /* %rsp */
0 * 8, /* %r8 */
1 * 8, /* %r9 */
2 * 8, /* %r10 */
3 * 8, /* %r11 */
4 * 8, /* %r12 */
5 * 8, /* %r13 */
6 * 8, /* %r14 */
7 * 8, /* %r15 */
16 * 8, /* %rip */
17 * 8, /* %eflags */
/* FIXME: kettenis/2002030531: The registers %cs, %fs and %gs are
available in `struct sigcontext'. However, they only occupy two
bytes instead of four, which makes using them here rather
difficult. Leave them out for now. */
-1, /* %cs */
-1, /* %ss */
-1, /* %ds */
-1, /* %es */
-1, /* %fs */
-1 /* %gs */
};
static void
amd64_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
tdep->gregset_reg_offset = amd64_linux_gregset_reg_offset;
tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset);
tdep->sizeof_gregset = 27 * 8;
* x86-64-tdep.h: Tewak comment. (enum amd64_regnum): New. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM) (X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM) (X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM) (X86_64_XMM1_REGNUM): Removed. (AMD64_NUM_GREGS): Renamed from X86_64_NUM_GREGS. (amd64_init_abi, amd64_supply_fxsave, amd64_fill_fxsave): Adjust prototypes for renamed functions. * x86-64-tdep.c: Fix typo. (amd64_dwarf_regmap): Use constants from `enum amd64_regnum' for register numbers. (amd64_return_value, amd64_push_arguments, amd64_push_dummy_call): Use constants from `enum amd64_regnum' for register numbers. (AMD64_NUM_SAVED_REGS): Adjust for renamed macros. (amd64_analyze_prologue, amd64_frame_cache, amd64_sigtramp_frame_cache): Use constants from `enum amd64_regnum' for register numbers. (amd64_supply_fpregset): Adjust for renamed functions. (amd64_init_abi): Rename from x86_64_init_abi. Use constants from `enum amd64_regnum' for register numbers. (I387_ST0_REGNUM): Use constant from `enum amd64_regnum'. (amd64_supply_fxsave): Rename from x86_64_supply_fxsave. (amd64_fill_fxsave): Rename fro x86_64_fill_fxsave. * x86-64-linux-tdep.c (amd64_linux_supply_gregset) (amd64_linux_fill_gregset): Adjust for renamed macros. (fetch_core_registers): Adjust for renamed functions. (amd64_linux_init_abi): Adjust for renamed functions. * x86-64-linux-nat.c (supply_gregset, fill_gregset): Adjust for renamed functions. * amd64-nat.c: Adjust for renamed macros. * amd64bsd-nat.c (fetch_inferior_registers) (store_inferior_registers): Use constants from `enum amd64_regnum' for register numbers. Adjust for renamed variables. * amd64fbsd-nat.c (supply_gregset, fill_gregset): Adjust for renamed variables. (_initialize_amd64fbsd_nat): Use constants from `enum amd64_regnum' for register numbers. * amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use constants from `enum amd64_regnum' for register numbers. (amd64fbsd_init_abi): Adjust for renamed functions. * amd64nbsd-tdep.c (amd64nbsd_sigcontext_addr): Use constants from `enum amd64_regnum' for register numbers. (amd64nbsd_init_abi): Adjust for renamed functions. (_initialize_amd64nbsd_ndep): Adjust for renamed macros. * amd64obsd-tdep.c (amd64obsd_sigcontext_addr): Use constants from `enum amd64_regnum' for register numbers. (amd64obsd_init_abi): Adjust for renamed functions. (_initialize_amd64obsd_ndep): Adjust for renamed macros.
2004-02-23 22:37:52 +01:00
amd64_init_abi (info, gdbarch);
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
2004-03-23 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (PC_IN_SIGTRAMP): Change to a function with predicate, deprecate. * gdbarch.h, gdbarch.c: Re-generate. * alpha-linux-tdep.c (alpha_linux_init_abi): Update. * alpha-osf1-tdep.c (alpha_osf1_init_abi): Update. * alpha-tdep.c (alpha_sigtramp_frame_sniffer): Update. * alphafbsd-tdep.c (alphafbsd_init_abi): Update. * alphanbsd-tdep.c (alphanbsd_init_abi): Update. * amd64-linux-tdep.c (amd64_linux_init_abi): Update. * amd64-tdep.c (amd64_sigtramp_frame_sniffer): Update. * amd64nbsd-tdep.c (amd64nbsd_init_abi): Update. * amd64obsd-tdep.c (amd64obsd_init_abi): Update. * arm-tdep.c (arm_sigtramp_unwind_sniffer): Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (bpstat_what): Update. * frame.c (frame_type_from_pc, legacy_get_prev_frame): Update. * frv-linux-tdep.c (frv_linux_init_abi): Update. * frv-tdep.c (frv_sigtramp_frame_sniffer): Update. * hppa-hpux-tdep.c (hppa_hpux_init_abi): Update. * i386-interix-tdep.c (i386_interix_init_abi): Update. * i386-linux-tdep.c (i386_linux_init_abi): Update. * i386-nto-tdep.c (i386nto_init_abi): Update. * i386-sol2-tdep.c (i386_sol2_init_abi): Update. * i386-tdep.c (i386_sigtramp_frame_sniffer) (i386_svr4_init_abi, i386_go32_init_abi, i386_gdbarch_init): Update. * i386bsd-tdep.c (i386bsd_init_abi): Update. * i386nbsd-tdep.c (i386nbsd_init_abi): Update. * i386obsd-tdep.c (i386obsd_init_abi): Update. * ia64-tdep.c (ia64_sigtramp_frame_sniffer): Update. * infrun.c (pc_in_sigtramp): Update. * m68k-tdep.c (m68k_sigtramp_frame_sniffer): Update. * m68klinux-tdep.c (m68k_linux_init_abi): Update. * mips-tdep.c (mips_gdbarch_init): Update. * mipsnbsd-tdep.c (mipsnbsd_init_abi): Update. * ppc-linux-tdep.c: Update comment. * ppcnbsd-tdep.c (ppcnbsd_init_abi): Update. * shnbsd-tdep.c (shnbsd_init_abi): Update. * sparc-linux-tdep.c (sparc32_linux_init_abi): Update. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Update. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Update. * sparc64fbsd-tdep.c (sparc64fbsd_init_abi): Update. * sparc64nbsd-tdep.c (sparc64nbsd_init_abi): Update. * sparc64obsd-tdep.c (sparc64obsd_init_abi): Update. * sparcnbsd-tdep.c (sparc32nbsd_init_abi): Update. * sparcobsd-tdep.c (sparc32obsd_init_abi): Update. Index: doc/ChangeLog 2004-03-23 Andrew Cagney <cagney@redhat.com> * gdbint.texinfo (Target Architecture Definition): Deprecate references to PC_IN_SIGTRAMP.
2004-03-23 15:48:00 +01:00
set_gdbarch_deprecated_pc_in_sigtramp (gdbarch, amd64_linux_pc_in_sigtramp);
tdep->sigcontext_addr = amd64_linux_sigcontext_addr;
tdep->sc_reg_offset = amd64_linux_sc_reg_offset;
tdep->sc_num_regs = ARRAY_SIZE (amd64_linux_sc_reg_offset);
/* GNU/Linux uses SVR4-style shared libraries. */
set_solib_svr4_fetch_link_map_offsets
(gdbarch, svr4_lp64_fetch_link_map_offsets);
}
* x86-64-tdep.h (x86_64_num_regs, x86_64_num_gregs): Remove variable declarations. (x86_64_register_number, x86_64_register_name): Remove prototypes. (x86_64_linux_frame_saved_pc, x86_64_linux+saved_pc_after_call, x86_64_linux_in_sigtramp, x86_64_linux_frame_chain, x86_64_init_frame_pc, x86_64_init_frame_pc, x86_64_function_has_prologue): Remove prototypes. (X86_64_NUM_GREGS): New define. (x86_64_supply_fxsave, x86_64_fill_fxsave): New prototypes. * x86-64-tdep.c: Don't include "dwarf2cfi.h". Include "dummy_frame.h", "frame.h", "frame-base.h", "frame-unwind.h". (RAX_REGNUM, RDX_REGNUM, RDI_REGNUM, EFLAGS_REGNUM, ST0_REGNUM, XMM1_REGNUM): Remove defines. (X86_64_RAX_REGNUM, X86_64_RDX_REGNUM, X86_64_RDI_REGNUM, X86_64_RBP_REGNUM, X86_64_RSP_REGNUM, X86_64_RIP_REGNUM, X86_64_EFLAGS_REGNUM, X86_64_ST0_REGNUM, X86_64_XMM0_REGNUM, X86_64_XMM1_REGNUM): New defines. (struct x86_64_register_info): Renamed from `struct register_info'. Remove `size' member. (x86_64_register_info_table): Remove variable. (x86_64_register_info): New variable. (X86_64_NUM_REGS): New define. (X86_64_NUM_GREGS): Remove define. (x86_64_num_regs, x86_64_num_gregs): Remove variables. (x86_64_dwarf2gdb_regno_map, x86_64_dwarf2gdb_regno_map_length): Remove variables. (x86_54_dwarf2_reg_to_regnum): Remove function. (x86_64_dwarf_regmap, x86_64_dwarf_regmap_len): New variables. (x86_64_dwarf_reg_to_regnum): New function. (x86_64_register_name): Rewrite. (x86_64_register_raw_size): Remove function. (x86_64_register_byte_table): Remove variable. (x86_64_register_byte): Remove function. (x86_64_register_virtual_type): Remove function. (x86_64_register_type): New function. (x86_64_register_convertible, x86_64_register_convert_to_virtual, x86_64_register_convert_to_raw): Remove functions. (x86_64_push_return_address, x86_64_pop_frame): Remove functon. (x86_64_use_struct_convention): Make static. Adjust for renamed defines. (x86_64_frame_init_saved_regs): Remove function. (x86_64_push_arguments): Make static. Change to accept a regcache as argument. (x86_64_store_return_value, x86_64_extract_return_value): Make static. Rewrite based on i386 counterparts. (x86_64_push_dummy_call): New function. (X86_64_NUM_SAVED_REGS): New define. (x86_64_register_number): Remove function. (x86_64_store_struct_return): Remove function. (x86_64_frameless_function_invocation, x86_64_function_has_prologue): Remove functions. (PROLOG_BUFSIZE): Remove define. (struct x86_64_frame_cache): New structure. (x86_64_alloc_frame_cache, x86_64_analyze_prologue, x86_64_frame_cache, x86_64_frame_this_id, x86_64_frame_prev_register, x86_64_frame_p, x86_64_sigtramp_frame_cache, x86_64_sigtramp_frame_this_id, x86_64_sigtramp_frame_prev_register, x86_sigtramp_frame_p): New functions. (x86_64_frame_unwind, x86_64_sigtramp_frame_unwind): New variables. (x86_64_skip_prologue): Rewrite in terms of x86_64_analyze_prologue. (x86_64_frame_base_address): New function. (x86_64_frame_base): New variable. (x86_64_save_dummy_frame_tos, x86_64_unwind_dummy_id): Rewrite. (x86_64_init_abi): Set register_type and push_dummy_call. Don't set deprecated_fp_regnum, deprecated_register_size, deprecated_register_bytes, register_raw_size, register_byte, register_virtual_type, register_convertiable, register_convert_to_virtual, convert_to_raw, deprecated_get_saved_register, deprecated_target_read_fp, deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame, deprecated_store_struct_return, deprecated_frame_init_saved_regs, deprecated_frame_chain, frameless_function_invocation, deprecated_frame_saved_pc, deprecated_saved_pc_after_call, frame_num_args, pc_in_sigtramp, dwarf2_build_frame_info, deprecated_init_extra_frame_info, deprecated_init_frame_pc and virtual_frame_pointer. Call frame_unwind_append_predicate to register x86_64_sigtramp_frame_p and x86_64_frame_p. Call frame_base_set_default to register x86_64_frame_base. (I387_FISEG_REGNUM, I387_FOSEG_REGNUM): New defines. (x86_64_supply_fxsave, x86_64_fill_fxsave): New functions. (_initialize_x86_64_tdep): Remove function. * x86-64-linux-tdep.c: Don't include "dwarf2cfi.h". (LINUX_SIGINFO_SIZE, LINUX_UCONTEXT_SIGCONTEXT_OFFSET, LINUX_SIGCONTEXT_PC_OFFSET, LINUX_SIGCONTEXT_FP_OFFSET): Don't define. (X86_64_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Define. (x86_64_linux_sigcontext_addr): Rewrite. (x86_64_linux_sigtramp_saved_pc, x86_64_linux_saved_pc_after_call, x86_64_linux_frame_saved_pc): Remove functions. (x86_64_linux_pc_in_sigtramp): Renamed from x86_64_linux_in_sigtramp. Try harder to recognize a signal trampoline. (x86_64_linux_frame_chain, x86_64_init_frame_pc): Remove_functions. (x86_64_linux_init_abi): Set pc_in_sigtramp. Initialize TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. * x86-64-linux-nat.c: Sync with i386-linux-tdep.c. (x86_64_regmap): Rename to regmap. (GETREGS_SUPPLIES): Use X86_64_NUM_GREGS instead of x86_64_num_gregs. (supply_gregset, fill_gregset): Likewise. Use regmap instead of x86_64_regmap. (x86_64_fxsave_offset): Remove function. (supply_fpregset): Simply call x86_64_supply_fxsave. (fill_fpregset): Simply call x86_64_fill_fxsave. (fetch_inferior_registers, store_inferior_registers): Avoid asignment in if-statement. (LINUX_SYSCALL_LEN, LINUX_SYSCALL_REGNUM, SYS_Sigreturn, SYS_rt_sigreturn, LINUX_SIGCONTEXT_EFLAGS_OFFSET, LINUX_UCONTEXT_SIGCONTEXT_OFFSET): Remove defines. (fetch_core_registers): Remove function. (linux_elf_core_fns): Remove. (offsetoff): Don't define. (_initialize_x86_64_linux_nat, kernel_u_size): Remove functions. * config/i386/x86-64linux.mt (TDEPFILES): Add i386-linux-tdep.o. * config/i386/x86-64linux.mh (NATDEPFILES): Remove core-aout.o, add core-regset.o. * config/i386/nm-x86-64linux.h: Use NM_X86_64_LINUX_H for protection against multiple includes instead of NM_X86_64_h. Add various comments. Include "config/nm-linux.h". Don't include <signal.h>. (REGISTER_U_ADDR, KERNEL_U_SIZE, U_REGS_OFFSET, KERN_U_ADDR, GET_THREAD_SIGNALS): Remove defines. (x86_64_register_u_addr, kernel_u_size, lin_thread_get_thread_signals): Remove prototypes. (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Define to `long'. [HAVE_LINK_H]: Don't include "solib.h". [HAVE_LINK_H] (SVR4_SHARED_LIBS): Remove define. * config/i386/tm-x86-64linux.h: Fix comments. * Makefile.in (x86-64-linux-nat.o, x86_64-linux-tdep.o, x86-64-tdep.o): Update dependencies.
2003-05-31 10:15:38 +02:00
/* Provide a prototype to silence -Wmissing-prototypes. */
extern void _initialize_amd64_linux_tdep (void);
void
_initialize_amd64_linux_tdep (void)
{
gdbarch_register_osabi (bfd_arch_i386, bfd_mach_x86_64,
GDB_OSABI_LINUX, amd64_linux_init_abi);
}