[Lldb-commits] [lldb] r185055 - Adding support for extracting line table information from .o files that do not have aranges
Enrico Granata
egranata at apple.com
Wed Jun 26 18:43:10 PDT 2013
Author: enrico
Date: Wed Jun 26 20:43:09 2013
New Revision: 185055
URL: http://llvm.org/viewvc/llvm-project?rev=185055&view=rev
Log:
Adding support for extracting line table information from .o files that do not have aranges
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=185055&r1=185054&r2=185055&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Wed Jun 26 20:43:09 2013
@@ -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
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);
}
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=185055&r1=185054&r2=185055&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Wed Jun 26 20:43:09 2013
@@ -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::LinkOSOLineTabl
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;
+}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=185055&r1=185054&r2=185055&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h Wed Jun 26 20:43:09 2013
@@ -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_
More information about the lldb-commits
mailing list