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

508 lines
16 KiB
C
Raw Normal View History

2002-02-24 23:31:19 +01:00
/* Target-dependent code for GNU/Linux running on i386's, for GDB.
Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
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 "gdbcore.h"
#include "frame.h"
#include "value.h"
#include "regcache.h"
#include "inferior.h"
#include "reggroups.h"
/* For i386_linux_skip_solib_resolver. */
#include "symtab.h"
#include "symfile.h"
#include "objfiles.h"
#include "solib-svr4.h" /* For struct link_map_offsets. */
#include "osabi.h"
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
#include "i386-tdep.h"
#include "i386-linux-tdep.h"
/* Return the name of register REG. */
static const char *
i386_linux_register_name (int reg)
{
/* Deal with the extra "orig_eax" pseudo register. */
if (reg == I386_LINUX_ORIG_EAX_REGNUM)
return "orig_eax";
return i386_register_name (reg);
}
/* Return non-zero, when the register is in the corresponding register
group. Put the LINUX_ORIG_EAX register in the system group. */
static int
i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
struct reggroup *group)
{
if (regnum == I386_LINUX_ORIG_EAX_REGNUM)
return (group == system_reggroup
|| group == save_reggroup
|| group == restore_reggroup);
return i386_register_reggroup_p (gdbarch, regnum, group);
}
/* Recognizing signal handler frames. */
2002-02-24 23:31:19 +01:00
/* GNU/Linux has two flavors of signals. Normal signal handlers, and
"realtime" (RT) signals. The RT signals can provide additional
information to the signal handler if the SA_SIGINFO flag is set
when establishing a signal handler using `sigaction'. It is not
2002-02-24 23:31:19 +01:00
unlikely that future versions of GNU/Linux will support SA_SIGINFO
for normal signals too. */
/* When the i386 Linux kernel calls a signal handler and the
SA_RESTORER flag isn't set, the return address points to a bit of
code on the stack. This function returns whether the PC appears to
be within this bit of code.
The instruction sequence for normal signals is
pop %eax
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
mov $0x77, %eax
int $0x80
or 0x58 0xb8 0x77 0x00 0x00 0x00 0xcd 0x80.
Checking for the code sequence should be somewhat reliable, because
the effect is to call the system call sigreturn. This is unlikely
to occur anywhere other than a signal trampoline.
It kind of sucks that we have to read memory from the process in
order to identify a signal trampoline, but there doesn't seem to be
any other way. The PC_IN_SIGTRAMP macro in tm-linux.h arranges to
only call us if no function name could be identified, which should
be the case since the code is on the stack.
Detection of signal trampolines for handlers that set the
SA_RESTORER flag is in general not possible. Unfortunately this is
what the GNU C Library has been doing for quite some time now.
However, as of version 2.1.2, the GNU C Library uses signal
trampolines (named __restore and __restore_rt) that are identical
to the ones used by the kernel. Therefore, these trampolines are
supported too. */
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
#define LINUX_SIGTRAMP_INSN0 0x58 /* pop %eax */
#define LINUX_SIGTRAMP_OFFSET0 0
#define LINUX_SIGTRAMP_INSN1 0xb8 /* mov $NNNN, %eax */
#define LINUX_SIGTRAMP_OFFSET1 1
#define LINUX_SIGTRAMP_INSN2 0xcd /* int */
#define LINUX_SIGTRAMP_OFFSET2 6
static const unsigned char linux_sigtramp_code[] =
{
LINUX_SIGTRAMP_INSN0, /* pop %eax */
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77, %eax */
LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */
};
#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
i386_linux_sigtramp_start (CORE_ADDR pc)
{
unsigned char buf[LINUX_SIGTRAMP_LEN];
/* We only recognize a signal trampoline if PC is at the start of
one of the three 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)
{
int adjust;
switch (buf[0])
{
case LINUX_SIGTRAMP_INSN1:
adjust = LINUX_SIGTRAMP_OFFSET1;
break;
case LINUX_SIGTRAMP_INSN2:
adjust = LINUX_SIGTRAMP_OFFSET2;
break;
default:
return 0;
}
pc -= adjust;
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;
}
/* This function does the same for RT signals. Here the instruction
sequence is
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
mov $0xad, %eax
int $0x80
or 0xb8 0xad 0x00 0x00 0x00 0xcd 0x80.
The effect is to call the system call rt_sigreturn. */
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
#define LINUX_RT_SIGTRAMP_INSN0 0xb8 /* mov $NNNN, %eax */
#define LINUX_RT_SIGTRAMP_OFFSET0 0
#define LINUX_RT_SIGTRAMP_INSN1 0xcd /* int */
#define LINUX_RT_SIGTRAMP_OFFSET1 5
static const unsigned char linux_rt_sigtramp_code[] =
{
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad, %eax */
LINUX_RT_SIGTRAMP_INSN1, 0x80 /* int $0x80 */
};
#define LINUX_RT_SIGTRAMP_LEN (sizeof linux_rt_sigtramp_code)
/* If PC is in a RT sigtramp routine, return the address of the start
of the routine. Otherwise, return 0. */
static CORE_ADDR
i386_linux_rt_sigtramp_start (CORE_ADDR pc)
{
unsigned char buf[LINUX_RT_SIGTRAMP_LEN];
/* 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_RT_SIGTRAMP_LEN) != 0)
return 0;
if (buf[0] != LINUX_RT_SIGTRAMP_INSN0)
{
if (buf[0] != LINUX_RT_SIGTRAMP_INSN1)
return 0;
pc -= LINUX_RT_SIGTRAMP_OFFSET1;
if (read_memory_nobpt (pc, (char *) buf, LINUX_RT_SIGTRAMP_LEN) != 0)
return 0;
}
if (memcmp (buf, linux_rt_sigtramp_code, LINUX_RT_SIGTRAMP_LEN) != 0)
return 0;
return pc;
}
2002-02-24 23:31:19 +01:00
/* Return whether PC is in a GNU/Linux sigtramp routine. */
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
static int
i386_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
{
/* If we have NAME, we can optimize the search. The trampolines are
named __restore and __restore_rt. However, they aren'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 (i386_linux_sigtramp_start (pc) != 0
|| i386_linux_rt_sigtramp_start (pc) != 0);
return (strcmp ("__restore", name) == 0
|| strcmp ("__restore_rt", name) == 0);
}
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
/* Offset to struct sigcontext in ucontext, from <asm/ucontext.h>. */
#define I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET 20
/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
routine, return the address of the associated sigcontext structure. */
static CORE_ADDR
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
i386_linux_sigcontext_addr (struct frame_info *next_frame)
{
CORE_ADDR pc;
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
CORE_ADDR sp;
char buf[4];
frame_unwind_register (next_frame, I386_ESP_REGNUM, buf);
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
sp = extract_unsigned_integer (buf, 4);
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
pc = i386_linux_sigtramp_start (frame_pc_unwind (next_frame));
if (pc)
{
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
/* The sigcontext structure lives on the stack, right after
the signum argument. We determine the address of the
sigcontext structure by looking at the frame's stack
pointer. Keep in mind that the first instruction of the
sigtramp code is "pop %eax". If the PC is after this
instruction, adjust the returned value accordingly. */
if (pc == frame_pc_unwind (next_frame))
return sp + 4;
return sp;
}
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
pc = i386_linux_rt_sigtramp_start (frame_pc_unwind (next_frame));
if (pc)
{
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
CORE_ADDR ucontext_addr;
/* 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. */
read_memory (sp + 8, buf, 4);
ucontext_addr = extract_unsigned_integer (buf, 4) + 20;
return ucontext_addr + I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET;
}
error ("Couldn't recognize signal trampoline.");
return 0;
}
/* Set the program counter for process PTID to PC. */
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
static void
i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
{
write_register_pid (I386_EIP_REGNUM, pc, ptid);
/* We must be careful with modifying the program counter. If we
just interrupted a system call, the kernel might try to restart
it when we resume the inferior. On restarting the system call,
the kernel will try backing up the program counter even though it
no longer points at the system call. This typically results in a
SIGSEGV or SIGILL. We can prevent this by writing `-1' in the
"orig_eax" pseudo-register.
Note that "orig_eax" is saved when setting up a dummy call frame.
This means that it is properly restored when that frame is
popped, and that the interrupted system call will be restarted
when we resume the inferior on return from a function call from
within GDB. In all other cases the system call will not be
restarted. */
write_register_pid (I386_LINUX_ORIG_EAX_REGNUM, -1, ptid);
}
/* Calling functions in shared libraries. */
/* Find the minimal symbol named NAME, and return both the minsym
struct and its objfile. This probably ought to be in minsym.c, but
everything there is trying to deal with things like C++ and
SOFUN_ADDRESS_MAYBE_TURQUOISE, ... Since this is so simple, it may
be considered too special-purpose for general consumption. */
static struct minimal_symbol *
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
find_minsym_and_objfile (char *name, struct objfile **objfilep)
{
struct objfile *objfile;
ALL_OBJFILES (objfile)
{
struct minimal_symbol *msym;
ALL_OBJFILE_MSYMBOLS (objfile, msym)
{
if (SYMBOL_LINKAGE_NAME (msym)
&& strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0)
{
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
*objfilep = objfile;
return msym;
}
}
}
return 0;
}
static CORE_ADDR
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
skip_gnu_resolver (CORE_ADDR pc)
{
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
/* The GNU dynamic linker is part of the GNU C library, so many
GNU/Linux distributions use it. (All ELF versions, as far as I
know.) An unresolved PLT entry points to "_dl_runtime_resolve",
which calls "fixup" to patch the PLT, and then passes control to
the function.
We look for the symbol `_dl_runtime_resolve', and find `fixup' in
the same objfile. If we are at the entry point of `fixup', then
we set a breakpoint at the return address (at the top of the
stack), and continue.
It's kind of gross to do all these checks every time we're
called, since they don't change once the executable has gotten
started. But this is only a temporary hack --- upcoming versions
2002-02-24 23:31:19 +01:00
of GNU/Linux will provide a portable, efficient interface for
debugging programs that use shared libraries. */
struct objfile *objfile;
struct minimal_symbol *resolver
= find_minsym_and_objfile ("_dl_runtime_resolve", &objfile);
if (resolver)
{
struct minimal_symbol *fixup
= lookup_minimal_symbol ("fixup", NULL, objfile);
if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc)
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
return frame_pc_unwind (get_current_frame ());
}
return 0;
}
/* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c.
This function:
1) decides whether a PLT has sent us into the linker to resolve
a function reference, and
2) if so, tells us where to set a temporary breakpoint that will
trigger when the dynamic linker is done. */
CORE_ADDR
i386_linux_skip_solib_resolver (CORE_ADDR pc)
{
CORE_ADDR result;
/* Plug in functions for other kinds of resolvers here. */
* i386-tdep.h (i386bsd_sigcontext_addr): Remove prototype. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS): Remove defenitions. (IS_FP_REGNUM, IS_SSE_REGNUM): Remove definitions. * i386-tdep.c: Mark functions that are 64-bit safe as such. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): New defines. (CODESTREAM_BUFSIZ, codestream_tell, codestream_peek, codestream_get): Remove define. (codestream_next_addr, condestream_addr, condestream_buf, codestream_off, codestream_cnt): Remove variables. (codestream_fill, codestream_seek, codestream_read): Remove functions. (i386_follow_jump): Rewrite to avoid usage of removed codestream functionality. (i386_get_frame_setup, i386_frameless_signal_p, i386_frame_chain, i386_sigtramp_saved_pc, i386_sigtramp_saved_sp, i386_frame_saved_pc, i386_saved_pc_after_call, i386_frame_num_args, i386_frame_init_saved_regs, i386_push_return_address, i386_do_pop_frame, i386_pop_frame, i386_push_arguments): Remove functions. (i386_skip_prologue): Rewrite to avoid usage of removed codestream functionality. Use i386_analyze_prologue instead of i386_get_frame_setup. (I386_NUM_SAVED_REGS): New define. (struct i386_frame_cache): New structure. (i386_alloc_frame_cache, i386_analyze_struct_return, i386_skip_probe, i386_analyze_frame_setup, i386_analyze_register_saves, i386_analyze_prologue, i386_unwind_pc, i386_frame_cache, i386_frame_this_id, i386_frame_prev_register, i386_sigtramp_frame_cache, i386_sigtramp_frame_this_id, i386_sigtramp_frame_prev_register, i386_frame_p, i386_sigtramp_frame_p, i386_frame_base_address, i386_unwind_dummy_id, i386_save_dummy_tos, i386_push_dummy_call): New functions. (i386_frame_unwind, i386_sigtramp_frame_unwind, i386_frame_base): New variables. (LOW_RETURN_REGNUM, HIGH_RETURN_REGNUM): Define in terms of I386_EAX_REGNUM and I386_EDX_REGNUM. (i386_extract_return_value, i386_store_return_value): Use I386_ST0_REGNUM where appropriate. (i386_extract_struct_value_address): Rewrite to use extract_address. (i386_svr4_pc_in_sigtramp): Add comment. (i386_svr4_sigcontext_addr): Rewrite. (i386_svr4_init_abi): Adjust TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386_gdbarch_init): Don't set deprecated_init_frame_pc. Set sp_regnum, fp_regnum, pc_regnum, ps_regnum and fp0_regnum in terms of new defines. Set push_dummy_call, don't set deprecated_push_arguments, deprecated_push_return_address, deprecated_pop_frame. Don't set parm_boundary. Don't set deprecated_frame_chain, deprecated_frame_saved_pc, deprecated_saved_pc_after_call. Set unwind_dummy_id, save_dummy_frame_tos, unwind_pc. Call frame_unwind_append_predicate and frame_base_set_default. Don't set deprecated_dummy_write_pc. Don't set deprecated_fp_regnum. Don't set frameless_function_invocation. Don't set deprecated_register_bytes, deprecated_register_size, deprecated_call_dummy_words and deprecated_sizeof_call_dummy. * i386-linux-tdep.c: Fix formatting in some comments. (LINUX_SIGTRAMP_INSN0, LINUX_SIGTRAMP_OFFSET0, LINUX_SIGTRAMP_INSN1, LINUX_SIGTRAMP_OFFSET1, LINUX_SIGTRAMP_INSN2, LINUX_SIGTRAMP_OFFSET2, LINUX_RT_SIGTRAMP_INSN0, LINUX_RT_SIGTRAMP_OFFSET0, LINUX_RT_SIGTRAMP_INSN1, LINUX_RT_SIGTRAMP_OFFSET1): Drop redundant parentheses. (I386_LINUX_UCONTEXT_SIGCONTEXT_OFFSET): New define. (i386_linux_sigcontext_addr): Use it. Rewrite. (find_minsym_and_objfile): Change name of second argument. (skip_gnu_resolver): Renamed from skip_hurd_resolver. All callers changed. Use frame_pc_unwind instead of DEPRECATED_SAVED_PC_AFTER_CALL. (i386_linux_init_abi): Don't set deprecated_register_bytes. * i386bsd-tdep.c (i386bsd_sigcontext_addr): Rewrite. * i386-nto-tdep.c (i386nto_sigcontext_addr): Adapt for new frame unwinder. * i386-cygwin-tdep.c: Don't include "gdbcore.h", "frame.h" and "dummy-frame.h". (i386_cygwin_frame_chain_valid, i386_cygwin_frame_chain): Removed. (_initialize_i386_cygwin_tdep): New prototype. (i386_cygwin_init_abi): Don't set deprecated_frame_chain and deprecated_frame_chain_valid. * i386-sol2-tdep.c (i386_sol2_init_abi): Don't set TDEP->sigcontext_addr, TDEP->sc_pc_offset and TDEP->sc_sp_offset. Rely on the SVR4 defaults. * config/i386/i386sol2.mt (TDEPFILES): Remove i386bsd-tdep.o. * Makefile.in (i386-tdep.o, i386-cygwin-tdep.o): Update dependencies.
2003-05-30 21:24:30 +02:00
result = skip_gnu_resolver (pc);
if (result)
return result;
return 0;
}
/* Fetch (and possibly build) an appropriate link_map_offsets
2002-02-24 23:31:19 +01:00
structure for native GNU/Linux x86 targets using the struct offsets
defined in link.h (but without actual reference to that file).
2002-02-24 23:31:19 +01:00
This makes it possible to access GNU/Linux x86 shared libraries
from a GDB that was not built on an GNU/Linux x86 host (for cross
debugging). */
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
static struct link_map_offsets *
i386_linux_svr4_fetch_link_map_offsets (void)
{
static struct link_map_offsets lmo;
static struct link_map_offsets *lmp = NULL;
if (lmp == NULL)
{
lmp = &lmo;
lmo.r_debug_size = 8; /* The actual size is 20 bytes, but
this is all we need. */
lmo.r_map_offset = 4;
lmo.r_map_size = 4;
lmo.link_map_size = 20; /* The actual size is 552 bytes, but
this is all we need. */
lmo.l_addr_offset = 0;
lmo.l_addr_size = 4;
lmo.l_name_offset = 4;
lmo.l_name_size = 4;
lmo.l_next_offset = 12;
lmo.l_next_size = 4;
lmo.l_prev_offset = 16;
lmo.l_prev_size = 4;
}
return lmp;
}
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
From Michal Ludvig <mludvig@suse.cz>: * i386-tdep.h (struct gdbarch_tdep): Add members `sc_reg_offset' and `sc_num_regs'. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): Move here from... * i386-tdep.c: ... here. (I386_NUM_SAVED_REGS): Define to I386_NUM_REGS. (i386_sigtramp_frame_cache): Use `sc_reg_offset' to find saved registers if possible. (i386_gdbarch_init): Initialize TDEP->sc_reg_offset. * i386bsd-tdep.c (i386bsd_sc_pc_offset, i386bsd_sc_sp_offset): Remove variables. (i386bsd_sc_reg_offset): New variable. (i386bsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386fbsd_sc_reg_offset): New variable. (i386fbsdaout_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs. (i386fbsd4_sc_pc_offset, i386fbsd4_sc_sp_offset): Remove variables. (i386fbsd4_sc_reg_offset): New variable. (i3864bsd4_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386-linux-tdep.c (i386_linux_sc_reg_offset): New variable. (i386_linux_init_abi): Set TDEP->sc_reg_offset and TDEP->sc_num_regs. * i386nbsd-tdep.c (i386nbsd_sc_pc_offset, i386nbsd_sc_sp_offset): Remove variables. (i386nbsd_sc_reg_offset): New variable. (i386nbsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386obsd-tdep.c (i386obsd_sc_pc_offset, i386obsd_sc_sp_offset): Remove variables. (i386obsd_sc_reg_offset): New variable. (i386obsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386bsd-nat.c (_initialize_i386bsd_nat): Adjust for changes in i386bsd-tdep.c, i386nbsd-tdep.c and i386obsd-tdep.c. Add check for frame pointer offset in `struct sigcontext'.
2003-05-31 18:08:06 +02:00
/* From <asm/sigcontext.h>. */
static int i386_linux_sc_reg_offset[I386_NUM_GREGS] =
{
11 * 4, /* %eax */
10 * 4, /* %ecx */
9 * 4, /* %edx */
8 * 4, /* %ebx */
7 * 4, /* %esp */
6 * 4, /* %ebp */
5 * 4, /* %esi */
4 * 4, /* %edi */
14 * 4, /* %eip */
16 * 4, /* %eflags */
15 * 4, /* %cs */
18 * 4, /* %ss */
3 * 4, /* %ds */
2 * 4, /* %es */
1 * 4, /* %fs */
0 * 4 /* %gs */
};
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
static void
i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
/* GNU/Linux uses ELF. */
i386_elf_init_abi (info, gdbarch);
/* We support the SSE registers on GNU/Linux. */
tdep->num_xmm_regs = I386_NUM_XREGS - 1;
/* set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS); */
/* Since we have the extra "orig_eax" register on GNU/Linux, we have
to adjust a few things. */
set_gdbarch_write_pc (gdbarch, i386_linux_write_pc);
set_gdbarch_num_regs (gdbarch, I386_SSE_NUM_REGS + 1);
set_gdbarch_register_name (gdbarch, i386_linux_register_name);
set_gdbarch_register_reggroup_p (gdbarch, i386_linux_register_reggroup_p);
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
tdep->sigcontext_addr = i386_linux_sigcontext_addr;
From Michal Ludvig <mludvig@suse.cz>: * i386-tdep.h (struct gdbarch_tdep): Add members `sc_reg_offset' and `sc_num_regs'. (I386_EAX_REGNUM, I386_EDX_REGNUM, I386_ESP_REGNUM, I386_EBP_REGNUM, I386_EIP_REGNUM, I386_EFLAGS_REGNUM, I386_ST0_REGNUM): Move here from... * i386-tdep.c: ... here. (I386_NUM_SAVED_REGS): Define to I386_NUM_REGS. (i386_sigtramp_frame_cache): Use `sc_reg_offset' to find saved registers if possible. (i386_gdbarch_init): Initialize TDEP->sc_reg_offset. * i386bsd-tdep.c (i386bsd_sc_pc_offset, i386bsd_sc_sp_offset): Remove variables. (i386bsd_sc_reg_offset): New variable. (i386bsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. (i386fbsd_sc_reg_offset): New variable. (i386fbsdaout_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs. (i386fbsd4_sc_pc_offset, i386fbsd4_sc_sp_offset): Remove variables. (i386fbsd4_sc_reg_offset): New variable. (i3864bsd4_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386-linux-tdep.c (i386_linux_sc_reg_offset): New variable. (i386_linux_init_abi): Set TDEP->sc_reg_offset and TDEP->sc_num_regs. * i386nbsd-tdep.c (i386nbsd_sc_pc_offset, i386nbsd_sc_sp_offset): Remove variables. (i386nbsd_sc_reg_offset): New variable. (i386nbsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386obsd-tdep.c (i386obsd_sc_pc_offset, i386obsd_sc_sp_offset): Remove variables. (i386obsd_sc_reg_offset): New variable. (i386obsd_init_abi): Initialize TDEP->sc_reg_offset and TDEP->sc_num_regs instead of TDEP->sc_pc_offset and TDEP->sc_sp_offset. * i386bsd-nat.c (_initialize_i386bsd_nat): Adjust for changes in i386bsd-tdep.c, i386nbsd-tdep.c and i386obsd-tdep.c. Add check for frame pointer offset in `struct sigcontext'.
2003-05-31 18:08:06 +02:00
tdep->sc_reg_offset = i386_linux_sc_reg_offset;
tdep->sc_num_regs = I386_NUM_GREGS;
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
/* When the i386 Linux kernel calls a signal handler, the return
address points to a bit of code on the stack. This function is
used to identify this bit of code as a signal trampoline in order
to support backtracing through calls to signal handlers. */
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
set_gdbarch_pc_in_sigtramp (gdbarch, i386_linux_pc_in_sigtramp);
set_solib_svr4_fetch_link_map_offsets (gdbarch,
i386_linux_svr4_fetch_link_map_offsets);
}
/* Provide a prototype to silence -Wmissing-prototypes. */
extern void _initialize_i386_linux_tdep (void);
void
_initialize_i386_linux_tdep (void)
{
* osabi.c: Include "gdb_assert.h" and "gdb_string.h". (struct gdb_osabi_handler): Remove member `arch'. Add member `arch_info'. (gdbarch_register_osabi): Add new argument `machine'. Use ot to construct a `struct bfd_arch_info' and store it in the `struct gdb_osabi_handler' that is created. (gdbarch_init_osabi): Check for compatibility based on machine type and architecture. * osabi.h (gdbarch_register_osabi): Adjust prototype and update comment. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add 0 as second argument in call to gdbarch_register_osabi. * alpha-osf1-tdep.c (_initialize_alpha_osf1_tdep): Likewise. * alphafbsd-tdep.c (_initialize_alphafbsd_tdep): Likewise. * alphanbsd-tdep.c (_initialize_alphanbsd_tdep): Likewise. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Likewise. * arm-tdep.c (_initialize_arm_tdep): Likewise. * armnbsd-tdep.c (_initialize_armnbsd_tdep): Likewise. * hppa-hpux-tdep.c (_initialize_hppa_hpux_tdep): Likewise. * i386-interix-tdep.c (_initialize_i386_interix_tdep): Likewise. * i386-linux-tdep.c (_initialize_i386_linux_tdep): Likewise. * i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Likewise. * i386-tdep.c (_initialize_i386_tdep): Likewise. * i386bsd-tdep.c (_initialize_i386bsd_tdep): Likewise. * i386gnu-tdep.c (_initialize_i386gnu_tdep): Likewise. * i386ly-tdep.c (_initialize_i386lynx_tdep): Renamed from _initialize_i386bsd_tdep and updated likewise. * i386nbsd-tdep.c (_initialize_i386nbsd_tdep): Likewise. * i386obsd-tdep.c (_initialize_i386obsd_tdep): Likewise. * mips-irix-tdep.c (_initialize_mips_irix_tdep): Likewise. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Likewise. * mipsnbsd-tdep.c (_initialize_mipsnbsd__tdep): Likewise. * ns32knbsd-tdep.c (_initialize_ns32kmnsd_tdep): Likewise. * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Likewise. * ppcnbsd-tdep.c (_initialize_ppcnbsd_tdep): Likewise. * shnbsd-tdep.c (_initialize_shnbsd_tdep): Likewise. * sparcnbsd-tdep.c (_initialize_sparcnbsd_tdep): Likewise.
2002-12-21 20:58:07 +01:00
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LINUX,
* config/i386/i386sol2.mt (TDEPFILES): Add i386-sol2-tdep.o and i386bsd-tdep.o. Remove solib.o, solib-svr4.o and solib-legacy.o. Move these to ... * config/i386/i386sol2.mh: ... here. * config/i386/tm-i386sol2.h (STAB_REG_TO_REGNUM): Remove define. (sigtramp_saved_pc, I386V4_SIGTRAMP_SAVED_PC): Don't #undef. (SIGCONTEXT_PC_OFFSET): Remove define. (IN_SIGTRAMP): Remove define. * i386-sol2-tdep.c: New file. * config/i386/i386nw.mt (TM_FILE): Change to tm-i386.h. * config/i386/tm-i386nw.h: Removed. * config/i386/tm-fbsd.h (STAB_REG_TO_REGNUM, USE_STRUCT_CONVENTION): Remove defines. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsd.h (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (IN_SIGTRAMP): Remove define. (i386bsd_in_sigtramp): Remove prototype. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Turn into a function. Update comment accordingly (SIGTRAMP_START, SIGTRAMP): Adjust definition accordingly. (FRAME_SAVED_PC): Remove define. (i386bsd_frame_saved_pc): Remove prototype. * config/i386/tm-nbsdaout.h (i386nbsd_aout_use_struct_convention): Remove prototype. (USE_STRUCT_CONVENTION): Remove prototype. * i386bsd-nat.c (i386bsd_sigcontext_pc_offset): Remove declaration. (_initialize_i386bsd_nat): Revise logic to determine some constants at compile time when compiling a native GDB. Warn if things don't match up with what we expect. * i386bsd-tdep.c (i386bsd_sigtramp_start, i386bsd_sigtramp_end): Remove variables. (i386bsd_in_sigtramp): Rename tp i386bsd_pc_in_sigtramp. Rewrite to use date stored in `struct gdbarch_tdep'. (i386bsd_sigcontext_offset): Remove varaible. (i386bsd_sigtramp_saved_pc): Make public. Rewrite to use data stored in `struct gdbarch_tdep'. (i386bsd_frame_saved_pc): Make static. (i386bsd_sigtramp_start, i386bsd_sigtramp_end): New functions. (i386bsd_sc_pc_offset, i386nbsd_sc_pc_offset, i386fbsd_sigtramp_start, i386fbsd_sigtramp_end, i386fbsd4_sc_pc_offset): New variables. (i386bsd_init_abi, i386nbsd_init_abi, i386nbsdelf_init_abi, i386fbsdaout_init_abi, i386fbsd_init_abi, i386fbsd4_init_abi): New functions. (i386bsd_aout_osabi_sniffer, _initialize_i386bsd_tdep): New functions. * i386fbsd-nat.c (_initialize_i386fbsd_nat): Fix type in comment. Modify the value of i386fbsd_sigtramp_start and i386fbsd_sigtramp_end instead of i386bsd_sigtramp_start and i386fbsd_sigtramp_end. * i386nbsd-tdep.c: (i386nbsd_aout_use_struct_convention): Remove function. * config/i386/tm-linux.h (I386_LINUX_ORIG_EAX_REGNUM): Move define to i386-linux-tdep.h. (NUM_REGS, MAX_NUM_REGS, REGISTER_BYTES, REGISTER_NAME, REGISTER_BYTE, REGISTER_RAW_SIZE, STAB_REG_TO_REGNUM): Remove defines. (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size): Remove prototypes. (i386_linux_svr4_fetch_link_map_offsets): Remove prototype. (SVR4_FETCH_LINK_MAP_OFFSETS): Remove define. (IN_SIGTRAMP, FRAME_CHAIN, FRAME_SAVED_PC, SAVED_PC_AFTER_CALL, TARGET_WRITE_PC): Remove defines. (i386_linux_in_sigtramp, i386_linux_frame_chain, i386_linux_frame_saved_pc, i386_linux_saved_pc_after_call, i386_linux_write_pc): Remove prototypes. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-linux-tdep.h: New file. * i386-linux-nat.c: Include "i386-linux-tdep.h". * i386-linux-tdep.c: Include "i386-tdep.h" and "i386-linux-tdep.h". (i386_linux_register_name, i386_linux_register_byte, i386_linux_register_raw_size, i386_linux_in_sigtramp, i386_linux_write_pc, i386_linux_svr4_fetch_link_map_offsets): Make static. (i386_linux_init_abi): New function. (_initialize_i386_linux_tdep): New function. * config/i386/tm-i386.h (SAVED_PC_AFTER_CALL): Remove define. (i386_saved_pc_after_call): Remove prototype. (MAX_NUM_REGS): Increase to deal with Linux's orig_eax "register". (REGISTER_NAME, STAB_REG_TO_REGNUM, SDB_REG_TO_REGNUM, DWARF_REG_TO_REGNUM, DWARF2_REG_TO_REGNUM): Remove defines. (i386_register_name, i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum): Remove prototypes. (SIZEOF_GREGS, SIZEOF_FPU_REGS, SIZEOF_FPU_CTL_REGS, SIZEOF_SSE_REGS): Remove defines. (REGISTER_BYTES): Remove define. (REGISTER_BYTE, REGISTER_RAW_SIZE): Remove defines. (i386_register_byte, i386_register_raw_size): Remove prototypes. (FRAME_CHAIN, FRAME_SAVED_PC): Remove defines. (i386_frame_chain, i386_frame_saved_pc): Remove prototypes. * config/i386/tm-i386v4.h (FRAME_CHAIN_VALID): Remove define. (JB_ELEMENT_SIZE, JB_PC, JB_EBX, JB_ESI, JB_EDI, JB_EBP, JB_ESP, JB_EDX, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. (I386V4_SIGTRAMP_SAVED_PC, IN_SIGTRAMP): Remove defines. (sigtramp_saved_pc): Remove define. (i386v4_sigtramp_saved_pc): Remove prototype. * config/i386/tm-go32.h (FRAME_CHAIN, FRAMELESS_FUNCTION_INVOCATION, FRAME_SAVED_PC): Remove defines. (i386go32_frame_saved_pc): Remove prototype. (JB_ELEMENT_SIZE, JB_PC, GET_LONGJMP_TARGET): Remove defines. (get_longjmp_target): Remove prototype. * i386-tdep.h: Include "osabi.h". (enum i386_abi): Removed. (enum struct_return): New enum. (struct gdbarch_tdep): Remove abi member, add osabi, jb_pc_offset, struct_return, sigtramp_saved_pc, sigtramp_start, sigtramp_end and sc_pc_offset members. (i386_gdbarch_register_os_abi): Remove prototype. (I386_NUM_GREGS, I386_NUM_FREGS, I386_NUM_XREGS, I386_SSE_NUM_REGS): New defines. (I386_SIZEOF_GREGS, I386_SIZEOF_FREGS, I386_SIZEOF_XREGS, I386_SSE_SIZEOF_REGS): New defines. (i386_register_name, i386_register_byte, i386_register_raw_size): New prototypes. (i386_elf_init_abi, i386_svr4_init_abi): New prototypes. (i386bsd_sigtramp_saved_pc): New prototype. * i386-tdep.c: Don't include "elf-bfd.h". (i386_stab_reg_to_regnum, i386_dwarf_reg_to_regnum, i386_frame_chain, i386_saved_pc_after_call): Make static. (i386_frame_saved_pc): Rewrite to call architecture dependent function to deal with signal handlers. Make static. (i386go32_frame_saved_pc): Removed. [GET_LONGJMP_TARGET] (JB_PC, JB_ELEMENT_SIZE, get_longjmp_target): Removed. (i386_get_longjmp_target): New function. (default_struct_convention, pcc_struct_convention, reg_struct_convention, valid_conventions, struct_convention): New variables. (i386_use_struct_convention): New function. (i386v4_sigtramp_saved_pc): Renamed to i386_svr4_sigtramp_saved_pc. Made static. Moved. (i386_pc_in_sigtramp): New function. (i386_abi_names): Removed. (ABI_TAG_OS_GNU_LINUX, ABI_TAG_OS_GNU_HURD, ABI_TAG_OS_GNU_SOLARIS, ABI_TAG_OS_FREEBSD, ABI_TAG_OS_NETBSD): Removed. (process_note_sections, i386_elf_abi_from_note, i386_elf_abi, i386_gdbarch_register_os_abi): Removed. (struct i386_abi_handler): Removed. (i386_abi_handler_list): Removed. (i386_svr4_pc_in_sigtramp, i386_go32_pc_in_sigtramp): New functions. (i386_elf_init_abi, i386_svr4_init_abi, i386_go32_init_abi, i386_nw_init_abi): New functions. (i386_gdbarch_init): Rewritten to use generic OS ABI framework. Use set_gdbarch_xxx() calls instead of relying on macros for a number of calls. (i386_coff_osabi_sniffer, i386_nlm_osabi_sniffer): New functions. (_initialize_i386_tdep): Add new 'struct-convcention' command. Register the various architecture variants defined in this file.
2002-06-14 21:42:20 +02:00
i386_linux_init_abi);
}