/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
};
-static int amd64_syscall_p (const struct amd64_insn *insn, int *lengthp);
+static bool amd64_syscall_p (const struct amd64_insn *insn, int *lengthp);
-static int
+static bool
rex_prefix_p (gdb_byte pfx)
{
return REX_PREFIX_P (pfx);
return displaced_step_copy_insn_closure_up (dsc.release ());
}
-static int
+static bool
amd64_absolute_jmp_p (const struct amd64_insn *details)
{
const gdb_byte *insn = &details->raw_insn[details->opcode_offset];
{
/* jump near, absolute indirect (/4) */
if ((insn[1] & 0x38) == 0x20)
- return 1;
+ return true;
/* jump far, absolute indirect (/5) */
if ((insn[1] & 0x38) == 0x28)
- return 1;
+ return true;
}
- return 0;
+ return false;
}
-/* Return non-zero if the instruction DETAILS is a jump, zero otherwise. */
+/* Return true if the instruction DETAILS is a jump, false otherwise. */
-static int
+static bool
amd64_jmp_p (const struct amd64_insn *details)
{
const gdb_byte *insn = &details->raw_insn[details->opcode_offset];
/* jump short, relative. */
if (insn[0] == 0xeb)
- return 1;
+ return true;
/* jump near, relative. */
if (insn[0] == 0xe9)
- return 1;
+ return true;
return amd64_absolute_jmp_p (details);
}
-static int
+static bool
amd64_absolute_call_p (const struct amd64_insn *details)
{
const gdb_byte *insn = &details->raw_insn[details->opcode_offset];
{
/* Call near, absolute indirect (/2) */
if ((insn[1] & 0x38) == 0x10)
- return 1;
+ return true;
/* Call far, absolute indirect (/3) */
if ((insn[1] & 0x38) == 0x18)
- return 1;
+ return true;
}
- return 0;
+ return false;
}
-static int
+static bool
amd64_ret_p (const struct amd64_insn *details)
{
/* NOTE: gcc can emit "repz ; ret". */
case 0xca: /* ret far, pop N bytes */
case 0xcb: /* ret far */
case 0xcf: /* iret */
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
-static int
+static bool
amd64_call_p (const struct amd64_insn *details)
{
const gdb_byte *insn = &details->raw_insn[details->opcode_offset];
if (amd64_absolute_call_p (details))
- return 1;
+ return true;
/* call near, relative */
if (insn[0] == 0xe8)
- return 1;
+ return true;
- return 0;
+ return false;
}
-/* Return non-zero if INSN is a system call, and set *LENGTHP to its
- length in bytes. Otherwise, return zero. */
+/* Return true if INSN is a system call, and set *LENGTHP to its
+ length in bytes. Otherwise, return false. */
-static int
+static bool
amd64_syscall_p (const struct amd64_insn *details, int *lengthp)
{
const gdb_byte *insn = &details->raw_insn[details->opcode_offset];
if (insn[0] == 0x0f && insn[1] == 0x05)
{
*lengthp = 2;
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/* Classify the instruction at ADDR using PRED.
Throw an error if the memory can't be read. */
-static int
+static bool
amd64_classify_insn_at (struct gdbarch *gdbarch, CORE_ADDR addr,
- int (*pred) (const struct amd64_insn *))
+ bool (*pred) (const struct amd64_insn *))
{
struct amd64_insn details;
read_code (addr, buf.data (), buf.size ());
amd64_get_insn_details (buf.data (), &details);
- int classification = pred (&details);
-
- return classification;
+ return pred (&details);
}
/* The gdbarch insn_is_call method. */
-static int
+static bool
amd64_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
{
return amd64_classify_insn_at (gdbarch, addr, amd64_call_p);
/* The gdbarch insn_is_ret method. */
-static int
+static bool
amd64_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
{
return amd64_classify_insn_at (gdbarch, addr, amd64_ret_p);
/* The gdbarch insn_is_jump method. */
-static int
+static bool
amd64_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
{
return amd64_classify_insn_at (gdbarch, addr, amd64_jmp_p);
return !(language_pass_by_reference (type).trivially_copyable);
}
-int default_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
+bool
+default_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
{
- return 0;
+ return false;
}
-int default_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
+bool
+default_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
{
- return 0;
+ return false;
}
-int default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
+bool
+default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
{
- return 0;
+ return false;
}
/* See arch-utils.h. */
extern bool default_return_in_first_hidden_param_p (struct gdbarch *,
struct type *);
-extern int default_insn_is_call (struct gdbarch *, CORE_ADDR);
-extern int default_insn_is_ret (struct gdbarch *, CORE_ADDR);
-extern int default_insn_is_jump (struct gdbarch *, CORE_ADDR);
+extern bool default_insn_is_call (struct gdbarch *, CORE_ADDR);
+extern bool default_insn_is_ret (struct gdbarch *, CORE_ADDR);
+extern bool default_insn_is_jump (struct gdbarch *, CORE_ADDR);
/* Default implementation of gdbarch_program_breakpoint_here_p. */
extern bool default_program_breakpoint_here_p (struct gdbarch *gdbarch,
gdbarch->ravenscar_ops = ravenscar_ops;
}
-int
+bool
gdbarch_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_assert (gdbarch != NULL);
gdbarch->insn_is_call = insn_is_call;
}
-int
+bool
gdbarch_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_assert (gdbarch != NULL);
gdbarch->insn_is_ret = insn_is_ret;
}
-int
+bool
gdbarch_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_assert (gdbarch != NULL);
extern struct ravenscar_arch_ops * gdbarch_ravenscar_ops (struct gdbarch *gdbarch);
extern void set_gdbarch_ravenscar_ops (struct gdbarch *gdbarch, struct ravenscar_arch_ops * ravenscar_ops);
-/* Return non-zero if the instruction at ADDR is a call; zero otherwise. */
+/* Return true if the instruction at ADDR is a call; false otherwise. */
-typedef int (gdbarch_insn_is_call_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern int gdbarch_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr);
+typedef bool (gdbarch_insn_is_call_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
+extern bool gdbarch_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr);
extern void set_gdbarch_insn_is_call (struct gdbarch *gdbarch, gdbarch_insn_is_call_ftype *insn_is_call);
-/* Return non-zero if the instruction at ADDR is a return; zero otherwise. */
+/* Return true if the instruction at ADDR is a return; false otherwise. */
-typedef int (gdbarch_insn_is_ret_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern int gdbarch_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr);
+typedef bool (gdbarch_insn_is_ret_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
+extern bool gdbarch_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr);
extern void set_gdbarch_insn_is_ret (struct gdbarch *gdbarch, gdbarch_insn_is_ret_ftype *insn_is_ret);
-/* Return non-zero if the instruction at ADDR is a jump; zero otherwise. */
+/* Return true if the instruction at ADDR is a jump; false otherwise. */
-typedef int (gdbarch_insn_is_jump_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
-extern int gdbarch_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr);
+typedef bool (gdbarch_insn_is_jump_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr);
+extern bool gdbarch_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr);
extern void set_gdbarch_insn_is_jump (struct gdbarch *gdbarch, gdbarch_insn_is_jump_ftype *insn_is_jump);
/* Return true if there's a program/permanent breakpoint planted in
Method(
comment="""
-Return non-zero if the instruction at ADDR is a call; zero otherwise.
+Return true if the instruction at ADDR is a call; false otherwise.
""",
- type="int",
+ type="bool",
name="insn_is_call",
params=[("CORE_ADDR", "addr")],
predefault="default_insn_is_call",
Method(
comment="""
-Return non-zero if the instruction at ADDR is a return; zero otherwise.
+Return true if the instruction at ADDR is a return; false otherwise.
""",
- type="int",
+ type="bool",
name="insn_is_ret",
params=[("CORE_ADDR", "addr")],
predefault="default_insn_is_ret",
Method(
comment="""
-Return non-zero if the instruction at ADDR is a jump; zero otherwise.
+Return true if the instruction at ADDR is a jump; false otherwise.
""",
- type="int",
+ type="bool",
name="insn_is_jump",
params=[("CORE_ADDR", "addr")],
predefault="default_insn_is_jump",
return NULL;
}
-static int
+static bool
i386_absolute_jmp_p (const gdb_byte *insn)
{
/* jmp far (absolute address in operand). */
if (insn[0] == 0xea)
- return 1;
+ return true;
if (insn[0] == 0xff)
{
/* jump near, absolute indirect (/4). */
if ((insn[1] & 0x38) == 0x20)
- return 1;
+ return true;
/* jump far, absolute indirect (/5). */
if ((insn[1] & 0x38) == 0x28)
- return 1;
+ return true;
}
- return 0;
+ return false;
}
-/* Return non-zero if INSN is a jump, zero otherwise. */
+/* Return true if INSN is a jump, false otherwise. */
-static int
+static bool
i386_jmp_p (const gdb_byte *insn)
{
/* jump short, relative. */
if (insn[0] == 0xeb)
- return 1;
+ return true;
/* jump near, relative. */
if (insn[0] == 0xe9)
- return 1;
+ return true;
return i386_absolute_jmp_p (insn);
}
-static int
+static bool
i386_absolute_call_p (const gdb_byte *insn)
{
/* call far, absolute. */
if (insn[0] == 0x9a)
- return 1;
+ return true;
if (insn[0] == 0xff)
{
/* Call near, absolute indirect (/2). */
if ((insn[1] & 0x38) == 0x10)
- return 1;
+ return true;
/* Call far, absolute indirect (/3). */
if ((insn[1] & 0x38) == 0x18)
- return 1;
+ return true;
}
- return 0;
+ return false;
}
-static int
+static bool
i386_ret_p (const gdb_byte *insn)
{
switch (insn[0])
case 0xca: /* ret far, pop N bytes. */
case 0xcb: /* ret far */
case 0xcf: /* iret */
- return 1;
+ return true;
default:
- return 0;
+ return false;
}
}
-static int
+static bool
i386_call_p (const gdb_byte *insn)
{
if (i386_absolute_call_p (insn))
- return 1;
+ return true;
/* call near, relative. */
if (insn[0] == 0xe8)
- return 1;
+ return true;
- return 0;
+ return false;
}
-/* Return non-zero if INSN is a system call, and set *LENGTHP to its
- length in bytes. Otherwise, return zero. */
+/* Return true if INSN is a system call, and set *LENGTHP to its
+ length in bytes. Otherwise, return false. */
-static int
+static bool
i386_syscall_p (const gdb_byte *insn, int *lengthp)
{
/* Is it 'int $0x80'? */
|| (insn[0] == 0x0f && insn[1] == 0x05))
{
*lengthp = 2;
- return 1;
+ return true;
}
- return 0;
+ return false;
}
/* The gdbarch insn_is_call method. */
-static int
+static bool
i386_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_byte buf[I386_MAX_INSN_LEN], *insn;
/* The gdbarch insn_is_ret method. */
-static int
+static bool
i386_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_byte buf[I386_MAX_INSN_LEN], *insn;
/* The gdbarch insn_is_jump method. */
-static int
+static bool
i386_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_byte buf[I386_MAX_INSN_LEN], *insn;
}
}
-/* Return non-zero if the instruction at ADDR is a call; zero otherwise. */
-static int
+/* Return true if the instruction at ADDR is a call; false otherwise. */
+static bool
z80_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_byte buf[8];
case insn_call_nn:
case insn_call_cc_nn:
case insn_rst_n:
- return 1;
+ return true;
}
- return 0;
+ return false;
}
-/* Return non-zero if the instruction at ADDR is a return; zero otherwise. */
-static int
+/* Return true if the instruction at ADDR is a return; false otherwise. */
+static bool
z80_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_byte buf[8];
{
case insn_ret:
case insn_ret_cc:
- return 1;
+ return true;
}
- return 0;
+ return false;
}
-/* Return non-zero if the instruction at ADDR is a jump; zero otherwise. */
-static int
+/* Return true if the instruction at ADDR is a jump; false otherwise. */
+static bool
z80_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr)
{
gdb_byte buf[8];
case insn_jr_d:
case insn_jr_cc_d:
case insn_djnz_d:
- return 1;
+ return true;
}
- return 0;
+ return false;
}
static const struct frame_unwind_legacy z80_frame_unwind (