]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: change gdbarch_get_longjmp_target to return bool
authorSimon Marchi <simon.marchi@efficios.com>
Fri, 27 Feb 2026 20:05:17 +0000 (15:05 -0500)
committerSimon Marchi <simon.marchi@efficios.com>
Mon, 9 Mar 2026 17:15:47 +0000 (13:15 -0400)
Change-Id: Ib3470d7af11c28335aacd011c9c97f60ad9a9803
Approved-By: Tom Tromey <tom@tromey.com>
16 files changed:
gdb/aarch64-tdep.c
gdb/alpha-tdep.c
gdb/amd64-tdep.c
gdb/arc-tdep.c
gdb/arm-tdep.c
gdb/gdbarch-gen.c
gdb/gdbarch-gen.h
gdb/gdbarch_components.py
gdb/i386-tdep.c
gdb/m68k-tdep.c
gdb/mips-linux-tdep.c
gdb/mips-netbsd-tdep.c
gdb/nds32-tdep.c
gdb/sparc64-linux-tdep.c
gdb/tic6x-tdep.c
gdb/tilegx-tdep.c

index 6bd974d1f98d9f1efccf2dbfc7fccbcabe7d2ea5..de0d7ddb73b9dd1a6b43229e9c70028498980660 100644 (file)
@@ -2842,7 +2842,7 @@ aarch64_return_value (struct gdbarch *gdbarch, struct value *func_value,
 
 /* Implement the "get_longjmp_target" gdbarch method.  */
 
-static int
+static bool
 aarch64_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
@@ -2855,10 +2855,10 @@ aarch64_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 
   if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
                          X_REGISTER_SIZE))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, X_REGISTER_SIZE, byte_order);
-  return 1;
+  return true;
 }
 
 /* Implement the "gen_return_address" gdbarch method.  */
index e89884602db7a0928b9a4720d04c9835bfb00353..e2a1929b9dc2e56eb700216da81b036479ca9b76 100644 (file)
@@ -820,7 +820,7 @@ alpha_deal_with_atomic_sequence (struct gdbarch *gdbarch, CORE_ADDR pc)
    which we extract the PC (JB_PC) that we will land at.  The PC is copied
    into the "pc".  This routine returns true on success.  */
 
-static int
+static bool
 alpha_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -833,10 +833,10 @@ alpha_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 
   if (target_read_memory (jb_addr + (tdep->jb_pc * tdep->jb_elt_size),
                          raw_buffer, tdep->jb_elt_size))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (raw_buffer, tdep->jb_elt_size, byte_order);
-  return 1;
+  return true;
 }
 
 \f
index 2588960362018073b56432d3d131a6bea9d49545..60e38687e4712980d8c4f9dca33bc0f99909c5ba 100755 (executable)
@@ -3443,7 +3443,7 @@ const struct regset amd64_fpregset =
    address is copied into PC.  This routine returns non-zero on
    success.  */
 
-static int
+static bool
 amd64_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   gdb_byte buf[8];
@@ -3456,17 +3456,17 @@ amd64_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
   /* If JB_PC_OFFSET is -1, we have no way to find out where the
      longjmp will land.         */
   if (jb_pc_offset == -1)
-    return 0;
+    return false;
 
   get_frame_register (frame, AMD64_RDI_REGNUM, buf);
   jb_addr= extract_typed_address
            (buf, builtin_type (gdbarch)->builtin_data_ptr);
   if (target_read_memory (jb_addr + jb_pc_offset, buf, len))
-    return 0;
+    return false;
 
   *pc = extract_typed_address (buf, builtin_type (gdbarch)->builtin_func_ptr);
 
-  return 1;
+  return true;
 }
 
 static const int amd64_record_regmap[] =
