[Lldb-commits] [lldb] r356773 - Revert "Move the rest of the sections over to DWARFContext."
Pavel Labath via lldb-commits
lldb-commits at lists.llvm.org
Fri Mar 22 09:07:59 PDT 2019
Author: labath
Date: Fri Mar 22 09:07:58 2019
New Revision: 356773
URL: http://llvm.org/viewvc/llvm-project?rev=356773&view=rev
Log:
Revert "Move the rest of the sections over to DWARFContext."
This reverts commit r356682 because it breaks the DWO flavours of some
tests:
lldb-Suite :: lang/c/const_variables/TestConstVariables.py
lldb-Suite :: lang/c/local_variables/TestLocalVariables.py
lldb-Suite :: lang/c/vla/TestVLA.py
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.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=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Fri Mar 22 09:07:58 2019
@@ -15,18 +15,17 @@
using namespace lldb;
using namespace lldb_private;
-DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data,
- DWARFContext &dwarf_context)
- : DWARFUnit(dwarf2Data, dwarf_context) {}
+DWARFCompileUnit::DWARFCompileUnit(SymbolFileDWARF *dwarf2Data)
+ : DWARFUnit(dwarf2Data) {}
-llvm::Expected<DWARFUnitSP> DWARFCompileUnit::extract(
- SymbolFileDWARF *dwarf2Data, DWARFContext &dwarf_context,
- const DWARFDataExtractor &debug_info, lldb::offset_t *offset_ptr) {
+llvm::Expected<DWARFUnitSP>
+DWARFCompileUnit::extract(SymbolFileDWARF *dwarf2Data,
+ const DWARFDataExtractor &debug_info,
+ lldb::offset_t *offset_ptr) {
assert(debug_info.ValidOffset(*offset_ptr));
// std::make_shared would require the ctor to be public.
- std::shared_ptr<DWARFCompileUnit> cu_sp(
- new DWARFCompileUnit(dwarf2Data, dwarf_context));
+ std::shared_ptr<DWARFCompileUnit> cu_sp(new DWARFCompileUnit(dwarf2Data));
cu_sp->m_offset = *offset_ptr;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h Fri Mar 22 09:07:58 2019
@@ -12,15 +12,10 @@
#include "DWARFUnit.h"
#include "llvm/Support/Error.h"
-namespace lldb_private {
-class DWARFContext;
-}
-
class DWARFCompileUnit : public DWARFUnit {
public:
static llvm::Expected<DWARFUnitSP>
extract(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context,
const lldb_private::DWARFDataExtractor &debug_info,
lldb::offset_t *offset_ptr);
void Dump(lldb_private::Stream *s) const override;
@@ -44,8 +39,7 @@ public:
uint32_t GetHeaderByteSize() const override;
private:
- DWARFCompileUnit(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context);
+ DWARFCompileUnit(SymbolFileDWARF *dwarf2Data);
DISALLOW_COPY_AND_ASSIGN(DWARFCompileUnit);
};
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.cpp Fri Mar 22 09:07:58 2019
@@ -14,13 +14,6 @@ using namespace lldb;
using namespace lldb_private;
static const DWARFDataExtractor *
-GetPointerOrNull(const llvm::Optional<DWARFDataExtractor> &extractor) {
- if (!extractor.hasValue())
- return nullptr;
- return extractor.getPointer();
-}
-
-static const DWARFDataExtractor *
LoadOrGetSection(Module &module, SectionType section_type,
llvm::Optional<DWARFDataExtractor> &extractor) {
if (extractor.hasValue())
@@ -48,61 +41,3 @@ const DWARFDataExtractor *DWARFContext::
return LoadOrGetSection(m_module, eSectionTypeDWARFDebugAranges,
m_data_debug_aranges);
}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugLineData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugLine,
- m_data_debug_line);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugLineStrData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugLineStr,
- m_data_debug_line_str);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugMacroData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugMacro,
- m_data_debug_macro);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugLocData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugLoc,
- m_data_debug_loc);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugLoclistData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugLocLists,
- m_data_debug_loclists);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugRangesData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugRanges,
- m_data_debug_ranges);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugRnglistsData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugRngLists,
- m_data_debug_rnglists);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugFrameData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugFrame,
- m_data_debug_frame);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadDebugTypesData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFDebugTypes,
- m_data_debug_types);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadGnuDebugAltlinkData() {
- return LoadOrGetSection(m_module, eSectionTypeDWARFGNUDebugAltLink,
- m_data_gnu_debug_altlink);
-}
-
-const DWARFDataExtractor *DWARFContext::getOrLoadBestDebugLocData() {
- const DWARFDataExtractor *loc = getOrLoadDebugLocData();
- if (loc)
- return loc;
-
- return getOrLoadDebugLoclistData();
-}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFContext.h Fri Mar 22 09:07:58 2019
@@ -19,33 +19,11 @@ class DWARFContext {
private:
Module &m_module;
llvm::Optional<DWARFDataExtractor> m_data_debug_aranges;
- llvm::Optional<DWARFDataExtractor> m_data_debug_frame;
- llvm::Optional<DWARFDataExtractor> m_data_debug_line;
- llvm::Optional<DWARFDataExtractor> m_data_debug_line_str;
- llvm::Optional<DWARFDataExtractor> m_data_debug_macro;
- llvm::Optional<DWARFDataExtractor> m_data_debug_loc;
- llvm::Optional<DWARFDataExtractor> m_data_debug_loclists;
- llvm::Optional<DWARFDataExtractor> m_data_debug_ranges;
- llvm::Optional<DWARFDataExtractor> m_data_debug_rnglists;
- llvm::Optional<DWARFDataExtractor> m_data_debug_types;
- llvm::Optional<DWARFDataExtractor> m_data_gnu_debug_altlink;
public:
explicit DWARFContext(Module &module);
const DWARFDataExtractor *getOrLoadArangesData();
- const DWARFDataExtractor *getOrLoadDebugLineData();
- const DWARFDataExtractor *getOrLoadDebugLineStrData();
- const DWARFDataExtractor *getOrLoadDebugMacroData();
- const DWARFDataExtractor *getOrLoadDebugLocData();
- const DWARFDataExtractor *getOrLoadDebugLoclistData();
- const DWARFDataExtractor *getOrLoadDebugRangesData();
- const DWARFDataExtractor *getOrLoadDebugRnglistsData();
- const DWARFDataExtractor *getOrLoadDebugFrameData();
- const DWARFDataExtractor *getOrLoadDebugTypesData();
- const DWARFDataExtractor *getOrLoadGnuDebugAltlinkData();
-
- const DWARFDataExtractor *getOrLoadBestDebugLocData();
};
} // namespace lldb_private
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp Fri Mar 22 09:07:58 2019
@@ -332,9 +332,8 @@ bool DWARFDIE::GetDIENamesAndRanges(
lldb_private::DWARFExpression *frame_base) const {
if (IsValid()) {
return m_die->GetDIENamesAndRanges(
- GetDWARF(), GetDWARF()->GetDWARFContext(), GetCU(), name, mangled,
- ranges, decl_file, decl_line, decl_column, call_file, call_line,
- call_column, frame_base);
+ GetDWARF(), GetCU(), name, mangled, ranges, decl_file, decl_line,
+ decl_column, call_file, call_line, call_column, frame_base);
} else
return false;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Fri Mar 22 09:07:58 2019
@@ -91,8 +91,8 @@ void DWARFDebugInfo::ParseCompileUnitHea
const auto &debug_info_data = m_dwarf2Data->get_debug_info_data();
while (debug_info_data.ValidOffset(offset)) {
- llvm::Expected<DWARFUnitSP> cu_sp = DWARFCompileUnit::extract(
- m_dwarf2Data, m_context, debug_info_data, &offset);
+ llvm::Expected<DWARFUnitSP> cu_sp =
+ DWARFCompileUnit::extract(m_dwarf2Data, debug_info_data, &offset);
if (!cu_sp) {
// FIXME: Propagate this error up.
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Fri Mar 22 09:07:58 2019
@@ -377,20 +377,19 @@ static dw_offset_t GetRangesOffset(const
// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges attributes.
//----------------------------------------------------------------------
bool DWARFDebugInfoEntry::GetDIENamesAndRanges(
- SymbolFileDWARF *dwarf2Data, DWARFContext &dwarf_context,
- const DWARFUnit *cu, const char *&name, const char *&mangled,
- DWARFRangeList &ranges, int &decl_file, int &decl_line, int &decl_column,
- int &call_file, int &call_line, int &call_column,
- DWARFExpression *frame_base) const {
+ SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, const char *&name,
+ const char *&mangled, DWARFRangeList &ranges, int &decl_file,
+ int &decl_line, int &decl_column, int &call_file, int &call_line,
+ int &call_column, DWARFExpression *frame_base) const {
if (dwarf2Data == nullptr)
return false;
SymbolFileDWARFDwo *dwo_symbol_file = cu->GetDwoSymbolFile();
if (dwo_symbol_file)
return GetDIENamesAndRanges(
- dwo_symbol_file, dwarf_context, dwo_symbol_file->GetCompileUnit(), name,
- mangled, ranges, decl_file, decl_line, decl_column, call_file,
- call_line, call_column, frame_base);
+ dwo_symbol_file, dwo_symbol_file->GetCompileUnit(), name, mangled,
+ ranges, decl_file, decl_line, decl_column, call_file, call_line,
+ call_column, frame_base);
dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
@@ -516,18 +515,15 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
frame_base->SetOpcodeData(module, debug_info_data, block_offset,
block_length);
} else {
- const DWARFDataExtractor *debug_loc =
- dwarf_context.getOrLoadBestDebugLocData();
- if (!debug_loc)
- break;
-
+ const DWARFDataExtractor &debug_loc_data =
+ dwarf2Data->DebugLocData();
const dw_offset_t debug_loc_offset = form_value.Unsigned();
size_t loc_list_length = DWARFExpression::LocationListSize(
- cu, *debug_loc, debug_loc_offset);
+ cu, debug_loc_data, debug_loc_offset);
if (loc_list_length > 0) {
- frame_base->SetOpcodeData(module, *debug_loc, debug_loc_offset,
- loc_list_length);
+ frame_base->SetOpcodeData(module, debug_loc_data,
+ debug_loc_offset, loc_list_length);
if (lo_pc != LLDB_INVALID_ADDRESS) {
assert(lo_pc >= cu->GetBaseAddress());
frame_base->SetLocationListSlide(lo_pc -
@@ -568,9 +564,8 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
DWARFDIE die = dwarf2Data->GetDIE(die_ref);
if (die)
die.GetDIE()->GetDIENamesAndRanges(
- die.GetDWARF(), die.GetDWARF()->GetDWARFContext(), die.GetCU(),
- name, mangled, ranges, decl_file, decl_line, decl_column,
- call_file, call_line, call_column);
+ die.GetDWARF(), die.GetCU(), name, mangled, ranges, decl_file,
+ decl_line, decl_column, call_file, call_line, call_column);
}
}
}
@@ -584,7 +579,6 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
// stream.
//----------------------------------------------------------------------
void DWARFDebugInfoEntry::Dump(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context,
const DWARFUnit *cu, Stream &s,
uint32_t recurse_depth) const {
const DWARFDataExtractor &debug_info_data = cu->GetData();
@@ -612,8 +606,8 @@ void DWARFDebugInfoEntry::Dump(SymbolFil
dw_attr_t attr;
abbrevDecl->GetAttrAndFormValueByIndex(i, attr, form_value);
- DumpAttribute(dwarf2Data, dwarf_context, cu, debug_info_data, &offset,
- s, attr, form_value);
+ DumpAttribute(dwarf2Data, cu, debug_info_data, &offset, s, attr,
+ form_value);
}
const DWARFDebugInfoEntry *child = GetFirstChild();
@@ -621,7 +615,7 @@ void DWARFDebugInfoEntry::Dump(SymbolFil
s.IndentMore();
while (child) {
- child->Dump(dwarf2Data, dwarf_context, cu, s, recurse_depth - 1);
+ child->Dump(dwarf2Data, cu, s, recurse_depth - 1);
child = child->GetSibling();
}
s.IndentLess();
@@ -644,10 +638,9 @@ void DWARFDebugInfoEntry::Dump(SymbolFil
// values for attributes, etc).
//----------------------------------------------------------------------
void DWARFDebugInfoEntry::DumpAttribute(
- SymbolFileDWARF *dwarf2Data, lldb_private::DWARFContext &dwarf_context,
- const DWARFUnit *cu, const DWARFDataExtractor &debug_info_data,
- lldb::offset_t *offset_ptr, Stream &s, dw_attr_t attr,
- DWARFFormValue &form_value) {
+ SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
+ const DWARFDataExtractor &debug_info_data, lldb::offset_t *offset_ptr,
+ Stream &s, dw_attr_t attr, DWARFFormValue &form_value) {
bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm);
s.Printf(" ");
@@ -700,13 +693,8 @@ void DWARFDebugInfoEntry::DumpAttribute(
// the .debug_loc section that describes the value over it's lifetime
uint64_t debug_loc_offset = form_value.Unsigned();
if (dwarf2Data) {
- const DWARFDataExtractor *debug_loc_data =
- dwarf_context.getOrLoadBestDebugLocData();
- if (!debug_loc_data)
- break;
-
- DWARFExpression::PrintDWARFLocationList(s, cu, *debug_loc_data,
- debug_loc_offset);
+ DWARFExpression::PrintDWARFLocationList(
+ s, cu, dwarf2Data->DebugLocData(), debug_loc_offset);
}
}
} break;
@@ -732,12 +720,8 @@ void DWARFDebugInfoEntry::DumpAttribute(
lldb::offset_t ranges_offset =
GetRangesOffset(dwarf2Data->DebugRanges(), form_value);
dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
- const DWARFDataExtractor *debug_ranges =
- dwarf_context.getOrLoadDebugRangesData();
- if (!debug_ranges)
- break;
-
- DWARFDebugRanges::Dump(s, *debug_ranges, &ranges_offset, base_addr);
+ DWARFDebugRanges::Dump(s, dwarf2Data->get_debug_ranges_data(),
+ &ranges_offset, base_addr);
} break;
default:
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Fri Mar 22 09:07:58 2019
@@ -158,23 +158,22 @@ public:
static bool OffsetLessThan(const DWARFDebugInfoEntry &a,
const DWARFDebugInfoEntry &b);
- void Dump(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context, const DWARFUnit *cu,
+ void Dump(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
lldb_private::Stream &s, uint32_t recurse_depth) const;
static void
- DumpAttribute(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context, const DWARFUnit *cu,
+ DumpAttribute(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
const lldb_private::DWARFDataExtractor &debug_info_data,
lldb::offset_t *offset_ptr, lldb_private::Stream &s,
dw_attr_t attr, DWARFFormValue &form_value);
- bool GetDIENamesAndRanges(
- SymbolFileDWARF *dwarf2Data, lldb_private::DWARFContext &dwarf_context,
- const DWARFUnit *cu, const char *&name, const char *&mangled,
- DWARFRangeList &rangeList, int &decl_file, int &decl_line,
- int &decl_column, int &call_file, int &call_line, int &call_column,
- lldb_private::DWARFExpression *frame_base = NULL) const;
+ bool
+ GetDIENamesAndRanges(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
+ const char *&name, const char *&mangled,
+ DWARFRangeList &rangeList, int &decl_file,
+ int &decl_line, int &decl_column, int &call_file,
+ int &call_line, int &call_column,
+ lldb_private::DWARFExpression *frame_base = NULL) const;
const DWARFAbbreviationDeclaration *
GetAbbreviationDeclarationPtr(SymbolFileDWARF *dwarf2Data,
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp Fri Mar 22 09:07:58 2019
@@ -29,12 +29,11 @@ static dw_addr_t GetBaseAddressMarker(ui
DWARFDebugRanges::DWARFDebugRanges() : m_range_map() {}
-void DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context) {
+void DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data) {
DWARFRangeList range_list;
lldb::offset_t offset = 0;
dw_offset_t debug_ranges_offset = offset;
- while (Extract(dwarf2Data, dwarf_context, &offset, range_list)) {
+ while (Extract(dwarf2Data, &offset, range_list)) {
range_list.Sort();
m_range_map[debug_ranges_offset] = range_list;
debug_ranges_offset = offset;
@@ -42,24 +41,21 @@ void DWARFDebugRanges::Extract(SymbolFil
}
bool DWARFDebugRanges::Extract(SymbolFileDWARF *dwarf2Data,
- DWARFContext &dwarf_context,
lldb::offset_t *offset_ptr,
DWARFRangeList &range_list) {
range_list.Clear();
lldb::offset_t range_offset = *offset_ptr;
- const DWARFDataExtractor *debug_ranges =
- dwarf_context.getOrLoadDebugRangesData();
- if (!debug_ranges)
- return false;
-
- uint32_t addr_size = debug_ranges->GetAddressByteSize();
+ const DWARFDataExtractor &debug_ranges_data =
+ dwarf2Data->get_debug_ranges_data();
+ uint32_t addr_size = debug_ranges_data.GetAddressByteSize();
dw_addr_t base_addr = 0;
dw_addr_t base_addr_marker = GetBaseAddressMarker(addr_size);
- while (debug_ranges->ValidOffsetForDataOfSize(*offset_ptr, 2 * addr_size)) {
- dw_addr_t begin = debug_ranges->GetMaxU64(offset_ptr, addr_size);
- dw_addr_t end = debug_ranges->GetMaxU64(offset_ptr, addr_size);
+ while (
+ debug_ranges_data.ValidOffsetForDataOfSize(*offset_ptr, 2 * addr_size)) {
+ dw_addr_t begin = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
+ dw_addr_t end = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
if (!begin && !end) {
// End of range list
@@ -259,38 +255,33 @@ bool DWARFDebugRngLists::FindRanges(cons
return false;
}
-void DWARFDebugRngLists::Extract(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context) {
- const DWARFDataExtractor *data = dwarf_context.getOrLoadDebugRnglistsData();
- if (!data)
- return;
-
+void DWARFDebugRngLists::Extract(SymbolFileDWARF *dwarf2Data) {
+ const DWARFDataExtractor &data = dwarf2Data->get_debug_rnglists_data();
lldb::offset_t offset = 0;
- uint64_t length = data->GetU32(&offset);
+ uint64_t length = data.GetU32(&offset);
// FIXME: Handle DWARF64.
lldb::offset_t end = offset + length;
// Check version.
- if (data->GetU16(&offset) < 5)
+ if (data.GetU16(&offset) < 5)
return;
- uint8_t addrSize = data->GetU8(&offset);
+ uint8_t addrSize = data.GetU8(&offset);
// We do not support non-zero segment selector size.
- if (data->GetU8(&offset) != 0) {
+ if (data.GetU8(&offset) != 0) {
lldbassert(0 && "not implemented");
return;
}
- uint32_t offsetsAmount = data->GetU32(&offset);
+ uint32_t offsetsAmount = data.GetU32(&offset);
for (uint32_t i = 0; i < offsetsAmount; ++i)
- Offsets.push_back(data->GetMaxU64(&offset, 4));
+ Offsets.push_back(data.GetMaxU64(&offset, 4));
lldb::offset_t listOffset = offset;
std::vector<RngListEntry> rangeList;
- while (offset < end &&
- ExtractRangeList(*data, addrSize, &offset, rangeList)) {
+ while (offset < end && ExtractRangeList(data, addrSize, &offset, rangeList)) {
m_range_map[listOffset] = rangeList;
listOffset = offset;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h Fri Mar 22 09:07:58 2019
@@ -14,16 +14,11 @@
#include <map>
-namespace lldb_private {
-class DWARFContext;
-}
-
class DWARFDebugRangesBase {
public:
virtual ~DWARFDebugRangesBase(){};
- virtual void Extract(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context) = 0;
+ virtual void Extract(SymbolFileDWARF *dwarf2Data) = 0;
virtual bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
DWARFRangeList &range_list) const = 0;
virtual uint64_t GetOffset(size_t Index) const = 0;
@@ -33,8 +28,7 @@ class DWARFDebugRanges final : public DW
public:
DWARFDebugRanges();
- void Extract(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context) override;
+ void Extract(SymbolFileDWARF *dwarf2Data) override;
bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
DWARFRangeList &range_list) const override;
uint64_t GetOffset(size_t Index) const override;
@@ -44,9 +38,8 @@ public:
lldb::offset_t *offset_ptr, dw_addr_t cu_base_addr);
protected:
- bool Extract(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context,
- lldb::offset_t *offset_ptr, DWARFRangeList &range_list);
+ bool Extract(SymbolFileDWARF *dwarf2Data, lldb::offset_t *offset_ptr,
+ DWARFRangeList &range_list);
typedef std::map<dw_offset_t, DWARFRangeList> range_map;
typedef range_map::iterator range_map_iterator;
@@ -63,8 +56,7 @@ class DWARFDebugRngLists final : public
};
public:
- void Extract(SymbolFileDWARF *dwarf2Data,
- lldb_private::DWARFContext &dwarf_context) override;
+ void Extract(SymbolFileDWARF *dwarf2Data) override;
bool FindRanges(const DWARFUnit *cu, dw_offset_t debug_ranges_offset,
DWARFRangeList &range_list) const override;
uint64_t GetOffset(size_t Index) const override;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Fri Mar 22 09:07:58 2019
@@ -489,16 +489,16 @@ void DWARFFormValue::Dump(Stream &s) con
}
const char *DWARFFormValue::AsCString() const {
- if (m_form == DW_FORM_string)
- return m_value.value.cstr;
-
- DWARFContext &context = m_cu->GetDWARFContext();
SymbolFileDWARF *symbol_file = m_cu->GetSymbolFileDWARF();
- if (m_form == DW_FORM_strp)
- return symbol_file->get_debug_str_data().PeekCStr(m_value.value.uval);
+ if (m_form == DW_FORM_string) {
+ return m_value.value.cstr;
+ } else if (m_form == DW_FORM_strp) {
+ if (!symbol_file)
+ return nullptr;
- if (m_form == DW_FORM_GNU_str_index) {
+ return symbol_file->get_debug_str_data().PeekCStr(m_value.value.uval);
+ } else if (m_form == DW_FORM_GNU_str_index) {
if (!symbol_file)
return nullptr;
@@ -526,13 +526,8 @@ const char *DWARFFormValue::AsCString()
return symbol_file->get_debug_str_data().PeekCStr(strOffset);
}
- if (m_form == DW_FORM_line_strp) {
- const DWARFDataExtractor *extractor = context.getOrLoadDebugLineStrData();
- if (!extractor)
- return nullptr;
-
- return extractor->PeekCStr(m_value.value.uval);
- }
+ if (m_form == DW_FORM_line_strp)
+ return symbol_file->get_debug_line_str_data().PeekCStr(m_value.value.uval);
return nullptr;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Fri Mar 22 09:07:58 2019
@@ -29,8 +29,8 @@ using namespace std;
extern int g_verbose;
-DWARFUnit::DWARFUnit(SymbolFileDWARF *dwarf, DWARFContext &dwarf_context)
- : m_dwarf(dwarf), m_dwarf_context(dwarf_context), m_cancel_scopes(false) {}
+DWARFUnit::DWARFUnit(SymbolFileDWARF *dwarf)
+ : m_dwarf(dwarf), m_cancel_scopes(false) {}
DWARFUnit::~DWARFUnit() {}
@@ -609,7 +609,6 @@ bool DWARFUnit::Supports_unnamed_objc_bi
}
SymbolFileDWARF *DWARFUnit::GetSymbolFileDWARF() const { return m_dwarf; }
-DWARFContext &DWARFUnit::GetDWARFContext() const { return m_dwarf_context; }
void DWARFUnit::ParseProducerInfo() {
m_producer_version_major = UINT32_MAX;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Fri Mar 22 09:07:58 2019
@@ -21,10 +21,6 @@ class NameToDIE;
class SymbolFileDWARF;
class SymbolFileDWARFDwo;
-namespace lldb_private {
-class DWARFContext;
-}
-
typedef std::shared_ptr<DWARFUnit> DWARFUnitSP;
enum DWARFProducer {
@@ -151,7 +147,6 @@ public:
bool Supports_unnamed_objc_bitfields();
SymbolFileDWARF *GetSymbolFileDWARF() const;
- lldb_private::DWARFContext &GetDWARFContext() const;
DWARFProducer GetProducer();
@@ -180,10 +175,9 @@ public:
}
protected:
- DWARFUnit(SymbolFileDWARF *dwarf, lldb_private::DWARFContext &dwarf_context);
+ DWARFUnit(SymbolFileDWARF *dwarf);
SymbolFileDWARF *m_dwarf = nullptr;
- lldb_private::DWARFContext &m_dwarf_context;
std::unique_ptr<SymbolFileDWARFDwo> m_dwo_symbol_file;
const DWARFAbbreviationDeclarationSet *m_abbrevs = nullptr;
void *m_user_data = nullptr;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Mar 22 09:07:58 2019
@@ -54,7 +54,6 @@
#include "AppleDWARFIndex.h"
#include "DWARFASTParser.h"
#include "DWARFASTParserClang.h"
-#include "DWARFContext.h"
#include "DWARFDebugAbbrev.h"
#include "DWARFDebugAranges.h"
#include "DWARFDebugInfo.h"
@@ -358,8 +357,11 @@ SymbolFileDWARF::SymbolFileDWARF(ObjectF
// contain the .o file index/ID
m_debug_map_module_wp(), m_debug_map_symfile(NULL),
m_context(*objfile->GetModule()), m_data_debug_abbrev(),
- m_data_debug_info(), m_data_debug_str(), m_abbr(), m_info(), m_line(),
- m_fetched_external_modules(false),
+ m_data_debug_frame(), m_data_debug_info(), m_data_debug_line(),
+ m_data_debug_macro(), m_data_debug_loc(), m_data_debug_ranges(),
+ m_data_debug_rnglists(), m_data_debug_str(), m_data_apple_names(),
+ m_data_apple_types(), m_data_apple_namespaces(), m_abbr(), m_info(),
+ m_line(), m_fetched_external_modules(false),
m_supports_DW_AT_APPLE_objc_complete_type(eLazyBoolCalculate), m_ranges(),
m_unique_ast_type_map() {}
@@ -559,10 +561,52 @@ const DWARFDataExtractor &SymbolFileDWAR
return GetCachedSectionData(eSectionTypeDWARFDebugAddr, m_data_debug_addr);
}
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_frame_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugFrame, m_data_debug_frame);
+}
+
const DWARFDataExtractor &SymbolFileDWARF::get_debug_info_data() {
return GetCachedSectionData(eSectionTypeDWARFDebugInfo, m_data_debug_info);
}
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_line_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugLine, m_data_debug_line);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_line_str_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugLineStr, m_data_debug_line_str);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_macro_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugMacro, m_data_debug_macro);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::DebugLocData() {
+ const DWARFDataExtractor &debugLocData = get_debug_loc_data();
+ if (debugLocData.GetByteSize() > 0)
+ return debugLocData;
+ return get_debug_loclists_data();
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_loc_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugLoc, m_data_debug_loc);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_loclists_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugLocLists,
+ m_data_debug_loclists);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_ranges_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugRanges,
+ m_data_debug_ranges);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_rnglists_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugRngLists,
+ m_data_debug_rnglists);
+}
+
const DWARFDataExtractor &SymbolFileDWARF::get_debug_str_data() {
return GetCachedSectionData(eSectionTypeDWARFDebugStr, m_data_debug_str);
}
@@ -572,6 +616,32 @@ const DWARFDataExtractor &SymbolFileDWAR
m_data_debug_str_offsets);
}
+const DWARFDataExtractor &SymbolFileDWARF::get_debug_types_data() {
+ return GetCachedSectionData(eSectionTypeDWARFDebugTypes, m_data_debug_types);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_apple_names_data() {
+ return GetCachedSectionData(eSectionTypeDWARFAppleNames, m_data_apple_names);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_apple_types_data() {
+ return GetCachedSectionData(eSectionTypeDWARFAppleTypes, m_data_apple_types);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_apple_namespaces_data() {
+ return GetCachedSectionData(eSectionTypeDWARFAppleNamespaces,
+ m_data_apple_namespaces);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_apple_objc_data() {
+ return GetCachedSectionData(eSectionTypeDWARFAppleObjC, m_data_apple_objc);
+}
+
+const DWARFDataExtractor &SymbolFileDWARF::get_gnu_debugaltlink() {
+ return GetCachedSectionData(eSectionTypeDWARFGNUDebugAltLink,
+ m_data_gnu_debugaltlink);
+}
+
DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() {
if (m_abbr)
return m_abbr.get();
@@ -639,13 +709,13 @@ DWARFDebugRangesBase *SymbolFileDWARF::D
Timer scoped_timer(func_cat, "%s this = %p", LLVM_PRETTY_FUNCTION,
static_cast<void *>(this));
- if (m_context.getOrLoadDebugRangesData())
- m_ranges = llvm::make_unique<DWARFDebugRanges>();
- else if (m_context.getOrLoadDebugRnglistsData())
- m_ranges = llvm::make_unique<DWARFDebugRngLists>();
+ if (get_debug_ranges_data().GetByteSize() > 0)
+ m_ranges.reset(new DWARFDebugRanges());
+ else if (get_debug_rnglists_data().GetByteSize() > 0)
+ m_ranges.reset(new DWARFDebugRngLists());
if (m_ranges)
- m_ranges->Extract(this, m_context);
+ m_ranges->Extract(this);
}
return m_ranges.get();
}
@@ -801,26 +871,23 @@ bool SymbolFileDWARF::ParseSupportFiles(
FileSpecList &support_files) {
ASSERT_MODULE_LOCK(this);
DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
- if (!dwarf_cu)
- return false;
- const DWARFBaseDIE cu_die = dwarf_cu->GetUnitDIEOnly();
-
- if (!cu_die)
- return false;
-
- const dw_offset_t stmt_list =
- cu_die.GetAttributeValueAsUnsigned(DW_AT_stmt_list, DW_INVALID_OFFSET);
- if (stmt_list == DW_INVALID_OFFSET)
- return false;
- // All file indexes in DWARF are one based and a file of index zero is
- // supposed to be the compile unit itself.
- support_files.Append(comp_unit);
- const DWARFDataExtractor *debug_line = m_context.getOrLoadDebugLineData();
- if (!debug_line)
- return false;
+ if (dwarf_cu) {
+ const DWARFBaseDIE cu_die = dwarf_cu->GetUnitDIEOnly();
- return DWARFDebugLine::ParseSupportFiles(comp_unit.GetModule(), *debug_line,
- stmt_list, support_files, dwarf_cu);
+ if (cu_die) {
+ const dw_offset_t stmt_list = cu_die.GetAttributeValueAsUnsigned(
+ DW_AT_stmt_list, DW_INVALID_OFFSET);
+ if (stmt_list != DW_INVALID_OFFSET) {
+ // All file indexes in DWARF are one based and a file of index zero is
+ // supposed to be the compile unit itself.
+ support_files.Append(comp_unit);
+ return DWARFDebugLine::ParseSupportFiles(
+ comp_unit.GetModule(), get_debug_line_data(), stmt_list,
+ support_files, dwarf_cu);
+ }
+ }
+ }
+ return false;
}
bool SymbolFileDWARF::ParseIsOptimized(CompileUnit &comp_unit) {
@@ -931,64 +998,58 @@ bool SymbolFileDWARF::ParseLineTable(Com
return true;
DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
- if (!dwarf_cu)
- return false;
-
- const DWARFBaseDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly();
- if (dwarf_cu_die) {
- const dw_offset_t cu_line_offset = dwarf_cu_die.GetAttributeValueAsUnsigned(
- DW_AT_stmt_list, DW_INVALID_OFFSET);
- if (cu_line_offset == DW_INVALID_OFFSET)
- return false;
-
- std::unique_ptr<LineTable> line_table_up(new LineTable(&comp_unit));
- if (!line_table_up)
- return false;
-
- ParseDWARFLineTableCallbackInfo info;
- info.line_table = line_table_up.get();
-
- /*
- * MIPS:
- * The SymbolContext may not have a valid target, thus we may not be
- * able
- * to call Address::GetOpcodeLoadAddress() which would clear the bit
- * #0
- * for MIPS. Use ArchSpec to clear the bit #0.
- */
- switch (GetObjectFile()->GetArchitecture().GetMachine()) {
- case llvm::Triple::mips:
- case llvm::Triple::mipsel:
- case llvm::Triple::mips64:
- case llvm::Triple::mips64el:
- info.addr_mask = ~((lldb::addr_t)1);
- break;
- default:
- info.addr_mask = ~((lldb::addr_t)0);
- break;
- }
-
- lldb::offset_t offset = cu_line_offset;
- const DWARFDataExtractor *debug_line = m_context.getOrLoadDebugLineData();
- if (!debug_line)
- return false;
+ if (dwarf_cu) {
+ const DWARFBaseDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly();
+ if (dwarf_cu_die) {
+ const dw_offset_t cu_line_offset =
+ dwarf_cu_die.GetAttributeValueAsUnsigned(DW_AT_stmt_list,
+ DW_INVALID_OFFSET);
+ if (cu_line_offset != DW_INVALID_OFFSET) {
+ std::unique_ptr<LineTable> line_table_up(new LineTable(&comp_unit));
+ if (line_table_up) {
+ ParseDWARFLineTableCallbackInfo info;
+ info.line_table = line_table_up.get();
+
+ /*
+ * MIPS:
+ * The SymbolContext may not have a valid target, thus we may not be
+ * able
+ * to call Address::GetOpcodeLoadAddress() which would clear the bit
+ * #0
+ * for MIPS. Use ArchSpec to clear the bit #0.
+ */
+ switch (GetObjectFile()->GetArchitecture().GetMachine()) {
+ case llvm::Triple::mips:
+ case llvm::Triple::mipsel:
+ case llvm::Triple::mips64:
+ case llvm::Triple::mips64el:
+ info.addr_mask = ~((lldb::addr_t)1);
+ break;
+ default:
+ info.addr_mask = ~((lldb::addr_t)0);
+ break;
+ }
- DWARFDebugLine::ParseStatementTable(
- *debug_line, &offset, ParseDWARFLineTableCallback, &info, dwarf_cu);
- SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
- if (debug_map_symfile) {
- // We have an object file that has a line table with addresses that
- // are not linked. We need to link the line table and convert the
- // addresses that are relative to the .o file into addresses for
- // the main executable.
- comp_unit.SetLineTable(
- debug_map_symfile->LinkOSOLineTable(this, line_table_up.get()));
- } else {
- comp_unit.SetLineTable(line_table_up.release());
- return true;
+ lldb::offset_t offset = cu_line_offset;
+ DWARFDebugLine::ParseStatementTable(get_debug_line_data(), &offset,
+ ParseDWARFLineTableCallback,
+ &info, dwarf_cu);
+ SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
+ if (debug_map_symfile) {
+ // We have an object file that has a line table with addresses that
+ // are not linked. We need to link the line table and convert the
+ // addresses that are relative to the .o file into addresses for
+ // the main executable.
+ comp_unit.SetLineTable(
+ debug_map_symfile->LinkOSOLineTable(this, line_table_up.get()));
+ } else {
+ comp_unit.SetLineTable(line_table_up.release());
+ return true;
+ }
+ }
+ }
}
}
-
return false;
}
@@ -998,19 +1059,18 @@ SymbolFileDWARF::ParseDebugMacros(lldb::
if (iter != m_debug_macros_map.end())
return iter->second;
- const DWARFDataExtractor *debug_macro_data =
- m_context.getOrLoadDebugMacroData();
- if (!debug_macro_data)
- return nullptr;
+ const DWARFDataExtractor &debug_macro_data = get_debug_macro_data();
+ if (debug_macro_data.GetByteSize() == 0)
+ return DebugMacrosSP();
lldb_private::DebugMacrosSP debug_macros_sp(new lldb_private::DebugMacros());
m_debug_macros_map[*offset] = debug_macros_sp;
const DWARFDebugMacroHeader &header =
- DWARFDebugMacroHeader::ParseHeader(*debug_macro_data, offset);
- DWARFDebugMacroEntry::ReadMacroEntries(
- *debug_macro_data, get_debug_str_data(), header.OffsetIs64Bit(), offset,
- this, debug_macros_sp);
+ DWARFDebugMacroHeader::ParseHeader(debug_macro_data, offset);
+ DWARFDebugMacroEntry::ReadMacroEntries(debug_macro_data, get_debug_str_data(),
+ header.OffsetIs64Bit(), offset, this,
+ debug_macros_sp);
return debug_macros_sp;
}
@@ -1537,8 +1597,6 @@ SymbolFileDWARF::GetDwoSymbolFileForComp
return llvm::make_unique<SymbolFileDWARFDwo>(dwo_obj_file, &dwarf_cu);
}
-DWARFContext &SymbolFileDWARF::GetDWARFContext() { return m_context; }
-
void SymbolFileDWARF::UpdateExternalModuleListIfNeeded() {
if (m_fetched_external_modules)
return;
@@ -3244,17 +3302,13 @@ VariableSP SymbolFileDWARF::ParseVariabl
uint32_t block_length = form_value.Unsigned();
location.CopyOpcodeData(module, data, block_offset, block_length);
} else {
- const DWARFDataExtractor *debug_loc_data =
- m_context.getOrLoadBestDebugLocData();
- if (!debug_loc_data)
- break;
-
+ const DWARFDataExtractor &debug_loc_data = DebugLocData();
const dw_offset_t debug_loc_offset = form_value.Unsigned();
size_t loc_list_length = DWARFExpression::LocationListSize(
- die.GetCU(), *debug_loc_data, debug_loc_offset);
+ die.GetCU(), debug_loc_data, debug_loc_offset);
if (loc_list_length > 0) {
- location.CopyOpcodeData(module, *debug_loc_data,
+ location.CopyOpcodeData(module, debug_loc_data,
debug_loc_offset, loc_list_length);
assert(func_low_pc != LLDB_INVALID_ADDRESS);
location.SetLocationListSlide(
@@ -3764,8 +3818,9 @@ SymbolFileDWARFDebugMap *SymbolFileDWARF
return m_debug_map_symfile;
}
-DWARFExpression::LocationListFormat SymbolFileDWARF::GetLocationListFormat() {
- if (m_context.getOrLoadDebugLoclistData())
+DWARFExpression::LocationListFormat
+SymbolFileDWARF::GetLocationListFormat() const {
+ if (m_data_debug_loclists.m_data.GetByteSize() > 0)
return DWARFExpression::LocLists;
return DWARFExpression::RegularLocationList;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Fri Mar 22 09:07:58 2019
@@ -228,9 +228,23 @@ public:
virtual const lldb_private::DWARFDataExtractor &get_debug_abbrev_data();
virtual const lldb_private::DWARFDataExtractor &get_debug_addr_data();
+ const lldb_private::DWARFDataExtractor &get_debug_frame_data();
virtual const lldb_private::DWARFDataExtractor &get_debug_info_data();
+ const lldb_private::DWARFDataExtractor &get_debug_line_data();
+ const lldb_private::DWARFDataExtractor &get_debug_line_str_data();
+ const lldb_private::DWARFDataExtractor &get_debug_macro_data();
+ const lldb_private::DWARFDataExtractor &get_debug_loc_data();
+ const lldb_private::DWARFDataExtractor &get_debug_loclists_data();
+ const lldb_private::DWARFDataExtractor &get_debug_ranges_data();
+ const lldb_private::DWARFDataExtractor &get_debug_rnglists_data();
virtual const lldb_private::DWARFDataExtractor &get_debug_str_data();
virtual const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data();
+ const lldb_private::DWARFDataExtractor &get_debug_types_data();
+ const lldb_private::DWARFDataExtractor &get_apple_names_data();
+ const lldb_private::DWARFDataExtractor &get_apple_types_data();
+ const lldb_private::DWARFDataExtractor &get_apple_namespaces_data();
+ const lldb_private::DWARFDataExtractor &get_apple_objc_data();
+ const lldb_private::DWARFDataExtractor &get_gnu_debugaltlink();
DWARFDebugAbbrev *DebugAbbrev();
@@ -244,6 +258,8 @@ public:
const DWARFDebugRangesBase *DebugRanges() const;
+ const lldb_private::DWARFDataExtractor &DebugLocData();
+
static bool SupportedVersion(uint16_t version);
DWARFDIE
@@ -269,7 +285,7 @@ public:
uint32_t cu_idx);
virtual lldb_private::DWARFExpression::LocationListFormat
- GetLocationListFormat();
+ GetLocationListFormat() const;
lldb::ModuleSP GetDWOModule(lldb_private::ConstString name);
@@ -286,7 +302,6 @@ public:
virtual std::unique_ptr<SymbolFileDWARFDwo>
GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu,
const DWARFDebugInfoEntry &cu_die);
- lldb_private::DWARFContext &GetDWARFContext();
// For regular SymbolFileDWARF instances the method returns nullptr,
// for the instances of the subclass SymbolFileDWARFDwo
@@ -447,9 +462,23 @@ protected:
DWARFDataSegment m_data_debug_abbrev;
DWARFDataSegment m_data_debug_addr;
+ DWARFDataSegment m_data_debug_frame;
DWARFDataSegment m_data_debug_info;
+ DWARFDataSegment m_data_debug_line;
+ DWARFDataSegment m_data_debug_line_str;
+ DWARFDataSegment m_data_debug_macro;
+ DWARFDataSegment m_data_debug_loc;
+ DWARFDataSegment m_data_debug_loclists;
+ DWARFDataSegment m_data_debug_ranges;
+ DWARFDataSegment m_data_debug_rnglists;
DWARFDataSegment m_data_debug_str;
DWARFDataSegment m_data_debug_str_offsets;
+ DWARFDataSegment m_data_debug_types;
+ DWARFDataSegment m_data_apple_names;
+ DWARFDataSegment m_data_apple_types;
+ DWARFDataSegment m_data_apple_namespaces;
+ DWARFDataSegment m_data_apple_objc;
+ DWARFDataSegment m_data_gnu_debugaltlink;
// The unique pointer items below are generated on demand if and when someone
// accesses
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp Fri Mar 22 09:07:58 2019
@@ -147,7 +147,7 @@ SymbolFileDWARF *SymbolFileDWARFDwo::Get
}
DWARFExpression::LocationListFormat
-SymbolFileDWARFDwo::GetLocationListFormat() {
+SymbolFileDWARFDwo::GetLocationListFormat() const {
return DWARFExpression::SplitDwarfLocationList;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h?rev=356773&r1=356772&r2=356773&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h Fri Mar 22 09:07:58 2019
@@ -26,7 +26,7 @@ public:
GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) override;
lldb_private::DWARFExpression::LocationListFormat
- GetLocationListFormat() override;
+ GetLocationListFormat() const override;
size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name,
DIEArray &method_die_offsets) override;
More information about the lldb-commits
mailing list