summaryrefslogtreecommitdiff
path: root/gdb/psympriv.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-10-17 12:34:53 -0600
committerTom Tromey <tom@tromey.com>2020-10-17 12:34:53 -0600
commit932539d7a35ccc15316ec8cc0ef0fefcb3c08f4d (patch)
tree0d5429e890098ea06ec1eec96cc2aafd45fe6e33 /gdb/psympriv.h
parentcfabbd351a174406fd5aa063303f5c8bf9266bbc (diff)
downloadbinutils-gdb-932539d7a35ccc15316ec8cc0ef0fefcb3c08f4d.tar.gz
Have partial symbol tables own psymbol vectors
Currently pointers to all partial symbols are stored in two vectors; and then indices into these vectors are stored in each partial_symtab. This patch changes this so that each partial symtab instead has vectors of symbols. add_psymbol_to_list can now be changed into a method on partial_symtab as well. My main motivation for doing this is that I am looking into calling sort_pst_symbols in the background. However, I haven't actually implemented this yet. (Also this may make it more feasible to also sort the static psymbols, though I haven't tried that either.) Also, though, this lets us remove the "current_global_psymbols" vector, because now the callers can simply refer directly to the psymtab that they are modifying (formerly this was implicit). The main drawback of this patch is that it increases the size of partial symtab. gdb/ChangeLog 2020-10-17 Tom Tromey <tom@tromey.com> * xcoffread.c (xcoff_end_psymtab): Use partial_symtab::empty. (scan_xcoff_symtab): Update. * psymtab.h (class psymtab_storage) <global_psymbols, static_psymbols, current_global_psymbols, current_static_psymbols>: Remove. * psymtab.c (require_partial_symbols, find_pc_sect_psymbol) (match_partial_symbol, lookup_partial_symbol): Update. (print_partial_symbols): Change parameters. (dump_psymtab, recursively_search_psymtabs) (psym_fill_psymbol_map, psym_find_compunit_symtab_by_address) (sort_pst_symbols, partial_symtab::partial_symtab): Update. (concat): Remove. (end_psymtab_common): Simplify. (append_psymbol_to_list): Change parameters. (partial_symtabs::add_psymbol): Rename from add_psymbol_to_list. (init_psymbol_list): Simplify. (maintenance_info_psymtabs, maintenance_check_psymtabs): Update. * psympriv.h (struct partial_symtab) <empty>: New method. <globals_offset, n_global_syms, statics_offset, n_static_syms>: Remove. <global_psymbols, static_psymbols>: New members. <add_psymbol>: New methods. (add_psymbol_to_list): Don't declare. (psymbol_placement): Move earlier. * mdebugread.c (parse_partial_symbols): Update. (handle_psymbol_enumerators): Change parameters. (mdebug_expand_psymtab): Update. * dwarf2/read.c (process_psymtab_comp_unit_reader) (add_partial_symbol): Update. * dwarf2/index-write.c (write_psymbols): Change parameters. (write_one_signatured_type): Update. (recursively_count_psymbols): Update. (recursively_write_psymbols): Update. (class debug_names) <recursively_write_psymbols>: Update. <write_psymbols>: Change parameters. <write_one_signatured_type>: Update. * dbxread.c (read_dbx_symtab): Update. (dbx_end_psymtab): Use partial_symtab::empty. * ctfread.c (struct ctf_context) <pst>: New member. (create_partial_symtab): Set it. (ctf_psymtab_type_cb, ctf_psymtab_var_cb): Update. (scan_partial_symbols): Use the psymtab's context. Update.
Diffstat (limited to 'gdb/psympriv.h')
-rw-r--r--gdb/psympriv.h107
1 files changed, 55 insertions, 52 deletions
diff --git a/gdb/psympriv.h b/gdb/psympriv.h
index 4622be389bd..97f9b3b596c 100644
--- a/gdb/psympriv.h
+++ b/gdb/psympriv.h
@@ -92,6 +92,15 @@ enum psymtab_search_status
PST_SEARCHED_AND_NOT_FOUND
};
+/* Specify whether a partial psymbol should be allocated on the global
+ list or the static list. */
+
+enum class psymbol_placement
+{
+ STATIC,
+ GLOBAL
+};
+
/* Each source file that has not been fully read in is represented by
a partial_symtab. This contains the information on where in the
executable the debugging symbols for a specific file are, and a
@@ -196,6 +205,48 @@ struct partial_symtab
text_high_valid = 1;
}
+ /* Return true if this symtab is empty -- meaning that it contains
+ no symbols. It may still have dependencies. */
+ bool empty () const
+ {
+ return global_psymbols.empty () && static_psymbols.empty ();
+ }
+
+ /* Add a symbol to this partial symbol table of OBJFILE.
+
+ If COPY_NAME is true, make a copy of NAME, otherwise use the passed
+ reference.
+
+ THECLASS is the type of symbol.
+
+ SECTION is the index of the section of OBJFILE in which the symbol is found.
+
+ WHERE determines whether the symbol goes in the list of static or global
+ partial symbols.
+
+ COREADDR is the address of the symbol. For partial symbols that don't have
+ an address, zero is passed.
+
+ LANGUAGE is the language from which the symbol originates. This will
+ influence, amongst other things, how the symbol name is demangled. */
+
+ void add_psymbol (gdb::string_view name,
+ bool copy_name, domain_enum domain,
+ enum address_class theclass,
+ short section,
+ psymbol_placement where,
+ CORE_ADDR coreaddr,
+ enum language language,
+ struct objfile *objfile);
+
+ /* Add a symbol to this partial symbol table of OBJFILE. The psymbol
+ must be fully constructed, and the names must be set and intern'd
+ as appropriate. */
+
+ void add_psymbol (const partial_symbol &psym,
+ psymbol_placement where,
+ struct objfile *objfile);
+
/* Chain of all existing partial symtabs. */
@@ -269,22 +320,18 @@ struct partial_symtab
/* Global symbol list. This list will be sorted after readin to
improve access. Binary search will be the usual method of
- finding a symbol within it. globals_offset is an integer offset
- within global_psymbols[]. */
+ finding a symbol within it. */
- int globals_offset = 0;
- int n_global_syms = 0;
+ std::vector<partial_symbol *> global_psymbols;
/* Static symbol list. This list will *not* be sorted after readin;
to find a symbol in it, exhaustive search must be used. This is
reasonable because searches through this list will eventually
lead to either the read in of a files symbols for real (assumed
to take a *lot* of time; check) or an error (and we don't care
- how long errors take). This is an offset and size within
- static_psymbols[]. */
+ how long errors take). */
- int statics_offset = 0;
- int n_static_syms = 0;
+ std::vector<partial_symbol *> static_psymbols;
/* True iff objfile->psymtabs_addrmap is properly populated for this
partial_symtab. For discontiguous overlapping psymtabs is the only usable
@@ -389,50 +436,6 @@ struct legacy_psymtab : public standard_psymtab
void *read_symtab_private = nullptr;
};
-/* Specify whether a partial psymbol should be allocated on the global
- list or the static list. */
-
-enum class psymbol_placement
-{
- STATIC,
- GLOBAL
-};
-
-/* Add a symbol to the partial symbol table of OBJFILE.
-
- If COPY_NAME is true, make a copy of NAME, otherwise use the passed
- reference.
-
- THECLASS is the type of symbol.
-
- SECTION is the index of the section of OBJFILE in which the symbol is found.
-
- WHERE determines whether the symbol goes in the list of static or global
- partial symbols of OBJFILE.
-
- COREADDR is the address of the symbol. For partial symbols that don't have
- an address, zero is passed.
-
- LANGUAGE is the language from which the symbol originates. This will
- influence, amongst other things, how the symbol name is demangled. */
-
-extern void add_psymbol_to_list (gdb::string_view name,
- bool copy_name, domain_enum domain,
- enum address_class theclass,
- short section,
- psymbol_placement where,
- CORE_ADDR coreaddr,
- enum language language,
- struct objfile *objfile);
-
-/* Add a symbol to the partial symbol table of OBJFILE. The psymbol
- must be fully constructed, and the names must be set and intern'd
- as appropriate. */
-
-extern void add_psymbol_to_list (const partial_symbol &psym,
- psymbol_placement where,
- struct objfile *objfile);
-
/* Initialize storage for partial symbols. If partial symbol storage
has already been initialized, this does nothing. TOTAL_SYMBOLS is
an estimate of how many symbols there will be. */