]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/solib: remove so_ prefix from so_name and so_original_name
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 26 May 2025 20:26:10 +0000 (16:26 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 29 May 2025 14:44:58 +0000 (10:44 -0400)
The `so_` prefix is unnecessary here, it's already clear by the fact
that they are field of the solib type (and previously so_list).

Change-Id: I2c6773afc121d7631901e602913ea8a068840d0b
Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
14 files changed:
gdb/break-catch-load.c
gdb/breakpoint.c
gdb/bsd-uthread.c
gdb/mi/mi-cmd-file.c
gdb/mi/mi-interp.c
gdb/solib-aix.c
gdb/solib-darwin.c
gdb/solib-dsbt.c
gdb/solib-frv.c
gdb/solib-rocm.c
gdb/solib-svr4.c
gdb/solib-target.c
gdb/solib.c
gdb/solist.h

index 5e290fd7a22a45059d1020a268f30419d91afd57..e084fbbcd5ccea0076554590f7d3bee46959dc88 100644 (file)
@@ -119,7 +119,7 @@ solib_catchpoint::check_status (struct bpstat *bs)
       for (solib *iter : current_program_space->added_solibs)
        {
          if (!regex
-             || compiled->exec (iter->so_name.c_str (), 0, nullptr, 0) == 0)
+             || compiled->exec (iter->name.c_str (), 0, nullptr, 0) == 0)
            return;
        }
     }
index abae16fe23f5d37563df78e0913561e1d904fb5c..7735574f3e22b2aaab99c8e2d10a5f3bf08dc5f3 100644 (file)
@@ -5137,7 +5137,7 @@ print_solib_event (bool is_catchpoint)
          if (!first)
            current_uiout->text ("    ");
          first = false;
-         current_uiout->field_string ("library", iter->so_name);
+         current_uiout->field_string ("library", iter->name);
          current_uiout->text ("\n");
        }
     }
@@ -8145,7 +8145,7 @@ disable_breakpoints_in_unloaded_shlib (program_space *pspace, const solib &solib
              target_terminal::ours_for_output ();
              warning (_("Temporarily disabling breakpoints "
                         "for unloaded shared library \"%s\""),
-                      solib.so_name.c_str ());
+                      solib.name.c_str ());
              disabled_shlib_breaks = true;
            }
        }
