diff options
Diffstat (limited to 'contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp')
-rw-r--r-- | contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp | 60 |
1 files changed, 21 insertions, 39 deletions
diff --git a/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp b/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp index 8469b78d0dd5..547bd0cd1a5a 100644 --- a/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp +++ b/contrib/llvm/tools/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp @@ -77,9 +77,6 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) DWARFDebugInfo* debug_info = dwarf2Data->DebugInfo(); if (debug_info) { - - const DWARFDataExtractor* debug_str = &dwarf2Data->get_debug_str_data(); - uint32_t cu_idx = 0; const uint32_t num_compile_units = dwarf2Data->GetNumCompileUnits(); for (cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) @@ -87,7 +84,9 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) DWARFCompileUnit* cu = debug_info->GetCompileUnitAtIndex(cu_idx); - const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (cu->GetAddressByteSize(), cu->IsDWARF64()); + DWARFFormValue::FixedFormSizes fixed_form_sizes = + DWARFFormValue::GetFixedFormSizesForAddressSize (cu->GetAddressByteSize(), + cu->IsDWARF64()); bool clear_dies = cu->ExtractDIEsIfNeeded (false) > 1; @@ -101,17 +100,17 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) size_t die_idx; for (die_idx = 0; die_idx < die_count; ++die_idx) { - const DWARFDebugInfoEntry *die = dies.GetDIEPtrAtIndex(die_idx); - DWARFDebugInfoEntry::Attributes attributes; + DWARFDIE die = dies.GetDIEAtIndex(die_idx); + DWARFAttributes attributes; const char *name = NULL; const char *mangled = NULL; bool add_die = false; - const size_t num_attributes = die->GetAttributes(dwarf2Data, cu, fixed_form_sizes, attributes); + const size_t num_attributes = die.GetDIE()->GetAttributes(die.GetCU(), fixed_form_sizes, attributes); if (num_attributes > 0) { uint32_t i; - dw_tag_t tag = die->Tag(); + dw_tag_t tag = die.Tag(); for (i=0; i<num_attributes; ++i) { @@ -120,14 +119,14 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) switch (attr) { case DW_AT_name: - if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value)) - name = form_value.AsCString(debug_str); + if (attributes.ExtractFormValueAtIndex(i, form_value)) + name = form_value.AsCString(); break; case DW_AT_MIPS_linkage_name: case DW_AT_linkage_name: - if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value)) - mangled = form_value.AsCString(debug_str); + if (attributes.ExtractFormValueAtIndex(i, form_value)) + mangled = form_value.AsCString(); break; case DW_AT_low_pc: @@ -140,10 +139,10 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) case DW_AT_location: if (tag == DW_TAG_variable) { - const DWARFDebugInfoEntry* parent_die = die->GetParent(); - while ( parent_die != NULL ) + DWARFDIE parent_die = die.GetParent(); + while ( parent_die ) { - switch (parent_die->Tag()) + switch (parent_die.Tag()) { case DW_TAG_subprogram: case DW_TAG_lexical_block: @@ -153,31 +152,16 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) // if the location describes a hard coded address, but we don't want the performance // penalty of that right now. add_die = false; -// if (attributes.ExtractFormValueAtIndex(dwarf2Data, i, form_value)) -// { -// // If we have valid block data, then we have location expression bytes -// // that are fixed (not a location list). -// const uint8_t *block_data = form_value.BlockData(); -// if (block_data) -// { -// uint32_t block_length = form_value.Unsigned(); -// if (block_length == 1 + attributes.CompileUnitAtIndex(i)->GetAddressByteSize()) -// { -// if (block_data[0] == DW_OP_addr) -// add_die = true; -// } -// } -// } - parent_die = NULL; // Terminate the while loop. + parent_die.Clear(); // Terminate the while loop. break; case DW_TAG_compile_unit: add_die = true; - parent_die = NULL; // Terminate the while loop. + parent_die.Clear(); // Terminate the while loop. break; default: - parent_die = parent_die->GetParent(); // Keep going in the while loop. + parent_die = parent_die.GetParent(); // Keep going in the while loop. break; } } @@ -189,7 +173,7 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data) if (add_die && (name || mangled)) { - pubnames_set.AddDescriptor(die->GetOffset() - cu_offset, mangled ? mangled : name); + pubnames_set.AddDescriptor(die.GetCompileUnitRelativeOffset(), mangled ? mangled : name); } } @@ -231,13 +215,11 @@ DWARFDebugPubnames::GeneratePubBaseTypes(SymbolFileDWARF* dwarf2Data) size_t die_idx; for (die_idx = 0; die_idx < die_count; ++die_idx) { - const DWARFDebugInfoEntry *die = dies.GetDIEPtrAtIndex(die_idx); - const char *name = die->GetAttributeValueAsString(dwarf2Data, cu, DW_AT_name, NULL); + DWARFDIE die = dies.GetDIEAtIndex (die_idx); + const char *name = die.GetName(); if (name) - { - pubnames_set.AddDescriptor(die->GetOffset() - cu_offset, name); - } + pubnames_set.AddDescriptor(die.GetCompileUnitRelativeOffset(), name); } if (pubnames_set.NumDescriptors() > 0) |