diff options
3 files changed, 52 insertions, 10 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp index ed615c42a90..493b3af6ecd 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp @@ -26,6 +26,7 @@ #include "LogChannelDWARF.h" #include "NameToDIE.h" #include "SymbolFileDWARF.h" +#include "SymbolFileDWARFDebugMap.h" using namespace lldb; using namespace lldb_private; @@ -403,20 +404,26 @@ DWARFCompileUnit::BuildAddressRangeTable (SymbolFileDWARF* dwarf2Data, sc.comp_unit = dwarf2Data->GetCompUnitForDWARFCompUnit(this); if (sc.comp_unit) { - LineTable *line_table = sc.comp_unit->GetLineTable(); - - if (line_table) + SymbolFileDWARFDebugMap *debug_map_sym_file = m_dwarf2Data->GetDebugMapSymfile(); + if (debug_map_sym_file == NULL) { - LineTable::FileAddressRanges file_ranges; - const bool append = true; - const size_t num_ranges = line_table->GetContiguousFileAddressRanges (file_ranges, append); - for (uint32_t idx=0; idx<num_ranges; ++idx) + LineTable *line_table = sc.comp_unit->GetLineTable(); + + if (line_table) { - const LineTable::FileAddressRanges::Entry &range = file_ranges.GetEntryRef(idx); - debug_aranges->AppendRange(GetOffset(), range.GetRangeBase(), range.GetRangeEnd()); - printf ("0x%8.8x: [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", GetOffset(), range.GetRangeBase(), range.GetRangeEnd()); + LineTable::FileAddressRanges file_ranges; + const bool append = true; + const size_t num_ranges = line_table->GetContiguousFileAddressRanges (file_ranges, append); + for (uint32_t idx=0; idx<num_ranges; ++idx) + { + const LineTable::FileAddressRanges::Entry &range = file_ranges.GetEntryRef(idx); + debug_aranges->AppendRange(GetOffset(), range.GetRangeBase(), range.GetRangeEnd()); + printf ("0x%8.8x: [0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", GetOffset(), range.GetRangeBase(), range.GetRangeEnd()); + } } } + else + debug_map_sym_file->AddOSOARanges(dwarf2Data,debug_aranges); } } diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 8816b3ea925..fbfbf5cdd3f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -9,6 +9,9 @@ #include "SymbolFileDWARFDebugMap.h" +#include "DWARFDebugAranges.h" + +#include "lldb/Core/RangeMap.h" #include "lldb/Core/Module.h" #include "lldb/Core/ModuleList.h" #include "lldb/Core/PluginManager.h" @@ -1542,4 +1545,30 @@ SymbolFileDWARFDebugMap::LinkOSOLineTable (SymbolFileDWARF *oso_dwarf, LineTable return NULL; } +size_t +SymbolFileDWARFDebugMap::AddOSOARanges (SymbolFileDWARF* dwarf2Data, DWARFDebugAranges* debug_aranges) +{ + size_t num_line_entries_added = 0; + if (debug_aranges && dwarf2Data) + { + CompileUnitInfo *compile_unit_info = GetCompileUnitInfo(dwarf2Data); + if (compile_unit_info) + { + const FileRangeMap &file_range_map = compile_unit_info->GetFileRangeMap(this); + for (size_t idx = 0; + idx < file_range_map.GetSize(); + idx++) + { + const FileRangeMap::Entry* entry = file_range_map.GetEntryAtIndex(idx); + if (entry) + { + printf ("[0x%16.16" PRIx64 " - 0x%16.16" PRIx64 ")\n", entry->GetRangeBase(), entry->GetRangeEnd()); + debug_aranges->AppendRange(dwarf2Data->GetID(), entry->GetRangeBase(), entry->GetRangeEnd()); + num_line_entries_added++; + } + } + } + } + return num_line_entries_added; +} diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h index 9db2a93f63a..d38bf66725a 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h @@ -23,6 +23,7 @@ class SymbolFileDWARF; class DWARFCompileUnit; +class DWARFDebugAranges; class DWARFDebugInfoEntry; class DWARFDeclContext; class DebugMapModule; @@ -128,6 +129,7 @@ protected: kNumFlags }; + friend class DWARFCompileUnit; friend class SymbolFileDWARF; friend class DebugMapModule; struct OSOInfo @@ -409,6 +411,10 @@ protected: lldb_private::LineTable * LinkOSOLineTable (SymbolFileDWARF *oso_symfile, lldb_private::LineTable *line_table); + + size_t + AddOSOARanges (SymbolFileDWARF* dwarf2Data, + DWARFDebugAranges* debug_aranges); }; #endif // #ifndef SymbolFileDWARF_SymbolFileDWARFDebugMap_h_ |