aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2read.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-10-22 17:28:37 -0600
committerTom Tromey <tom@tromey.com>2020-01-26 16:40:21 -0700
commit891813beaab0029c88c9eeec9c1847d68a4d6050 (patch)
treeb8f7d6ed3f2dc760bab54a5f641c044ca104cc98 /gdb/dwarf2read.h
parentc3693a1d9466bc9d3abe004e66f1b56fed22ba61 (diff)
downloadgdb-891813beaab0029c88c9eeec9c1847d68a4d6050.zip
gdb-891813beaab0029c88c9eeec9c1847d68a4d6050.tar.gz
gdb-891813beaab0029c88c9eeec9c1847d68a4d6050.tar.bz2
Introduce partial_symtab::read_symtab method
This introduces a new partial_symtab::read_symtab method, and updates the symbol readers to subclass partial_symtab and implement this method. The old read_symtab and read_symtab_private members are removed. In practice, only DWARF and CTF are truly updated to take advantage of the new setup. The other symbol readers are less actively maintained, and so this patch also introduces a "legacy_psymtab", which essentially works the same way as the old partial_symtab. (Note that, without more knowledge of the interaction between these symbol readers, fixing this to remove the new (small) overhead is not trivial, because these readers copy the read_symtab pointer between partial symtabs.) gdb/ChangeLog 2020-01-26 Tom Tromey <tom@tromey.com> * xcoffread.c (this_symtab_psymtab, read_xcoff_symtab) (xcoff_psymtab_to_symtab_1, xcoff_read_symtab) (xcoff_start_psymtab, xcoff_end_psymtab, scan_xcoff_symtab): Use legacy_symtab. * stabsread.h (dbx_end_psymtab): Use legacy_symtab. * psymtab.c (psymtab_to_symtab): Call method. (dump_psymtab): Update. * psympriv.h (struct partial_symtab): Add virtual destructor. <read_symtab>: New method. (struct legacy_symtab): New. * mdebugread.c (mdebug_read_symtab): Use legacy_psymtab. (struct pst_map) <pst>: Now a legacy_psymtab. (parse_procedure, parse_partial_symbols, psymtab_to_symtab_1) (new_psymtab): Use legacy_psymtab. * dwarf2read.h (struct dwarf2_psymtab): New. (struct dwarf2_per_cu_data) <psymtab>: Use it. * dwarf2read.c (dwarf2_create_include_psymtab) (dwarf2_build_include_psymtabs, create_type_unit_group) (create_partial_symtab, process_psymtab_comp_unit_reader) (build_type_psymtabs_reader, build_type_psymtab_dependencies) (set_partial_user): Use dwarf2_psymtab. (dwarf2_psymtab::read_symtab): Rename from dwarf2_read_symtab. (psymtab_to_symtab_1, process_full_comp_unit) (process_full_type_unit, dwarf2_ranges_read) (dwarf2_get_pc_bounds, psymtab_include_file_name) (dwarf_decode_lines): Use dwarf2_psymtab. * dwarf-index-write.c (psym_index_map): Use dwarf2_psymtab. (add_address_entry_worker, write_one_signatured_type) (recursively_count_psymbols, recursively_write_psymbols) (write_one_signatured_type, psyms_seen_size, write_gdbindex) (write_debug_names): Likewise. * dbxread.c (struct header_file_location): Take a legacy_psymtab. <pst>: Now a legacy_psymtab. (find_corresponding_bincl_psymtab): Return a legacy_psymtab. (read_dbx_symtab, start_psymtab, dbx_end_psymtab) (dbx_psymtab_to_symtab_1, read_ofile_symtab): Use legacy_psymtab. * ctfread.c (struct ctf_psymtab): New. (ctf_start_symtab, ctf_end_symtab, psymtab_to_symtab): Take a ctf_psymtab. (ctf_psymtab::read_symtab): Rename from ctf_read_symtab. (create_partial_symtab): Return a ctf_psymtab. (scan_partial_symbols): Update. Change-Id: Ia57a828786867d6ad03200af8f996f48ed15285e
Diffstat (limited to 'gdb/dwarf2read.h')
-rw-r--r--gdb/dwarf2read.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h
index bc8087b..06bd908 100644
--- a/gdb/dwarf2read.h
+++ b/gdb/dwarf2read.h
@@ -25,6 +25,7 @@
#include "filename-seen-cache.h"
#include "gdb_obstack.h"
#include "gdbsupport/hash_enum.h"
+#include "psympriv.h"
/* Hold 'maintenance (set|show) dwarf' commands. */
extern struct cmd_list_element *set_dwarf_cmdlist;
@@ -269,9 +270,28 @@ public:
dwarf2_per_objfile *get_dwarf2_per_objfile (struct objfile *objfile);
+/* A partial symtab specialized for DWARF. */
+struct dwarf2_psymtab : public partial_symtab
+{
+ dwarf2_psymtab (const char *filename, struct objfile *objfile)
+ : partial_symtab (filename, objfile)
+ {
+ }
+
+ dwarf2_psymtab (const char *filename, struct objfile *objfile,
+ CORE_ADDR addr)
+ : partial_symtab (filename, objfile, addr)
+ {
+ }
+
+ void read_symtab (struct objfile *) override;
+
+ struct dwarf2_per_cu_data *per_cu_data;
+};
+
/* Persistent data held for a compilation unit, even when not
processing it. We put a pointer to this structure in the
- read_symtab_private field of the psymtab. */
+ psymtab. */
struct dwarf2_per_cu_data
{
@@ -339,7 +359,7 @@ struct dwarf2_per_cu_data
{
/* The partial symbol table associated with this compilation unit,
or NULL for unread partial units. */
- struct partial_symtab *psymtab;
+ dwarf2_psymtab *psymtab;
/* Data needed by the "quick" functions. */
struct dwarf2_per_cu_quick_data *quick;