Change gdbarch_inner_than to return bool

A recent patch from Andrew pointed out that gdbarch_inner_than returns
'int', while it should really return 'bool'.

Approved-By: Pedro Alves <pedro@palves.net>
This commit is contained in:
Tom Tromey 2024-05-10 11:54:15 -06:00
parent 04e63f26ba
commit e14f6ec969
7 changed files with 13 additions and 13 deletions

View File

@ -173,16 +173,16 @@ default_code_of_frame_writable (struct gdbarch *gdbarch,
/* Helper functions for gdbarch_inner_than */
int
bool
core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs)
{
return (lhs < rhs);
return lhs < rhs;
}
int
bool
core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs)
{
return (lhs > rhs);
return lhs > rhs;
}
/* Misc helper functions for targets. */

View File

@ -83,8 +83,8 @@ extern bool default_displaced_step_hw_singlestep (struct gdbarch *);
extern CORE_ADDR displaced_step_at_entry_point (struct gdbarch *gdbarch);
/* The only possible cases for inner_than. */
extern int core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs);
extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs);
extern bool core_addr_lessthan (CORE_ADDR lhs, CORE_ADDR rhs);
extern bool core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs);
/* Identity functions on a CORE_ADDR. Just return the "addr". */

View File

@ -547,8 +547,8 @@ typedef CORE_ADDR (gdbarch_skip_entrypoint_ftype) (struct gdbarch *gdbarch, CORE
extern CORE_ADDR gdbarch_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR ip);
extern void set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch, gdbarch_skip_entrypoint_ftype *skip_entrypoint);
typedef int (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs);
extern int gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs);
typedef bool (gdbarch_inner_than_ftype) (CORE_ADDR lhs, CORE_ADDR rhs);
extern bool gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs);
extern void set_gdbarch_inner_than (struct gdbarch *gdbarch, gdbarch_inner_than_ftype *inner_than);
typedef const gdb_byte * (gdbarch_breakpoint_from_pc_ftype) (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr);

View File

@ -173,8 +173,8 @@ check_stack_growth (struct gdbarch *gdbarch)
implementation by calling gdbarch_inner_than. GDB assumes that stacks
either grow down or up (see uses of gdbarch_stack_grows_down), so exactly
one of these needs to be true. */
bool stack_grows_down = gdbarch_inner_than (gdbarch, 1, 2) != 0;
bool stack_grows_up = gdbarch_inner_than (gdbarch, 2, 1) != 0;
bool stack_grows_down = gdbarch_inner_than (gdbarch, 1, 2);
bool stack_grows_up = gdbarch_inner_than (gdbarch, 2, 1);
SELF_CHECK (stack_grows_up != stack_grows_down);
}

View File

@ -2788,7 +2788,7 @@ set_gdbarch_skip_entrypoint (struct gdbarch *gdbarch,
gdbarch->skip_entrypoint = skip_entrypoint;
}
int
bool
gdbarch_inner_than (struct gdbarch *gdbarch, CORE_ADDR lhs, CORE_ADDR rhs)
{
gdb_assert (gdbarch != NULL);

View File

@ -375,7 +375,7 @@ gdbarch_num_cooked_regs (gdbarch *arch)
static inline bool
gdbarch_stack_grows_down (gdbarch *arch)
{
return gdbarch_inner_than (arch, 1, 2) != 0;
return gdbarch_inner_than (arch, 1, 2);
}
#endif

View File

@ -1020,7 +1020,7 @@ is not used.
)
Function(
type="int",
type="bool",
name="inner_than",
params=[("CORE_ADDR", "lhs"), ("CORE_ADDR", "rhs")],
)