index 341aea98fb773990fa55b18dcde21dcea19b4322..13811923f41d24b1c66747bfeb5a75edd7f64f86 100644 (file)
@@ -280,13 +280,13 @@ bsd_uthread_solib_loaded (solib &so)
 
   for (names = bsd_uthread_solib_names; *names; names++)
     {
-      if (startswith (so.so_original_name, *names))
+      if (startswith (so.original_name, *names))
        {
          solib_read_symbols (so, 0);
 
          if (bsd_uthread_activate (so.objfile))
            {
-             bsd_uthread_solib_name = so.so_original_name;
+             bsd_uthread_solib_name = so.original_name;
              return;
            }
        }
@@ -300,7 +300,7 @@ bsd_uthread_solib_unloaded (program_space *pspace, const solib &so,
   if (bsd_uthread_solib_name.empty () || still_in_use)
     return;
 
-  if (so.so_original_name == bsd_uthread_solib_name)
+  if (so.original_name == bsd_uthread_solib_name)
     bsd_uthread_deactivate ();
 }
 
index 2354012f6912a149da6bea212f537660e2d80d95..a888bee958cd75bb9d7a6a9faf375f0c75f17f79 100644 (file)
@@ -163,10 +163,10 @@ mi_cmd_file_list_shared_libraries (const char *command,
 
   for (const solib &so : current_program_space->solibs ())
     {
-      if (so.so_name.empty ())
+      if (so.name.empty ())
        continue;
 
-      if (pattern != nullptr && !re_exec (so.so_name.c_str ()))
+      if (pattern != nullptr && !re_exec (so.name.c_str ()))
        continue;
 
       ui_out_emit_tuple tuple_emitter (uiout, NULL);
index ae1070eb18805428a9f9151526d37145719be42a..357fc016a1ebcdbccb1c420acb942e9064023a78 100644 (file)
@@ -726,9 +726,9 @@ mi_output_solib_attribs_1 (ui_out *uiout, const solib &solib,
 {
   gdbarch *gdbarch = current_inferior ()->arch ();
 
-  uiout->field_string ("id", solib.so_original_name);
-  uiout->field_string ("target-name", solib.so_original_name);
-  uiout->field_string ("host-name", solib.so_name);
+  uiout->field_string ("id", solib.original_name);
+  uiout->field_string ("target-name", solib.original_name);
+  uiout->field_string ("host-name", solib.name);
   if (include_symbols_loaded_p)
     uiout->field_signed ("symbols-loaded", solib.symbols_loaded);
   if (!gdbarch_has_global_solist (current_inferior ()->arch ()))
index 0ad25f18cdcf25bd0ba0d017e5ecf2cf072ad391..0d8bb69a96e7c521472711ca4906c30b48e14e95 100644 (file)
@@ -482,8 +482,8 @@ solib_aix_current_sos ()
 
       /* Add it to the list.  */
       auto &new_solib = sos.emplace_back ();
-      new_solib.so_original_name = so_name;
-      new_solib.so_name = so_name;
+      new_solib.original_name = so_name;
+      new_solib.name = so_name;
       new_solib.lm_info = std::make_unique<lm_info_aix> (info);
     }
 
index 368f4014ba599076a8a2bb8fbe16667e3e37dc38..ef033d0cda37407bdb1e1a86fb88a89bf148b565 100644 (file)
@@ -264,8 +264,8 @@ darwin_current_sos ()
 
       auto li = std::make_unique<lm_info_darwin> ();
 
-      newobj.so_name = file_path.get ();
-      newobj.so_original_name = newobj.so_name;
+      newobj.name = file_path.get ();
+      newobj.original_name = newobj.name;
       li->lm_addr = load_addr;
 
       newobj.lm_info = std::move (li);
index 3832a7a63337d6b14cebfc858c36ee79479e39bb..d1735f268fcf041d084875816854ca07abc05984 100644 (file)
@@ -612,8 +612,8 @@ dsbt_current_sos (void)
                gdb_printf (gdb_stdlog, "current_sos: name = %s\n",
                            name_buf.get ());
 
-             sop.so_name = name_buf.get ();
-             sop.so_original_name = sop.so_name;
+             sop.name = name_buf.get ();
+             sop.original_name = sop.name;
            }
 
          sop.lm_info = std::move (li);
index bf13d365d1b2e996cf8852a85ecbbd44d97718b8..2b39d152141f8541d7dfdaae3aeddd2f4d66cfe0 100644 (file)
@@ -397,8 +397,8 @@ frv_current_sos ()
            warning (_("Can't read pathname for link map entry."));
          else
            {
-             sop.so_name = name_buf.get ();
-             sop.so_original_name = sop.so_name;
+             sop.name = name_buf.get ();
+             sop.original_name = sop.name;
            }
        }
       else
index 27b404c83e5bbb034f46779d0ef51fb4294dbbfc..94aa68b8667de3a1ba2589ab97cf81b1accd83e9 100644 (file)
@@ -214,8 +214,8 @@ so_list_from_rocm_sos (const std::vector<rocm_so> &sos)
       auto &newobj = dst.emplace_back ();
 
       newobj.lm_info = std::make_unique<lm_info_svr4> (*so.lm_info);
-      newobj.so_name = so.name;
-      newobj.so_original_name = so.unique_name;
+      newobj.name = so.name;
+      newobj.original_name = so.unique_name;
     }
 
   return dst;
index a1dc13cb6ff2f817d68bc2bcbb7e5d2e63c3db08..6a1cc10f0f6dec1661e97d4c1cdc359b239ab3a2 100644 (file)
@@ -194,8 +194,8 @@ svr4_same (const solib &gdb, const solib &inferior)
   auto *lmi
     = gdb::checked_static_cast<const lm_info_svr4 *> (inferior.lm_info.get ());
 
-  return svr4_same (gdb.so_original_name.c_str (),
-                   inferior.so_original_name.c_str (), *lmg, *lmi);
+  return svr4_same (gdb.original_name.c_str (),
+                   inferior.original_name.c_str (), *lmg, *lmi);
 }
 
 static lm_info_svr4_up
