]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: change gdbarch_ax_pseudo_register_push_stack to return bool
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 27 Feb 2026 20:05:02 +0000 (15:05 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 9 Mar 2026 17:15:46 +0000 (13:15 -0400)
Change-Id: I1da4dc7a8976aa901875e452813b37fa3518cdb5
Approved-By: Tom Tromey <tom@tromey.com>
gdb/ax-general.c
gdb/gdbarch-gen.c
gdb/gdbarch-gen.h
gdb/gdbarch_components.py
gdb/mips-tdep.c
gdb/s390-tdep.c

index 05ca556703e086303a04e9be55aea39cc5ac0605..0c767c1c0dfa9749450262ff973d66bc04bb7fac 100644 (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));
     }
index c4da3fa4c29c9c4284f8384489955354fc4b4e51..e622e812de5b2c4370c9fc9f5fa0c4f4d4c6b8f0 100644 (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);
index 13e9b94a8ff8384206ab33b5f097e5c842ea561f..b0534c3e6abc06ffc866ffb706c20384e2b3eabb 100644 (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
index 4c51dc3d04cb128fb863547fb3d41382d8f75bb7..3dead48393434f4cb0376698b6da7af626f89178 100644 (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,
index 0babb8b9b987b37e371800c0648bed26add0599a..82fa67e7055bbe0a0637309740325a8a964a5db0 100644 (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.  */
index 8a3bde525e93add622d50e970eba49bf6af57119..ab00b65d6406c7d06d10da5f0b8de4be80ef166a 100644 (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