From 50ca09324ae2132f9bb73324482e4c0f5eaeddd1 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Fri, 28 Feb 2025 14:27:12 -0500 Subject: [PATCH] gdb/dwarf: remove unnecessary abfd parameter in dwarf2_per_bfd::locate_sections The parameter `abfd` is always the same as `this->obfd`, there is no need to pass it as a parameter. Change-Id: If7ad58ad4efdf6b070cbf2b8a73436bd8b452fa6 Approved-By: Tom Tromey --- 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 1203cbd0ab6..29af3dbf24b 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 ccc8f4f8e8c..43d0e5d2ebf 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -517,8 +517,7 @@ private: /* 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. */ -- 2.39.5