[PATCH] gdb/dwarf: remove unnecessary abfd parameter in dwarf2_per_bfd::locate_sections

simon.marchi@polymtl.ca simon.marchi@polymtl.ca
Fri Feb 28 19:27:12 GMT 2025


From: Simon Marchi <simon.marchi@efficios.com>

The parameter `abfd` is always the same as `this->obfd`, there is no
need to pass it as a parameter.

Change-Id: If7ad58ad4efdf6b070cbf2b8a73436bd8b452fa6
---
 gdb/dwarf2/read.c | 8 ++++----
 gdb/dwarf2/read.h | 3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index b377b07cf7ce..704962afdcdf 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1261,7 +1261,7 @@ dwarf2_per_bfd::dwarf2_per_bfd (bfd *obfd, const dwarf2_debug_sections *names,
     names = &dwarf2_elf_names;
 
   for (asection *sec = obfd->sections; sec != NULL; sec = sec->next)
-    locate_sections (obfd, sec, *names);
+    this->locate_sections (sec, *names);
 }
 
 dwarf2_per_bfd::~dwarf2_per_bfd ()
@@ -1422,7 +1422,7 @@ dwarf2_has_info (struct objfile *objfile,
 /* See declaration.  */
 
 void
-dwarf2_per_bfd::locate_sections (bfd *abfd, asection *sectp,
+dwarf2_per_bfd::locate_sections (asection *sectp,
 				 const dwarf2_debug_sections &names)
 {
   flagword aflag = bfd_section_flags (sectp);
@@ -1430,13 +1430,13 @@ dwarf2_per_bfd::locate_sections (bfd *abfd, asection *sectp,
   if ((aflag & SEC_HAS_CONTENTS) == 0)
     {
     }
-  else if (bfd_section_size_insane (abfd, sectp))
+  else if (bfd_section_size_insane (this->obfd, sectp))
     {
       bfd_size_type size = sectp->size;
       warning (_("Discarding section %s which has an invalid size (%s) "
 		 "[in module %s]"),
 	       bfd_section_name (sectp), phex_nz (size, sizeof (size)),
-	       bfd_get_filename (abfd));
+	       this->filename ());
     }
   else if (names.info.matches (sectp->name))
     {
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index fcb7d403d9fa..e8f9410ed966 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -519,8 +519,7 @@ struct dwarf2_per_bfd
   /* This function is mapped across the sections and remembers the
      offset and size of each of the debugging sections we are
      interested in.  */
-  void locate_sections (bfd *abfd, asection *sectp,
-			const dwarf2_debug_sections &names);
+  void locate_sections (asection *sectp, const dwarf2_debug_sections &names);
 
 public:
   /* The corresponding BFD.  */

base-commit: cb9995e8d8fab4e48ba202fe8456e68cc130490a
-- 
2.48.1



More information about the Gdb-patches mailing list