aboutsummaryrefslogtreecommitdiff
path: root/gold/gdb-index.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gold/gdb-index.cc')
-rw-r--r--gold/gdb-index.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/gold/gdb-index.cc b/gold/gdb-index.cc
index d42fbbd..1504abe 100644
--- a/gold/gdb-index.cc
+++ b/gold/gdb-index.cc
@@ -32,7 +32,7 @@
namespace gold
{
-const int gdb_index_version = 5;
+const int gdb_index_version = 7;
// Sizes of various records in the .gdb_index section.
const int gdb_index_offset_size = 4;
@@ -436,7 +436,8 @@ Gdb_index_info_reader::visit_die(Dwarf_die* die, Dwarf_die* context)
// If the DIE is not a declaration, add it to the index.
std::string full_name = this->get_qualified_name(die, context);
if (!full_name.empty())
- this->gdb_index_->add_symbol(this->cu_index_, full_name.c_str());
+ this->gdb_index_->add_symbol(this->cu_index_,
+ full_name.c_str(), 0);
}
break;
case elfcpp::DW_TAG_typedef:
@@ -476,7 +477,7 @@ Gdb_index_info_reader::visit_die(Dwarf_die* die, Dwarf_die* context)
full_name = this->get_qualified_name(die, context);
if (!full_name.empty())
this->gdb_index_->add_symbol(this->cu_index_,
- full_name.c_str());
+ full_name.c_str(), 0);
}
// We're interested in the children only for namespaces and
@@ -870,11 +871,12 @@ Gdb_index_info_reader::read_pubtable(Dwarf_pubnames_table* table, off_t offset)
return false;
while (true)
{
- const char* name = table->next_name();
+ uint8_t flag_byte;
+ const char* name = table->next_name(&flag_byte);
if (name == NULL)
break;
- this->gdb_index_->add_symbol(this->cu_index_, name);
+ this->gdb_index_->add_symbol(this->cu_index_, name, flag_byte);
}
return true;
}
@@ -885,6 +887,14 @@ Gdb_index_info_reader::read_pubtable(Dwarf_pubnames_table* table, off_t offset)
bool
Gdb_index_info_reader::read_pubnames_and_pubtypes(Dwarf_die* die)
{
+ // If this is a skeleton debug-type die (generated via
+ // -gsplit-dwarf), then the associated pubnames should have been
+ // read along with the corresponding CU. In any case, there isn't
+ // enough info inside to build a gdb index entry.
+ if (die->tag() == elfcpp::DW_TAG_type_unit
+ && die->string_attribute(elfcpp::DW_AT_GNU_dwo_name))
+ return true;
+
// We use stmt_list_off as a unique identifier for the
// compilation unit and its associated type units.
unsigned int shndx;
@@ -1112,7 +1122,7 @@ Gdb_index::scan_debug_info(bool is_type_unit,
// Add a symbol.
void
-Gdb_index::add_symbol(int cu_index, const char* sym_name)
+Gdb_index::add_symbol(int cu_index, const char* sym_name, uint8_t flags)
{
unsigned int hash = mapped_index_string_hash(
reinterpret_cast<const unsigned char*>(sym_name));
@@ -1139,8 +1149,10 @@ Gdb_index::add_symbol(int cu_index, const char* sym_name)
// if it's not already on the list. We only need to
// check the last added entry.
Cu_vector* cu_vec = this->cu_vector_list_[found->cu_vector_index];
- if (cu_vec->size() == 0 || cu_vec->back() != cu_index)
- cu_vec->push_back(cu_index);
+ if (cu_vec->size() == 0
+ || cu_vec->back().first != cu_index
+ || cu_vec->back().second != flags)
+ cu_vec->push_back(std::make_pair(cu_index, flags));
}
// Return TRUE if we have already processed the pubnames associated
@@ -1317,9 +1329,11 @@ Gdb_index::do_write(Output_file* of)
pov += 4;
for (unsigned int j = 0; j < cu_vec->size(); ++j)
{
- int cu_index = (*cu_vec)[j];
+ int cu_index = (*cu_vec)[j].first;
+ uint8_t flags = (*cu_vec)[j].second;
if (cu_index < 0)
cu_index = comp_units_count + (-1 - cu_index);
+ cu_index |= flags << 24;
elfcpp::Swap<32, false>::writeval(pov, cu_index);
pov += 4;
}