mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2026-08-27 00:26:02 -04:00
gdb: change gdbarch_get_longjmp_target to return bool
Change-Id: Ib3470d7af11c28335aacd011c9c97f60ad9a9803 Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
parent
c978e5be77
commit
61bef6f99b
16 changed files with 55 additions and 55 deletions
|
|
@ -2842,7 +2842,7 @@ aarch64_return_value (struct gdbarch *gdbarch, struct value *func_value,
|
|||
|
||||
/* Implement the "get_longjmp_target" gdbarch method. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
aarch64_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
CORE_ADDR jb_addr;
|
||||
|
|
@ -2855,10 +2855,10 @@ aarch64_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
|
||||
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
|
||||
X_REGISTER_SIZE))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, X_REGISTER_SIZE, byte_order);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Implement the "gen_return_address" gdbarch method. */
|
||||
|
|
|
|||
|
|
@ -820,7 +820,7 @@ alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|||
which we extract the PC (JB_PC) that we will land at. The PC is copied
|
||||
into the "pc". This routine returns true on success. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
alpha_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
|
|
@ -833,10 +833,10 @@ alpha_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
|
||||
if (target_read_memory (jb_addr + (tdep->jb_pc * tdep->jb_elt_size),
|
||||
raw_buffer, tdep->jb_elt_size))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (raw_buffer, tdep->jb_elt_size, byte_order);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3443,7 +3443,7 @@ const struct regset amd64_fpregset =
|
|||
address is copied into PC. This routine returns non-zero on
|
||||
success. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
amd64_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
gdb_byte buf[8];
|
||||
|
|
@ -3456,17 +3456,17 @@ amd64_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
/* If JB_PC_OFFSET is -1, we have no way to find out where the
|
||||
longjmp will land. */
|
||||
if (jb_pc_offset == -1)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
get_frame_register (frame, AMD64_RDI_REGNUM, buf);
|
||||
jb_addr= extract_typed_address
|
||||
(buf, builtin_type (gdbarch)->builtin_data_ptr);
|
||||
if (target_read_memory (jb_addr + jb_pc_offset, buf, len))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static const int amd64_record_regmap[] =
|
||||
|
|
|
|||
|
|
@ -1007,7 +1007,7 @@ arc_store_return_value (struct gdbarch *gdbarch, struct type *type,
|
|||
|
||||
/* Implement the "get_longjmp_target" gdbarch method. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
arc_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
arc_debug_printf ("called");
|
||||
|
|
@ -1019,11 +1019,11 @@ arc_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
CORE_ADDR jb_addr = get_frame_register_unsigned (frame, ARC_FIRST_ARG_REGNUM);
|
||||
|
||||
if (target_read_memory (jb_addr + pc_offset, buf, ARC_REGISTER_SIZE))
|
||||
return 0; /* Failed to read from memory. */
|
||||
return false; /* Failed to read from memory. */
|
||||
|
||||
*pc = extract_unsigned_integer (buf, ARC_REGISTER_SIZE,
|
||||
gdbarch_byte_order (gdbarch));
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Implement the "return_value" gdbarch method. */
|
||||
|
|
|
|||
|
|
@ -9300,7 +9300,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
|
|||
}
|
||||
|
||||
|
||||
static int
|
||||
static bool
|
||||
arm_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
|
|
@ -9313,10 +9313,10 @@ arm_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
|
||||
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
|
||||
ARM_INT_REGISTER_SIZE))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, ARM_INT_REGISTER_SIZE, byte_order);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
/* A call to cmse secure entry function "foo" at "a" is modified by
|
||||
GNU ld as "b".
|
||||
|
|
|
|||
|
|
@ -2340,7 +2340,7 @@ gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch)
|
|||
return gdbarch->get_longjmp_target != NULL;
|
||||
}
|
||||
|
||||
int
|
||||
bool
|
||||
gdbarch_get_longjmp_target (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
gdb_assert (gdbarch != NULL);
|
||||
|
|
|
|||
|
|
@ -375,14 +375,14 @@ extern bool gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum);
|
|||
extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_cannot_store_register_ftype *cannot_store_register);
|
||||
|
||||
/* Determine the address where a longjmp will land and save this address
|
||||
in PC. Return nonzero on success.
|
||||
in PC. Return true on success.
|
||||
|
||||
FRAME corresponds to the longjmp frame. */
|
||||
|
||||
extern bool gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch);
|
||||
|
||||
typedef int (gdbarch_get_longjmp_target_ftype) (const frame_info_ptr &frame, CORE_ADDR *pc);
|
||||
extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR *pc);
|
||||
typedef bool (gdbarch_get_longjmp_target_ftype) (const frame_info_ptr &frame, CORE_ADDR *pc);
|
||||
extern bool gdbarch_get_longjmp_target (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR *pc);
|
||||
extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target);
|
||||
|
||||
typedef int (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch, int regnum, struct type *type);
|
||||
|
|
|
|||
|
|
@ -728,11 +728,11 @@ Method(
|
|||
Function(
|
||||
comment="""
|
||||
Determine the address where a longjmp will land and save this address
|
||||
in PC. Return nonzero on success.
|
||||
in PC. Return true on success.
|
||||
|
||||
FRAME corresponds to the longjmp frame.
|
||||
""",
|
||||
type="int",
|
||||
type="bool",
|
||||
name="get_longjmp_target",
|
||||
params=[("const frame_info_ptr &", "frame"), ("CORE_ADDR *", "pc")],
|
||||
predicate=True,
|
||||
|
|
|
|||
|
|
@ -2562,10 +2562,10 @@ i386_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
|
|||
/* Figure out where the longjmp will land. Slurp the args out of the
|
||||
stack. We expect the first arg to be a pointer to the jmp_buf
|
||||
structure from which we extract the address that we will land at.
|
||||
This address is copied into PC. This routine returns non-zero on
|
||||
This address is copied into PC. This routine returns true on
|
||||
success. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
i386_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
gdb_byte buf[4];
|
||||
|
|
@ -2578,19 +2578,19 @@ i386_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
/* If JB_PC_OFFSET is -1, we have no way to find out where the
|
||||
longjmp will land. */
|
||||
if (jb_pc_offset == -1)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
get_frame_register (frame, I386_ESP_REGNUM, buf);
|
||||
sp = extract_unsigned_integer (buf, 4, byte_order);
|
||||
if (target_read_memory (sp + 4, buf, 4))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
jb_addr = extract_unsigned_integer (buf, 4, byte_order);
|
||||
if (target_read_memory (jb_addr + jb_pc_offset, buf, 4))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, 4, byte_order);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1050,7 +1050,7 @@ m68k_dummy_id (struct gdbarch *gdbarch, const frame_info_ptr &this_frame)
|
|||
we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
|
||||
This routine returns true on success. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
m68k_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
gdb_byte *buf;
|
||||
|
|
@ -1062,7 +1062,7 @@ m68k_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
if (tdep->jb_pc < 0)
|
||||
{
|
||||
internal_error (_("m68k_get_longjmp_target: not implemented"));
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
buf = (gdb_byte *) alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
|
||||
|
|
@ -1070,7 +1070,7 @@ m68k_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
|
||||
if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack. */
|
||||
buf, gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
jb_addr = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch)
|
||||
/ TARGET_CHAR_BIT, byte_order);
|
||||
|
|
@ -1078,11 +1078,11 @@ m68k_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
|
||||
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT),
|
||||
byte_order)
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch)
|
||||
/ TARGET_CHAR_BIT, byte_order);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -85,13 +85,13 @@ enum
|
|||
/* Figure out where the longjmp will land.
|
||||
We expect the first arg to be a pointer to the jmp_buf structure
|
||||
from which we extract the pc (MIPS_LINUX_JB_PC) that we will land
|
||||
at. The pc is copied into PC. This routine returns 1 on
|
||||
at. The pc is copied into PC. This routine returns true on
|
||||
success. */
|
||||
|
||||
#define MIPS_LINUX_JB_ELEMENT_SIZE 4
|
||||
#define MIPS_LINUX_JB_PC 0
|
||||
|
||||
static int
|
||||
static bool
|
||||
mips_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
CORE_ADDR jb_addr;
|
||||
|
|
@ -105,13 +105,13 @@ mips_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
+ MIPS_LINUX_JB_PC * MIPS_LINUX_JB_ELEMENT_SIZE),
|
||||
buf.data (),
|
||||
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf.data (),
|
||||
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT,
|
||||
byte_order);
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Transform the bits comprising a 32-bit register to the right size
|
||||
|
|
@ -245,7 +245,7 @@ mips_fill_gregset_wrapper (const struct regset *regset,
|
|||
|
||||
#define MIPS64_LINUX_JB_PC 0
|
||||
|
||||
static int
|
||||
static bool
|
||||
mips64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
CORE_ADDR jb_addr;
|
||||
|
|
@ -260,13 +260,13 @@ mips64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
if (target_read_memory (jb_addr + MIPS64_LINUX_JB_PC * element_size,
|
||||
buf,
|
||||
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf,
|
||||
gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT,
|
||||
byte_order);
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Register set support functions. These operate on standard 64-bit
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ static const unsigned char sigtramp_retcode_mipseb[RETCODE_SIZE] =
|
|||
#define NBSD_MIPS_JB_OFFSET(gdbarch) (NBSD_MIPS_JB_PC * \
|
||||
NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch))
|
||||
|
||||
static int
|
||||
static bool
|
||||
mipsnbsd_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
|
|
@ -267,11 +267,11 @@ mipsnbsd_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
|
||||
if (target_read_memory (jb_addr + NBSD_MIPS_JB_OFFSET (gdbarch), buf,
|
||||
NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch)))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch),
|
||||
byte_order);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
|
|
|
|||
|
|
@ -1823,7 +1823,7 @@ nds32_return_value (struct gdbarch *gdbarch, struct value *func_type,
|
|||
|
||||
/* Implement the "get_longjmp_target" gdbarch method. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
nds32_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
gdb_byte buf[4];
|
||||
|
|
@ -1834,10 +1834,10 @@ nds32_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
jb_addr = get_frame_register_unsigned (frame, NDS32_R0_REGNUM);
|
||||
|
||||
if (target_read_memory (jb_addr + 11 * 4, buf, 4))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, 4, byte_order);
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Validate the given TDESC, and fixed-number some registers in it.
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ sparc64_linux_get_syscall_number (struct gdbarch *gdbarch,
|
|||
|
||||
/* Implement the "get_longjmp_target" gdbarch method. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
sparc64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
|
|
@ -335,7 +335,7 @@ sparc64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
then we need to jump over the instruction at the delay slot. */
|
||||
|
||||
if (target_read_memory (jb_addr + 32 + (18 * 8), buf, 8))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, 8, gdbarch_byte_order (gdbarch));
|
||||
|
||||
|
|
@ -343,7 +343,7 @@ sparc64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
*pc += 4; /* delay slot insn */
|
||||
*pc += 4; /* call insn */
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1099,7 +1099,7 @@ tic6x_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|||
|
||||
/* This is the implementation of gdbarch method get_longjmp_target. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
tic6x_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
|
|
@ -1113,11 +1113,11 @@ tic6x_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
/* JMP_BUF contains 13 elements of type int, and return address is stored
|
||||
in the last slot. */
|
||||
if (target_read_memory (jb_addr + 12 * 4, buf, 4))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, 4, byte_order);
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* This is the implementation of gdbarch method
|
||||
|
|
|
|||
|
|
@ -773,7 +773,7 @@ tilegx_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|||
|
||||
/* This is the implementation of gdbarch method get_longjmp_target. */
|
||||
|
||||
static int
|
||||
static bool
|
||||
tilegx_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
||||
{
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
|
|
@ -787,11 +787,11 @@ tilegx_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
|
|||
has a size of 8 bytes. The return address is stored in the 25th
|
||||
slot. */
|
||||
if (target_read_memory (jb_addr + 25 * 8, buf, 8))
|
||||
return 0;
|
||||
return false;
|
||||
|
||||
*pc = extract_unsigned_integer (buf, 8, byte_order);
|
||||
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* by assigning the 'faultnum' reg in kernel pt_regs with this value,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue