gdb: change gdbarch_ax_pseudo_register_push_stack to return bool

Change-Id: I1da4dc7a8976aa901875e452813b37fa3518cdb5
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Simon Marchi 2026-02-27 15:05:02 -05:00
parent c7632ee1cb
commit d867b23f0b
6 changed files with 15 additions and 12 deletions

View file

@ -232,7 +232,8 @@ ax_reg (struct agent_expr *x, int reg)
error (_("'%s' is a pseudo-register; "
"GDB cannot yet trace its contents."),
user_reg_map_regnum_to_name (x->gdbarch, reg));
if (gdbarch_ax_pseudo_register_push_stack (x->gdbarch, x, reg))
if (!gdbarch_ax_pseudo_register_push_stack (x->gdbarch, x, reg))
error (_("Trace '%s' failed."),
user_reg_map_regnum_to_name (x->gdbarch, reg));
}

View file

@ -1974,7 +1974,7 @@ gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch)
return gdbarch->ax_pseudo_register_push_stack != NULL;
}
int
bool
gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg)
{
gdb_assert (gdbarch != NULL);

View file

@ -246,12 +246,13 @@ extern void set_gdbarch_ax_pseudo_register_collect (struct gdbarch *gdbarch, gdb
/* Assemble agent expression bytecode to push the value of pseudo-register
REG on the interpreter stack.
Return -1 if something goes wrong, 0 otherwise. */
REG must be a valid register number.
Return false if something goes wrong, true otherwise. */
extern bool gdbarch_ax_pseudo_register_push_stack_p (struct gdbarch *gdbarch);
typedef int (gdbarch_ax_pseudo_register_push_stack_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
extern int gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
typedef bool (gdbarch_ax_pseudo_register_push_stack_ftype) (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
extern bool gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, struct agent_expr *ax, int reg);
extern void set_gdbarch_ax_pseudo_register_push_stack (struct gdbarch *gdbarch, gdbarch_ax_pseudo_register_push_stack_ftype *ax_pseudo_register_push_stack);
/* Some architectures can display additional information for specific

View file

@ -498,9 +498,10 @@ Method(
comment="""
Assemble agent expression bytecode to push the value of pseudo-register
REG on the interpreter stack.
Return -1 if something goes wrong, 0 otherwise.
REG must be a valid register number.
Return false if something goes wrong, true otherwise.
""",
type="int",
type="bool",
name="ax_pseudo_register_push_stack",
params=[("struct agent_expr *", "ax"), ("int", "reg")],
predicate=True,

View file

@ -841,7 +841,7 @@ mips_ax_pseudo_register_collect (struct gdbarch *gdbarch,
ax_reg_mask (ax, rawnum);
}
static int
static bool
mips_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
struct agent_expr *ax, int reg)
{
@ -870,7 +870,7 @@ mips_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
else
internal_error (_("bad register size"));
return 0;
return true;
}
/* Table to translate 3-bit register field to actual register number. */

View file

@ -1536,7 +1536,7 @@ s390_ax_pseudo_register_collect (struct gdbarch *gdbarch,
/* The "ax_pseudo_register_push_stack" gdbarch method. */
static int
static bool
s390_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
struct agent_expr *ax, int regnum)
{
@ -1571,13 +1571,13 @@ s390_ax_pseudo_register_push_stack (struct gdbarch *gdbarch,
else if (regnum_is_vxr_full (tdep, regnum))
{
/* Too large to stuff on the stack. */
return 1;
return false;
}
else
{
internal_error (_("invalid regnum"));
}
return 0;
return true;
}
/* The "gen_return_address" gdbarch method. Since this is supposed to be