aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
commit5f29bb8a675e8f96452b632e7129113f7dec850e (patch)
tree3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
parent88c643b6fec27eec436c8d138fee6346e92337d6 (diff)
downloadsrc-5f29bb8a675e8f96452b632e7129113f7dec850e.tar.gz
src-5f29bb8a675e8f96452b632e7129113f7dec850e.zip
Vendor import of stripped lldb trunk r366426 (just before the release_90
Notes
Notes: svn path=/vendor/lldb/dist/; revision=351290
Diffstat (limited to 'source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp')
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp78
1 files changed, 17 insertions, 61 deletions
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp b/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
index 077de9604f1d..96adb72c9532 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
@@ -1,9 +1,8 @@
//===-- DWARFBaseDIE.cpp ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
@@ -18,14 +17,12 @@
using namespace lldb_private;
-DIERef DWARFBaseDIE::GetDIERef() const {
+llvm::Optional<DIERef> DWARFBaseDIE::GetDIERef() const {
if (!IsValid())
- return DIERef();
+ return llvm::None;
- dw_offset_t cu_offset = m_cu->GetOffset();
- if (m_cu->GetBaseObjOffset() != DW_INVALID_OFFSET)
- cu_offset = m_cu->GetBaseObjOffset();
- return DIERef(cu_offset, m_die->GetOffset());
+ return DIERef(m_cu->GetSymbolFileDWARF().GetDwoNum(), m_cu->GetDebugSection(),
+ m_die->GetOffset());
}
dw_tag_t DWARFBaseDIE::Tag() const {
@@ -42,8 +39,7 @@ const char *DWARFBaseDIE::GetTagAsCString() const {
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;
}
@@ -51,26 +47,7 @@ const char *DWARFBaseDIE::GetAttributeValueAsString(const dw_attr_t attr,
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);
- else
- return fail_value;
-}
-
-int64_t DWARFBaseDIE::GetAttributeValueAsSigned(const dw_attr_t attr,
- int64_t fail_value) const {
- if (IsValid())
- return m_die->GetAttributeValueAsSigned(GetDWARF(), GetCU(), attr,
- fail_value);
- else
- return fail_value;
-}
-
-uint64_t DWARFBaseDIE::GetAttributeValueAsReference(const dw_attr_t attr,
- uint64_t fail_value) const {
- if (IsValid())
- return m_die->GetAttributeValueAsReference(GetDWARF(), GetCU(), attr,
- fail_value);
+ return m_die->GetAttributeValueAsUnsigned(GetCU(), attr, fail_value);
else
return fail_value;
}
@@ -78,19 +55,20 @@ uint64_t DWARFBaseDIE::GetAttributeValueAsReference(const dw_attr_t attr,
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;
}
lldb::user_id_t DWARFBaseDIE::GetID() const {
- return GetDIERef().GetUID(GetDWARF());
+ if (IsValid())
+ return GetDWARF()->GetUID(*this);
+ return LLDB_INVALID_UID;
}
const char *DWARFBaseDIE::GetName() const {
if (IsValid())
- return m_die->GetName(GetDWARF(), m_cu);
+ return m_die->GetName(m_cu);
else
return nullptr;
}
@@ -110,13 +88,6 @@ lldb::ModuleSP DWARFBaseDIE::GetModule() const {
return lldb::ModuleSP();
}
-lldb_private::CompileUnit *DWARFBaseDIE::GetLLDBCompileUnit() const {
- if (IsValid())
- return GetDWARF()->GetCompUnitForDWARFCompUnit(GetCU());
- else
- return nullptr;
-}
-
dw_offset_t DWARFBaseDIE::GetOffset() const {
if (IsValid())
return m_die->GetOffset();
@@ -124,16 +95,9 @@ dw_offset_t DWARFBaseDIE::GetOffset() const {
return DW_INVALID_OFFSET;
}
-dw_offset_t DWARFBaseDIE::GetCompileUnitRelativeOffset() const {
- if (IsValid())
- return m_die->GetOffset() - m_cu->GetOffset();
- else
- return DW_INVALID_OFFSET;
-}
-
SymbolFileDWARF *DWARFBaseDIE::GetDWARF() const {
if (m_cu)
- return m_cu->GetSymbolFileDWARF();
+ return &m_cu->GetSymbolFileDWARF();
else
return nullptr;
}
@@ -163,21 +127,13 @@ bool DWARFBaseDIE::Supports_DW_AT_APPLE_objc_complete_type() const {
size_t DWARFBaseDIE::GetAttributes(DWARFAttributes &attributes,
uint32_t depth) const {
- if (IsValid()) {
- return m_die->GetAttributes(m_cu, m_cu->GetFixedFormSizes(), attributes,
- depth);
- }
+ if (IsValid())
+ return m_die->GetAttributes(m_cu, attributes, depth);
if (depth == 0)
attributes.Clear();
return 0;
}
-void DWARFBaseDIE::Dump(lldb_private::Stream *s,
- const uint32_t recurse_depth) const {
- if (s && IsValid())
- m_die->Dump(GetDWARF(), GetCU(), *s, recurse_depth);
-}
-
bool operator==(const DWARFBaseDIE &lhs, const DWARFBaseDIE &rhs) {
return lhs.GetDIE() == rhs.GetDIE() && lhs.GetCU() == rhs.GetCU();
}