]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/solib: boolify in_dynsym_resolve_code functions
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 26 May 2025 20:26:14 +0000 (16:26 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 29 May 2025 14:49:37 +0000 (10:49 -0400)
Change-Id: I66f5986e1a2452e3817f326d908b2e49f99e2fc6
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
12 files changed:
gdb/mips-linux-tdep.c
gdb/objfiles.h
gdb/ppc-linux-tdep.c
gdb/solib-aix.c
gdb/solib-darwin.c
gdb/solib-dsbt.c
gdb/solib-frv.c
gdb/solib-svr4.c
gdb/solib-svr4.h
gdb/solib-target.c
gdb/solib.c
gdb/solib.h

index 46766e40a190b44095a05fb3d0e2f4b82e455a6d..bf3df3697e1551b17e2559b4db5bac0620de5983 100644 (file)
@@ -666,24 +666,24 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc)
   return 1;
 }
 
-/* Return non-zero iff PC belongs to the dynamic linker resolution
+/* Return true iff PC belongs to the dynamic linker resolution
    code, a PLT entry, or a lazy binding stub.  */
 
-static int
+static bool
 mips_linux_in_dynsym_resolve_code (CORE_ADDR pc)
 {
   /* Check whether PC is in the dynamic linker.  This also checks
      whether it is in the .plt section, used by non-PIC executables.  */
   if (svr4_in_dynsym_resolve_code (pc))
-    return 1;
+    return true;
 
   /* Likewise for the stubs.  They live in the .MIPS.stubs section these
      days, so we check if the PC is within, than fall back to a pattern
      match.  */
   if (mips_linux_in_dynsym_stub (pc))
-    return 1;
+    return true;
 
-  return 0;
+  return false;
 }
 
 /* See the comments for SKIP_SOLIB_RESOLVER at the top of infrun.c,
index 41aacc372bcf96e76aa7488ef397ff3aea7fdbbb..4a3475862a95a8290d090795c0e097aebd2ed7e3 100644 (file)
@@ -989,10 +989,10 @@ extern struct obj_section *find_pc_section (CORE_ADDR pc);
 /* Return true if PC is in a section called NAME.  */
 extern bool pc_in_section (CORE_ADDR, const char *);
 
-/* Return non-zero if PC is in a SVR4-style procedure linkage table
+/* Return true  if PC is in a SVR4-style procedure linkage table
    section.  */
 
