From 86b23fc07eb4a2867709e5145fd1de0cc7039486 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 27 Feb 2026 15:05:20 -0500 Subject: [PATCH] gdb: change gdbarch_stap_is_single_operand to return bool Change-Id: I46976d84d1971df2cec75b70a1cf75168d740a10 Approved-By: Tom Tromey --- gdb/aarch64-linux-tdep.c | 2 +- gdb/arm-linux-tdep.c | 2 +- gdb/gdbarch-gen.c | 2 +- gdb/gdbarch-gen.h | 6 +++--- gdb/gdbarch_components.py | 4 ++-- gdb/i386-tdep.c | 2 +- gdb/i386-tdep.h | 4 ++-- gdb/ia64-linux-tdep.c | 2 +- gdb/ppc-linux-tdep.c | 2 +- gdb/riscv-tdep.c | 2 +- gdb/s390-tdep.c | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) diff --git a/gdb/aarch64-linux-tdep.c b/gdb/aarch64-linux-tdep.c index b85c25ecae1..b037dbdb886 100644 --- a/gdb/aarch64-linux-tdep.c +++ b/gdb/aarch64-linux-tdep.c @@ -1797,7 +1797,7 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch, /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ -static int +static bool aarch64_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) { return (*s == '#' || c_isdigit (*s) /* Literal number. */ diff --git a/gdb/arm-linux-tdep.c b/gdb/arm-linux-tdep.c index cf425992ce4..591e60d5084 100644 --- a/gdb/arm-linux-tdep.c +++ b/gdb/arm-linux-tdep.c @@ -1163,7 +1163,7 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch, /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ -static int +static bool arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) { return (*s == '#' || *s == '$' || c_isdigit (*s) /* Literal number. */ diff --git a/gdb/gdbarch-gen.c b/gdb/gdbarch-gen.c index 9fad9ff2823..7cc13a2d625 100644 --- a/gdb/gdbarch-gen.c +++ b/gdb/gdbarch-gen.c @@ -4537,7 +4537,7 @@ gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch) return gdbarch->stap_is_single_operand != NULL; } -int +bool gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) { gdb_assert (gdbarch != NULL); diff --git a/gdb/gdbarch-gen.h b/gdb/gdbarch-gen.h index f556751f26b..d401c6fcbd6 100644 --- a/gdb/gdbarch-gen.h +++ b/gdb/gdbarch-gen.h @@ -1387,14 +1387,14 @@ extern void set_gdbarch_stap_gdb_register_suffix (struct gdbarch *gdbarch, const - Register displacement, e.g. `4(%eax)' on x86 This function should check for these patterns on the string - and return 1 if some were found, or zero otherwise. Please try to match + and return true if some were found, or false otherwise. Please try to match as much info as you can from the string, i.e., if you have to match something like `(%', do not match just the `('. */ extern bool gdbarch_stap_is_single_operand_p (struct gdbarch *gdbarch); -typedef int (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch, const char *s); -extern int gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s); +typedef bool (gdbarch_stap_is_single_operand_ftype) (struct gdbarch *gdbarch, const char *s); +extern bool gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, const char *s); extern void set_gdbarch_stap_is_single_operand (struct gdbarch *gdbarch, gdbarch_stap_is_single_operand_ftype *stap_is_single_operand); /* Function used to handle a "special case" in the parser. diff --git a/gdb/gdbarch_components.py b/gdb/gdbarch_components.py index 2d0fc40e0ce..b0fe68d6bb7 100644 --- a/gdb/gdbarch_components.py +++ b/gdb/gdbarch_components.py @@ -2244,11 +2244,11 @@ Single operands can be: - Register displacement, e.g. `4(%eax)' on x86 This function should check for these patterns on the string -and return 1 if some were found, or zero otherwise. Please try to match +and return true if some were found, or false otherwise. Please try to match as much info as you can from the string, i.e., if you have to match something like `(%', do not match just the `('. """, - type="int", + type="bool", name="stap_is_single_operand", params=[("const char *", "s")], predicate=True, diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 09fd94f3d09..6863c1579e6 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -3835,7 +3835,7 @@ i386_svr4_sigcontext_addr (const frame_info_ptr &this_frame) /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ -int +bool i386_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) { return (*s == '$' /* Literal number. */ diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h index 21f9ed42a17..d64d5241754 100644 --- a/gdb/i386-tdep.h +++ b/gdb/i386-tdep.h @@ -481,8 +481,8 @@ extern int i386bsd_sc_reg_offset[]; /* SystemTap related functions. */ -extern int i386_stap_is_single_operand (struct gdbarch *gdbarch, - const char *s); +extern bool i386_stap_is_single_operand (struct gdbarch *gdbarch, + const char *s); extern expr::operation_up i386_stap_parse_special_token (struct gdbarch *gdbarch, struct stap_parse_info *p); diff --git a/gdb/ia64-linux-tdep.c b/gdb/ia64-linux-tdep.c index aa7ed1906bf..28779d8b5aa 100644 --- a/gdb/ia64-linux-tdep.c +++ b/gdb/ia64-linux-tdep.c @@ -124,7 +124,7 @@ ia64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc) /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ -static int +static bool ia64_linux_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) { return ((c_isdigit (*s) && s[1] == '[' && s[2] == 'r') /* Displacement. */ diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 40f0a824352..2dd36786bd3 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -1707,7 +1707,7 @@ ppc_elfv2_skip_entrypoint (struct gdbarch *gdbarch, CORE_ADDR pc) /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ -static int +static bool ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) { return (*s == 'i' /* Literal number. */ diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c index ee5db15947b..252c2e5042e 100644 --- a/gdb/riscv-tdep.c +++ b/gdb/riscv-tdep.c @@ -4178,7 +4178,7 @@ riscv_print_insn (bfd_vma addr, struct disassemble_info *info) /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ -static int +static bool riscv_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) { return (c_isdigit (*s) /* Literal number. */ diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index 07793c4809e..aed7ae6b9b4 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -7049,7 +7049,7 @@ s390_gnu_triplet_regexp (struct gdbarch *gdbarch) /* Implementation of `gdbarch_stap_is_single_operand', as defined in gdbarch.h. */ -static int +static bool s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s) { return ((c_isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement