diff options
author | Sterling Augustine <saugustine@google.com> | 2013-07-29 18:29:12 +0000 |
---|---|---|
committer | Sterling Augustine <saugustine@google.com> | 2013-07-29 18:29:12 +0000 |
commit | 234d4ab880bf72f0a0c678c551d8245e32ce86fc (patch) | |
tree | 1bf01149ded8212bce541fc56894422deccd894e /gold/gdb-index.h | |
parent | c8f30dac8c2799564b9ceff1d299ed876ecda1c9 (diff) | |
download | binutils-gdb-234d4ab880bf72f0a0c678c551d8245e32ce86fc.tar.gz |
2013-07-22 Sterling Augustine <saugustine@google.com>
* dwarf_reader.cc (Dwarf_pubnames_table::read_section):
Convert parameter shndx to local variable. Add parameters symtab
and symtab_size. Scan over section names. Find relocation
section corresponding to current section. Create and initialize
reloc_mapper_ and reloc_type_.
(Dwarf_pubnames_table::read_header): Add assertion. Change
unit_length to off_t. Initialize member unit_length_. Fill in field
cu_offset_.
* dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
Initialize new fields unit_length_ and cu_offset_.
(Dwarf_pubnames_table::read_section): Update prototype.
(Dwarf_pubnames_table::cu_offset): New member function.
(Dwarf_pubnames_table::subsection_size): Likewise.
(Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
New fields.
(Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
member functions public.
* gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
Update comment. Rework logic. Move repeated parts to...
(Gdb_index_info_reader::read_pubtable): ...here. New function.
(Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
pubtypes_table_, and stmt_list_offset.
(Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
Gdb_index::find_pubtype_offset,
Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
(Gdb_index::pubnames_read): Update prototype and rework logic.
* gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
Forward declare.
(Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
Gdb_index::map_pubtable_to_dies):
Declare functions.
(Gdb_index::pubnames_read): Update declaration.
(Gdb_index::Pubname_offset_map): New type.
(Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
Gdb_index::stmt_list_offset): Declare.
(Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
Gdb_index::pubtypes_offset_): Remove.
Diffstat (limited to 'gold/gdb-index.h')
-rw-r--r-- | gold/gdb-index.h | 76 |
1 files changed, 62 insertions, 14 deletions
diff --git a/gold/gdb-index.h b/gold/gdb-index.h index 14c1583371a..5d9fe476452 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. |