index 9559d64bb14cd679b9c1366f8f00b8cf113517cf..ff283014e524e4c3b8ea3a0c36253b9661192879 100644 (file)
@@ -1007,7 +1007,7 @@ arc_store_return_value (struct gdbarch *gdbarch, struct type *type,
 
 /* Implement the "get_longjmp_target" gdbarch method.  */
 
-static int
+static bool
 arc_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   arc_debug_printf ("called");
@@ -1019,11 +1019,11 @@ arc_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
   CORE_ADDR jb_addr = get_frame_register_unsigned (frame, ARC_FIRST_ARG_REGNUM);
 
   if (target_read_memory (jb_addr + pc_offset, buf, ARC_REGISTER_SIZE))
-    return 0; /* Failed to read from memory.  */
+    return false; /* Failed to read from memory.  */
 
   *pc = extract_unsigned_integer (buf, ARC_REGISTER_SIZE,
                                  gdbarch_byte_order (gdbarch));
-  return 1;
+  return true;
 }
 
 /* Implement the "return_value" gdbarch method.  */
index 4b77b223edcf095e68d538dcbc5d5fb9e6241d81..dabae0aec0f005a5e739584828bd41e925070bb2 100644 (file)
@@ -9300,7 +9300,7 @@ arm_return_value (struct gdbarch *gdbarch, struct value *function,
 }
 
 
-static int
+static bool
 arm_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -9313,10 +9313,10 @@ arm_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 
   if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
                          ARM_INT_REGISTER_SIZE))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, ARM_INT_REGISTER_SIZE, byte_order);
-  return 1;
+  return true;
 }
 /* A call to cmse secure entry function "foo" at "a" is modified by
      GNU ld as "b".
index f5f3893311bd79c0561125daedfe523c7f923ac2..2906249d8b47600e724d2cfffeefe286df622c84 100644 (file)
@@ -2340,7 +2340,7 @@ gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch)
   return gdbarch->get_longjmp_target != NULL;
 }
 
-int
+bool
 gdbarch_get_longjmp_target (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   gdb_assert (gdbarch != NULL);
index cb4fb63be61fc68cc6f9bcb9085e449654428f8c..c8048888baef52c1f2925d47c39d56de3edc93d0 100644 (file)
@@ -375,14 +375,14 @@ extern bool gdbarch_cannot_store_register (struct gdbarch *gdbarch, int regnum);
 extern void set_gdbarch_cannot_store_register (struct gdbarch *gdbarch, gdbarch_cannot_store_register_ftype *cannot_store_register);
 
 /* Determine the address where a longjmp will land and save this address
-   in PC.  Return nonzero on success.
+   in PC.  Return true on success.
 
    FRAME corresponds to the longjmp frame. */
 
 extern bool gdbarch_get_longjmp_target_p (struct gdbarch *gdbarch);
 
-typedef int (gdbarch_get_longjmp_target_ftype) (const frame_info_ptr &frame, CORE_ADDR *pc);
-extern int gdbarch_get_longjmp_target (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR *pc);
+typedef bool (gdbarch_get_longjmp_target_ftype) (const frame_info_ptr &frame, CORE_ADDR *pc);
+extern bool gdbarch_get_longjmp_target (struct gdbarch *gdbarch, const frame_info_ptr &frame, CORE_ADDR *pc);
 extern void set_gdbarch_get_longjmp_target (struct gdbarch *gdbarch, gdbarch_get_longjmp_target_ftype *get_longjmp_target);
 
 typedef int (gdbarch_convert_register_p_ftype) (struct gdbarch *gdbarch, int regnum, struct type *type);
