* gdbarch.sh (get_longjmp_target): Add FRAME argument.

* gdbarch.c, gdbarch.h: Regenerate.
	* infrun.c (handle_inferior_event): Pass current frame to
	gdbarch_get_longjmp_target.

	* alpha-tdep.c (alpha_get_longjmp_target): Add FRAME argument.
	Read registers from FRAME instead of using read_register.
	Use get_frame_arch instead of current_gdbarch.
	* arm-tdep.c (arm_get_longjmp_target): Likewise.
	* i386-tdep.c (i386_get_longjmp_target): Likewise.
	* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
	* mips-linux-tdep.c (mips_linux_get_longjmp_target): Likewise.
	(mips64_linux_get_longjmp_target): Likewise.
	* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
This commit is contained in:
Ulrich Weigand 2007-06-15 22:41:13 +00:00
parent 52f729a724
commit 60ade65d49
11 changed files with 42 additions and 24 deletions

View File

@ -1,3 +1,20 @@
2007-06-15 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.sh (get_longjmp_target): Add FRAME argument.
* gdbarch.c, gdbarch.h: Regenerate.
* infrun.c (handle_inferior_event): Pass current frame to
gdbarch_get_longjmp_target.
* alpha-tdep.c (alpha_get_longjmp_target): Add FRAME argument.
Read registers from FRAME instead of using read_register.
Use get_frame_arch instead of current_gdbarch.
* arm-tdep.c (arm_get_longjmp_target): Likewise.
* i386-tdep.c (i386_get_longjmp_target): Likewise.
* m68k-tdep.c (m68k_get_longjmp_target): Likewise.
* mips-linux-tdep.c (mips_linux_get_longjmp_target): Likewise.
(mips64_linux_get_longjmp_target): Likewise.
* mipsnbsd-tdep.c (mipsnbsd_get_longjmp_target): Likewise.
2007-06-15 Ulrich Weigand <uweigand@de.ibm.com>
* gdbarch.sh (skip_trampoline_code): Add FRAME argument.

View File

@ -724,13 +724,13 @@ alpha_skip_prologue (CORE_ADDR pc)
into the "pc". This routine returns true on success. */
static int
alpha_get_longjmp_target (CORE_ADDR *pc)
alpha_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
CORE_ADDR jb_addr;
gdb_byte raw_buffer[ALPHA_REGISTER_SIZE];
jb_addr = read_register (ALPHA_A0_REGNUM);
jb_addr = get_frame_register_unsigned (frame, ALPHA_A0_REGNUM);
if (target_read_memory (jb_addr + (tdep->jb_pc * tdep->jb_elt_size),
raw_buffer, tdep->jb_elt_size))

View File

@ -2342,13 +2342,13 @@ arm_return_value (struct gdbarch *gdbarch, struct type *valtype,
static int
arm_get_longjmp_target (CORE_ADDR *pc)
arm_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
CORE_ADDR jb_addr;
char buf[INT_REGISTER_SIZE];
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
jb_addr = read_register (ARM_A1_REGNUM);
jb_addr = get_frame_register_unsigned (frame, ARM_A1_REGNUM);
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
INT_REGISTER_SIZE))

View File

@ -2040,13 +2040,13 @@ gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch)
}
int
gdbarch_get_longjmp_target (struct gdbarch *gdbarch, CORE_ADDR *pc)
gdbarch_get_longjmp_target (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR *pc)
{
gdb_assert (gdbarch != NULL);
gdb_assert (gdbarch->get_longjmp_target != NULL);
if (gdbarch_debug >= 2)
fprintf_unfiltered (gdb_stdlog, "gdbarch_get_longjmp_target called\n");
return gdbarch->get_longjmp_target (pc);
return gdbarch->get_longjmp_target (frame, pc);
}
void

View File

@ -383,8 +383,8 @@ extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_
extern int gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch);
typedef int (gdbarch_get_longjmp_target_ftype) (CORE_ADDR *pc);
extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch, CORE_ADDR *pc);
typedef int (gdbarch_get_longjmp_target_ftype) (struct frame_info *frame, CORE_ADDR *pc);
extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch, struct frame_info *frame, CORE_ADDR *pc);
extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target);
extern int gdbarch_believe_pcc_promotion (struct gdbarch *gdbarch);

View File

