[Lldb-commits] [lldb] r356509 - Delete more dead code.
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 19 13:08:56 PDT 2019
Author: zturner
Date: Tue Mar 19 13:08:56 2019
New Revision: 356509
URL: http://llvm.org/viewvc/llvm-project?rev=356509&view=rev
Log:
Delete more dead code.
All of this is code that is unreferenced. Removing as much of
this as possible makes it more easy to determine what functionality
is missing and/or shared between LLVM and LLDB's DWARF interfaces.
Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
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/LogChannelDWARF.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp Tue Mar 19 13:08:56 2019
@@ -85,5 +85,5 @@ DWARFAbbreviationDeclaration::FindAttrib
bool DWARFAbbreviationDeclaration::
operator==(const DWARFAbbreviationDeclaration &rhs) const {
return Tag() == rhs.Tag() && HasChildren() == rhs.HasChildren() &&
- Attributes() == rhs.Attributes();
+ m_attributes == rhs.m_attributes;
}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.h Tue Mar 19 13:08:56 2019
@@ -21,18 +21,12 @@ public:
// For hand crafting an abbreviation declaration
DWARFAbbreviationDeclaration(dw_tag_t tag, uint8_t has_children);
- void AddAttribute(const DWARFAttribute &attr) {
- m_attributes.push_back(attr);
- }
dw_uleb128_t Code() const { return m_code; }
void SetCode(dw_uleb128_t code) { m_code = code; }
dw_tag_t Tag() const { return m_tag; }
bool HasChildren() const { return m_has_children; }
size_t NumAttributes() const { return m_attributes.size(); }
- dw_attr_t GetAttrByIndex(uint32_t idx) const {
- return m_attributes.size() > idx ? m_attributes[idx].get_attr() : 0;
- }
dw_form_t GetFormByIndex(uint32_t idx) const {
return m_attributes.size() > idx ? m_attributes[idx].get_form() : 0;
}
@@ -60,7 +54,6 @@ public:
lldb::offset_t *offset_ptr);
bool IsValid();
bool operator==(const DWARFAbbreviationDeclaration &rhs) const;
- const DWARFAttribute::collection &Attributes() const { return m_attributes; }
protected:
dw_uleb128_t m_code;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp Tue Mar 19 13:08:56 2019
@@ -32,19 +32,6 @@ void DWARFAttributes::Append(const DWARF
m_infos.push_back(attr_value);
}
-bool DWARFAttributes::ContainsAttribute(dw_attr_t attr) const {
- return FindAttributeIndex(attr) != UINT32_MAX;
-}
-
-bool DWARFAttributes::RemoveAttribute(dw_attr_t attr) {
- uint32_t attr_index = FindAttributeIndex(attr);
- if (attr_index != UINT32_MAX) {
- m_infos.erase(m_infos.begin() + attr_index);
- return true;
- }
- return false;
-}
-
bool DWARFAttributes::ExtractFormValueAtIndex(
uint32_t i, DWARFFormValue &form_value) const {
const DWARFUnit *cu = CompileUnitAtIndex(i);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h Tue Mar 19 13:08:56 2019
@@ -26,8 +26,6 @@ public:
m_attr = attr;
m_form = form;
}
- void set_attr(dw_attr_t attr) { m_attr = attr; }
- void set_form(dw_form_t form) { m_form = form; }
dw_attr_t get_attr() const { return m_attr; }
dw_form_t get_form() const { return m_form; }
void get(dw_attr_t &attr, dw_form_t &form,
@@ -70,8 +68,6 @@ public:
uint64_t FormValueAsUnsignedAtIndex(uint32_t i, uint64_t fail_value) const;
uint64_t FormValueAsUnsigned(dw_attr_t attr, uint64_t fail_value) const;
uint32_t FindAttributeIndex(dw_attr_t attr) const;
- bool ContainsAttribute(dw_attr_t attr) const;
- bool RemoveAttribute(dw_attr_t attr);
void Clear() { m_infos.clear(); }
size_t Size() const { return m_infos.size(); }
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=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp Tue Mar 19 13:08:56 2019
@@ -56,15 +56,6 @@ uint64_t DWARFBaseDIE::GetAttributeValue
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())
@@ -122,13 +113,6 @@ dw_offset_t DWARFBaseDIE::GetOffset() co
else
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)
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h Tue Mar 19 13:08:56 2019
@@ -96,8 +96,6 @@ public:
dw_offset_t GetOffset() const;
- dw_offset_t GetCompileUnitRelativeOffset() const;
-
//----------------------------------------------------------------------
// Get the LLDB user ID for this DIE. This is often just the DIE offset,
// but it might have a SymbolFileDWARF::GetID() in the high 32 bits if
@@ -127,9 +125,6 @@ public:
uint64_t GetAttributeValueAsUnsigned(const dw_attr_t attr,
uint64_t fail_value) const;
- int64_t GetAttributeValueAsSigned(const dw_attr_t attr,
- int64_t fail_value) const;
-
uint64_t GetAttributeValueAsReference(const dw_attr_t attr,
uint64_t fail_value) const;
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp Tue Mar 19 13:08:56 2019
@@ -75,25 +75,6 @@ DWARFAbbreviationDeclarationSet::GetAbbr
return NULL;
}
-//----------------------------------------------------------------------
-// DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential()
-//
-// Append an abbreviation declaration with a sequential code for O(n) lookups.
-// Handy when creating an DWARFAbbreviationDeclarationSet.
-//----------------------------------------------------------------------
-dw_uleb128_t DWARFAbbreviationDeclarationSet::AppendAbbrevDeclSequential(
- const DWARFAbbreviationDeclaration &abbrevDecl) {
- // Get the next abbreviation code based on our current array size
- dw_uleb128_t code = m_decls.size() + 1;
-
- // Push the new declaration on the back
- m_decls.push_back(abbrevDecl);
-
- // Update the code for this new declaration
- m_decls.back().SetCode(code);
-
- return code; // return the new abbreviation code!
-}
//----------------------------------------------------------------------
// DWARFAbbreviationDeclarationSet::GetUnsupportedForms()
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h Tue Mar 19 13:08:56 2019
@@ -40,8 +40,6 @@ public:
llvm::Error extract(const lldb_private::DWARFDataExtractor &data,
lldb::offset_t *offset_ptr);
// void Encode(BinaryStreamBuf& debug_abbrev_buf) const;
- dw_uleb128_t
- AppendAbbrevDeclSequential(const DWARFAbbreviationDeclaration &abbrevDecl);
void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const;
const DWARFAbbreviationDeclaration *
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp Tue Mar 19 13:08:56 2019
@@ -34,103 +34,6 @@ void DWARFDebugArangeSet::Clear() {
m_arange_descriptors.clear();
}
-void DWARFDebugArangeSet::SetHeader(uint16_t version, uint32_t cu_offset,
- uint8_t addr_size, uint8_t seg_size) {
- m_header.version = version;
- m_header.cu_offset = cu_offset;
- m_header.addr_size = addr_size;
- m_header.seg_size = seg_size;
-}
-
-void DWARFDebugArangeSet::Compact() {
- if (m_arange_descriptors.empty())
- return;
-
- // Iterate through all arange descriptors and combine any ranges that overlap
- // or have matching boundaries. The m_arange_descriptors are assumed to be in
- // ascending order after being built by adding descriptors using the
- // AddDescriptor method.
- uint32_t i = 0;
- while (i + 1 < m_arange_descriptors.size()) {
- if (m_arange_descriptors[i].end_address() >=
- m_arange_descriptors[i + 1].address) {
- // The current range ends at or exceeds the start of the next address
- // range. Compute the max end address between the two and use that to
- // make the new length.
- const dw_addr_t max_end_addr =
- std::max(m_arange_descriptors[i].end_address(),
- m_arange_descriptors[i + 1].end_address());
- m_arange_descriptors[i].length =
- max_end_addr - m_arange_descriptors[i].address;
- // Now remove the next entry as it was just combined with the previous
- // one.
- m_arange_descriptors.erase(m_arange_descriptors.begin() + i + 1);
- } else {
- // Discontiguous address range, just proceed to the next one.
- ++i;
- }
- }
-}
-//----------------------------------------------------------------------
-// Compare function DWARFDebugArangeSet::Descriptor structures
-//----------------------------------------------------------------------
-static bool DescriptorLessThan(const DWARFDebugArangeSet::Descriptor &range1,
- const DWARFDebugArangeSet::Descriptor &range2) {
- return range1.address < range2.address;
-}
-
-//----------------------------------------------------------------------
-// Add a range descriptor and keep things sorted so we can easily compact the
-// ranges before being saved or used.
-//----------------------------------------------------------------------
-void DWARFDebugArangeSet::AddDescriptor(
- const DWARFDebugArangeSet::Descriptor &range) {
- if (m_arange_descriptors.empty()) {
- m_arange_descriptors.push_back(range);
- return;
- }
-
- DescriptorIter end = m_arange_descriptors.end();
- DescriptorIter pos =
- lower_bound(m_arange_descriptors.begin(), end, range, DescriptorLessThan);
- const dw_addr_t range_end_addr = range.end_address();
- if (pos != end) {
- const dw_addr_t found_end_addr = pos->end_address();
- if (range.address < pos->address) {
- if (range_end_addr < pos->address) {
- // Non-contiguous entries, add this one before the found entry
- m_arange_descriptors.insert(pos, range);
- } else if (range_end_addr == pos->address) {
- // The top end of 'range' is the lower end of the entry pointed to by
- // 'pos'. We can combine range with the entry we found by setting the
- // starting address and increasing the length since they don't overlap.
- pos->address = range.address;
- pos->length += range.length;
- } else {
- // We can combine these two and make sure the largest end address is
- // used to make end address.
- pos->address = range.address;
- pos->length = std::max(found_end_addr, range_end_addr) - pos->address;
- }
- } else if (range.address == pos->address) {
- pos->length = std::max(pos->length, range.length);
- }
- } else {
- // NOTE: 'pos' points to entry past the end which is ok for insert,
- // don't use otherwise!!!
- const dw_addr_t max_addr = m_arange_descriptors.back().end_address();
- if (max_addr < range.address) {
- // Non-contiguous entries, add this one before the found entry
- m_arange_descriptors.insert(pos, range);
- } else if (max_addr == range.address) {
- m_arange_descriptors.back().length += range.length;
- } else {
- m_arange_descriptors.back().length = std::max(max_addr, range_end_addr) -
- m_arange_descriptors.back().address;
- }
- }
-}
-
llvm::Error DWARFDebugArangeSet::extract(const DWARFDataExtractor &data,
lldb::offset_t *offset_ptr) {
assert(data.ValidOffset(*offset_ptr));
@@ -215,10 +118,6 @@ llvm::Error DWARFDebugArangeSet::extract
"arange descriptors not terminated by null entry");
}
-dw_offset_t DWARFDebugArangeSet::GetOffsetOfNextEntry() const {
- return m_offset + m_header.length + 4;
-}
-
class DescriptorContainsAddress {
public:
DescriptorContainsAddress(dw_addr_t address) : m_address(address) {}
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h Tue Mar 19 13:08:56 2019
@@ -40,22 +40,11 @@ public:
DWARFDebugArangeSet();
void Clear();
void SetOffset(uint32_t offset) { m_offset = offset; }
- void SetHeader(uint16_t version, uint32_t cu_offset, uint8_t addr_size,
- uint8_t seg_size);
- void AddDescriptor(const DWARFDebugArangeSet::Descriptor &range);
- void Compact();
llvm::Error extract(const lldb_private::DWARFDataExtractor &data,
lldb::offset_t *offset_ptr);
- dw_offset_t GetCompileUnitDIEOffset() const { return m_header.cu_offset; }
- dw_offset_t GetOffsetOfNextEntry() const;
dw_offset_t FindAddress(dw_addr_t address) const;
size_t NumDescriptors() const { return m_arange_descriptors.size(); }
const Header &GetHeader() const { return m_header; }
- const Descriptor *GetDescriptor(uint32_t i) const {
- if (i < m_arange_descriptors.size())
- return &m_arange_descriptors[i];
- return NULL;
- }
const Descriptor &GetDescriptorRef(uint32_t i) const {
return m_arange_descriptors[i];
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp Tue Mar 19 13:08:56 2019
@@ -61,7 +61,7 @@ DWARFDebugAranges::extract(const DWARFDa
const uint32_t num_descriptors = set.NumDescriptors();
if (num_descriptors > 0) {
- const dw_offset_t cu_offset = set.GetCompileUnitDIEOffset();
+ const dw_offset_t cu_offset = set.GetHeader().cu_offset;
for (uint32_t i = 0; i < num_descriptors; ++i) {
const DWARFDebugArangeSet::Descriptor &descriptor =
@@ -71,26 +71,8 @@ DWARFDebugAranges::extract(const DWARFDa
}
}
set.Clear();
- }
- return llvm::ErrorSuccess();
-}
-
-//----------------------------------------------------------------------
-// Generate
-//----------------------------------------------------------------------
-bool DWARFDebugAranges::Generate(SymbolFileDWARF *dwarf2Data) {
- Clear();
- DWARFDebugInfo *debug_info = dwarf2Data->DebugInfo();
- if (debug_info) {
- uint32_t cu_idx = 0;
- const uint32_t num_compile_units = dwarf2Data->GetNumCompileUnits();
- for (cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) {
- DWARFUnit *cu = debug_info->GetCompileUnitAtIndex(cu_idx);
- if (cu)
- cu->BuildAddressRangeTable(dwarf2Data, this);
}
- }
- return !IsEmpty();
+ return llvm::ErrorSuccess();
}
void DWARFDebugAranges::Dump(Log *log) const {
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.h Tue Mar 19 13:08:56 2019
@@ -32,17 +32,11 @@ public:
llvm::Error
extract(const lldb_private::DWARFDataExtractor &debug_aranges_data);
- bool Generate(SymbolFileDWARF *dwarf2Data);
-
// Use append range multiple times and then call sort
void AppendRange(dw_offset_t cu_offset, dw_addr_t low_pc, dw_addr_t high_pc);
void Sort(bool minimize);
- const Range *RangeAtIndex(uint32_t idx) const {
- return m_aranges.GetEntryAtIndex(idx);
- }
-
void Dump(lldb_private::Log *log) const;
dw_offset_t FindAddress(dw_addr_t address) const;
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=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Tue Mar 19 13:08:56 2019
@@ -121,19 +121,6 @@ DWARFUnit *DWARFDebugInfo::GetCompileUni
return cu;
}
-bool DWARFDebugInfo::ContainsCompileUnit(const DWARFUnit *cu) const {
- // Not a verify efficient function, but it is handy for use in assertions to
- // make sure that a compile unit comes from a debug information file.
- CompileUnitColl::const_iterator end_pos = m_compile_units.end();
- CompileUnitColl::const_iterator pos;
-
- for (pos = m_compile_units.begin(); pos != end_pos; ++pos) {
- if (pos->get() == cu)
- return true;
- }
- return false;
-}
-
bool DWARFDebugInfo::OffsetLessThanCompileUnitOffset(
dw_offset_t offset, const DWARFUnitSP &cu_sp) {
return offset < cu_sp->GetOffset();
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Tue Mar 19 13:08:56 2019
@@ -36,7 +36,6 @@ public:
void SetDwarfData(SymbolFileDWARF *dwarf2Data);
size_t GetNumCompileUnits();
- bool ContainsCompileUnit(const DWARFUnit *cu) const;
DWARFUnit *GetCompileUnitAtIndex(uint32_t idx);
DWARFUnit *GetCompileUnit(dw_offset_t cu_offset, uint32_t *idx_ptr = NULL);
DWARFUnit *GetCompileUnitContainingDIEOffset(dw_offset_t die_offset);
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=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Tue Mar 19 13:08:56 2019
@@ -206,8 +206,7 @@ bool DWARFDebugInfoEntry::FastExtract(
// .debug_abbrev data within the SymbolFileDWARF class starting at the given
// offset
//----------------------------------------------------------------------
-bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data,
- const DWARFUnit *cu,
+bool DWARFDebugInfoEntry::Extract(const DWARFUnit *cu,
lldb::offset_t *offset_ptr) {
const DWARFDataExtractor &debug_info_data = cu->GetData();
// const DWARFDataExtractor& debug_str_data =
@@ -934,22 +933,6 @@ uint64_t DWARFDebugInfoEntry::GetAttribu
}
//----------------------------------------------------------------------
-// GetAttributeValueAsSigned
-//
-// Get the value of an attribute a signed value and return it.
-//----------------------------------------------------------------------
-int64_t DWARFDebugInfoEntry::GetAttributeValueAsSigned(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, int64_t fail_value,
- bool check_specification_or_abstract_origin) const {
- DWARFFormValue form_value;
- if (GetAttributeValue(dwarf2Data, cu, attr, form_value, nullptr,
- check_specification_or_abstract_origin))
- return form_value.Signed();
- return fail_value;
-}
-
-//----------------------------------------------------------------------
// GetAttributeValueAsReference
//
// Get the value of an attribute as reference and fix up and compile unit
@@ -1135,7 +1118,7 @@ bool DWARFDebugInfoEntry::GetName(Symbol
DWARFDebugInfoEntry die;
lldb::offset_t offset = die_offset;
- if (die.Extract(dwarf2Data, cu, &offset)) {
+ if (die.Extract(cu, &offset)) {
if (die.IsNULL()) {
s.PutCString("NULL");
return true;
@@ -1169,7 +1152,7 @@ bool DWARFDebugInfoEntry::AppendTypeName
DWARFDebugInfoEntry die;
lldb::offset_t offset = die_offset;
- if (die.Extract(dwarf2Data, cu, &offset)) {
+ if (die.Extract(cu, &offset)) {
if (die.IsNULL()) {
s.PutCString("NULL");
return true;
@@ -1779,25 +1762,6 @@ bool DWARFDebugInfoEntry::OffsetLessThan
return a.GetOffset() < b.GetOffset();
}
-void DWARFDebugInfoEntry::DumpDIECollection(
- Stream &strm, DWARFDebugInfoEntry::collection &die_collection) {
- DWARFDebugInfoEntry::const_iterator pos;
- DWARFDebugInfoEntry::const_iterator end = die_collection.end();
- strm.PutCString("\noffset parent sibling child\n");
- strm.PutCString("-------- -------- -------- --------\n");
- for (pos = die_collection.begin(); pos != end; ++pos) {
- const DWARFDebugInfoEntry &die_ref = *pos;
- const DWARFDebugInfoEntry *p = die_ref.GetParent();
- const DWARFDebugInfoEntry *s = die_ref.GetSibling();
- const DWARFDebugInfoEntry *c = die_ref.GetFirstChild();
- strm.Printf("%.8x: %.8x %.8x %.8x 0x%4.4x %s%s\n", die_ref.GetOffset(),
- p ? p->GetOffset() : 0, s ? s->GetOffset() : 0,
- c ? c->GetOffset() : 0, die_ref.Tag(),
- DW_TAG_value_to_name(die_ref.Tag()),
- die_ref.HasChildren() ? " *" : "");
- }
-}
-
bool DWARFDebugInfoEntry::operator==(const DWARFDebugInfoEntry &rhs) const {
return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
m_sibling_idx == rhs.m_sibling_idx &&
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=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Tue Mar 19 13:08:56 2019
@@ -74,8 +74,7 @@ public:
const DWARFFormValue::FixedFormSizes &fixed_form_sizes,
lldb::offset_t *offset_ptr);
- bool Extract(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- lldb::offset_t *offset_ptr);
+ bool Extract(const DWARFUnit *cu, lldb::offset_t *offset_ptr);
bool LookupAddress(const dw_addr_t address, SymbolFileDWARF *dwarf2Data,
const DWARFUnit *cu,
@@ -109,11 +108,6 @@ public:
const dw_attr_t attr, uint64_t fail_value,
bool check_specification_or_abstract_origin = false) const;
- int64_t GetAttributeValueAsSigned(
- SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
- const dw_attr_t attr, int64_t fail_value,
- 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,
@@ -259,10 +253,6 @@ public:
void SetParentIndex(uint32_t idx) { m_parent_idx = idx; }
- static void
- DumpDIECollection(lldb_private::Stream &strm,
- DWARFDebugInfoEntry::collection &die_collection);
-
protected:
dw_offset_t
m_offset; // Offset within the .debug_info of the start of this entry
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=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Tue Mar 19 13:08:56 2019
@@ -65,8 +65,6 @@ void DWARFUnit::ExtractUnitDIEIfNeeded()
AddUnitDIE(m_first_die);
return;
}
-
- ExtractDIEsEndCheck(offset);
}
//----------------------------------------------------------------------
@@ -164,7 +162,6 @@ void DWARFUnit::ExtractDIEsRWLocked() {
lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
DWARFDebugInfoEntry die;
- // Keep a flat array of the DIE for binary lookup by DIE offset
uint32_t depth = 0;
// We are in our compile unit, parse starting at the offset we were told to
@@ -251,40 +248,12 @@ void DWARFUnit::ExtractDIEsRWLocked() {
m_die_array.shrink_to_fit();
- ExtractDIEsEndCheck(offset);
-
if (m_dwo_symbol_file) {
DWARFUnit *dwo_cu = m_dwo_symbol_file->GetCompileUnit();
dwo_cu->ExtractDIEsIfNeeded();
}
}
-//--------------------------------------------------------------------------
-// Final checks for both ExtractUnitDIEIfNeeded() and ExtractDIEsIfNeeded().
-//--------------------------------------------------------------------------
-void DWARFUnit::ExtractDIEsEndCheck(lldb::offset_t offset) const {
- // Give a little bit of info if we encounter corrupt DWARF (our offset should
- // always terminate at or before the start of the next compilation unit
- // header).
- if (offset > GetNextCompileUnitOffset()) {
- m_dwarf->GetObjectFile()->GetModule()->ReportWarning(
- "DWARF compile unit extends beyond its bounds cu 0x%8.8x at "
- "0x%8.8" PRIx64 "\n",
- GetOffset(), offset);
- }
-
- Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
- if (log && log->GetVerbose()) {
- StreamString strm;
- Dump(&strm);
- if (m_die_array.empty())
- strm.Printf("error: no DIE for compile unit");
- else
- m_die_array[0].Dump(m_dwarf, this, strm, UINT32_MAX);
- log->PutString(strm.GetString());
- }
-}
-
// This is used when a split dwarf is enabled.
// A skeleton compilation unit may contain the DW_AT_str_offsets_base attribute
// that points to the first string offset of the CU contribution to the
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=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Tue Mar 19 13:08:56 2019
@@ -243,7 +243,6 @@ private:
}
void AddUnitDIE(const DWARFDebugInfoEntry &cu_die);
- void ExtractDIEsEndCheck(lldb::offset_t offset) const;
void ComputeCompDirAndGuessPathStyle();
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp Tue Mar 19 13:08:56 2019
@@ -11,9 +11,6 @@
using namespace lldb_private;
static constexpr Log::Category g_categories[] = {
- {{"aranges"},
- {"log the parsing of .debug_aranges"},
- DWARF_LOG_DEBUG_ARANGES},
{{"comp"},
{"log insertions of object files into DWARF debug maps"},
DWARF_LOG_TYPE_COMPLETION},
@@ -25,12 +22,6 @@ static constexpr Log::Category g_categor
{{"map"},
{"log struct/unions/class type completions"},
DWARF_LOG_DEBUG_MAP},
- {{"pubnames"},
- {"log the parsing of .debug_pubnames"},
- DWARF_LOG_DEBUG_PUBNAMES},
- {{"pubtypes"},
- {"log the parsing of .debug_pubtypes"},
- DWARF_LOG_DEBUG_PUBTYPES},
};
Log::Channel LogChannelDWARF::g_channel(g_categories, DWARF_LOG_DEFAULT);
Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h?rev=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h Tue Mar 19 13:08:56 2019
@@ -13,12 +13,9 @@
#define DWARF_LOG_DEBUG_INFO (1u << 1)
#define DWARF_LOG_DEBUG_LINE (1u << 2)
-#define DWARF_LOG_DEBUG_PUBNAMES (1u << 3)
-#define DWARF_LOG_DEBUG_PUBTYPES (1u << 4)
-#define DWARF_LOG_DEBUG_ARANGES (1u << 5)
-#define DWARF_LOG_LOOKUPS (1u << 6)
-#define DWARF_LOG_TYPE_COMPLETION (1u << 7)
-#define DWARF_LOG_DEBUG_MAP (1u << 8)
+#define DWARF_LOG_LOOKUPS (1u << 3)
+#define DWARF_LOG_TYPE_COMPLETION (1u << 4)
+#define DWARF_LOG_DEBUG_MAP (1u << 5)
#define DWARF_LOG_ALL (UINT32_MAX)
#define DWARF_LOG_DEFAULT (DWARF_LOG_DEBUG_INFO)
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=356509&r1=356508&r2=356509&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Mar 19 13:08:56 2019
@@ -1761,8 +1761,7 @@ uint32_t SymbolFileDWARF::ResolveSymbolC
llvm::Expected<DWARFDebugAranges &> aranges =
debug_info->GetCompileUnitAranges();
if (!aranges) {
- Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO |
- DWARF_LOG_DEBUG_ARANGES);
+ Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
LLDB_LOG_ERROR(log, aranges.takeError(),
"SymbolFileDWARF::ResolveSymbolContext failed to get cu "
"aranges. {0}");
More information about the lldb-commits
mailing list