[Lldb-commits] [lldb] r361277 - Remove `SymbolFileDWARF *` when there is already `DWARFUnit *`
Jan Kratochvil via lldb-commits
lldb-commits at lists.llvm.org
Tue May 21 10:38:56 PDT 2019
Author: jankratochvil
Date: Tue May 21 10:38:56 2019
New Revision: 361277
URL: http://llvm.org/viewvc/llvm-project?rev=361277&view=rev
Log:
Remove `SymbolFileDWARF *` when there is already `DWARFUnit *`
In D61502#1503247 @clayborg suggested that SymbolFileDWARF *dwarf2Data is
really redundant in all the calls with also having DWARFUnit *cu. So remove it.
One `SymbolFileDWARF *` nullptr check
(DWARFDebugInfoEntry::GetDIENamesAndRanges) could be removed, other two nullptr
checks (DWARFDebugInfoEntry::GetName and DWARFDebugInfoEntry::AppendTypeName)
need to stay in place (now for `DWARFUnit *`).
Differential Revision: https://reviews.llvm.org/D62011
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
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/DWARFUnit.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp?rev=361277&r1=361276&r2=361277&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp Tue May 21 10:38:56 2019
@@ -41,8 +41,7 @@ const char *DWARFBaseDIE::GetTagAsCStrin
const char *DWARFBaseDIE::GetAttributeValueAsString(const dw_attr_t attr,
const char *fail_value) const {
if (IsValid())
- return m_die->GetAttributeValueAsString(GetDWARF(), GetCU(), attr,
- fail_value);
+ return m_die->GetAttributeValueAsString(GetCU(), attr, fail_value);
else
return fail_value;
}
@@ -50,8 +49,7 @@ const char *DWARFBaseDIE::GetAttributeVa
uint64_t DWARFBaseDIE::GetAttributeValueAsUnsigned(const dw_attr_t attr,
uint64_t fail_value) const {
if (IsValid())
- return m_die->GetAttributeValueAsUnsigned(GetDWARF(), GetCU(), attr,
- fail_value);
+ return m_die->GetAttributeValueAsUnsigned(GetCU(), attr, fail_value);
else
return fail_value;
}
@@ -59,8 +57,7 @@ uint64_t DWARFBaseDIE::GetAttributeValue
uint64_t DWARFBaseDIE::GetAttributeValueAsAddress(const dw_attr_t attr,
uint64_t fail_value) const {
if (IsValid())
- return m_die->GetAttributeValueAsAddress(GetDWARF(), GetCU(), attr,
- fail_value);
+ return m_die->GetAttributeValueAsAddress(GetCU(), attr, fail_value);
else
return fail_value;
}
@@ -73,7 +70,7 @@ lldb::user_id_t DWARFBaseDIE::GetID() co
const char *DWARFBaseDIE::GetName() const {
if (IsValid())
- return m_die->GetName(GetDWARF(), m_cu);
+ return m_die->GetName(m_cu);
else
return nullptr;
}
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=361277&r1=361276&r2=361277&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp Tue May 21 10:38:56 2019
@@ -113,7 +113,7 @@ DWARFDIE::GetSibling() const {
DWARFDIE
DWARFDIE::GetReferencedDIE(const dw_attr_t attr) const {
if (IsValid())
- return m_die->GetAttributeValueAsReference(GetDWARF(), GetCU(), attr);
+ return m_die->GetAttributeValueAsReference(GetCU(), attr);
else
return {};
}
@@ -130,10 +130,9 @@ DWARFDIE
DWARFDIE::GetAttributeValueAsReferenceDIE(const dw_attr_t attr) const {
if (IsValid()) {
DWARFUnit *cu = GetCU();
- SymbolFileDWARF *dwarf = cu->GetSymbolFileDWARF();
const bool check_specification_or_abstract_origin = true;
DWARFFormValue form_value;
- if (m_die->GetAttributeValue(dwarf, cu, attr, form_value, nullptr,
+ if (m_die->GetAttributeValue(cu, attr, form_value, nullptr,
check_specification_or_abstract_origin))
return form_value.Reference();
}
@@ -147,7 +146,7 @@ DWARFDIE::LookupDeepestBlock(lldb::addr_
DWARFUnit *cu = GetCU();
DWARFDebugInfoEntry *function_die = nullptr;
DWARFDebugInfoEntry *block_die = nullptr;
- if (m_die->LookupAddress(file_addr, dwarf, cu, &function_die, &block_die)) {
+ if (m_die->LookupAddress(file_addr, cu, &function_die, &block_die)) {
if (block_die && block_die != function_die) {
if (cu->ContainsDIEOffset(block_die->GetOffset()))
return DWARFDIE(cu, block_die);
@@ -164,21 +163,21 @@ DWARFDIE::LookupDeepestBlock(lldb::addr_
const char *DWARFDIE::GetMangledName() const {
if (IsValid())
- return m_die->GetMangledName(GetDWARF(), m_cu);
+ return m_die->GetMangledName(m_cu);
else
return nullptr;
}
const char *DWARFDIE::GetPubname() const {
if (IsValid())
- return m_die->GetPubname(GetDWARF(), m_cu);
+ return m_die->GetPubname(m_cu);
else
return nullptr;
}
const char *DWARFDIE::GetQualifiedName(std::string &storage) const {
if (IsValid())
- return m_die->GetQualifiedName(GetDWARF(), m_cu, storage);
+ return m_die->GetQualifiedName(m_cu, storage);
else
return nullptr;
}
@@ -215,7 +214,7 @@ std::vector<DWARFDIE> DWARFDIE::GetDeclC
void DWARFDIE::GetDWARFDeclContext(DWARFDeclContext &dwarf_decl_ctx) const {
if (IsValid()) {
dwarf_decl_ctx.SetLanguage(GetLanguage());
- m_die->GetDWARFDeclContext(GetDWARF(), GetCU(), dwarf_decl_ctx);
+ m_die->GetDWARFDeclContext(GetCU(), dwarf_decl_ctx);
} else {
dwarf_decl_ctx.Clear();
}
@@ -273,7 +272,7 @@ void DWARFDIE::GetDeclContext(std::vecto
DWARFDIE
DWARFDIE::GetParentDeclContextDIE() const {
if (IsValid())
- return m_die->GetParentDeclContextDIE(GetDWARF(), m_cu);
+ return m_die->GetParentDeclContextDIE(m_cu);
else
return DWARFDIE();
}
@@ -331,8 +330,8 @@ bool DWARFDIE::GetDIENamesAndRanges(
lldb_private::DWARFExpression *frame_base) const {
if (IsValid()) {
return m_die->GetDIENamesAndRanges(
- GetDWARF(), GetCU(), name, mangled, ranges, decl_file, decl_line,
- decl_column, call_file, call_line, call_column, frame_base);
+ 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=361277&r1=361276&r2=361277&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Tue May 21 10:38:56 2019
@@ -65,7 +65,7 @@ llvm::Expected<DWARFDebugAranges &> DWAR
dw_offset_t offset = cu->GetOffset();
if (cus_with_data.find(offset) == cus_with_data.end())
- cu->BuildAddressRangeTable(m_dwarf2Data, m_cu_aranges_up.get());
+ cu->BuildAddressRangeTable(m_cu_aranges_up.get());
}
const bool minimize = true;
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=361277&r1=361276&r2=361277&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue May 21 10:38:56 2019
@@ -373,19 +373,15 @@ static dw_offset_t GetRangesOffset(const
// Gets the valid address ranges for a given DIE by looking for a
// DW_AT_low_pc/DW_AT_high_pc pair, DW_AT_entry_pc, or DW_AT_ranges attributes.
bool DWARFDebugInfoEntry::GetDIENamesAndRanges(
- 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;
-
+ 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 {
SymbolFileDWARFDwo *dwo_symbol_file = cu->GetDwoSymbolFile();
if (dwo_symbol_file)
return GetDIENamesAndRanges(
- dwo_symbol_file, dwo_symbol_file->GetCompileUnit(), name, mangled,
- ranges, decl_file, decl_line, decl_column, call_file, call_line,
- call_column, frame_base);
+ 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;
@@ -394,8 +390,9 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
lldb::offset_t offset;
const DWARFAbbreviationDeclaration *abbrevDecl =
- GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
+ GetAbbreviationDeclarationPtr(cu, offset);
+ SymbolFileDWARF *dwarf2Data = cu->GetSymbolFileDWARF();
lldb::ModuleSP module = dwarf2Data->GetObjectFile()->GetModule();
if (abbrevDecl) {
@@ -559,9 +556,9 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
if (die_ref.die_offset != DW_INVALID_OFFSET) {
DWARFDIE die = dwarf2Data->GetDIE(die_ref);
if (die)
- die.GetDIE()->GetDIENamesAndRanges(
- die.GetDWARF(), die.GetCU(), name, mangled, ranges, decl_file,
- decl_line, decl_column, call_file, call_line, call_column);
+ die.GetDIE()->GetDIENamesAndRanges(die.GetCU(), name, mangled, ranges,
+ decl_file, decl_line, decl_column,
+ call_file, call_line, call_column);
}
}
}
@@ -572,8 +569,7 @@ bool DWARFDebugInfoEntry::GetDIENamesAnd
//
// Dumps a debug information entry and all of it's attributes to the specified
// stream.
-void DWARFDebugInfoEntry::Dump(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu, Stream &s,
+void DWARFDebugInfoEntry::Dump(const DWARFUnit *cu, Stream &s,
uint32_t recurse_depth) const {
const DWARFDataExtractor &debug_info_data = cu->GetData();
lldb::offset_t offset = m_offset;
@@ -600,8 +596,7 @@ void DWARFDebugInfoEntry::Dump(SymbolFil
dw_attr_t attr;
abbrevDecl->GetAttrAndFormValueByIndex(i, attr, form_value);
- DumpAttribute(dwarf2Data, cu, debug_info_data, &offset, s, attr,
- form_value);
+ DumpAttribute(cu, debug_info_data, &offset, s, attr, form_value);
}
const DWARFDebugInfoEntry *child = GetFirstChild();
@@ -609,7 +604,7 @@ void DWARFDebugInfoEntry::Dump(SymbolFil
s.IndentMore();
while (child) {
- child->Dump(dwarf2Data, cu, s, recurse_depth - 1);
+ child->Dump(cu, s, recurse_depth - 1);
child = child->GetSibling();
}
s.IndentLess();
@@ -630,9 +625,9 @@ void DWARFDebugInfoEntry::Dump(SymbolFil
// display of attributes is done (disassemble location lists, show enumeration
// values for attributes, etc).
void DWARFDebugInfoEntry::DumpAttribute(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const DWARFDataExtractor &debug_info_data, lldb::offset_t *offset_ptr,
- Stream &s, dw_attr_t attr, DWARFFormValue &form_value) {
+ 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(" ");
@@ -655,6 +650,8 @@ void DWARFDebugInfoEntry::DumpAttribute(
s.PutCString("( ");
+ SymbolFileDWARF *dwarf2Data = cu->GetSymbolFileDWARF();
+
// Check to see if we have any special attribute formatters
switch (attr) {
case DW_AT_stmt_list:
@@ -696,19 +693,17 @@ void DWARFDebugInfoEntry::DumpAttribute(
DWARFDIE abstract_die = form_value.Reference();
form_value.Dump(s);
// *ostrm_ptr << HEX32 << abstract_die.GetOffset() << " ( ";
- GetName(dwarf2Data, abstract_die.GetCU(), abstract_die.GetOffset(), s);
+ GetName(abstract_die.GetCU(), abstract_die.GetOffset(), s);
} break;
case DW_AT_type: {
DWARFDIE type_die = form_value.Reference();
s.PutCString(" ( ");
- AppendTypeName(dwarf2Data, type_die.GetCU(), type_die.GetOffset(), s);
+ AppendTypeName(type_die.GetCU(), type_die.GetOffset(), s);
s.PutCString(" )");
} break;
case DW_AT_ranges: {
- if (!dwarf2Data)
- break;
lldb::offset_t ranges_offset =
GetRangesOffset(dwarf2Data->DebugRanges(), form_value);
dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
@@ -735,7 +730,7 @@ size_t DWARFDebugInfoEntry::GetAttribute
lldb::offset_t offset = 0;
if (cu) {
dwarf2Data = cu->GetSymbolFileDWARF();
- abbrevDecl = GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
+ abbrevDecl = GetAbbreviationDeclarationPtr(cu, offset);
}
if (abbrevDecl) {
@@ -797,20 +792,19 @@ size_t DWARFDebugInfoEntry::GetAttribute
// since an offset of zero is invalid for an attribute (it would be a compile
// unit header).
dw_offset_t DWARFDebugInfoEntry::GetAttributeValue(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, DWARFFormValue &form_value,
+ const DWARFUnit *cu, const dw_attr_t attr, DWARFFormValue &form_value,
dw_offset_t *end_attr_offset_ptr,
bool check_specification_or_abstract_origin) const {
SymbolFileDWARFDwo *dwo_symbol_file = cu->GetDwoSymbolFile();
if (dwo_symbol_file && m_tag != DW_TAG_compile_unit &&
m_tag != DW_TAG_partial_unit)
- return GetAttributeValue(dwo_symbol_file, dwo_symbol_file->GetCompileUnit(),
- attr, form_value, end_attr_offset_ptr,
+ return GetAttributeValue(dwo_symbol_file->GetCompileUnit(), attr,
+ form_value, end_attr_offset_ptr,
check_specification_or_abstract_origin);
lldb::offset_t offset;
const DWARFAbbreviationDeclaration *abbrevDecl =
- GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
+ GetAbbreviationDeclarationPtr(cu, offset);
if (abbrevDecl) {
uint32_t attr_idx = abbrevDecl->FindAttributeIndex(attr);
@@ -835,23 +829,21 @@ dw_offset_t DWARFDebugInfoEntry::GetAttr
}
if (check_specification_or_abstract_origin) {
- if (GetAttributeValue(dwarf2Data, cu, DW_AT_specification, form_value)) {
+ if (GetAttributeValue(cu, DW_AT_specification, form_value)) {
DWARFDIE die = form_value.Reference();
if (die) {
dw_offset_t die_offset = die.GetDIE()->GetAttributeValue(
- die.GetDWARF(), die.GetCU(), attr, form_value, end_attr_offset_ptr,
- false);
+ die.GetCU(), attr, form_value, end_attr_offset_ptr, false);
if (die_offset)
return die_offset;
}
}
- if (GetAttributeValue(dwarf2Data, cu, DW_AT_abstract_origin, form_value)) {
+ if (GetAttributeValue(cu, DW_AT_abstract_origin, form_value)) {
DWARFDIE die = form_value.Reference();
if (die) {
dw_offset_t die_offset = die.GetDIE()->GetAttributeValue(
- die.GetDWARF(), die.GetCU(), attr, form_value, end_attr_offset_ptr,
- false);
+ die.GetCU(), attr, form_value, end_attr_offset_ptr, false);
if (die_offset)
return die_offset;
}
@@ -870,7 +862,7 @@ dw_offset_t DWARFDebugInfoEntry::GetAttr
return 0;
return dwo_cu_die.GetDIE()->GetAttributeValue(
- dwo_symbol_file, dwo_cu, attr, form_value, end_attr_offset_ptr,
+ dwo_cu, attr, form_value, end_attr_offset_ptr,
check_specification_or_abstract_origin);
}
@@ -881,11 +873,10 @@ dw_offset_t DWARFDebugInfoEntry::GetAttr
// be available as long as the SymbolFileDWARF is still around and it's content
// doesn't change.
const char *DWARFDebugInfoEntry::GetAttributeValueAsString(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, const char *fail_value,
+ const DWARFUnit *cu, const dw_attr_t attr, const char *fail_value,
bool check_specification_or_abstract_origin) const {
DWARFFormValue form_value;
- if (GetAttributeValue(dwarf2Data, cu, attr, form_value, nullptr,
+ if (GetAttributeValue(cu, attr, form_value, nullptr,
check_specification_or_abstract_origin))
return form_value.AsCString();
return fail_value;
@@ -895,11 +886,10 @@ const char *DWARFDebugInfoEntry::GetAttr
//
// Get the value of an attribute as unsigned and return it.
uint64_t DWARFDebugInfoEntry::GetAttributeValueAsUnsigned(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, uint64_t fail_value,
+ const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value,
bool check_specification_or_abstract_origin) const {
DWARFFormValue form_value;
- if (GetAttributeValue(dwarf2Data, cu, attr, form_value, nullptr,
+ if (GetAttributeValue(cu, attr, form_value, nullptr,
check_specification_or_abstract_origin))
return form_value.Unsigned();
return fail_value;
@@ -910,21 +900,20 @@ uint64_t DWARFDebugInfoEntry::GetAttribu
// Get the value of an attribute as reference and fix up and compile unit
// relative offsets as needed.
DWARFDIE DWARFDebugInfoEntry::GetAttributeValueAsReference(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, const dw_attr_t attr,
+ const DWARFUnit *cu, const dw_attr_t attr,
bool check_specification_or_abstract_origin) const {
DWARFFormValue form_value;
- if (GetAttributeValue(dwarf2Data, cu, attr, form_value, nullptr,
+ if (GetAttributeValue(cu, attr, form_value, nullptr,
check_specification_or_abstract_origin))
return form_value.Reference();
return {};
}
uint64_t DWARFDebugInfoEntry::GetAttributeValueAsAddress(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, uint64_t fail_value,
+ const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value,
bool check_specification_or_abstract_origin) const {
DWARFFormValue form_value;
- if (GetAttributeValue(dwarf2Data, cu, attr, form_value, nullptr,
+ if (GetAttributeValue(cu, attr, form_value, nullptr,
check_specification_or_abstract_origin))
return form_value.Address();
return fail_value;
@@ -937,10 +926,10 @@ uint64_t DWARFDebugInfoEntry::GetAttribu
//
// Returns the hi_pc or fail_value.
dw_addr_t DWARFDebugInfoEntry::GetAttributeHighPC(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, dw_addr_t lo_pc,
- uint64_t fail_value, bool check_specification_or_abstract_origin) const {
+ const DWARFUnit *cu, dw_addr_t lo_pc, uint64_t fail_value,
+ bool check_specification_or_abstract_origin) const {
DWARFFormValue form_value;
- if (GetAttributeValue(dwarf2Data, cu, DW_AT_high_pc, form_value, nullptr,
+ if (GetAttributeValue(cu, DW_AT_high_pc, form_value, nullptr,
check_specification_or_abstract_origin)) {
dw_form_t form = form_value.Form();
if (form == DW_FORM_addr || form == DW_FORM_addrx ||
@@ -960,13 +949,12 @@ dw_addr_t DWARFDebugInfoEntry::GetAttrib
//
// Returns true or sets lo_pc and hi_pc to fail_value.
bool DWARFDebugInfoEntry::GetAttributeAddressRange(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, dw_addr_t &lo_pc,
- dw_addr_t &hi_pc, uint64_t fail_value,
- bool check_specification_or_abstract_origin) const {
- lo_pc = GetAttributeValueAsAddress(dwarf2Data, cu, DW_AT_low_pc, fail_value,
+ const DWARFUnit *cu, dw_addr_t &lo_pc, dw_addr_t &hi_pc,
+ uint64_t fail_value, bool check_specification_or_abstract_origin) const {
+ lo_pc = GetAttributeValueAsAddress(cu, DW_AT_low_pc, fail_value,
check_specification_or_abstract_origin);
if (lo_pc != fail_value) {
- hi_pc = GetAttributeHighPC(dwarf2Data, cu, lo_pc, fail_value,
+ hi_pc = GetAttributeHighPC(cu, lo_pc, fail_value,
check_specification_or_abstract_origin);
if (hi_pc != fail_value)
return true;
@@ -977,21 +965,21 @@ bool DWARFDebugInfoEntry::GetAttributeAd
}
size_t DWARFDebugInfoEntry::GetAttributeAddressRanges(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- DWARFRangeList &ranges, bool check_hi_lo_pc,
+ const DWARFUnit *cu, DWARFRangeList &ranges, bool check_hi_lo_pc,
bool check_specification_or_abstract_origin) const {
ranges.Clear();
+ SymbolFileDWARF *dwarf2Data = cu->GetSymbolFileDWARF();
+
DWARFFormValue form_value;
- if (GetAttributeValue(dwarf2Data, cu, DW_AT_ranges, form_value)) {
+ if (GetAttributeValue(cu, DW_AT_ranges, form_value)) {
if (DWARFDebugRangesBase *debug_ranges = dwarf2Data->DebugRanges())
debug_ranges->FindRanges(cu, GetRangesOffset(debug_ranges, form_value),
ranges);
} else if (check_hi_lo_pc) {
dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
- if (GetAttributeAddressRange(dwarf2Data, cu, lo_pc, hi_pc,
- LLDB_INVALID_ADDRESS,
+ if (GetAttributeAddressRange(cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS,
check_specification_or_abstract_origin)) {
if (lo_pc < hi_pc)
ranges.Append(DWARFRangeList::Entry(lo_pc, hi_pc - lo_pc));
@@ -1004,9 +992,8 @@ size_t DWARFDebugInfoEntry::GetAttribute
//
// Get value of the DW_AT_name attribute and return it if one exists, else
// return NULL.
-const char *DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu) const {
- return GetAttributeValueAsString(dwarf2Data, cu, DW_AT_name, nullptr, true);
+const char *DWARFDebugInfoEntry::GetName(const DWARFUnit *cu) const {
+ return GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
}
// GetMangledName
@@ -1014,25 +1001,22 @@ const char *DWARFDebugInfoEntry::GetName
// Get value of the DW_AT_MIPS_linkage_name attribute and return it if one
// exists, else return the value of the DW_AT_name attribute
const char *
-DWARFDebugInfoEntry::GetMangledName(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
+DWARFDebugInfoEntry::GetMangledName(const DWARFUnit *cu,
bool substitute_name_allowed) const {
const char *name = nullptr;
- name = GetAttributeValueAsString(dwarf2Data, cu, DW_AT_MIPS_linkage_name,
- nullptr, true);
+ name = GetAttributeValueAsString(cu, DW_AT_MIPS_linkage_name, nullptr, true);
if (name)
return name;
- name = GetAttributeValueAsString(dwarf2Data, cu, DW_AT_linkage_name, nullptr,
- true);
+ name = GetAttributeValueAsString(cu, DW_AT_linkage_name, nullptr, true);
if (name)
return name;
if (!substitute_name_allowed)
return nullptr;
- name = GetAttributeValueAsString(dwarf2Data, cu, DW_AT_name, nullptr, true);
+ name = GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
return name;
}
@@ -1040,23 +1024,20 @@ DWARFDebugInfoEntry::GetMangledName(Symb
//
// Get value the name for a DIE as it should appear for a .debug_pubnames or
// .debug_pubtypes section.
-const char *DWARFDebugInfoEntry::GetPubname(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu) const {
+const char *DWARFDebugInfoEntry::GetPubname(const DWARFUnit *cu) const {
const char *name = nullptr;
- if (!dwarf2Data)
+ if (!cu)
return name;
- name = GetAttributeValueAsString(dwarf2Data, cu, DW_AT_MIPS_linkage_name,
- nullptr, true);
+ name = GetAttributeValueAsString(cu, DW_AT_MIPS_linkage_name, nullptr, true);
if (name)
return name;
- name = GetAttributeValueAsString(dwarf2Data, cu, DW_AT_linkage_name, nullptr,
- true);
+ name = GetAttributeValueAsString(cu, DW_AT_linkage_name, nullptr, true);
if (name)
return name;
- name = GetAttributeValueAsString(dwarf2Data, cu, DW_AT_name, nullptr, true);
+ name = GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
return name;
}
@@ -1066,10 +1047,9 @@ const char *DWARFDebugInfoEntry::GetPubn
// exists at offset "die_offset" and place that value into the supplied stream
// object. If the DIE is a NULL object "NULL" is placed into the stream, and if
// no DW_AT_name attribute exists for the DIE then nothing is printed.
-bool DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
+bool DWARFDebugInfoEntry::GetName(const DWARFUnit *cu,
const dw_offset_t die_offset, Stream &s) {
- if (dwarf2Data == NULL) {
+ if (cu == NULL) {
s.PutCString("NULL");
return false;
}
@@ -1081,8 +1061,8 @@ bool DWARFDebugInfoEntry::GetName(Symbol
s.PutCString("NULL");
return true;
} else {
- const char *name = die.GetAttributeValueAsString(
- dwarf2Data, cu, DW_AT_name, nullptr, true);
+ const char *name =
+ die.GetAttributeValueAsString(cu, DW_AT_name, nullptr, true);
if (name) {
s.PutCString(name);
return true;
@@ -1097,11 +1077,10 @@ bool DWARFDebugInfoEntry::GetName(Symbol
// Follows the type name definition down through all needed tags to end up with
// a fully qualified type name and dump the results to the supplied stream.
// This is used to show the name of types given a type identifier.
-bool DWARFDebugInfoEntry::AppendTypeName(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
+bool DWARFDebugInfoEntry::AppendTypeName(const DWARFUnit *cu,
const dw_offset_t die_offset,
Stream &s) {
- if (dwarf2Data == NULL) {
+ if (cu == NULL) {
s.PutCString("NULL");
return false;
}
@@ -1113,13 +1092,13 @@ bool DWARFDebugInfoEntry::AppendTypeName
s.PutCString("NULL");
return true;
} else {
- const char *name = die.GetPubname(dwarf2Data, cu);
+ const char *name = die.GetPubname(cu);
if (name)
s.PutCString(name);
else {
bool result = true;
const DWARFAbbreviationDeclaration *abbrevDecl =
- die.GetAbbreviationDeclarationPtr(dwarf2Data, cu, offset);
+ die.GetAbbreviationDeclarationPtr(cu, offset);
if (abbrevDecl == NULL)
return false;
@@ -1194,10 +1173,9 @@ bool DWARFDebugInfoEntry::AppendTypeName
// Follow the DW_AT_type if possible
DWARFFormValue form_value;
- if (die.GetAttributeValue(dwarf2Data, cu, DW_AT_type, form_value)) {
+ if (die.GetAttributeValue(cu, DW_AT_type, form_value)) {
DWARFDIE next_die = form_value.Reference();
- result = AppendTypeName(dwarf2Data, next_die.GetCU(),
- next_die.GetOffset(), s);
+ result = AppendTypeName(next_die.GetCU(), next_die.GetOffset(), s);
}
switch (abbrevDecl->Tag()) {
@@ -1225,14 +1203,12 @@ bool DWARFDebugInfoEntry::AppendTypeName
// BuildAddressRangeTable
void DWARFDebugInfoEntry::BuildAddressRangeTable(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- DWARFDebugAranges *debug_aranges) const {
+ const DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const {
if (m_tag) {
if (m_tag == DW_TAG_subprogram) {
dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
- if (GetAttributeAddressRange(dwarf2Data, cu, lo_pc, hi_pc,
- LLDB_INVALID_ADDRESS)) {
+ if (GetAttributeAddressRange(cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS)) {
/// printf("BuildAddressRangeTable() 0x%8.8x: %30s: [0x%8.8x -
/// 0x%8.8x)\n", m_offset, DW_TAG_value_to_name(tag), lo_pc, hi_pc);
debug_aranges->AppendRange(cu->GetOffset(), lo_pc, hi_pc);
@@ -1241,7 +1217,7 @@ void DWARFDebugInfoEntry::BuildAddressRa
const DWARFDebugInfoEntry *child = GetFirstChild();
while (child) {
- child->BuildAddressRangeTable(dwarf2Data, cu, debug_aranges);
+ child->BuildAddressRangeTable(cu, debug_aranges);
child = child->GetSibling();
}
}
@@ -1254,14 +1230,12 @@ void DWARFDebugInfoEntry::BuildAddressRa
// of the compile unit offset (which is the way the standard .debug_aranges
// section does it).
void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- DWARFDebugAranges *debug_aranges) const {
+ const DWARFUnit *cu, DWARFDebugAranges *debug_aranges) const {
if (m_tag) {
if (m_tag == DW_TAG_subprogram) {
dw_addr_t lo_pc = LLDB_INVALID_ADDRESS;
dw_addr_t hi_pc = LLDB_INVALID_ADDRESS;
- if (GetAttributeAddressRange(dwarf2Data, cu, lo_pc, hi_pc,
- LLDB_INVALID_ADDRESS)) {
+ if (GetAttributeAddressRange(cu, lo_pc, hi_pc, LLDB_INVALID_ADDRESS)) {
// printf("BuildAddressRangeTable() 0x%8.8x: [0x%16.16" PRIx64 " -
// 0x%16.16" PRIx64 ")\n", m_offset, lo_pc, hi_pc); // DEBUG ONLY
debug_aranges->AppendRange(GetOffset(), lo_pc, hi_pc);
@@ -1270,7 +1244,7 @@ void DWARFDebugInfoEntry::BuildFunctionA
const DWARFDebugInfoEntry *child = GetFirstChild();
while (child) {
- child->BuildFunctionAddressRangeTable(dwarf2Data, cu, debug_aranges);
+ child->BuildFunctionAddressRangeTable(cu, debug_aranges);
child = child->GetSibling();
}
}
@@ -1284,43 +1258,38 @@ DWARFDebugInfoEntry::GetDeclContextDIEs(
}
void DWARFDebugInfoEntry::GetDWARFDeclContext(
- SymbolFileDWARF *dwarf2Data, DWARFUnit *cu,
- DWARFDeclContext &dwarf_decl_ctx) const {
+ DWARFUnit *cu, DWARFDeclContext &dwarf_decl_ctx) const {
const dw_tag_t tag = Tag();
if (tag != DW_TAG_compile_unit && tag != DW_TAG_partial_unit) {
- dwarf_decl_ctx.AppendDeclContext(tag, GetName(dwarf2Data, cu));
- DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(dwarf2Data, cu);
+ dwarf_decl_ctx.AppendDeclContext(tag, GetName(cu));
+ DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(cu);
if (parent_decl_ctx_die && parent_decl_ctx_die.GetDIE() != this) {
if (parent_decl_ctx_die.Tag() != DW_TAG_compile_unit &&
parent_decl_ctx_die.Tag() != DW_TAG_partial_unit)
parent_decl_ctx_die.GetDIE()->GetDWARFDeclContext(
- parent_decl_ctx_die.GetDWARF(), parent_decl_ctx_die.GetCU(),
- dwarf_decl_ctx);
+ parent_decl_ctx_die.GetCU(), dwarf_decl_ctx);
}
}
}
bool DWARFDebugInfoEntry::MatchesDWARFDeclContext(
- SymbolFileDWARF *dwarf2Data, DWARFUnit *cu,
- const DWARFDeclContext &dwarf_decl_ctx) const {
+ DWARFUnit *cu, const DWARFDeclContext &dwarf_decl_ctx) const {
DWARFDeclContext this_dwarf_decl_ctx;
- GetDWARFDeclContext(dwarf2Data, cu, this_dwarf_decl_ctx);
+ GetDWARFDeclContext(cu, this_dwarf_decl_ctx);
return this_dwarf_decl_ctx == dwarf_decl_ctx;
}
DWARFDIE
-DWARFDebugInfoEntry::GetParentDeclContextDIE(SymbolFileDWARF *dwarf2Data,
- DWARFUnit *cu) const {
+DWARFDebugInfoEntry::GetParentDeclContextDIE(DWARFUnit *cu) const {
DWARFAttributes attributes;
GetAttributes(cu, DWARFFormValue::FixedFormSizes(), attributes);
- return GetParentDeclContextDIE(dwarf2Data, cu, attributes);
+ return GetParentDeclContextDIE(cu, attributes);
}
DWARFDIE
DWARFDebugInfoEntry::GetParentDeclContextDIE(
- SymbolFileDWARF *dwarf2Data, DWARFUnit *cu,
- const DWARFAttributes &attributes) const {
+ DWARFUnit *cu, const DWARFAttributes &attributes) const {
DWARFDIE die(cu, const_cast<DWARFDebugInfoEntry *>(this));
while (die) {
@@ -1361,22 +1330,22 @@ DWARFDebugInfoEntry::GetParentDeclContex
return DWARFDIE();
}
-const char *DWARFDebugInfoEntry::GetQualifiedName(SymbolFileDWARF *dwarf2Data,
- DWARFUnit *cu,
+const char *DWARFDebugInfoEntry::GetQualifiedName(DWARFUnit *cu,
std::string &storage) const {
DWARFAttributes attributes;
GetAttributes(cu, DWARFFormValue::FixedFormSizes(), attributes);
- return GetQualifiedName(dwarf2Data, cu, attributes, storage);
+ return GetQualifiedName(cu, attributes, storage);
}
-const char *DWARFDebugInfoEntry::GetQualifiedName(
- SymbolFileDWARF *dwarf2Data, DWARFUnit *cu,
- const DWARFAttributes &attributes, std::string &storage) const {
+const char *
+DWARFDebugInfoEntry::GetQualifiedName(DWARFUnit *cu,
+ const DWARFAttributes &attributes,
+ std::string &storage) const {
- const char *name = GetName(dwarf2Data, cu);
+ const char *name = GetName(cu);
if (name) {
- DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(dwarf2Data, cu);
+ DWARFDIE parent_decl_ctx_die = GetParentDeclContextDIE(cu);
storage.clear();
// TODO: change this to get the correct decl context parent....
while (parent_decl_ctx_die) {
@@ -1423,7 +1392,6 @@ const char *DWARFDebugInfoEntry::GetQual
// LookupAddress
bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
- SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu,
DWARFDebugInfoEntry **function_die,
DWARFDebugInfoEntry **block_die) {
@@ -1567,11 +1535,10 @@ bool DWARFDebugInfoEntry::LookupAddress(
}
if (match_addr_range) {
- dw_addr_t lo_pc = GetAttributeValueAsAddress(dwarf2Data, cu, DW_AT_low_pc,
- LLDB_INVALID_ADDRESS);
+ dw_addr_t lo_pc =
+ GetAttributeValueAsAddress(cu, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
if (lo_pc != LLDB_INVALID_ADDRESS) {
- dw_addr_t hi_pc =
- GetAttributeHighPC(dwarf2Data, cu, lo_pc, LLDB_INVALID_ADDRESS);
+ dw_addr_t hi_pc = GetAttributeHighPC(cu, lo_pc, LLDB_INVALID_ADDRESS);
if (hi_pc != LLDB_INVALID_ADDRESS) {
// printf("\n0x%8.8x: %30s: address = 0x%8.8x [0x%8.8x - 0x%8.8x) ",
// m_offset, DW_TAG_value_to_name(tag), address, lo_pc, hi_pc);
@@ -1613,8 +1580,9 @@ bool DWARFDebugInfoEntry::LookupAddress(
}
} else {
DWARFFormValue form_value;
- if (GetAttributeValue(dwarf2Data, cu, DW_AT_ranges, form_value)) {
+ if (GetAttributeValue(cu, DW_AT_ranges, form_value)) {
DWARFRangeList ranges;
+ SymbolFileDWARF *dwarf2Data = cu->GetSymbolFileDWARF();
DWARFDebugRangesBase *debug_ranges = dwarf2Data->DebugRanges();
debug_ranges->FindRanges(
cu, GetRangesOffset(debug_ranges, form_value), ranges);
@@ -1657,8 +1625,7 @@ bool DWARFDebugInfoEntry::LookupAddress(
// printf("checking children\n");
DWARFDebugInfoEntry *child = GetFirstChild();
while (child) {
- if (child->LookupAddress(address, dwarf2Data, cu, function_die,
- block_die))
+ if (child->LookupAddress(address, cu, function_die, block_die))
return true;
child = child->GetSibling();
}
@@ -1669,9 +1636,8 @@ bool DWARFDebugInfoEntry::LookupAddress(
const DWARFAbbreviationDeclaration *
DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- lldb::offset_t &offset) const {
- if (dwarf2Data) {
+ const DWARFUnit *cu, lldb::offset_t &offset) const {
+ if (cu) {
offset = GetOffset();
const DWARFAbbreviationDeclarationSet *abbrev_set = cu->GetAbbreviations();
@@ -1687,6 +1653,8 @@ DWARFDebugInfoEntry::GetAbbreviationDecl
if (abbrev_decl->Code() == abbrev_code)
return abbrev_decl;
+ SymbolFileDWARF *dwarf2Data = cu->GetSymbolFileDWARF();
+
dwarf2Data->GetObjectFile()->GetModule()->ReportErrorIfModifyDetected(
"0x%8.8x: the DWARF debug information has been modified (abbrev "
"code was %u, and is now %u)",
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=361277&r1=361276&r2=361277&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Tue May 21 10:38:56 2019
@@ -61,12 +61,10 @@ public:
bool operator==(const DWARFDebugInfoEntry &rhs) const;
bool operator!=(const DWARFDebugInfoEntry &rhs) const;
- void BuildAddressRangeTable(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
+ void BuildAddressRangeTable(const DWARFUnit *cu,
DWARFDebugAranges *debug_aranges) const;
- void BuildFunctionAddressRangeTable(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
+ void BuildFunctionAddressRangeTable(const DWARFUnit *cu,
DWARFDebugAranges *debug_aranges) const;
bool FastExtract(const lldb_private::DWARFDataExtractor &debug_info_data,
@@ -76,8 +74,7 @@ public:
bool Extract(const DWARFUnit *cu, lldb::offset_t *offset_ptr);
- bool LookupAddress(const dw_addr_t address, SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
+ bool LookupAddress(const dw_addr_t address, const DWARFUnit *cu,
DWARFDebugInfoEntry **function_die,
DWARFDebugInfoEntry **block_die);
@@ -88,95 +85,79 @@ public:
const; // "curr_depth" for internal use only, don't set this yourself!!!
dw_offset_t
- GetAttributeValue(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, DWARFFormValue &formValue,
+ GetAttributeValue(const DWARFUnit *cu, const dw_attr_t attr,
+ DWARFFormValue &formValue,
dw_offset_t *end_attr_offset_ptr = nullptr,
bool check_specification_or_abstract_origin = false) const;
const char *GetAttributeValueAsString(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, const char *fail_value,
+ const DWARFUnit *cu, const dw_attr_t attr, const char *fail_value,
bool check_specification_or_abstract_origin = false) const;
uint64_t GetAttributeValueAsUnsigned(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, uint64_t fail_value,
+ const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value,
bool check_specification_or_abstract_origin = false) const;
DWARFDIE GetAttributeValueAsReference(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, const dw_attr_t attr,
+ const DWARFUnit *cu, const dw_attr_t attr,
bool check_specification_or_abstract_origin = false) const;
uint64_t GetAttributeValueAsAddress(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, uint64_t fail_value,
+ const DWARFUnit *cu, const dw_attr_t attr, uint64_t fail_value,
bool check_specification_or_abstract_origin = false) const;
dw_addr_t
- GetAttributeHighPC(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- dw_addr_t lo_pc, uint64_t fail_value,
+ GetAttributeHighPC(const DWARFUnit *cu, dw_addr_t lo_pc, uint64_t fail_value,
bool check_specification_or_abstract_origin = false) const;
bool GetAttributeAddressRange(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu, dw_addr_t &lo_pc,
- dw_addr_t &hi_pc, uint64_t fail_value,
+ const DWARFUnit *cu, dw_addr_t &lo_pc, dw_addr_t &hi_pc,
+ uint64_t fail_value,
bool check_specification_or_abstract_origin = false) const;
size_t GetAttributeAddressRanges(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- DWARFRangeList &ranges, bool check_hi_lo_pc,
+ const DWARFUnit *cu, DWARFRangeList &ranges, bool check_hi_lo_pc,
bool check_specification_or_abstract_origin = false) const;
- const char *GetName(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu) const;
+ const char *GetName(const DWARFUnit *cu) const;
- const char *GetMangledName(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
+ const char *GetMangledName(const DWARFUnit *cu,
bool substitute_name_allowed = true) const;
- const char *GetPubname(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu) const;
+ const char *GetPubname(const DWARFUnit *cu) const;
- static bool GetName(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_offset_t die_offset, lldb_private::Stream &s);
+ static bool GetName(const DWARFUnit *cu, const dw_offset_t die_offset,
+ lldb_private::Stream &s);
- static bool AppendTypeName(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
- const dw_offset_t die_offset,
+ static bool AppendTypeName(const DWARFUnit *cu, const dw_offset_t die_offset,
lldb_private::Stream &s);
- const char *GetQualifiedName(SymbolFileDWARF *dwarf2Data,
- DWARFUnit *cu,
- std::string &storage) const;
+ const char *GetQualifiedName(DWARFUnit *cu, std::string &storage) const;
- const char *GetQualifiedName(SymbolFileDWARF *dwarf2Data,
- DWARFUnit *cu,
- const DWARFAttributes &attributes,
+ const char *GetQualifiedName(DWARFUnit *cu, const DWARFAttributes &attributes,
std::string &storage) const;
static bool OffsetLessThan(const DWARFDebugInfoEntry &a,
const DWARFDebugInfoEntry &b);
- void Dump(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- lldb_private::Stream &s, uint32_t recurse_depth) const;
+ void Dump(const DWARFUnit *cu, lldb_private::Stream &s,
+ uint32_t recurse_depth) const;
static void
- DumpAttribute(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
+ DumpAttribute(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, 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,
+ GetDIENamesAndRanges(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,
- const DWARFUnit *cu,
+ GetAbbreviationDeclarationPtr(const DWARFUnit *cu,
lldb::offset_t &offset) const;
dw_tag_t Tag() const { return m_tag; }
@@ -217,17 +198,14 @@ public:
std::vector<DWARFDIE> GetDeclContextDIEs(DWARFUnit *cu) const;
- void GetDWARFDeclContext(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu,
+ void GetDWARFDeclContext(DWARFUnit *cu,
DWARFDeclContext &dwarf_decl_ctx) const;
- bool MatchesDWARFDeclContext(SymbolFileDWARF *dwarf2Data,
- DWARFUnit *cu,
+ bool MatchesDWARFDeclContext(DWARFUnit *cu,
const DWARFDeclContext &dwarf_decl_ctx) const;
- DWARFDIE GetParentDeclContextDIE(SymbolFileDWARF *dwarf2Data,
- DWARFUnit *cu) const;
- DWARFDIE GetParentDeclContextDIE(SymbolFileDWARF *dwarf2Data,
- DWARFUnit *cu,
+ DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu) const;
+ DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu,
const DWARFAttributes &attributes) const;
void SetParent(DWARFDebugInfoEntry *parent) {
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=361277&r1=361276&r2=361277&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue May 21 10:38:56 2019
@@ -279,23 +279,22 @@ static void SetDwoStrOffsetsBase(DWARFUn
// m_die_array_mutex must be already held as read/write.
void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) {
dw_addr_t addr_base = cu_die.GetAttributeValueAsUnsigned(
- m_dwarf, this, DW_AT_addr_base, LLDB_INVALID_ADDRESS);
+ this, DW_AT_addr_base, LLDB_INVALID_ADDRESS);
if (addr_base != LLDB_INVALID_ADDRESS)
SetAddrBase(addr_base);
dw_addr_t ranges_base = cu_die.GetAttributeValueAsUnsigned(
- m_dwarf, this, DW_AT_rnglists_base, LLDB_INVALID_ADDRESS);
+ this, DW_AT_rnglists_base, LLDB_INVALID_ADDRESS);
if (ranges_base != LLDB_INVALID_ADDRESS)
SetRangesBase(ranges_base);
- SetStrOffsetsBase(cu_die.GetAttributeValueAsUnsigned(
- m_dwarf, this, DW_AT_str_offsets_base, 0));
+ SetStrOffsetsBase(
+ cu_die.GetAttributeValueAsUnsigned(this, DW_AT_str_offsets_base, 0));
- uint64_t base_addr = cu_die.GetAttributeValueAsAddress(
- m_dwarf, this, DW_AT_low_pc, LLDB_INVALID_ADDRESS);
+ uint64_t base_addr = cu_die.GetAttributeValueAsAddress(this, DW_AT_low_pc,
+ LLDB_INVALID_ADDRESS);
if (base_addr == LLDB_INVALID_ADDRESS)
- base_addr = cu_die.GetAttributeValueAsAddress(
- m_dwarf, this, DW_AT_entry_pc, 0);
+ base_addr = cu_die.GetAttributeValueAsAddress(this, DW_AT_entry_pc, 0);
SetBaseAddress(base_addr);
std::unique_ptr<SymbolFileDWARFDwo> dwo_symbol_file =
@@ -312,7 +311,7 @@ void DWARFUnit::AddUnitDIE(const DWARFDe
return; // Can't fetch the compile unit DIE from the dwo file.
uint64_t main_dwo_id =
- cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_GNU_dwo_id, 0);
+ cu_die.GetAttributeValueAsUnsigned(this, DW_AT_GNU_dwo_id, 0);
uint64_t sub_dwo_id =
dwo_cu_die.GetAttributeValueAsUnsigned(DW_AT_GNU_dwo_id, 0);
if (main_dwo_id != sub_dwo_id)
@@ -328,13 +327,13 @@ void DWARFUnit::AddUnitDIE(const DWARFDe
// DW_AT_* attributes standardized in DWARF v5 are also applicable to the main
// unit in contrast.
if (addr_base == LLDB_INVALID_ADDRESS)
- addr_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
- DW_AT_GNU_addr_base, 0);
+ addr_base =
+ cu_die.GetAttributeValueAsUnsigned(this, DW_AT_GNU_addr_base, 0);
dwo_cu->SetAddrBase(addr_base);
if (ranges_base == LLDB_INVALID_ADDRESS)
- ranges_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
- DW_AT_GNU_ranges_base, 0);
+ ranges_base =
+ cu_die.GetAttributeValueAsUnsigned(this, DW_AT_GNU_ranges_base, 0);
dwo_cu->SetRangesBase(ranges_base);
dwo_cu->SetBaseObjOffset(GetOffset());
@@ -406,8 +405,7 @@ void DWARFUnit::ClearDIEsRWLocked() {
m_dwo_symbol_file->GetCompileUnit()->ClearDIEsRWLocked();
}
-void DWARFUnit::BuildAddressRangeTable(SymbolFileDWARF *dwarf,
- DWARFDebugAranges *debug_aranges) {
+void DWARFUnit::BuildAddressRangeTable(DWARFDebugAranges *debug_aranges) {
// This function is usually called if there in no .debug_aranges section in
// order to produce a compile unit level set of address ranges that is
// accurate.
@@ -421,7 +419,7 @@ void DWARFUnit::BuildAddressRangeTable(S
if (die) {
DWARFRangeList ranges;
const size_t num_ranges =
- die->GetAttributeAddressRanges(dwarf, this, ranges, false);
+ die->GetAttributeAddressRanges(this, ranges, false);
if (num_ranges > 0) {
// This compile unit has DW_AT_ranges, assume this is correct if it is
// present since clang no longer makes .debug_aranges by default and it
@@ -445,13 +443,13 @@ void DWARFUnit::BuildAddressRangeTable(S
die = DIEPtr();
if (die)
- die->BuildAddressRangeTable(dwarf, this, debug_aranges);
+ die->BuildAddressRangeTable(this, debug_aranges);
if (debug_aranges->GetNumRanges() == num_debug_aranges) {
// We got nothing from the functions, maybe we have a line tables only
// situation. Check the line tables and build the arange table from this.
SymbolContext sc;
- sc.comp_unit = dwarf->GetCompUnitForDWARFCompUnit(this);
+ sc.comp_unit = m_dwarf->GetCompUnitForDWARFCompUnit(this);
if (sc.comp_unit) {
SymbolFileDWARFDebugMap *debug_map_sym_file =
m_dwarf->GetDebugMapSymfile();
@@ -471,7 +469,7 @@ void DWARFUnit::BuildAddressRangeTable(S
}
}
} else
- debug_map_sym_file->AddOSOARanges(dwarf, debug_aranges);
+ debug_map_sym_file->AddOSOARanges(m_dwarf, debug_aranges);
}
}
@@ -479,7 +477,7 @@ void DWARFUnit::BuildAddressRangeTable(S
// We got nothing from the functions, maybe we have a line tables only
// situation. Check the line tables and build the arange table from this.
SymbolContext sc;
- sc.comp_unit = dwarf->GetCompUnitForDWARFCompUnit(this);
+ sc.comp_unit = m_dwarf->GetCompUnitForDWARFCompUnit(this);
if (sc.comp_unit) {
LineTable *line_table = sc.comp_unit->GetLineTable();
@@ -597,7 +595,7 @@ void DWARFUnit::ParseProducerInfo() {
if (die) {
const char *producer_cstr =
- die->GetAttributeValueAsString(m_dwarf, this, DW_AT_producer, NULL);
+ die->GetAttributeValueAsString(this, DW_AT_producer, NULL);
if (producer_cstr) {
RegularExpression llvm_gcc_regex(
llvm::StringRef("^4\\.[012]\\.[01] \\(Based on Apple "
@@ -674,7 +672,7 @@ LanguageType DWARFUnit::GetLanguageType(
const DWARFDebugInfoEntry *die = GetUnitDIEPtrOnly();
if (die)
m_language_type = LanguageTypeFromDWARF(
- die->GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_language, 0));
+ die->GetAttributeValueAsUnsigned(this, DW_AT_language, 0));
return m_language_type;
}
@@ -683,8 +681,8 @@ bool DWARFUnit::GetIsOptimized() {
const DWARFDebugInfoEntry *die = GetUnitDIEPtrOnly();
if (die) {
m_is_optimized = eLazyBoolNo;
- if (die->GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_APPLE_optimized,
- 0) == 1) {
+ if (die->GetAttributeValueAsUnsigned(this, DW_AT_APPLE_optimized, 0) ==
+ 1) {
m_is_optimized = eLazyBoolYes;
}
}
@@ -748,7 +746,7 @@ void DWARFUnit::ComputeCompDirAndGuessPa
return;
llvm::StringRef comp_dir = removeHostnameFromPathname(
- die->GetAttributeValueAsString(m_dwarf, this, DW_AT_comp_dir, NULL));
+ die->GetAttributeValueAsString(this, DW_AT_comp_dir, NULL));
if (!comp_dir.empty()) {
FileSpec::Style comp_dir_style =
FileSpec::GuessPathStyle(comp_dir).getValueOr(FileSpec::Style::native);
@@ -756,8 +754,7 @@ void DWARFUnit::ComputeCompDirAndGuessPa
} else {
// Try to detect the style based on the DW_AT_name attribute, but just store
// the detected style in the m_comp_dir field.
- const char *name =
- die->GetAttributeValueAsString(m_dwarf, this, DW_AT_name, NULL);
+ const char *name = die->GetAttributeValueAsString(this, DW_AT_name, NULL);
m_comp_dir = FileSpec(
"", FileSpec::GuessPathStyle(name).getValueOr(FileSpec::Style::native));
}
@@ -774,14 +771,13 @@ const DWARFDebugAranges &DWARFUnit::GetF
m_func_aranges_up.reset(new DWARFDebugAranges());
const DWARFDebugInfoEntry *die = DIEPtr();
if (die)
- die->BuildFunctionAddressRangeTable(m_dwarf, this,
- m_func_aranges_up.get());
+ die->BuildFunctionAddressRangeTable(this, m_func_aranges_up.get());
if (m_dwo_symbol_file) {
DWARFUnit *dwo_cu = m_dwo_symbol_file->GetCompileUnit();
const DWARFDebugInfoEntry *dwo_die = dwo_cu->DIEPtr();
if (dwo_die)
- dwo_die->BuildFunctionAddressRangeTable(m_dwo_symbol_file.get(), dwo_cu,
+ dwo_die->BuildFunctionAddressRangeTable(dwo_cu,
m_func_aranges_up.get());
}
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=361277&r1=361276&r2=361277&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Tue May 21 10:38:56 2019
@@ -143,8 +143,7 @@ public:
void SetRangesBase(dw_addr_t ranges_base);
void SetBaseObjOffset(dw_offset_t base_obj_offset);
void SetStrOffsetsBase(dw_offset_t str_offsets_base);
- void BuildAddressRangeTable(SymbolFileDWARF *dwarf,
- DWARFDebugAranges *debug_aranges);
+ void BuildAddressRangeTable(DWARFDebugAranges *debug_aranges);
lldb::ByteOrder GetByteOrder() const;
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=361277&r1=361276&r2=361277&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue May 21 10:38:56 2019
@@ -1485,15 +1485,15 @@ SymbolFileDWARF::GetDwoSymbolFileForComp
if (GetDebugMapSymfile())
return nullptr;
- const char *dwo_name = cu_die.GetAttributeValueAsString(
- this, &dwarf_cu, DW_AT_GNU_dwo_name, nullptr);
+ const char *dwo_name =
+ cu_die.GetAttributeValueAsString(&dwarf_cu, DW_AT_GNU_dwo_name, nullptr);
if (!dwo_name)
return nullptr;
SymbolFileDWARFDwp *dwp_symfile = GetDwpSymbolFile();
if (dwp_symfile) {
- uint64_t dwo_id = cu_die.GetAttributeValueAsUnsigned(this, &dwarf_cu,
- DW_AT_GNU_dwo_id, 0);
+ uint64_t dwo_id =
+ cu_die.GetAttributeValueAsUnsigned(&dwarf_cu, DW_AT_GNU_dwo_id, 0);
std::unique_ptr<SymbolFileDWARFDwo> dwo_symfile =
dwp_symfile->GetSymbolFileForDwoId(&dwarf_cu, dwo_id);
if (dwo_symfile)
@@ -1503,8 +1503,8 @@ SymbolFileDWARF::GetDwoSymbolFileForComp
FileSpec dwo_file(dwo_name);
FileSystem::Instance().Resolve(dwo_file);
if (dwo_file.IsRelative()) {
- const char *comp_dir = cu_die.GetAttributeValueAsString(
- this, &dwarf_cu, DW_AT_comp_dir, nullptr);
+ const char *comp_dir =
+ cu_die.GetAttributeValueAsString(&dwarf_cu, DW_AT_comp_dir, nullptr);
if (!comp_dir)
return nullptr;
More information about the lldb-commits
mailing list