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

index 4fcd82f01111f09e0bc7e4a431b391645b715c85..98732420fe2aa037b815726138f57e1fd7a0a83f 100644 (file)
@@ -340,10 +340,10 @@ default_remote_register_number (struct gdbarch *gdbarch,
 
 /* See arch-utils.h.  */
 
-int
+bool
 default_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
 {
-  return 0;
+  return false;
 }
 
 \f
index 4d1c76a69bfe034c8754ea5845d8bf92098024a7..a898a3b1ad2a6b89762b76e8f04b425c84fdd3f8 100644 (file)
@@ -334,7 +334,8 @@ extern bool default_program_breakpoint_here_p (struct gdbarch *gdbarch,
 
 /* Do-nothing version of vsyscall_range.  Returns false.  */
 
-extern int default_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range);
+extern bool default_vsyscall_range (struct gdbarch *gdbarch,
+                                   struct mem_range *range);
 
 /* Symbols for gdbarch_infcall_mmap; their Linux PROT_* system
    definitions would be dependent on compilation host.  */
index 2e3e2c80210688281d2fd93ce7e1bee7a8d37ef9..458e9154272051994e2a93f337e0a4966e1db42b 100644 (file)
@@ -2474,7 +2474,7 @@ fbsd_corefile_parse_exec_context (struct gdbarch *gdbarch, bfd *cbfd)
 
 /* Return the address range of the vDSO for the current inferior.  */
 
-static int
+static bool
 fbsd_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
 {
   struct fbsd_pspace_data *data = get_fbsd_pspace_data (current_program_space);
@@ -2488,10 +2488,10 @@ fbsd_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
     }
 
   if (data->vdso_range_p < 0)
-    return 0;
+    return false;
 
   *range = data->vdso_range;
-  return 1;
+  return true;
 }
 
 /* To be called from GDB_OSABI_FREEBSD handlers. */
index 2c6da958bdddd50f99c34ef0218fca415bf396a6..4f9cc637a5af397b63b86b5fcbed09bf5258b778 100644 (file)
@@ -5008,7 +5008,7 @@ set_gdbarch_print_auxv_entry (struct gdbarch *gdbarch,
   gdbarch->print_auxv_entry = print_auxv_entry;
 }
 
-int
+bool
 gdbarch_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
 {
   gdb_assert (gdbarch != NULL);
index db7cdb437fd5d2499d53f7e5f6ce2b2d60e84422..44e424e9420e4871ab4736bf848d92a8799a0a49 100644 (file)
@@ -1622,8 +1622,8 @@ extern void set_gdbarch_print_auxv_entry (struct gdbarch *gdbarch, gdbarch_print
    range with zero length is returned.  Returns true if the vsyscall is
    found, false otherwise. */
 
-typedef int (gdbarch_vsyscall_range_ftype) (struct gdbarch *gdbarch, struct mem_range *range);
-extern int gdbarch_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range);
+typedef bool (gdbarch_vsyscall_range_ftype) (struct gdbarch *gdbarch, struct mem_range *range);
+extern bool gdbarch_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range);
 extern void set_gdbarch_vsyscall_range (struct gdbarch *gdbarch, gdbarch_vsyscall_range_ftype *vsyscall_range);
 
 /* Allocate SIZE bytes of PROT protected page aligned memory in inferior.
index 77c82c300441efc819186351fbc056dcda74b4a9..f817bcb3c3f0a4b7c618b76967d146dcf1bcc39c 100644 (file)
@@ -2587,7 +2587,7 @@ write it to *RANGE.  If the vsyscall's length can't be determined, a
 range with zero length is returned.  Returns true if the vsyscall is
 found, false otherwise.
 """,
-    type="int",
+    type="bool",
     name="vsyscall_range",
     params=[("struct mem_range *", "range")],
     predefault="default_vsyscall_range",
index 5a2bd97df50546fd982716deee2d0bfca3b0b1f9..495dd068038427632e3301611781e14944396b63 100644 (file)
@@ -2720,14 +2720,14 @@ linux_gdb_signal_to_target (struct gdbarch *gdbarch,
 /* Helper for linux_vsyscall_range that does the real work of finding
    the vsyscall's address range.  */
 
-static int
+static bool
 linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
 {
   char filename[100];
   long pid;
 
   if (target_auxv_search (AT_SYSINFO_EHDR, &range->start) <= 0)
-    return 0;
+    return false;
 
   /* It doesn't make sense to access the host's /proc when debugging a
      core file.  Instead, look for the PT_LOAD segment that matches
@@ -2740,28 +2740,28 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
       bfd *cbfd = get_inferior_core_bfd (current_inferior ());
       phdrs_size = bfd_get_elf_phdr_upper_bound (cbfd);
       if (phdrs_size == -1)
-       return 0;
+       return false;
 
       gdb::unique_xmalloc_ptr<Elf_Internal_Phdr>
        phdrs ((Elf_Internal_Phdr *) xmalloc (phdrs_size));
       num_phdrs = bfd_get_elf_phdrs (cbfd, phdrs.get ());
       if (num_phdrs == -1)
-       return 0;
+       return false;
 
       for (i = 0; i < num_phdrs; i++)
        if (phdrs.get ()[i].p_type == PT_LOAD
            && phdrs.get ()[i].p_vaddr == range->start)
          {
            range->length = phdrs.get ()[i].p_memsz;
-           return 1;
+           return true;
          }
 
-      return 0;
+      return false;
     }
 
   /* We need to know the real target PID to access /proc.  */
   if (current_inferior ()->fake_pid_p)
-    return 0;
+    return false;
 
   pid = current_inferior ()->pid;
 
@@ -2795,20 +2795,20 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
                p++;
              endaddr = strtoulst (p, &p, 16);
              range->length = endaddr - addr;
-             return 1;
+             return true;
            }
        }
     }
   else
     warning (_("unable to open /proc file '%s'"), filename);
 
-  return 0;
+  return false;
 }
 
 /* Implementation of the "vsyscall_range" gdbarch hook.  Handles
    caching, and defers the real work to linux_vsyscall_range_raw.  */
 
-static int
+static bool
 linux_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
 {
   struct linux_info *info = get_linux_inferior_data (current_inferior ());
@@ -2822,10 +2822,10 @@ linux_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range)
     }
 
   if (info->vsyscall_range_p < 0)
-    return 0;
+    return false;
 
   *range = info->vsyscall_range;
-  return 1;
+  return true;
 }
 
 /* Symbols for linux_infcall_mmap's ARG_FLAGS; their Linux MAP_* system