-static inline int
+static inline bool
 in_plt_section (CORE_ADDR pc)
 {
   return (pc_in_section (pc, ".plt")
index c998fc2dbe1bcc10c4ece3d6ffb59e8a8af22b9e..b3cc4d5485e2e2a5d1cf413a6926b667ef57518d 100644 (file)
@@ -310,22 +310,22 @@ static const struct ppc_insn_pattern powerpc32_plt_stub_so_2[] =
    section.  For secure PLT, stub is in .text and we need to check
    instruction patterns.  */
 
-static int
+static bool
 powerpc_linux_in_dynsym_resolve_code (CORE_ADDR pc)
 {
   /* Check whether PC is in the dynamic linker.  This also checks
      whether it is in the .plt section, used by non-PIC executables.  */
   if (svr4_in_dynsym_resolve_code (pc))
-    return 1;
+    return true;
 
   /* Check if we are in the resolver.  */
   bound_minimal_symbol sym = lookup_minimal_symbol_by_pc (pc);
-  if (sym.minsym != NULL
-      && (strcmp (sym.minsym->linkage_name (), "__glink") == 0
-         || strcmp (sym.minsym->linkage_name (), "__glink_PLTresolve") == 0))
-    return 1;
 
-  return 0;
+  if (sym.minsym == nullptr)
+    return false;
+
+  return (strcmp (sym.minsym->linkage_name (), "__glink") == 0
+         || strcmp (sym.minsym->linkage_name (), "__glink_PLTresolve") == 0);
 }
 
 /* Follow PLT stub to actual routine.
index fb9c781f51067d4a16b83674c1551da8d21de471..4eb89e9341b9ee09df5d1eb979b3eab725b4256c 100644 (file)
@@ -499,10 +499,10 @@ solib_aix_open_symbol_file_object (int from_tty)
 
 /* Implement the "in_dynsym_resolve_code" solib_ops method.  */
 
-static int
+static bool
 solib_aix_in_dynsym_resolve_code (CORE_ADDR pc)
 {
-  return 0;
+  return false;
 }
 
 /* Implement the "bfd_open" solib_ops method.  */
index c0c6fb5552491cad7759a6b5cddd6c8191790c06..86a71bb228091384d9b2f356b5f343959c1afcb7 100644 (file)
@@ -363,13 +363,13 @@ darwin_read_exec_load_addr_at_init (struct darwin_info *info)
   return darwin_validate_exec_header (load_addr);
 }
 
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
+/* Return true if PC lies in the dynamic symbol resolution code of the
    run time loader.  */
 
-static int
+static bool
 darwin_in_dynsym_resolve_code (CORE_ADDR pc)
 {
-  return 0;
+  return false;
 }
 
 /* A wrapper for bfd_mach_o_fat_extract that handles reference
index 0d8b067a20fabb8cd22cf2f4b4b58b7688311f36..ed6580eca0fadda9954ccda278ca9879b5e2d4e4 100644 (file)
@@ -629,10 +629,10 @@ dsbt_current_sos (void)
   return sos;
 }
 
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
+/* Return true if PC lies in the dynamic symbol resolution code of the
    run time loader.  */
 
-static int
+static bool
 dsbt_in_dynsym_resolve_code (CORE_ADDR pc)
 {
   dsbt_info *info = get_dsbt_info (current_program_space);
index 124b5eba590878816878b46a867038c7805cf36f..0ccbf90330973f72d0470a0a23cd9e17127fc75b 100644 (file)
@@ -423,7 +423,7 @@ static CORE_ADDR interp_text_sect_high;
 static CORE_ADDR interp_plt_sect_low;
 static CORE_ADDR interp_plt_sect_high;
 
-static int
+static bool
 frv_in_dynsym_resolve_code (CORE_ADDR pc)
 {
   return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
index 4aa30858df5f2c8e859ee9ea91d8d67b94d098a3..5a8b08edacda0282af48ae93d2a84bf0c401965b 100644 (file)
@@ -1802,10 +1802,10 @@ match_main (const char *soname)
   return (0);
 }
 
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
+/* Return true if PC lies in the dynamic symbol resolution code of the
    SVR4 run time loader.  */
 
-int
+bool
 svr4_in_dynsym_resolve_code (CORE_ADDR pc)
 {
   struct svr4_info *info = get_svr4_info (current_program_space);
index 0a04d9c2ee668bee3cf1783a4598c53458f95ef5..1ff9be78a43d993584c18cce7aa9733bf32be2ae 100644 (file)
@@ -108,9 +108,9 @@ extern CORE_ADDR svr4_fetch_objfile_link_map (struct objfile *objfile);
 extern struct link_map_offsets *svr4_ilp32_fetch_link_map_offsets (void);
 extern struct link_map_offsets *svr4_lp64_fetch_link_map_offsets (void);
 
-/* Return 1 if PC lies in the dynamic symbol resolution code of the
+/* Return true if PC lies in the dynamic symbol resolution code of the
    SVR4 run time loader.  */
-int svr4_in_dynsym_resolve_code (CORE_ADDR pc);
+bool svr4_in_dynsym_resolve_code (CORE_ADDR pc);
 
 /* For the MUSL C library, given link map address LM_ADDR, return the
    corresponding TLS module id, or 0 if not found.  */
index 41a7f8eb68f7c496132ee76b9bcd6ef2599cfff1..7ccb87daa9564e323d3cf697f5fab5ed17478ec6 100644 (file)
@@ -390,7 +390,7 @@ solib_target_open_symbol_file_object (int from_tty)
   return 0;
 }
 
-static int
+static bool
 solib_target_in_dynsym_resolve_code (CORE_ADDR pc)
 {
   /* We don't have a range of addresses for the dynamic linker; there
index 1a105bd7cb9b057f11b643a2634b526999fec4d1..8a997a40c22f5491577aec2f4497bfa13fe0d996 100644 (file)
@@ -1324,9 +1324,8 @@ solib_create_inferior_hook (int from_tty)
 bool
 in_solib_dynsym_resolve_code (CORE_ADDR pc)
 {
-  const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
-
-  return ops->in_dynsym_resolve_code (pc) != 0;
+  return (gdbarch_so_ops (current_inferior ()->arch ())
+         ->in_dynsym_resolve_code (pc));
 }
 
 /* Implements the "sharedlibrary" command.  */
index 4955eedd629cfe3cac623f9e797835fa65358a46..f5922aa5f5d6e319671c9dc14514d3b434180ba5 100644 (file)
@@ -150,7 +150,7 @@ struct solib_ops
 
   /* Determine if PC lies in the dynamic symbol resolution code of
      the run time loader.  */
-  int (*in_dynsym_resolve_code) (CORE_ADDR pc);
+  bool (*in_dynsym_resolve_code) (CORE_ADDR pc);
 
   /* Find and open shared library binary file.  */
   gdb_bfd_ref_ptr (*bfd_open) (const char *pathname);