@ -483,7 +483,7 @@ f::int:register_sim_regno:int reg_nr:reg_nr::legacy_register_sim_regno::0
f::int:cannot_fetch_register:int regnum:regnum::cannot_register_not::0
f::int:cannot_store_register:int regnum:regnum::cannot_register_not::0
# setjmp/longjmp support.
F::int:get_longjmp_target:CORE_ADDR *pc:pc
F::int:get_longjmp_target:struct frame_info *frame, CORE_ADDR *pc:frame, pc
#
v:=:int:believe_pcc_promotion:::::::
#

View File

@ -1266,11 +1266,11 @@ i386_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
This function is 64-bit safe. */
static int
i386_get_longjmp_target (CORE_ADDR *pc)
i386_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
gdb_byte buf[8];
CORE_ADDR sp, jb_addr;
int jb_pc_offset = gdbarch_tdep (current_gdbarch)->jb_pc_offset;
int jb_pc_offset = gdbarch_tdep (get_frame_arch (frame))->jb_pc_offset;
int len = TYPE_LENGTH (builtin_type_void_func_ptr);
/* If JB_PC_OFFSET is -1, we have no way to find out where the
@ -1280,7 +1280,7 @@ i386_get_longjmp_target (CORE_ADDR *pc)
/* Don't use I386_ESP_REGNUM here, since this function is also used
for AMD64. */
regcache_cooked_read (current_regcache, SP_REGNUM, buf);
get_frame_register (frame, SP_REGNUM, buf);
sp = extract_typed_address (buf, builtin_type_void_data_ptr);
if (target_read_memory (sp + len, buf, len))
return 0;

View File

@ -2077,7 +2077,8 @@ process_event_stop_test:
remove_breakpoints ();
breakpoints_inserted = 0;
if (!gdbarch_get_longjmp_target_p (current_gdbarch)
|| !gdbarch_get_longjmp_target (current_gdbarch, &jmp_buf_pc))
|| !gdbarch_get_longjmp_target (current_gdbarch,
get_current_frame (), &jmp_buf_pc))
{
keep_going (ecs);
return;

View File

@ -978,11 +978,11 @@ m68k_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
This routine returns true on success. */
static int
m68k_get_longjmp_target (CORE_ADDR *pc)
m68k_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
gdb_byte *buf;
CORE_ADDR sp, jb_addr;
struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch);
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (frame));
if (tdep->jb_pc < 0)
{
@ -992,7 +992,7 @@ m68k_get_longjmp_target (CORE_ADDR *pc)
}
buf = alloca (gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT);
sp = read_register (SP_REGNUM);
sp = get_frame_register_unsigned (frame, SP_REGNUM);
if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack */
buf,

View File

@ -52,12 +52,12 @@ static struct target_so_ops mips_svr4_so_ops;
#define MIPS_LINUX_JB_PC 0
static int
mips_linux_get_longjmp_target (CORE_ADDR *pc)
mips_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
CORE_ADDR jb_addr;
char buf[gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT];
jb_addr = read_register (MIPS_A0_REGNUM);
jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
if (target_read_memory (jb_addr
+ MIPS_LINUX_JB_PC * MIPS_LINUX_JB_ELEMENT_SIZE,
@ -254,13 +254,13 @@ mips_fill_fpregset (const struct regcache *regcache,
#define MIPS64_LINUX_JB_PC 0
static int
mips64_linux_get_longjmp_target (CORE_ADDR *pc)
mips64_linux_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
CORE_ADDR jb_addr;
void *buf = alloca (gdbarch_ptr_bit (current_gdbarch) / TARGET_CHAR_BIT);
int element_size = gdbarch_ptr_bit (current_gdbarch) == 32 ? 4 : 8;
jb_addr = read_register (MIPS_A0_REGNUM);
jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
if (target_read_memory (jb_addr + MIPS64_LINUX_JB_PC * element_size,
buf,

View File

@ -284,14 +284,14 @@ mipsnbsd_sigtramp_offset (struct frame_info *next_frame)
NBSD_MIPS_JB_ELEMENT_SIZE)
static int
mipsnbsd_get_longjmp_target (CORE_ADDR *pc)
mipsnbsd_get_longjmp_target (struct frame_info *frame, CORE_ADDR *pc)
{
CORE_ADDR jb_addr;
char *buf;
buf = alloca (NBSD_MIPS_JB_ELEMENT_SIZE);
jb_addr = read_register (MIPS_A0_REGNUM);
jb_addr = get_frame_register_unsigned (frame, MIPS_A0_REGNUM);
if (target_read_memory (jb_addr + NBSD_MIPS_JB_OFFSET, buf,
NBSD_MIPS_JB_ELEMENT_SIZE))