@@ -317,7 +317,7 @@ lm_addr_check (const solib &so, bfd *abfd)
                gdb_printf (_("Using PIC (Position Independent Code) "
                              "prelink displacement %s for \"%s\".\n"),
                            paddress (current_inferior ()->arch (), l_addr),
-                           so.so_name.c_str ());
+                           so.name.c_str ());
            }
          else
            {
@@ -333,7 +333,7 @@ lm_addr_check (const solib &so, bfd *abfd)
              warning (_(".dynamic section for \"%s\" "
                         "is not at the expected address "
                         "(wrong library or version mismatch?)"),
-                        so.so_name.c_str ());
+                        so.name.c_str ());
            }
        }
 
@@ -1057,8 +1057,8 @@ so_list_from_svr4_sos (const std::vector<svr4_so> &sos)
     {
       auto &newobj = dst.emplace_back ();
 
-      newobj.so_name = so.name;
-      newobj.so_original_name = so.name;
+      newobj.name = so.name;
+      newobj.original_name = so.name;
       newobj.lm_info = std::make_unique<lm_info_svr4> (*so.lm_info);
     }
 
@@ -1259,8 +1259,8 @@ svr4_default_sos (svr4_info *info)
   auto &newobj = sos.emplace_back ();
 
   newobj.lm_info = std::move (li);
-  newobj.so_name = info->debug_loader_name;
-  newobj.so_original_name = newobj.so_name;
+  newobj.name = info->debug_loader_name;
+  newobj.original_name = newobj.name;
 
   return sos;
 }
