[PATCH v2 04/13] gdb: implement readnow_functions::find_last_source_symtab

Jan Vrany
2025-11-24T20:03:30Z

This commit implements readnow_functions::has_unexpanded_symtabs
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
Approved-By: Tom Tromey <tom@tromey.com>
---
gdb/dwarf2/read.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index bbe531c7ed3..e408f852dc0 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1543,6 +1543,14 @@ struct readnow_functions : public dwarf2_base_index_functions
return false;
}

+ struct symtab *find_last_source_symtab (struct objfile *objfile) override
+ {
+ if (objfile->compunit_symtabs.empty ())
+ return nullptr;
+ else
+ return objfile->compunit_symtabs.back ().primary_filetab ();
+ }
+
void dump (struct objfile *objfile) override
{
}
--
2.51.0