forked from OSchip/llvm-project
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. llvm-svn: 356509
This commit is contained in:
parent
6271606969
commit
611d1f98c5
|
@ -85,5 +85,5 @@ DWARFAbbreviationDeclaration::FindAttributeIndex(dw_attr_t attr) const {
|
||||||
bool DWARFAbbreviationDeclaration::
|
bool DWARFAbbreviationDeclaration::
|
||||||
operator==(const DWARFAbbreviationDeclaration &rhs) const {
|
operator==(const DWARFAbbreviationDeclaration &rhs) const {
|
||||||
return Tag() == rhs.Tag() && HasChildren() == rhs.HasChildren() &&
|
return Tag() == rhs.Tag() && HasChildren() == rhs.HasChildren() &&
|
||||||
Attributes() == rhs.Attributes();
|
m_attributes == rhs.m_attributes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,18 +21,12 @@ public:
|
||||||
|
|
||||||
// For hand crafting an abbreviation declaration
|
// For hand crafting an abbreviation declaration
|
||||||
DWARFAbbreviationDeclaration(dw_tag_t tag, uint8_t has_children);
|
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; }
|
dw_uleb128_t Code() const { return m_code; }
|
||||||
void SetCode(dw_uleb128_t code) { m_code = code; }
|
void SetCode(dw_uleb128_t code) { m_code = code; }
|
||||||
dw_tag_t Tag() const { return m_tag; }
|
dw_tag_t Tag() const { return m_tag; }
|
||||||
bool HasChildren() const { return m_has_children; }
|
bool HasChildren() const { return m_has_children; }
|
||||||
size_t NumAttributes() const { return m_attributes.size(); }
|
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 {
|
dw_form_t GetFormByIndex(uint32_t idx) const {
|
||||||
return m_attributes.size() > idx ? m_attributes[idx].get_form() : 0;
|
return m_attributes.size() > idx ? m_attributes[idx].get_form() : 0;
|
||||||
}
|
}
|
||||||
|
@ -60,7 +54,6 @@ public:
|
||||||
lldb::offset_t *offset_ptr);
|
lldb::offset_t *offset_ptr);
|
||||||
bool IsValid();
|
bool IsValid();
|
||||||
bool operator==(const DWARFAbbreviationDeclaration &rhs) const;
|
bool operator==(const DWARFAbbreviationDeclaration &rhs) const;
|
||||||
const DWARFAttribute::collection &Attributes() const { return m_attributes; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
dw_uleb128_t m_code;
|
dw_uleb128_t m_code;
|
||||||
|
|
|
@ -32,19 +32,6 @@ void DWARFAttributes::Append(const DWARFUnit *cu, dw_offset_t attr_die_offset,
|
||||||
m_infos.push_back(attr_value);
|
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(
|
bool DWARFAttributes::ExtractFormValueAtIndex(
|
||||||
uint32_t i, DWARFFormValue &form_value) const {
|
uint32_t i, DWARFFormValue &form_value) const {
|
||||||
const DWARFUnit *cu = CompileUnitAtIndex(i);
|
const DWARFUnit *cu = CompileUnitAtIndex(i);
|
||||||
|
|
|
@ -26,8 +26,6 @@ public:
|
||||||
m_attr = attr;
|
m_attr = attr;
|
||||||
m_form = form;
|
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_attr_t get_attr() const { return m_attr; }
|
||||||
dw_form_t get_form() const { return m_form; }
|
dw_form_t get_form() const { return m_form; }
|
||||||
void get(dw_attr_t &attr, dw_form_t &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 FormValueAsUnsignedAtIndex(uint32_t i, uint64_t fail_value) const;
|
||||||
uint64_t FormValueAsUnsigned(dw_attr_t attr, 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;
|
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(); }
|
void Clear() { m_infos.clear(); }
|
||||||
size_t Size() const { return m_infos.size(); }
|
size_t Size() const { return m_infos.size(); }
|
||||||
|
|
||||||
|
|
|
@ -56,15 +56,6 @@ uint64_t DWARFBaseDIE::GetAttributeValueAsUnsigned(const dw_attr_t attr,
|
||||||
return fail_value;
|
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 DWARFBaseDIE::GetAttributeValueAsReference(const dw_attr_t attr,
|
||||||
uint64_t fail_value) const {
|
uint64_t fail_value) const {
|
||||||
if (IsValid())
|
if (IsValid())
|
||||||
|
@ -123,13 +114,6 @@ dw_offset_t DWARFBaseDIE::GetOffset() const {
|
||||||
return DW_INVALID_OFFSET;
|
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 {
|
SymbolFileDWARF *DWARFBaseDIE::GetDWARF() const {
|
||||||
if (m_cu)
|
if (m_cu)
|
||||||
return m_cu->GetSymbolFileDWARF();
|
return m_cu->GetSymbolFileDWARF();
|
||||||
|
|
|
@ -96,8 +96,6 @@ public:
|
||||||
|
|
||||||
dw_offset_t GetOffset() const;
|
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,
|
// 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
|
// 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 GetAttributeValueAsUnsigned(const dw_attr_t attr,
|
||||||
uint64_t fail_value) const;
|
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 GetAttributeValueAsReference(const dw_attr_t attr,
|
||||||
uint64_t fail_value) const;
|
uint64_t fail_value) const;
|
||||||
|
|
||||||
|
|
|
@ -75,25 +75,6 @@ DWARFAbbreviationDeclarationSet::GetAbbreviationDeclaration(
|
||||||
return NULL;
|
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()
|
// DWARFAbbreviationDeclarationSet::GetUnsupportedForms()
|
||||||
|
|
|
@ -40,8 +40,6 @@ public:
|
||||||
llvm::Error extract(const lldb_private::DWARFDataExtractor &data,
|
llvm::Error extract(const lldb_private::DWARFDataExtractor &data,
|
||||||
lldb::offset_t *offset_ptr);
|
lldb::offset_t *offset_ptr);
|
||||||
// void Encode(BinaryStreamBuf& debug_abbrev_buf) const;
|
// void Encode(BinaryStreamBuf& debug_abbrev_buf) const;
|
||||||
dw_uleb128_t
|
|
||||||
AppendAbbrevDeclSequential(const DWARFAbbreviationDeclaration &abbrevDecl);
|
|
||||||
void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const;
|
void GetUnsupportedForms(std::set<dw_form_t> &invalid_forms) const;
|
||||||
|
|
||||||
const DWARFAbbreviationDeclaration *
|
const DWARFAbbreviationDeclaration *
|
||||||
|
|
|
@ -34,103 +34,6 @@ void DWARFDebugArangeSet::Clear() {
|
||||||
m_arange_descriptors.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,
|
llvm::Error DWARFDebugArangeSet::extract(const DWARFDataExtractor &data,
|
||||||
lldb::offset_t *offset_ptr) {
|
lldb::offset_t *offset_ptr) {
|
||||||
assert(data.ValidOffset(*offset_ptr));
|
assert(data.ValidOffset(*offset_ptr));
|
||||||
|
@ -215,10 +118,6 @@ llvm::Error DWARFDebugArangeSet::extract(const DWARFDataExtractor &data,
|
||||||
"arange descriptors not terminated by null entry");
|
"arange descriptors not terminated by null entry");
|
||||||
}
|
}
|
||||||
|
|
||||||
dw_offset_t DWARFDebugArangeSet::GetOffsetOfNextEntry() const {
|
|
||||||
return m_offset + m_header.length + 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
class DescriptorContainsAddress {
|
class DescriptorContainsAddress {
|
||||||
public:
|
public:
|
||||||
DescriptorContainsAddress(dw_addr_t address) : m_address(address) {}
|
DescriptorContainsAddress(dw_addr_t address) : m_address(address) {}
|
||||||
|
|
|
@ -40,22 +40,11 @@ public:
|
||||||
DWARFDebugArangeSet();
|
DWARFDebugArangeSet();
|
||||||
void Clear();
|
void Clear();
|
||||||
void SetOffset(uint32_t offset) { m_offset = offset; }
|
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,
|
llvm::Error extract(const lldb_private::DWARFDataExtractor &data,
|
||||||
lldb::offset_t *offset_ptr);
|
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;
|
dw_offset_t FindAddress(dw_addr_t address) const;
|
||||||
size_t NumDescriptors() const { return m_arange_descriptors.size(); }
|
size_t NumDescriptors() const { return m_arange_descriptors.size(); }
|
||||||
const Header &GetHeader() const { return m_header; }
|
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 {
|
const Descriptor &GetDescriptorRef(uint32_t i) const {
|
||||||
return m_arange_descriptors[i];
|
return m_arange_descriptors[i];
|
||||||
|
|
|
@ -61,7 +61,7 @@ DWARFDebugAranges::extract(const DWARFDataExtractor &debug_aranges_data) {
|
||||||
|
|
||||||
const uint32_t num_descriptors = set.NumDescriptors();
|
const uint32_t num_descriptors = set.NumDescriptors();
|
||||||
if (num_descriptors > 0) {
|
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) {
|
for (uint32_t i = 0; i < num_descriptors; ++i) {
|
||||||
const DWARFDebugArangeSet::Descriptor &descriptor =
|
const DWARFDebugArangeSet::Descriptor &descriptor =
|
||||||
|
@ -71,26 +71,8 @@ DWARFDebugAranges::extract(const DWARFDataExtractor &debug_aranges_data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
set.Clear();
|
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 llvm::ErrorSuccess();
|
||||||
return !IsEmpty();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWARFDebugAranges::Dump(Log *log) const {
|
void DWARFDebugAranges::Dump(Log *log) const {
|
||||||
|
|
|
@ -32,17 +32,11 @@ public:
|
||||||
llvm::Error
|
llvm::Error
|
||||||
extract(const lldb_private::DWARFDataExtractor &debug_aranges_data);
|
extract(const lldb_private::DWARFDataExtractor &debug_aranges_data);
|
||||||
|
|
||||||
bool Generate(SymbolFileDWARF *dwarf2Data);
|
|
||||||
|
|
||||||
// Use append range multiple times and then call sort
|
// 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 AppendRange(dw_offset_t cu_offset, dw_addr_t low_pc, dw_addr_t high_pc);
|
||||||
|
|
||||||
void Sort(bool minimize);
|
void Sort(bool minimize);
|
||||||
|
|
||||||
const Range *RangeAtIndex(uint32_t idx) const {
|
|
||||||
return m_aranges.GetEntryAtIndex(idx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Dump(lldb_private::Log *log) const;
|
void Dump(lldb_private::Log *log) const;
|
||||||
|
|
||||||
dw_offset_t FindAddress(dw_addr_t address) const;
|
dw_offset_t FindAddress(dw_addr_t address) const;
|
||||||
|
|
|
@ -121,19 +121,6 @@ DWARFUnit *DWARFDebugInfo::GetCompileUnitAtIndex(uint32_t idx) {
|
||||||
return cu;
|
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(
|
bool DWARFDebugInfo::OffsetLessThanCompileUnitOffset(
|
||||||
dw_offset_t offset, const DWARFUnitSP &cu_sp) {
|
dw_offset_t offset, const DWARFUnitSP &cu_sp) {
|
||||||
return offset < cu_sp->GetOffset();
|
return offset < cu_sp->GetOffset();
|
||||||
|
|
|
@ -36,7 +36,6 @@ public:
|
||||||
void SetDwarfData(SymbolFileDWARF *dwarf2Data);
|
void SetDwarfData(SymbolFileDWARF *dwarf2Data);
|
||||||
|
|
||||||
size_t GetNumCompileUnits();
|
size_t GetNumCompileUnits();
|
||||||
bool ContainsCompileUnit(const DWARFUnit *cu) const;
|
|
||||||
DWARFUnit *GetCompileUnitAtIndex(uint32_t idx);
|
DWARFUnit *GetCompileUnitAtIndex(uint32_t idx);
|
||||||
DWARFUnit *GetCompileUnit(dw_offset_t cu_offset, uint32_t *idx_ptr = NULL);
|
DWARFUnit *GetCompileUnit(dw_offset_t cu_offset, uint32_t *idx_ptr = NULL);
|
||||||
DWARFUnit *GetCompileUnitContainingDIEOffset(dw_offset_t die_offset);
|
DWARFUnit *GetCompileUnitContainingDIEOffset(dw_offset_t die_offset);
|
||||||
|
|
|
@ -206,8 +206,7 @@ bool DWARFDebugInfoEntry::FastExtract(
|
||||||
// .debug_abbrev data within the SymbolFileDWARF class starting at the given
|
// .debug_abbrev data within the SymbolFileDWARF class starting at the given
|
||||||
// offset
|
// offset
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
bool DWARFDebugInfoEntry::Extract(SymbolFileDWARF *dwarf2Data,
|
bool DWARFDebugInfoEntry::Extract(const DWARFUnit *cu,
|
||||||
const DWARFUnit *cu,
|
|
||||||
lldb::offset_t *offset_ptr) {
|
lldb::offset_t *offset_ptr) {
|
||||||
const DWARFDataExtractor &debug_info_data = cu->GetData();
|
const DWARFDataExtractor &debug_info_data = cu->GetData();
|
||||||
// const DWARFDataExtractor& debug_str_data =
|
// const DWARFDataExtractor& debug_str_data =
|
||||||
|
@ -933,22 +932,6 @@ uint64_t DWARFDebugInfoEntry::GetAttributeValueAsUnsigned(
|
||||||
return fail_value;
|
return fail_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
|
||||||
// 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
|
// GetAttributeValueAsReference
|
||||||
//
|
//
|
||||||
|
@ -1135,7 +1118,7 @@ bool DWARFDebugInfoEntry::GetName(SymbolFileDWARF *dwarf2Data,
|
||||||
|
|
||||||
DWARFDebugInfoEntry die;
|
DWARFDebugInfoEntry die;
|
||||||
lldb::offset_t offset = die_offset;
|
lldb::offset_t offset = die_offset;
|
||||||
if (die.Extract(dwarf2Data, cu, &offset)) {
|
if (die.Extract(cu, &offset)) {
|
||||||
if (die.IsNULL()) {
|
if (die.IsNULL()) {
|
||||||
s.PutCString("NULL");
|
s.PutCString("NULL");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1169,7 +1152,7 @@ bool DWARFDebugInfoEntry::AppendTypeName(SymbolFileDWARF *dwarf2Data,
|
||||||
|
|
||||||
DWARFDebugInfoEntry die;
|
DWARFDebugInfoEntry die;
|
||||||
lldb::offset_t offset = die_offset;
|
lldb::offset_t offset = die_offset;
|
||||||
if (die.Extract(dwarf2Data, cu, &offset)) {
|
if (die.Extract(cu, &offset)) {
|
||||||
if (die.IsNULL()) {
|
if (die.IsNULL()) {
|
||||||
s.PutCString("NULL");
|
s.PutCString("NULL");
|
||||||
return true;
|
return true;
|
||||||
|
@ -1779,25 +1762,6 @@ bool DWARFDebugInfoEntry::OffsetLessThan(const DWARFDebugInfoEntry &a,
|
||||||
return a.GetOffset() < b.GetOffset();
|
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 {
|
bool DWARFDebugInfoEntry::operator==(const DWARFDebugInfoEntry &rhs) const {
|
||||||
return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
|
return m_offset == rhs.m_offset && m_parent_idx == rhs.m_parent_idx &&
|
||||||
m_sibling_idx == rhs.m_sibling_idx &&
|
m_sibling_idx == rhs.m_sibling_idx &&
|
||||||
|
|
|
@ -74,8 +74,7 @@ public:
|
||||||
const DWARFFormValue::FixedFormSizes &fixed_form_sizes,
|
const DWARFFormValue::FixedFormSizes &fixed_form_sizes,
|
||||||
lldb::offset_t *offset_ptr);
|
lldb::offset_t *offset_ptr);
|
||||||
|
|
||||||
bool Extract(SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
|
bool Extract(const DWARFUnit *cu, lldb::offset_t *offset_ptr);
|
||||||
lldb::offset_t *offset_ptr);
|
|
||||||
|
|
||||||
bool LookupAddress(const dw_addr_t address, SymbolFileDWARF *dwarf2Data,
|
bool LookupAddress(const dw_addr_t address, SymbolFileDWARF *dwarf2Data,
|
||||||
const DWARFUnit *cu,
|
const DWARFUnit *cu,
|
||||||
|
@ -109,11 +108,6 @@ public:
|
||||||
const dw_attr_t attr, uint64_t fail_value,
|
const dw_attr_t attr, uint64_t fail_value,
|
||||||
bool check_specification_or_abstract_origin = false) const;
|
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(
|
uint64_t GetAttributeValueAsAddress(
|
||||||
SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
|
SymbolFileDWARF *dwarf2Data, const DWARFUnit *cu,
|
||||||
const dw_attr_t attr, uint64_t fail_value,
|
const dw_attr_t attr, uint64_t fail_value,
|
||||||
|
@ -259,10 +253,6 @@ public:
|
||||||
|
|
||||||
void SetParentIndex(uint32_t idx) { m_parent_idx = idx; }
|
void SetParentIndex(uint32_t idx) { m_parent_idx = idx; }
|
||||||
|
|
||||||
static void
|
|
||||||
DumpDIECollection(lldb_private::Stream &strm,
|
|
||||||
DWARFDebugInfoEntry::collection &die_collection);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
dw_offset_t
|
dw_offset_t
|
||||||
m_offset; // Offset within the .debug_info of the start of this entry
|
m_offset; // Offset within the .debug_info of the start of this entry
|
||||||
|
|
|
@ -65,8 +65,6 @@ void DWARFUnit::ExtractUnitDIEIfNeeded() {
|
||||||
AddUnitDIE(m_first_die);
|
AddUnitDIE(m_first_die);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtractDIEsEndCheck(offset);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------
|
//----------------------------------------------------------------------
|
||||||
|
@ -164,7 +162,6 @@ void DWARFUnit::ExtractDIEsRWLocked() {
|
||||||
lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
|
lldb::offset_t next_cu_offset = GetNextCompileUnitOffset();
|
||||||
|
|
||||||
DWARFDebugInfoEntry die;
|
DWARFDebugInfoEntry die;
|
||||||
// Keep a flat array of the DIE for binary lookup by DIE offset
|
|
||||||
|
|
||||||
uint32_t depth = 0;
|
uint32_t depth = 0;
|
||||||
// We are in our compile unit, parse starting at the offset we were told to
|
// 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();
|
m_die_array.shrink_to_fit();
|
||||||
|
|
||||||
ExtractDIEsEndCheck(offset);
|
|
||||||
|
|
||||||
if (m_dwo_symbol_file) {
|
if (m_dwo_symbol_file) {
|
||||||
DWARFUnit *dwo_cu = m_dwo_symbol_file->GetCompileUnit();
|
DWARFUnit *dwo_cu = m_dwo_symbol_file->GetCompileUnit();
|
||||||
dwo_cu->ExtractDIEsIfNeeded();
|
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.
|
// This is used when a split dwarf is enabled.
|
||||||
// A skeleton compilation unit may contain the DW_AT_str_offsets_base attribute
|
// 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
|
// that points to the first string offset of the CU contribution to the
|
||||||
|
|
|
@ -243,7 +243,6 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddUnitDIE(const DWARFDebugInfoEntry &cu_die);
|
void AddUnitDIE(const DWARFDebugInfoEntry &cu_die);
|
||||||
void ExtractDIEsEndCheck(lldb::offset_t offset) const;
|
|
||||||
|
|
||||||
void ComputeCompDirAndGuessPathStyle();
|
void ComputeCompDirAndGuessPathStyle();
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,6 @@
|
||||||
using namespace lldb_private;
|
using namespace lldb_private;
|
||||||
|
|
||||||
static constexpr Log::Category g_categories[] = {
|
static constexpr Log::Category g_categories[] = {
|
||||||
{{"aranges"},
|
|
||||||
{"log the parsing of .debug_aranges"},
|
|
||||||
DWARF_LOG_DEBUG_ARANGES},
|
|
||||||
{{"comp"},
|
{{"comp"},
|
||||||
{"log insertions of object files into DWARF debug maps"},
|
{"log insertions of object files into DWARF debug maps"},
|
||||||
DWARF_LOG_TYPE_COMPLETION},
|
DWARF_LOG_TYPE_COMPLETION},
|
||||||
|
@ -25,12 +22,6 @@ static constexpr Log::Category g_categories[] = {
|
||||||
{{"map"},
|
{{"map"},
|
||||||
{"log struct/unions/class type completions"},
|
{"log struct/unions/class type completions"},
|
||||||
DWARF_LOG_DEBUG_MAP},
|
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);
|
Log::Channel LogChannelDWARF::g_channel(g_categories, DWARF_LOG_DEFAULT);
|
||||||
|
|
|
@ -13,12 +13,9 @@
|
||||||
|
|
||||||
#define DWARF_LOG_DEBUG_INFO (1u << 1)
|
#define DWARF_LOG_DEBUG_INFO (1u << 1)
|
||||||
#define DWARF_LOG_DEBUG_LINE (1u << 2)
|
#define DWARF_LOG_DEBUG_LINE (1u << 2)
|
||||||
#define DWARF_LOG_DEBUG_PUBNAMES (1u << 3)
|
#define DWARF_LOG_LOOKUPS (1u << 3)
|
||||||
#define DWARF_LOG_DEBUG_PUBTYPES (1u << 4)
|
#define DWARF_LOG_TYPE_COMPLETION (1u << 4)
|
||||||
#define DWARF_LOG_DEBUG_ARANGES (1u << 5)
|
#define DWARF_LOG_DEBUG_MAP (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_ALL (UINT32_MAX)
|
#define DWARF_LOG_ALL (UINT32_MAX)
|
||||||
#define DWARF_LOG_DEFAULT (DWARF_LOG_DEBUG_INFO)
|
#define DWARF_LOG_DEFAULT (DWARF_LOG_DEBUG_INFO)
|
||||||
|
|
||||||
|
|
|
@ -1761,8 +1761,7 @@ uint32_t SymbolFileDWARF::ResolveSymbolContext(const Address &so_addr,
|
||||||
llvm::Expected<DWARFDebugAranges &> aranges =
|
llvm::Expected<DWARFDebugAranges &> aranges =
|
||||||
debug_info->GetCompileUnitAranges();
|
debug_info->GetCompileUnitAranges();
|
||||||
if (!aranges) {
|
if (!aranges) {
|
||||||
Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO |
|
Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
|
||||||
DWARF_LOG_DEBUG_ARANGES);
|
|
||||||
LLDB_LOG_ERROR(log, aranges.takeError(),
|
LLDB_LOG_ERROR(log, aranges.takeError(),
|
||||||
"SymbolFileDWARF::ResolveSymbolContext failed to get cu "
|
"SymbolFileDWARF::ResolveSymbolContext failed to get cu "
|
||||||
"aranges. {0}");
|
"aranges. {0}");
|
||||||
|
|
Loading…
Reference in New Issue