From: Jan Vrany <jan.vrany@labware.com>
To: gdb-patches@sourceware.org
Cc: Jan Vrany <jan.vrany@labware.com>
Subject: [PATCH 2/7] gdb: update expanded_symbols_functions::find_pc_sect_compunit_symtab
Date: Thu, 19 Feb 2026 18:56:33 +0000 [thread overview]
Message-ID: <20260219185638.360694-3-jan.vrany@labware.com> (raw)
In-Reply-To: <20260219185638.360694-1-jan.vrany@labware.com>
This commit updates expanded_symbols_functions::find_pc_sect_compunit_symtab
to search all compunits rather than just returning null.
The original implementation (just return null) was based on reasoning
that its would suffice since find_compunit_symtab_for_pc_sect walks
all CUs anyway [1]. This commit is a preparation to simplify
find_compunit_symtab_for_pc_sect by removing that code.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33829
[1] https://inbox.sourceware.org/gdb-patches/874iqoogoa.fsf@tromey.com/
---
gdb/expanded-symbol.c | 18 ++++++++++++++++++
gdb/expanded-symbol.h | 8 +-------
2 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/gdb/expanded-symbol.c b/gdb/expanded-symbol.c
index 050608795f9..3c7f9019beb 100644
--- a/gdb/expanded-symbol.c
+++ b/gdb/expanded-symbol.c
@@ -18,6 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
+#include "block.h"
#include "objfiles.h"
#include "symtab.h"
#include "source.h"
@@ -113,3 +114,20 @@ expanded_symbols_functions::find_symbol_by_address (objfile *objfile,
return nullptr;
}
+
+/* See expanded-symbol.h. */
+
+compunit_symtab *
+expanded_symbols_functions::find_pc_sect_compunit_symtab
+ (objfile *objfile, bound_minimal_symbol msymbol, CORE_ADDR pc,
+ obj_section *section, int warn_if_readin)
+{
+ for (compunit_symtab &symtab : objfile->compunits ())
+ {
+ const blockvector *bv = symtab.blockvector ();
+ if (bv != nullptr && bv->contains (pc))
+ return &symtab;
+ }
+
+ return nullptr;
+}
diff --git a/gdb/expanded-symbol.h b/gdb/expanded-symbol.h
index c088d74f7e5..dc2e9814b3c 100644
--- a/gdb/expanded-symbol.h
+++ b/gdb/expanded-symbol.h
@@ -71,13 +71,7 @@ struct expanded_symbols_functions : public quick_symbol_functions
compunit_symtab *find_pc_sect_compunit_symtab
(objfile *objfile, bound_minimal_symbol msymbol, CORE_ADDR pc,
- obj_section *section, int warn_if_readin) override
- {
- /* Simply returning NULL here is okay since the (only) caller
- find_compunit_symtab_for_pc_sect iterates over existing CUs
- anyway. */
- return nullptr;
- }
+ obj_section *section, int warn_if_readin) override;
symbol *find_symbol_by_address (objfile *objfile, CORE_ADDR address)
override;
--
2.51.0
next prev parent reply other threads:[~2026-02-19 18:58 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-19 18:56 [PATCH 0/7] Remove addrmap from blockvector Jan Vrany
2026-02-19 18:56 ` [PATCH 1/7] gdb: implement readnow_functions::find_pc_sect_compunit_symtab Jan Vrany
2026-02-19 20:01 ` Tom Tromey
2026-02-20 12:36 ` Jan Vraný
2026-02-20 14:25 ` Tom Tromey
2026-02-20 15:57 ` Jan Vraný
2026-02-19 18:56 ` Jan Vrany [this message]
2026-02-19 20:02 ` [PATCH 2/7] gdb: update expanded_symbols_functions::find_pc_sect_compunit_symtab Tom Tromey
2026-02-19 18:56 ` [PATCH 3/7] gdb: simplify find_compunit_symtab_for_pc_sect Jan Vrany
2026-02-19 20:02 ` Tom Tromey
2026-02-20 12:40 ` Jan Vraný
2026-02-20 14:25 ` Tom Tromey
2026-02-26 15:00 ` Jan Vraný
2026-02-19 18:56 ` [PATCH 4/7] gdb: do not set blockvector address map Jan Vrany
2026-02-19 20:03 ` Tom Tromey
2026-02-20 12:42 ` Jan Vraný
2026-02-19 18:56 ` [PATCH 5/7] gdb: update blockvector::lookup to handle non-contiguous blocks Jan Vrany
2026-02-19 20:06 ` Tom Tromey
2026-02-19 20:20 ` Tom Tromey
2026-02-20 13:03 ` Jan Vraný
2026-02-20 16:38 ` Tom Tromey
2026-03-03 11:06 ` Jan Vraný
2026-03-09 15:52 ` Jan Vraný
2026-02-19 18:56 ` [PATCH 6/7] gdb: remove address map from struct blockvector Jan Vrany
2026-02-19 18:56 ` [PATCH 7/7] gdb: add unit test for blockvector::lookup of non-contiguous blocks Jan Vrany
2026-02-19 20:12 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260219185638.360694-3-jan.vrany@labware.com \
--to=jan.vrany@labware.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox