mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-09 01:29:52 +00:00
Clean up DWARFDebugInfoEntry
llvm-svn: 361962
This commit is contained in:
parent
268dfaf153
commit
898aaf1cb8
@ -1074,13 +1074,6 @@ void DWARFDebugInfoEntry::BuildFunctionAddressRangeTable(
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<DWARFDIE>
|
||||
DWARFDebugInfoEntry::GetDeclContextDIEs(DWARFUnit *cu) const {
|
||||
|
||||
DWARFDIE die(cu, const_cast<DWARFDebugInfoEntry *>(this));
|
||||
return die.GetDeclContextDIEs();
|
||||
}
|
||||
|
||||
void DWARFDebugInfoEntry::GetDWARFDeclContext(
|
||||
DWARFUnit *cu, DWARFDeclContext &dwarf_decl_ctx) const {
|
||||
const dw_tag_t tag = Tag();
|
||||
@ -1096,14 +1089,6 @@ void DWARFDebugInfoEntry::GetDWARFDeclContext(
|
||||
}
|
||||
}
|
||||
|
||||
bool DWARFDebugInfoEntry::MatchesDWARFDeclContext(
|
||||
DWARFUnit *cu, const DWARFDeclContext &dwarf_decl_ctx) const {
|
||||
|
||||
DWARFDeclContext this_dwarf_decl_ctx;
|
||||
GetDWARFDeclContext(cu, this_dwarf_decl_ctx);
|
||||
return this_dwarf_decl_ctx == dwarf_decl_ctx;
|
||||
}
|
||||
|
||||
DWARFDIE
|
||||
DWARFDebugInfoEntry::GetParentDeclContextDIE(DWARFUnit *cu) const {
|
||||
DWARFAttributes attributes;
|
||||
@ -1214,7 +1199,6 @@ DWARFDebugInfoEntry::GetQualifiedName(DWARFUnit *cu,
|
||||
return storage.c_str();
|
||||
}
|
||||
|
||||
// LookupAddress
|
||||
bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
|
||||
const DWARFUnit *cu,
|
||||
DWARFDebugInfoEntry **function_die,
|
||||
@ -1232,13 +1216,9 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
|
||||
check_children = true;
|
||||
break;
|
||||
case DW_TAG_entry_point:
|
||||
break;
|
||||
case DW_TAG_enumeration_type:
|
||||
break;
|
||||
case DW_TAG_formal_parameter:
|
||||
break;
|
||||
case DW_TAG_imported_declaration:
|
||||
break;
|
||||
case DW_TAG_label:
|
||||
break;
|
||||
case DW_TAG_lexical_block:
|
||||
@ -1246,9 +1226,7 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
|
||||
match_addr_range = true;
|
||||
break;
|
||||
case DW_TAG_member:
|
||||
break;
|
||||
case DW_TAG_pointer_type:
|
||||
break;
|
||||
case DW_TAG_reference_type:
|
||||
break;
|
||||
case DW_TAG_compile_unit:
|
||||
@ -1260,20 +1238,15 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
|
||||
check_children = true;
|
||||
break;
|
||||
case DW_TAG_subroutine_type:
|
||||
break;
|
||||
case DW_TAG_typedef:
|
||||
break;
|
||||
case DW_TAG_union_type:
|
||||
break;
|
||||
case DW_TAG_unspecified_parameters:
|
||||
break;
|
||||
case DW_TAG_variant:
|
||||
break;
|
||||
case DW_TAG_common_block:
|
||||
check_children = true;
|
||||
break;
|
||||
case DW_TAG_common_inclusion:
|
||||
break;
|
||||
case DW_TAG_inheritance:
|
||||
break;
|
||||
case DW_TAG_inlined_subroutine:
|
||||
@ -1284,76 +1257,53 @@ bool DWARFDebugInfoEntry::LookupAddress(const dw_addr_t address,
|
||||
match_addr_range = true;
|
||||
break;
|
||||
case DW_TAG_ptr_to_member_type:
|
||||
break;
|
||||
case DW_TAG_set_type:
|
||||
break;
|
||||
case DW_TAG_subrange_type:
|
||||
break;
|
||||
case DW_TAG_with_stmt:
|
||||
break;
|
||||
case DW_TAG_access_declaration:
|
||||
break;
|
||||
case DW_TAG_base_type:
|
||||
break;
|
||||
case DW_TAG_catch_block:
|
||||
match_addr_range = true;
|
||||
break;
|
||||
case DW_TAG_const_type:
|
||||
break;
|
||||
case DW_TAG_constant:
|
||||
break;
|
||||
case DW_TAG_enumerator:
|
||||
break;
|
||||
case DW_TAG_file_type:
|
||||
break;
|
||||
case DW_TAG_friend:
|
||||
break;
|
||||
case DW_TAG_namelist:
|
||||
break;
|
||||
case DW_TAG_namelist_item:
|
||||
break;
|
||||
case DW_TAG_packed_type:
|
||||
break;
|
||||
case DW_TAG_subprogram:
|
||||
match_addr_range = true;
|
||||
break;
|
||||
case DW_TAG_template_type_parameter:
|
||||
break;
|
||||
case DW_TAG_template_value_parameter:
|
||||
break;
|
||||
case DW_TAG_GNU_template_parameter_pack:
|
||||
break;
|
||||
case DW_TAG_thrown_type:
|
||||
break;
|
||||
case DW_TAG_try_block:
|
||||
match_addr_range = true;
|
||||
break;
|
||||
case DW_TAG_variant_part:
|
||||
break;
|
||||
case DW_TAG_variable:
|
||||
break;
|
||||
case DW_TAG_volatile_type:
|
||||
break;
|
||||
case DW_TAG_dwarf_procedure:
|
||||
break;
|
||||
case DW_TAG_restrict_type:
|
||||
break;
|
||||
case DW_TAG_interface_type:
|
||||
break;
|
||||
case DW_TAG_namespace:
|
||||
check_children = true;
|
||||
break;
|
||||
case DW_TAG_imported_module:
|
||||
break;
|
||||
case DW_TAG_unspecified_type:
|
||||
break;
|
||||
case DW_TAG_partial_unit:
|
||||
match_addr_range = true;
|
||||
break;
|
||||
case DW_TAG_imported_unit:
|
||||
break;
|
||||
case DW_TAG_shared_type:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -1485,11 +1435,6 @@ DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool DWARFDebugInfoEntry::OffsetLessThan(const DWARFDebugInfoEntry &a,
|
||||
const DWARFDebugInfoEntry &b) {
|
||||
return a.GetOffset() < b.GetOffset();
|
||||
}
|
||||
|
||||
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 &&
|
||||
|
@ -19,26 +19,6 @@
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
typedef std::map<const DWARFDebugInfoEntry *, dw_addr_t> DIEToAddressMap;
|
||||
typedef DIEToAddressMap::iterator DIEToAddressMapIter;
|
||||
typedef DIEToAddressMap::const_iterator DIEToAddressMapConstIter;
|
||||
|
||||
typedef std::map<dw_addr_t, const DWARFDebugInfoEntry *> AddressToDIEMap;
|
||||
typedef AddressToDIEMap::iterator AddressToDIEMapIter;
|
||||
typedef AddressToDIEMap::const_iterator AddressToDIEMapConstIter;
|
||||
|
||||
typedef std::map<dw_offset_t, dw_offset_t> DIEToDIEMap;
|
||||
typedef DIEToDIEMap::iterator DIEToDIEMapIter;
|
||||
typedef DIEToDIEMap::const_iterator DIEToDIEMapConstIter;
|
||||
|
||||
typedef std::map<uint32_t, const DWARFDebugInfoEntry *> UInt32ToDIEMap;
|
||||
typedef UInt32ToDIEMap::iterator UInt32ToDIEMapIter;
|
||||
typedef UInt32ToDIEMap::const_iterator UInt32ToDIEMapConstIter;
|
||||
|
||||
typedef std::multimap<uint32_t, const DWARFDebugInfoEntry *> UInt32ToDIEMMap;
|
||||
typedef UInt32ToDIEMMap::iterator UInt32ToDIEMMapIter;
|
||||
typedef UInt32ToDIEMMap::const_iterator UInt32ToDIEMMapConstIter;
|
||||
|
||||
class DWARFDeclContext;
|
||||
|
||||
#define DIE_SIBLING_IDX_BITSIZE 31
|
||||
@ -49,10 +29,6 @@ public:
|
||||
typedef collection::iterator iterator;
|
||||
typedef collection::const_iterator const_iterator;
|
||||
|
||||
typedef std::vector<dw_offset_t> offset_collection;
|
||||
typedef offset_collection::iterator offset_collection_iterator;
|
||||
typedef offset_collection::const_iterator offset_collection_const_iterator;
|
||||
|
||||
DWARFDebugInfoEntry()
|
||||
: m_offset(DW_INVALID_OFFSET), m_parent_idx(0), m_sibling_idx(0),
|
||||
m_has_children(false), m_abbr_idx(0), m_tag(0) {}
|
||||
@ -129,9 +105,6 @@ public:
|
||||
const char *GetQualifiedName(DWARFUnit *cu, const DWARFAttributes &attributes,
|
||||
std::string &storage) const;
|
||||
|
||||
static bool OffsetLessThan(const DWARFDebugInfoEntry &a,
|
||||
const DWARFDebugInfoEntry &b);
|
||||
|
||||
void Dump(const DWARFUnit *cu, lldb_private::Stream &s,
|
||||
uint32_t recurse_depth) const;
|
||||
|
||||
@ -187,38 +160,14 @@ public:
|
||||
return HasChildren() ? this + 1 : nullptr;
|
||||
}
|
||||
|
||||
std::vector<DWARFDIE> GetDeclContextDIEs(DWARFUnit *cu) const;
|
||||
|
||||
void GetDWARFDeclContext(DWARFUnit *cu,
|
||||
DWARFDeclContext &dwarf_decl_ctx) const;
|
||||
|
||||
bool MatchesDWARFDeclContext(DWARFUnit *cu,
|
||||
const DWARFDeclContext &dwarf_decl_ctx) const;
|
||||
|
||||
DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu) const;
|
||||
DWARFDIE GetParentDeclContextDIE(DWARFUnit *cu,
|
||||
const DWARFAttributes &attributes) const;
|
||||
|
||||
void SetParent(DWARFDebugInfoEntry *parent) {
|
||||
if (parent) {
|
||||
// We know we are kept in a vector of contiguous entries, so we know
|
||||
// our parent will be some index behind "this".
|
||||
m_parent_idx = this - parent;
|
||||
} else
|
||||
m_parent_idx = 0;
|
||||
}
|
||||
void SetSibling(DWARFDebugInfoEntry *sibling) {
|
||||
if (sibling) {
|
||||
// We know we are kept in a vector of contiguous entries, so we know
|
||||
// our sibling will be some index after "this".
|
||||
m_sibling_idx = sibling - this;
|
||||
sibling->SetParent(GetParent());
|
||||
} else
|
||||
m_sibling_idx = 0;
|
||||
}
|
||||
|
||||
void SetSiblingIndex(uint32_t idx) { m_sibling_idx = idx; }
|
||||
|
||||
void SetParentIndex(uint32_t idx) { m_parent_idx = idx; }
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user