summaryrefslogtreecommitdiff
path: root/gold/gdb-index.h
diff options
context:
space:
mode:
Diffstat (limited to 'gold/gdb-index.h')
-rw-r--r--gold/gdb-index.h76
1 files changed, 62 insertions, 14 deletions
diff --git a/gold/gdb-index.h b/gold/gdb-index.h
index 14c1583371..5d9fe47645 100644
--- a/gold/gdb-index.h
+++ b/gold/gdb-index.h
@@ -42,6 +42,8 @@ class Sized_relobj;
class Dwarf_range_list;
template <typename T>
class Gdb_hashtab;
+class Gdb_index_info_reader;
+class Dwarf_pubnames_table;
// This class manages the .gdb_index section, which is a fast
// lookup table for DWARF information used by the gdb debugger.
@@ -91,15 +93,35 @@ class Gdb_index : public Output_section_data
void
add_symbol(int cu_index, const char* sym_name);
- // Return TRUE if we have already processed the pubnames set for
- // OBJECT at OFFSET in section SHNDX
- bool
- pubnames_read(const Relobj* object, unsigned int shndx, off_t offset);
+ // Return the offset into the pubnames table for the cu at the given
+ // offset.
+ off_t
+ find_pubname_offset(off_t cu_offset);
+
+ // Return the offset into the pubtypes table for the cu at the
+ // given offset.
+ off_t
+ find_pubtype_offset(off_t cu_offset);
- // Return TRUE if we have already processed the pubtypes set for
- // OBJECT at OFFSET in section SHNDX
+ // Return TRUE if we have already processed the pubnames and types
+ // set for OBJECT of the CUs and TUS associated with the statement
+ // list at OFFSET.
bool
- pubtypes_read(const Relobj* object, unsigned int shndx, off_t offset);
+ pubnames_read(const Relobj* object, off_t offset);
+
+ // Record that we have already read the pubnames associated with
+ // OBJECT and OFFSET.
+ void
+ set_pubnames_read(const Relobj* object, off_t offset);
+
+ // Return a pointer to the given table.
+ Dwarf_pubnames_table*
+ pubnames_table()
+ { return pubnames_table_; }
+
+ Dwarf_pubnames_table*
+ pubtypes_table()
+ { return pubtypes_table_; }
// Print usage statistics.
static void
@@ -125,6 +147,21 @@ class Gdb_index : public Output_section_data
do_print_to_mapfile(Mapfile* mapfile) const
{ mapfile->print_output_data(this, _("** gdb_index")); }
+ // Create a map from dies to pubnames.
+ Dwarf_pubnames_table*
+ map_pubtable_to_dies(unsigned int attr,
+ Gdb_index_info_reader* dwinfo,
+ Relobj* object,
+ const unsigned char* symbols,
+ off_t symbols_size);
+
+ // Wrapper for map_pubtable_to_dies
+ void
+ map_pubnames_and_types_to_dies(Gdb_index_info_reader* dwinfo,
+ Relobj* object,
+ const unsigned char* symbols,
+ off_t symbols_size);
+
private:
// An entry in the compilation unit list.
struct Comp_unit
@@ -178,6 +215,21 @@ class Gdb_index : public Output_section_data
typedef std::vector<int> Cu_vector;
+ typedef Unordered_map<off_t, off_t> Pubname_offset_map;
+ Pubname_offset_map cu_pubname_map_;
+ Pubname_offset_map cu_pubtype_map_;
+
+ // Scan the given pubtable and build a map of the various dies it
+ // refers to, so we can process the entries when we encounter the
+ // die.
+ void
+ map_pubtable_to_dies(Dwarf_pubnames_table* table,
+ Pubname_offset_map* map);
+
+ // Tables to store the pubnames section of the current object.
+ Dwarf_pubnames_table* pubnames_table_;
+ Dwarf_pubnames_table* pubtypes_table_;
+
// The .gdb_index section.
Output_section* gdb_index_section_;
// The list of DWARF compilation units.
@@ -200,14 +252,10 @@ class Gdb_index : public Output_section_data
off_t symtab_offset_;
off_t cu_pool_offset_;
off_t stringpool_offset_;
- // Object, section index and offset of last read pubnames section.
+ // Object, stmt list offset of the CUs and TUs associated with the
+ // last read pubnames and pubtypes sections.
const Relobj* pubnames_object_;
- unsigned int pubnames_shndx_;
- off_t pubnames_offset_;
- // Object, section index and offset of last read pubtypes section.
- const Relobj* pubtypes_object_;
- unsigned int pubtypes_shndx_;
- off_t pubtypes_offset_;
+ off_t stmt_list_offset_;
};
} // End namespace gold.