index 59a5dda7b6ea53bac30abc793988310286e6ae16..d2d902b11f648eeb359157d30102281db8919dce 100644 (file)
@@ -728,11 +728,11 @@ Method(
 Function(
     comment="""
 Determine the address where a longjmp will land and save this address
-in PC.  Return nonzero on success.
+in PC.  Return true on success.
 
 FRAME corresponds to the longjmp frame.
 """,
-    type="int",
+    type="bool",
     name="get_longjmp_target",
     params=[("const frame_info_ptr &", "frame"), ("CORE_ADDR *", "pc")],
     predicate=True,
index b74b8bd39944c18c01e1b1c883301cfeecfc8083..07eeba4c3c41eebab64dbfd95a0a4be0ccfe612c 100644 (file)
@@ -2562,10 +2562,10 @@ i386_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
 /* Figure out where the longjmp will land.  Slurp the args out of the
    stack.  We expect the first arg to be a pointer to the jmp_buf
    structure from which we extract the address that we will land at.
-   This address is copied into PC.  This routine returns non-zero on
+   This address is copied into PC.  This routine returns true on
    success.  */
 
-static int
+static bool
 i386_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   gdb_byte buf[4];
@@ -2578,19 +2578,19 @@ i386_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
   /* If JB_PC_OFFSET is -1, we have no way to find out where the
      longjmp will land.  */
   if (jb_pc_offset == -1)
-    return 0;
+    return false;
 
   get_frame_register (frame, I386_ESP_REGNUM, buf);
   sp = extract_unsigned_integer (buf, 4, byte_order);
   if (target_read_memory (sp + 4, buf, 4))
-    return 0;
+    return false;
 
   jb_addr = extract_unsigned_integer (buf, 4, byte_order);
   if (target_read_memory (jb_addr + jb_pc_offset, buf, 4))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, 4, byte_order);
-  return 1;
+  return true;
 }
 \f
 
index 544b9cb39ed1399f212fd134a2dc761a6f1093a3..8613062482d8101c34074bd5b8c184c7db4ee505 100644 (file)
@@ -1050,7 +1050,7 @@ m68k_dummy_id (struct gdbarch *gdbarch, const frame_info_ptr &this_frame)
    we extract the pc (JB_PC) that we will land at.  The pc is copied into PC.
    This routine returns true on success.  */
 
-static int
+static bool
 m68k_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   gdb_byte *buf;
@@ -1062,7 +1062,7 @@ m68k_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
   if (tdep->jb_pc < 0)
     {
       internal_error (_("m68k_get_longjmp_target: not implemented"));
-      return 0;
+      return false;
     }
 
   buf = (gdb_byte *) alloca (gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT);
@@ -1070,7 +1070,7 @@ m68k_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 
   if (target_read_memory (sp + SP_ARG0,        /* Offset of first arg on stack.  */
                          buf, gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
-    return 0;
+    return false;
 
   jb_addr = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch)
                                             / TARGET_CHAR_BIT, byte_order);
@@ -1078,11 +1078,11 @@ m68k_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
   if (target_read_memory (jb_addr + tdep->jb_pc * tdep->jb_elt_size, buf,
                          gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT),
                          byte_order)
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, gdbarch_ptr_bit (gdbarch)
                                         / TARGET_CHAR_BIT, byte_order);
-  return 1;
+  return true;
 }
 \f
 
index b498bf7665524a4c64261390c66332fd13477ae8..9fa2b1c235458183b6179520f14e765be90ac293 100644 (file)
@@ -85,13 +85,13 @@ enum
 /* Figure out where the longjmp will land.
    We expect the first arg to be a pointer to the jmp_buf structure
    from which we extract the pc (MIPS_LINUX_JB_PC) that we will land
-   at.  The pc is copied into PC.  This routine returns 1 on
+   at.  The pc is copied into PC.  This routine returns true on
    success.  */
 
 #define MIPS_LINUX_JB_ELEMENT_SIZE 4
 #define MIPS_LINUX_JB_PC 0
 
-static int
+static bool
 mips_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
@@ -105,13 +105,13 @@ mips_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
                           + MIPS_LINUX_JB_PC * MIPS_LINUX_JB_ELEMENT_SIZE),
                          buf.data (),
                          gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf.data (),
                                  gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT,
                                  byte_order);
 
