mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:18:14 +08:00
Adding support for extracting line table information from .o files that do not have aranges
llvm-svn: 185055
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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_
|
||||
|
||||
Reference in New Issue
Block a user