[PATCH v2 09/13] gdb: implement readnow_functions::find_pc_sect_compunit_symtab

Jan Vrany
2025-11-24T20:10:23Z

This commit implements readnow_functions::find_pc_sect_compunit_symtab
without using DWARF data structures. This will allow readnow_functions
to be used in other cases, for example in JIT reader.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33554
---
gdb/dwarf2/read.c | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 89e06923320..0d57a2bd538 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1625,6 +1625,16 @@ struct readnow_functions : public dwarf2_base_index_functions
return true;
}

+ struct compunit_symtab *find_pc_sect_compunit_symtab
+ (struct objfile *objfile, bound_minimal_symbol msymbol, CORE_ADDR pc,
+ struct obj_section *section, int warn_if_readin) override
+ {
+ /* Simply returning NULL here is okay since the (only) caller
+ find_compunit_symtab_for_pc_sect interates over existing CUs
+ anyway. */
+ return nullptr;
+ }
+
struct symbol *find_symbol_by_address (struct objfile *objfile,
CORE_ADDR address) override
{
--
2.51.0