-  return 1;
+  return true;
 }
 
 /* Transform the bits comprising a 32-bit register to the right size
@@ -245,7 +245,7 @@ mips_fill_gregset_wrapper (const struct regset *regset,
 
 #define MIPS64_LINUX_JB_PC 0
 
-static int
+static bool
 mips64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   CORE_ADDR jb_addr;
@@ -260,13 +260,13 @@ mips64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
   if (target_read_memory (jb_addr + MIPS64_LINUX_JB_PC * element_size,
                          buf,
                          gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf,
                                  gdbarch_ptr_bit (gdbarch) / TARGET_CHAR_BIT,
                                  byte_order);
 
-  return 1;
+  return true;
 }
 
 /* Register set support functions.  These operate on standard 64-bit
index 7ddf3b5d39a5999d2528efeaf5e8f9bf49f1d155..a5bcde20e460feea589d378d99592c6339b5b82f 100644 (file)
@@ -253,7 +253,7 @@ static const unsigned char sigtramp_retcode_mipseb[RETCODE_SIZE] =
 #define NBSD_MIPS_JB_OFFSET(gdbarch)           (NBSD_MIPS_JB_PC * \
                                         NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch))
 
-static int
+static bool
 mipsnbsd_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -267,11 +267,11 @@ mipsnbsd_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 
   if (target_read_memory (jb_addr + NBSD_MIPS_JB_OFFSET (gdbarch), buf,
                          NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch)))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, NBSD_MIPS_JB_ELEMENT_SIZE (gdbarch),
                                  byte_order);
-  return 1;
+  return true;
 }
 
 static bool
index 90ed8355775cbfcb7f5b7bae7a6bcd8249e3d7ba..3da3c3b61957ed7fc5f61c5691bf52f25821a215 100644 (file)
@@ -1823,7 +1823,7 @@ nds32_return_value (struct gdbarch *gdbarch, struct value *func_type,
 \f
 /* Implement the "get_longjmp_target" gdbarch method.  */
 
-static int
+static bool
 nds32_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   gdb_byte buf[4];
@@ -1834,10 +1834,10 @@ nds32_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
   jb_addr = get_frame_register_unsigned (frame, NDS32_R0_REGNUM);
 
   if (target_read_memory (jb_addr + 11 * 4, buf, 4))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, 4, byte_order);
-  return 1;
+  return true;
 }
 \f
 /* Validate the given TDESC, and fixed-number some registers in it.
index 03a6ccbd38b3cffe601597c3116b238158a7b63f..cb7ce41e5cbd65e855548c18235e5cbd41e15493 100644 (file)
@@ -306,7 +306,7 @@ sparc64_linux_get_syscall_number (struct gdbarch *gdbarch,
 \f
 /* Implement the "get_longjmp_target" gdbarch method.  */
 
-static int
+static bool
 sparc64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -335,7 +335,7 @@ sparc64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
      then we need to jump over the instruction at the delay slot.  */
 
   if (target_read_memory (jb_addr + 32 + (18 * 8), buf, 8))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, 8, gdbarch_byte_order (gdbarch));
 
@@ -343,7 +343,7 @@ sparc64_linux_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
       *pc += 4; /* delay slot insn  */
   *pc += 4; /* call insn  */
 
-  return 1;
+  return true;
 }
 
 \f
index 1730a75cd47d0a9c429e26ab5089a455346e1e33..3661ec1211090b6e3a2c91ae3a462a003783c834 100644 (file)
@@ -1099,7 +1099,7 @@ tic6x_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
 
 /* This is the implementation of gdbarch method get_longjmp_target.  */
 
-static int
+static bool
 tic6x_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -1113,11 +1113,11 @@ tic6x_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
   /* JMP_BUF contains 13 elements of type int, and return address is stored
      in the last slot.  */
   if (target_read_memory (jb_addr + 12 * 4, buf, 4))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, 4, byte_order);
 
-  return 1;
+  return true;
 }
 
 /* This is the implementation of gdbarch method
index f30c73663855a85db8bd8e1b49ee405046cabefc..c9458fd526b86eba48f4b4652b65bf30b154c610 100644 (file)
@@ -773,7 +773,7 @@ tilegx_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc)
 
 /* This is the implementation of gdbarch method get_longjmp_target.  */
 
-static int
+static bool
 tilegx_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -787,11 +787,11 @@ tilegx_get_longjmp_target (const frame_info_ptr &frame, CORE_ADDR *pc)
      has a size of 8 bytes.  The return address is stored in the 25th
      slot.  */
   if (target_read_memory (jb_addr + 25 * 8, buf, 8))
-    return 0;
+    return false;
 
   *pc = extract_unsigned_integer (buf, 8, byte_order);
 
-  return 1;
+  return true;
 }
 
 /* by assigning the 'faultnum' reg in kernel pt_regs with this value,