@@ -2623,7 +2623,7 @@ enable_break (struct svr4_info *info, int from_tty)
         address from the shared library table.  */
       for (const solib &so : current_program_space->solibs ())
        {
-         if (svr4_same_1 (interp_name, so.so_original_name.c_str ()))
+         if (svr4_same_1 (interp_name, so.original_name.c_str ()))
            {
              load_addr_found = 1;
              loader_found_in_list = 1;
@@ -3656,7 +3656,7 @@ find_debug_base_for_solib (const solib *solib)
       const std::vector<svr4_so> &sos = tuple.second;
 
       for (const svr4_so &so : sos)
-       if (svr4_same (solib->so_original_name.c_str (), so.name.c_str (),
+       if (svr4_same (solib->original_name.c_str (), so.name.c_str (),
                       *lm_info, *so.lm_info))
          return debug_base;
     }
@@ -3798,14 +3798,14 @@ svr4_get_solibs_in_ns (int nsid)
       /* This is inspired by the svr4_same, by finding the svr4_so object
         in the map, and then double checking if the lm_info is considered
         the same.  */
-      if (namespace_solibs.count (so.so_original_name) > 0
-         && namespace_solibs[so.so_original_name]->l_addr_inferior
+      if (namespace_solibs.count (so.original_name) > 0
+         && namespace_solibs[so.original_name]->l_addr_inferior
              == lm_inferior->l_addr_inferior)
        {
          ns_solibs.push_back (&so);
          /* Remove the SO from the map, so that we don't end up
             printing the dynamic linker multiple times.  */
-         namespace_solibs.erase (so.so_original_name);
+         namespace_solibs.erase (so.original_name);
        }
     }
 
index f304431b8148ae4489c984974c867458061de8de..42979323c83da639cc318638ad61baac3e507ce8 100644 (file)
@@ -248,8 +248,8 @@ solib_target_current_sos (void)
       auto &new_solib = sos.emplace_back ();
 
       /* We don't need a copy of the name in INFO anymore.  */
-      new_solib.so_name = std::move (info->name);
-      new_solib.so_original_name = new_solib.so_name;
+      new_solib.name = std::move (info->name);
+      new_solib.original_name = new_solib.name;
       new_solib.lm_info = std::move (info);
     }
 
@@ -291,7 +291,7 @@ solib_target_relocate_section_addresses (solib &so, target_section *sec)
          if (num_alloc_sections != li->section_bases.size ())
            warning (_("\
 Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
-                    so.so_name.c_str ());
+                    so.name.c_str ());
          else
            {
              int bases_index = 0;
@@ -334,7 +334,7 @@ Could not relocate shared library \"%s\": wrong number of ALLOC sections"),
 
          if (data == NULL)
            warning (_("\
-Could not relocate shared library \"%s\": no segments"), so.so_name.c_str ());
+Could not relocate shared library \"%s\": no segments"), so.name.c_str ());
          else
            {
              ULONGEST orig_delta;
@@ -345,7 +345,7 @@ Could not relocate shared library \"%s\": no segments"), so.so_name.c_str ());
                                                    li->segment_bases.size (),
                                                    li->segment_bases.data ()))
                warning (_("\
-Could not relocate shared library \"%s\": bad offsets"), so.so_name.c_str ());
+Could not relocate shared library \"%s\": bad offsets"), so.name.c_str ());
 
              /* Find the range of addresses to report for this library in
                 "info sharedlibrary".  Report any consecutive segments
index 0f29edb6bca3cfebecad17025ecdaabd9e6e75bc..1c267cf973f8d64caefb6a408d2419dec45e427f 100644 (file)
@@ -485,7 +485,7 @@ solib_map_sections (solib &so)
 {
   const solib_ops *ops = gdbarch_so_ops (current_inferior ()->arch ());
 
-  gdb::unique_xmalloc_ptr<char> filename (tilde_expand (so.so_name.c_str ()));
+  gdb::unique_xmalloc_ptr<char> filename (tilde_expand (so.name.c_str ()));
   gdb_bfd_ref_ptr abfd (ops->bfd_open (filename.get ()));
 
   /* If we have a core target then the core target might have some helpful
@@ -498,7 +498,7 @@ solib_map_sections (solib &so)
      its filename.  */
   std::optional<CORE_ADDR> solib_addr = ops->find_solib_addr (so);
   std::optional <const core_target_mapped_file_info> mapped_file_info
-    = core_target_find_mapped_file (so.so_name.c_str (), solib_addr);
+    = core_target_find_mapped_file (so.name.c_str (), solib_addr);
 
   /* If we already know the build-id of this solib from a core file, verify
      it matches ABFD's build-id.  If there is a mismatch or the solib wasn't
@@ -527,7 +527,7 @@ solib_map_sections (solib &so)
          if (abfd == nullptr)
            abfd = find_objfile_by_build_id (current_program_space,
                                             mapped_file_info->build_id (),
-                                            so.so_name.c_str ());
+                                            so.name.c_str ());
 
          if (abfd == nullptr && mismatch)
            {
@@ -545,14 +545,14 @@ solib_map_sections (solib &so)
   /* Leave bfd open, core_xfer_memory and "info files" need it.  */
   so.abfd = std::move (abfd);
 
-  /* Copy the full path name into so_name, allowing symbol_file_add
+  /* Copy the full path name into `so.name`, allowing symbol_file_add
      to find it later.  This also affects the =library-loaded GDB/MI
      event, and in particular the part of that notification providing
      the library's host-side path.  If we let the target dictate
      that objfile's path, and the target is different from the host,
      GDB/MI will not provide the correct host-side path.  */
 
-  so.so_name = bfd_get_filename (so.abfd.get ());
+  so.name = bfd_get_filename (so.abfd.get ());
   so.sections = build_section_table (so.abfd.get ());
 
   for (target_section &p : so.sections)
