/* 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;
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. */
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);
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;
}
\f
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];
/* 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[] =
/* 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");
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. */
}
-static int
+static bool
arm_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
{
struct gdbarch *gdbarch = get_frame_arch (frame);
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".
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);
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);
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,
/* 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];
/* 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;
}
\f
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;
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);
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);
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;
}
\f
/* 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;
+ 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
#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;
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
#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);
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
\f
/* 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];
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;
}
\f
/* Validate the given TDESC, and fixed-number some registers in it.
\f
/* 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);
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));
*pc += 4; /* delay slot insn */
*pc += 4; /* call insn */
- return 1;
+ return true;
}
\f
/* 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);
/* 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
/* 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);
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,