* 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.
This commit is contained in:
parent
c9c27aad54
commit
acd5c79833
@ -1,3 +1,94 @@
|
||||
2003-05-30 Mark Kettenis <kettenis@gnu.org>
|
||||
|
||||
* 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 Andrew Cagney <cagney@redhat.com>
|
||||
|
||||
* infcall.c (call_function_by_hand): Always call
|
||||
|
@ -1792,11 +1792,12 @@ i386-nat.o: i386-nat.c $(defs_h) $(breakpoint_h) $(command_h) $(gdbcmd_h)
|
||||
i386-sol2-tdep.o: i386-sol2-tdep.c $(defs_h) $(value_h) $(i386_tdep_h) \
|
||||
$(osabi_h)
|
||||
i386-stub.o: i386-stub.c
|
||||
i386-tdep.o: i386-tdep.c $(defs_h) $(gdb_string_h) $(frame_h) $(inferior_h) \
|
||||
$(gdbcore_h) $(objfiles_h) $(target_h) $(floatformat_h) $(symfile_h) \
|
||||
$(symtab_h) $(gdbcmd_h) $(command_h) $(arch_utils_h) $(regcache_h) \
|
||||
$(doublest_h) $(value_h) $(gdb_assert_h) $(i386_tdep_h) \
|
||||
$(i387_tdep_h) $(osabi_h)
|
||||
i386-tdep.o: i386-tdep.c $(defs_h) $(arch_utils_h) $(command_h) \
|
||||
$(dummy_frame_h) $(doublest_h) $(floatformat_h) $(frame_h) \
|
||||
$(frame_base_h) $(frame_unwind_h) $(inferior_h) $(gdbcmd_h) \
|
||||
$(gdbcore_h) $(objfiles_h) $(osabi_h) $(regcache_h) $(reggroups_h) \
|
||||
$(symfile_h) $(symtab_h) $(target_h) $(value_h) $(gdb_assert_h) \
|
||||
$(gdb_string_h) $(i386_tdep_h) $(i387_tdep_h)
|
||||
i386b-nat.o: i386b-nat.c $(defs_h)
|
||||
i386bsd-nat.o: i386bsd-nat.c $(defs_h) $(inferior_h) $(regcache_h) \
|
||||
$(gdb_assert_h) $(gregset_h) $(i386_tdep_h) $(i387_tdep_h) \
|
||||
@ -1811,7 +1812,7 @@ i386gnu-tdep.o: i386gnu-tdep.c $(defs_h) $(i386_tdep_h) $(osabi_h)
|
||||
i386ly-tdep.o: i386ly-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) \
|
||||
$(regcache_h) $(target_h) $(i386_tdep_h) $(osabi_h)
|
||||
i386-cygwin-tdep.o: i386-cygwin-tdep.c $(defs_h) $(gdb_string_h) \
|
||||
$(i386_tdep_h) $(osabi_h) $(gdbcore_h) $(frame_h) $(dummy_frame_h)
|
||||
$(i386_tdep_h) $(osabi_h)
|
||||
i386nbsd-tdep.o: i386nbsd-tdep.c $(defs_h) $(gdbtypes_h) $(gdbcore_h) \
|
||||
$(regcache_h) $(arch_utils_h) $(i386_tdep_h) $(i387_tdep_h) \
|
||||
$(nbsd_tdep_h) $(solib_svr4_h) $(osabi_h)
|
||||
|
@ -1,3 +1,3 @@
|
||||
# Target: Intel 386 running Solaris 2 (SVR4)
|
||||
TDEPFILES= i386-tdep.o i387-tdep.o i386-sol2-tdep.o i386bsd-tdep.o
|
||||
TDEPFILES= i386-tdep.o i387-tdep.o i386-sol2-tdep.o
|
||||
TM_FILE= tm-i386sol2.h
|
||||
|
@ -1,56 +1,30 @@
|
||||
/* Target-dependent code for Cygwin running on i386's, for GDB.
|
||||
|
||||
Copyright 2003 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
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 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.
|
||||
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. */
|
||||
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 "osabi.h"
|
||||
|
||||
#include "gdb_string.h"
|
||||
#include "gdbcore.h"
|
||||
|
||||
#include "i386-tdep.h"
|
||||
#include "osabi.h"
|
||||
#include "frame.h"
|
||||
#include "dummy-frame.h"
|
||||
|
||||
static int
|
||||
i386_cygwin_frame_chain_valid (CORE_ADDR chain, struct frame_info *thisframe)
|
||||
{
|
||||
/* In the context where this is used, we get the saved PC before we've
|
||||
successfully unwound far enough to be sure what we've got (it may
|
||||
be a signal handler caller). If we're dealing with a signal
|
||||
handler caller, this will return valid, which is fine. If not,
|
||||
it'll make the correct test. */
|
||||
return ((get_frame_type (thisframe) == SIGTRAMP_FRAME) || chain != 0);
|
||||
}
|
||||
/* Return the chain-pointer for FRAME. In the case of the i386, the
|
||||
frame's nominal address is the address of a 4-byte word containing
|
||||
the calling frame's address. */
|
||||
static CORE_ADDR
|
||||
i386_cygwin_frame_chain (struct frame_info *frame)
|
||||
{
|
||||
if (pc_in_dummy_frame (get_frame_pc (frame)))
|
||||
return get_frame_base (frame);
|
||||
|
||||
if (get_frame_type (frame) == SIGTRAMP_FRAME
|
||||
|| i386_frameless_signal_p (frame))
|
||||
return get_frame_base (frame);
|
||||
|
||||
return read_memory_unsigned_integer (get_frame_base (frame), 4);
|
||||
}
|
||||
|
||||
static void
|
||||
i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
@ -58,8 +32,6 @@ i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||
|
||||
tdep->struct_return = reg_struct_return;
|
||||
set_gdbarch_deprecated_frame_chain (gdbarch, i386_cygwin_frame_chain);
|
||||
set_gdbarch_deprecated_frame_chain_valid (gdbarch, i386_cygwin_frame_chain_valid);
|
||||
}
|
||||
|
||||
static enum gdb_osabi
|
||||
@ -75,6 +47,9 @@ i386_cygwin_osabi_sniffer (bfd * abfd)
|
||||
return GDB_OSABI_UNKNOWN;
|
||||
}
|
||||
|
||||
/* Provide a prototype to silence -Wmissing-prototypes. */
|
||||
void _initialize_i386_cygwin_tdep (void);
|
||||
|
||||
void
|
||||
_initialize_i386_cygwin_tdep (void)
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||
|
||||
The instruction sequence for normal signals is
|
||||
pop %eax
|
||||
mov $0x77,%eax
|
||||
mov $0x77, %eax
|
||||
int $0x80
|
||||
or 0x58 0xb8 0x77 0x00 0x00 0x00 0xcd 0x80.
|
||||
|
||||
@ -103,17 +103,17 @@ i386_linux_register_reggroup_p (struct gdbarch *gdbarch, int regnum,
|
||||
to the ones used by the kernel. Therefore, these trampolines are
|
||||
supported too. */
|
||||
|
||||
#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)
|
||||
#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 */
|
||||
LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77,%eax */
|
||||
LINUX_SIGTRAMP_INSN1, 0x77, 0x00, 0x00, 0x00, /* mov $0x77, %eax */
|
||||
LINUX_SIGTRAMP_INSN2, 0x80 /* int $0x80 */
|
||||
};
|
||||
|
||||
@ -167,20 +167,20 @@ i386_linux_sigtramp_start (CORE_ADDR pc)
|
||||
|
||||
/* This function does the same for RT signals. Here the instruction
|
||||
sequence is
|
||||
mov $0xad,%eax
|
||||
mov $0xad, %eax
|
||||
int $0x80
|
||||
or 0xb8 0xad 0x00 0x00 0x00 0xcd 0x80.
|
||||
|
||||
The effect is to call the system call rt_sigreturn. */
|
||||
|
||||
#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)
|
||||
#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[] =
|
||||
{
|
||||
LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad,%eax */
|
||||
LINUX_RT_SIGTRAMP_INSN0, 0xad, 0x00, 0x00, 0x00, /* mov $0xad, %eax */
|
||||
LINUX_RT_SIGTRAMP_INSN1, 0x80 /* int $0x80 */
|
||||
};
|
||||
|
||||
@ -239,50 +239,47 @@ i386_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
|
||||
|| strcmp ("__restore_rt", name) == 0);
|
||||
}
|
||||
|
||||
/* Assuming FRAME is for a GNU/Linux sigtramp routine, return the
|
||||
address of the associated sigcontext structure. */
|
||||
/* 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_linux_sigcontext_addr (struct frame_info *frame)
|
||||
i386_linux_sigcontext_addr (struct frame_info *next_frame)
|
||||
{
|
||||
CORE_ADDR pc;
|
||||
CORE_ADDR sp;
|
||||
char buf[4];
|
||||
|
||||
pc = i386_linux_sigtramp_start (get_frame_pc (frame));
|
||||
frame_unwind_register (next_frame, SP_REGNUM, buf);
|
||||
sp = extract_unsigned_integer (buf, 4);
|
||||
|
||||
pc = i386_linux_sigtramp_start (frame_pc_unwind (next_frame));
|
||||
if (pc)
|
||||
{
|
||||
CORE_ADDR sp;
|
||||
|
||||
if (get_next_frame (frame))
|
||||
/* If this isn't the top frame, the next frame must be for the
|
||||
signal handler itself. The sigcontext structure lives on
|
||||
the stack, right after the signum argument. */
|
||||
return get_frame_base (get_next_frame (frame)) + 12;
|
||||
|
||||
/* This is the top frame. We'll have to find the address of the
|
||||
sigcontext structure by looking at the stack pointer. Keep
|
||||
in mind that the first instruction of the sigtramp code is
|
||||
"pop %eax". If the PC is at this instruction, adjust the
|
||||
returned value accordingly. */
|
||||
sp = read_register (SP_REGNUM);
|
||||
if (pc == get_frame_pc (frame))
|
||||
/* 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;
|
||||
}
|
||||
|
||||
pc = i386_linux_rt_sigtramp_start (get_frame_pc (frame));
|
||||
pc = i386_linux_rt_sigtramp_start (frame_pc_unwind (next_frame));
|
||||
if (pc)
|
||||
{
|
||||
if (get_next_frame (frame))
|
||||
/* If this isn't the top frame, the next frame must be for the
|
||||
signal handler itself. 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. */
|
||||
return read_memory_integer (get_frame_base (get_next_frame (frame))
|
||||
+ 16, 4) + 20;
|
||||
CORE_ADDR ucontext_addr;
|
||||
|
||||
/* This is the top frame. Again, use the stack pointer to find
|
||||
the address of the sigcontext structure. */
|
||||
return read_memory_integer (read_register (SP_REGNUM) + 8, 4) + 20;
|
||||
/* 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.");
|
||||
@ -322,7 +319,7 @@ i386_linux_write_pc (CORE_ADDR pc, ptid_t ptid)
|
||||
be considered too special-purpose for general consumption. */
|
||||
|
||||
static struct minimal_symbol *
|
||||
find_minsym_and_objfile (char *name, struct objfile **objfile_p)
|
||||
find_minsym_and_objfile (char *name, struct objfile **objfilep)
|
||||
{
|
||||
struct objfile *objfile;
|
||||
|
||||
@ -335,7 +332,7 @@ find_minsym_and_objfile (char *name, struct objfile **objfile_p)
|
||||
if (SYMBOL_LINKAGE_NAME (msym)
|
||||
&& strcmp (SYMBOL_LINKAGE_NAME (msym), name) == 0)
|
||||
{
|
||||
*objfile_p = objfile;
|
||||
*objfilep = objfile;
|
||||
return msym;
|
||||
}
|
||||
}
|
||||
@ -345,9 +342,9 @@ find_minsym_and_objfile (char *name, struct objfile **objfile_p)
|
||||
}
|
||||
|
||||
static CORE_ADDR
|
||||
skip_hurd_resolver (CORE_ADDR pc)
|
||||
skip_gnu_resolver (CORE_ADDR pc)
|
||||
{
|
||||
/* The HURD dynamic linker is part of the GNU C library, so many
|
||||
/* 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
|
||||
@ -374,7 +371,7 @@ skip_hurd_resolver (CORE_ADDR pc)
|
||||
= lookup_minimal_symbol ("fixup", NULL, objfile);
|
||||
|
||||
if (fixup && SYMBOL_VALUE_ADDRESS (fixup) == pc)
|
||||
return (DEPRECATED_SAVED_PC_AFTER_CALL (get_current_frame ()));
|
||||
return frame_pc_unwind (get_current_frame ());
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -393,7 +390,7 @@ i386_linux_skip_solib_resolver (CORE_ADDR pc)
|
||||
CORE_ADDR result;
|
||||
|
||||
/* Plug in functions for other kinds of resolvers here. */
|
||||
result = skip_hurd_resolver (pc);
|
||||
result = skip_gnu_resolver (pc);
|
||||
if (result)
|
||||
return result;
|
||||
|
||||
@ -461,7 +458,6 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
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);
|
||||
set_gdbarch_deprecated_register_bytes (gdbarch, I386_SSE_SIZEOF_REGS + 4);
|
||||
|
||||
tdep->jb_pc_offset = 20; /* From <bits/setjmp.h>. */
|
||||
|
||||
|
@ -231,14 +231,20 @@ i386nto_pc_in_sigtramp (CORE_ADDR pc, char *name)
|
||||
return name && strcmp ("__signalstub", name) == 0;
|
||||
}
|
||||
|
||||
#define SIGCONTEXT_OFFSET 136
|
||||
static CORE_ADDR
|
||||
i386nto_sigcontext_addr (struct frame_info *frame)
|
||||
{
|
||||
if (get_next_frame (frame))
|
||||
return get_frame_base (get_next_frame (frame)) + SIGCONTEXT_OFFSET;
|
||||
#define I386_NTO_SIGCONTEXT_OFFSET 136
|
||||
|
||||
return read_register (SP_REGNUM) + SIGCONTEXT_OFFSET;
|
||||
/* Assuming NEXT_FRAME is a frame following a QNX Neutrino sigtramp
|
||||
routine, return the address of the associated sigcontext structure. */
|
||||
|
||||
static CORE_ADDR
|
||||
i386nto_sigcontext_addr (struct frame_info *next_frame)
|
||||
{
|
||||
char buf[4];
|
||||
|
||||
frame_unwind_register (next_frame, SP_REGNUM, buf);
|
||||
sp = extract_unsigned_integer (buf, 4);
|
||||
|
||||
return sp + I386_NTO_SIGCONTEXT_OFFSET;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -42,12 +42,8 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||
/* Solaris is SVR4-based. */
|
||||
i386_svr4_init_abi (info, gdbarch);
|
||||
|
||||
/* Signal trampolines are different from SVR4, in fact they're
|
||||
rather similar to BSD. */
|
||||
/* Signal trampolines are slightly different from SVR4. */
|
||||
set_gdbarch_pc_in_sigtramp (gdbarch, i386_sol2_pc_in_sigtramp);
|
||||
tdep->sigcontext_addr = i386bsd_sigcontext_addr;
|
||||
tdep->sc_pc_offset = 36 + 14 * 4;
|
||||
tdep->sc_sp_offset = 36 + 17 * 4;
|
||||
}
|
||||
|
||||
|
||||
|
1226
gdb/i386-tdep.c
1226
gdb/i386-tdep.c
File diff suppressed because it is too large
Load Diff
@ -136,8 +136,6 @@ extern int i386_mxcsr_regnum_p (int regnum);
|
||||
#define FCOFF_REGNUM FIOFF_REGNUM
|
||||
#define FDS_REGNUM FOSEG_REGNUM
|
||||
#define FDOFF_REGNUM FOOFF_REGNUM
|
||||
#define IS_FP_REGNUM(n) i386_fp_regnum_p (n)
|
||||
#define IS_SSE_REGNUM(n) i386_sse_regnum_p (n)
|
||||
|
||||
#define I386_NUM_GREGS 16
|
||||
#define I386_NUM_FREGS 16
|
||||
@ -146,16 +144,6 @@ extern int i386_mxcsr_regnum_p (int regnum);
|
||||
#define I386_SSE_NUM_REGS (I386_NUM_GREGS + I386_NUM_FREGS \
|
||||
+ I386_NUM_XREGS)
|
||||
|
||||
/* Sizes of individual register sets. These cover the entire register
|
||||
file, so summing up the sizes of those portions actually present
|
||||
yields DEPRECATED_REGISTER_BYTES. */
|
||||
#define I386_SIZEOF_GREGS (I386_NUM_GREGS * 4)
|
||||
#define I386_SIZEOF_FREGS (8 * 10 + 8 * 4)
|
||||
#define I386_SIZEOF_XREGS (8 * 16 + 4)
|
||||
|
||||
#define I386_SSE_SIZEOF_REGS (I386_SIZEOF_GREGS + I386_SIZEOF_FREGS \
|
||||
+ I386_SIZEOF_XREGS)
|
||||
|
||||
/* Size of the largest register. */
|
||||
#define I386_MAX_REGISTER_SIZE 16
|
||||
|
||||
@ -178,7 +166,6 @@ extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *);
|
||||
|
||||
/* Functions exported from i386bsd-tdep.c. */
|
||||
|
||||
extern CORE_ADDR i386bsd_sigcontext_addr (struct frame_info *frame);
|
||||
extern void i386bsd_init_abi (struct gdbarch_info, struct gdbarch *);
|
||||
|
||||
#endif /* i386-tdep.h */
|
||||
|
@ -41,26 +41,19 @@ i386bsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
|
||||
return (pc >= tdep->sigtramp_start && pc < tdep->sigtramp_end);
|
||||
}
|
||||
|
||||
/* Assuming FRAME is for a BSD sigtramp routine, return the address of
|
||||
the associated sigcontext structure.
|
||||
/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp
|
||||
routine, return the address of the associated sigcontext structure. */
|
||||
|
||||
Note: This function is used for Solaris 2 too, so don't make it
|
||||
static. */
|
||||
|
||||
CORE_ADDR
|
||||
i386bsd_sigcontext_addr (struct frame_info *frame)
|
||||
static CORE_ADDR
|
||||
i386bsd_sigcontext_addr (struct frame_info *next_frame)
|
||||
{
|
||||
struct frame_info *next_frame = get_next_frame (frame);
|
||||
char buf[4];
|
||||
CORE_ADDR sp;
|
||||
|
||||
if (next_frame)
|
||||
/* If this isn't the top frame, the next frame must be for the
|
||||
signal handler itself. A pointer to the sigcontext structure
|
||||
is passed as the third argument to the signal handler. */
|
||||
return read_memory_unsigned_integer (get_frame_base (next_frame) + 16, 4);
|
||||
frame_unwind_register (next_frame, SP_REGNUM, buf);
|
||||
sp = extract_unsigned_integer (buf, 4);
|
||||
|
||||
/* This is the top frame. We'll have to find the address of the
|
||||
sigcontext structure by looking at the stack pointer. */
|
||||
return read_memory_unsigned_integer (read_register (SP_REGNUM) + 8, 4);
|
||||
return read_memory_unsigned_integer (sp + 8, 4);
|
||||
}
|
||||
|
||||
/* Return the start address of the sigtramp routine. */
|
||||
|
Loading…
x
Reference in New Issue
Block a user