@@ -600,7 +600,7 @@ solib::clear ()
 
   /* Restore the target-supplied file name.  SO_NAME may be the path
      of the symbol file.  */
-  this->so_name = this->so_original_name;
+  this->name = this->original_name;
 
   /* Do the same for target-specific data.  */
   if (ops->clear_so != NULL)
@@ -634,7 +634,7 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
          so.objfile = nullptr;
          for (objfile *objfile : current_program_space->objfiles ())
            {
-             if (filename_cmp (objfile_name (objfile), so.so_name.c_str ())
+             if (filename_cmp (objfile_name (objfile), so.name.c_str ())
                    == 0
                  && objfile->addr_low == so.addr_low)
                {
@@ -648,7 +648,7 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
                = build_section_addr_info_from_section_table (so.sections);
              gdb_bfd_ref_ptr tmp_bfd = so.abfd;
              so.objfile
-               = symbol_file_add_from_bfd (tmp_bfd, so.so_name.c_str (),
+               = symbol_file_add_from_bfd (tmp_bfd, so.name.c_str (),
                                            flags, &sap, OBJF_SHARED, nullptr);
              so.objfile->addr_low = so.addr_low;
            }
@@ -660,7 +660,7 @@ solib_read_symbols (solib &so, symfile_add_flags flags)
          exception_fprintf (gdb_stderr, e,
                             _ ("Error while reading shared"
                                " library symbols for %s:\n"),
-                            so.so_name.c_str ());
+                            so.name.c_str ());
        }
 
       return true;
@@ -781,8 +781,8 @@ update_solib_list (int from_tty)
            }
          else
            {
-             if (!filename_cmp (gdb_iter->so_original_name.c_str (),
-                                inferior_iter->so_original_name.c_str ()))
+             if (!filename_cmp (gdb_iter->original_name.c_str (),
+                                inferior_iter->original_name.c_str ()))
                break;
            }
        }
@@ -814,7 +814,7 @@ update_solib_list (int from_tty)
              && !still_in_use)
            gdb_iter->objfile->unlink ();
 
-         current_program_space->deleted_solibs.push_back (gdb_iter->so_name);
+         current_program_space->deleted_solibs.push_back (gdb_iter->name);
 
          /* Some targets' section tables might be referring to
             sections from so.abfd; remove them.  */
@@ -844,7 +844,7 @@ update_solib_list (int from_tty)
                {
                  not_found++;
                  if (not_found_filename == NULL)
-                   not_found_filename = new_so.so_original_name.c_str ();
+                   not_found_filename = new_so.original_name.c_str ();
                }
            }
 
@@ -918,7 +918,7 @@ libpthread_name_p (const char *name)
 static bool
 libpthread_solib_p (const solib &so)
 {
-  return libpthread_name_p (so.so_name.c_str ());
+  return libpthread_name_p (so.name.c_str ());
 }
 
 /* Read in symbolic information for any shared objects whose names
@@ -968,7 +968,7 @@ solib_add (const char *pattern, int from_tty, int readsyms)
       add_flags |= SYMFILE_VERBOSE;
 
     for (solib &gdb : current_program_space->solibs ())
-      if (!pattern || re_exec (gdb.so_name.c_str ()))
+      if (!pattern || re_exec (gdb.name.c_str ()))
        {
          /* Normally, we would read the symbols from that library
             only if READSYMS is set.  However, we're making a small
@@ -987,7 +987,7 @@ solib_add (const char *pattern, int from_tty, int readsyms)
                  if (pattern && (from_tty || info_verbose))
                    gdb_printf (_ ("Symbols already loaded for %ps\n"),
                                styled_string (file_name_style.style (),
-                                              gdb.so_name.c_str ()));
+                                              gdb.name.c_str ()));
                }
              else if (solib_read_symbols (gdb, add_flags))
                loaded_any_symbols = true;
@@ -1056,7 +1056,7 @@ print_solib_list_table (std::vector<const solib *> solib_list,
 
     for (const solib *so : solib_list)
       {
-       if (so->so_name.empty ())
+       if (so->name.empty ())
          continue;
 
        ui_out_emit_tuple tuple_emitter (uiout, "lib");
@@ -1093,7 +1093,7 @@ print_solib_list_table (std::vector<const solib *> solib_list,
        else
          uiout->field_string ("syms-read", so->symbols_loaded ? "Yes" : "No");
 
-       uiout->field_string ("name", so->so_name, file_name_style.style ());
+       uiout->field_string ("name", so->name, file_name_style.style ());
 
        uiout->text ("\n");
       }
@@ -1130,9 +1130,9 @@ info_sharedlibrary_command (const char *pattern, int from_tty)
   std::vector<const solib *> print_libs;
   for (const solib &so : current_program_space->solibs ())
     {
-      if (!so.so_name.empty ())
+      if (!so.name.empty ())
        {
-         if (pattern && !re_exec (so.so_name.c_str ()))
+         if (pattern && !re_exec (so.name.c_str ()))
            continue;
          print_libs.push_back (&so);
        }
@@ -1267,7 +1267,7 @@ solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
 {
   for (const solib &so : pspace->so_list)
     if (solib_contains_address_p (so, address))
-      return so.so_name.c_str ();
+      return so.name.c_str ();
 
   return nullptr;
 }
@@ -1414,7 +1414,7 @@ reload_shared_libraries_1 (int from_tty)
        add_flags |= SYMFILE_VERBOSE;
 
       gdb::unique_xmalloc_ptr<char> filename (
-       tilde_expand (so.so_original_name.c_str ()));
+       tilde_expand (so.original_name.c_str ()));
       gdb_bfd_ref_ptr abfd (solib_bfd_open (filename.get ()));
       if (abfd != NULL)
        found_pathname = bfd_get_filename (abfd.get ());
@@ -1423,7 +1423,7 @@ reload_shared_libraries_1 (int from_tty)
         symbol file, close that.  */
       if ((found_pathname == NULL && was_loaded)
          || (found_pathname != NULL
-             && filename_cmp (found_pathname, so.so_name.c_str ()) != 0))
+             && filename_cmp (found_pathname, so.name.c_str ()) != 0))
        {
          if (so.objfile && !(so.objfile->flags & OBJF_USERLOADED)
              && !solib_used (current_program_space, so))
@@ -1436,7 +1436,7 @@ reload_shared_libraries_1 (int from_tty)
         file, open it.  */
       if (found_pathname != NULL
          && (!was_loaded
-             || filename_cmp (found_pathname, so.so_name.c_str ()) != 0))
+             || filename_cmp (found_pathname, so.name.c_str ()) != 0))
        {
          bool got_error = false;
 
index 6ab5a06ccc9002ba88a6f3f36a267d1223ae2508..20ec5a380e51457a7cbe729e5b631eb6a0635ea9 100644 (file)
@@ -65,10 +65,10 @@ struct solib : intrusive_list_node<solib>
      which needs to be looked up in LD_LIBRARY_PATH, etc.  We use it
      to tell which entries in the inferior's dynamic linker's link
      map we've already loaded.  */
-  std::string so_original_name;
+  std::string original_name;
 
   /* Shared object file name, expanded to something GDB can open.  */
-  std::string so_name;
+  std::string name;
 
   /* The following fields of the structure are built from
      information gathered from the shared object file itself, and
@@ -139,8 +139,7 @@ struct solib_ops
   /* Given two so_list objects, one from the GDB thread list
      and another from the list returned by current_sos, return 1
      if they represent the same library.
-     Falls back to using strcmp on so_original_name field when set
-     to NULL.  */
+     Falls back to using strcmp on ORIGINAL_NAME when set to nullptr.  */
   int (*same) (const solib &gdb, const solib &inferior);
 
   /* Return whether a region of memory must be kept in a core file