Changeset View
Changeset View
Standalone View
Standalone View
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | class DWARFUnitHeader { | ||||
const llvm::DWARFUnitIndex::Entry *m_index_entry = nullptr; | const llvm::DWARFUnitIndex::Entry *m_index_entry = nullptr; | ||||
uint8_t m_unit_type = 0; | uint8_t m_unit_type = 0; | ||||
uint8_t m_addr_size = 0; | uint8_t m_addr_size = 0; | ||||
uint64_t m_type_hash = 0; | uint64_t m_type_hash = 0; | ||||
uint32_t m_type_offset = 0; | uint32_t m_type_offset = 0; | ||||
uint64_t m_dwo_id = 0; | llvm::Optional<uint64_t> m_dwo_id; | ||||
DWARFUnitHeader() = default; | DWARFUnitHeader() = default; | ||||
public: | public: | ||||
dw_offset_t GetOffset() const { return m_offset; } | dw_offset_t GetOffset() const { return m_offset; } | ||||
uint16_t GetVersion() const { return m_version; } | uint16_t GetVersion() const { return m_version; } | ||||
uint16_t GetAddressByteSize() const { return m_addr_size; } | uint16_t GetAddressByteSize() const { return m_addr_size; } | ||||
dw_offset_t GetLength() const { return m_length; } | dw_offset_t GetLength() const { return m_length; } | ||||
dw_offset_t GetAbbrOffset() const { return m_abbr_offset; } | dw_offset_t GetAbbrOffset() const { return m_abbr_offset; } | ||||
uint8_t GetUnitType() const { return m_unit_type; } | uint8_t GetUnitType() const { return m_unit_type; } | ||||
const llvm::DWARFUnitIndex::Entry *GetIndexEntry() const { | const llvm::DWARFUnitIndex::Entry *GetIndexEntry() const { | ||||
return m_index_entry; | return m_index_entry; | ||||
} | } | ||||
uint64_t GetTypeHash() const { return m_type_hash; } | uint64_t GetTypeHash() const { return m_type_hash; } | ||||
dw_offset_t GetTypeOffset() const { return m_type_offset; } | dw_offset_t GetTypeOffset() const { return m_type_offset; } | ||||
uint64_t GetDWOId() const { return m_dwo_id; } | llvm::Optional<uint64_t> GetDWOId() const { return m_dwo_id; } | ||||
bool IsTypeUnit() const { | bool IsTypeUnit() const { | ||||
return m_unit_type == llvm::dwarf::DW_UT_type || | return m_unit_type == llvm::dwarf::DW_UT_type || | ||||
m_unit_type == llvm::dwarf::DW_UT_split_type; | m_unit_type == llvm::dwarf::DW_UT_split_type; | ||||
} | } | ||||
uint32_t GetNextUnitOffset() const { return m_offset + m_length + 4; } | uint32_t GetNextUnitOffset() const { return m_offset + m_length + 4; } | ||||
static llvm::Expected<DWARFUnitHeader> | static llvm::Expected<DWARFUnitHeader> | ||||
extract(const lldb_private::DWARFDataExtractor &data, DIERef::Section section, | extract(const lldb_private::DWARFDataExtractor &data, DIERef::Section section, | ||||
lldb_private::DWARFContext &dwarf_context, | lldb_private::DWARFContext &dwarf_context, | ||||
lldb::offset_t *offset_ptr); | lldb::offset_t *offset_ptr); | ||||
}; | }; | ||||
class DWARFUnit : public lldb_private::UserID { | class DWARFUnit : public lldb_private::UserID { | ||||
using die_iterator_range = | using die_iterator_range = | ||||
llvm::iterator_range<DWARFDebugInfoEntry::collection::iterator>; | llvm::iterator_range<DWARFDebugInfoEntry::collection::iterator>; | ||||
public: | public: | ||||
static llvm::Expected<DWARFUnitSP> | static llvm::Expected<DWARFUnitSP> | ||||
extract(SymbolFileDWARF &dwarf2Data, lldb::user_id_t uid, | extract(SymbolFileDWARF &dwarf2Data, lldb::user_id_t uid, | ||||
const lldb_private::DWARFDataExtractor &debug_info, | const lldb_private::DWARFDataExtractor &debug_info, | ||||
DIERef::Section section, lldb::offset_t *offset_ptr); | DIERef::Section section, lldb::offset_t *offset_ptr); | ||||
virtual ~DWARFUnit(); | virtual ~DWARFUnit(); | ||||
bool IsDWOUnit() { return m_is_dwo; } | bool IsDWOUnit() { return m_is_dwo; } | ||||
uint64_t GetDWOId(); | llvm::Optional<uint64_t> GetDWOId(); | ||||
void ExtractUnitDIEIfNeeded(); | void ExtractUnitDIEIfNeeded(); | ||||
void ExtractUnitDIENoDwoIfNeeded(); | void ExtractUnitDIENoDwoIfNeeded(); | ||||
void ExtractDIEsIfNeeded(); | void ExtractDIEsIfNeeded(); | ||||
class ScopedExtractDIEs { | class ScopedExtractDIEs { | ||||
DWARFUnit *m_cu; | DWARFUnit *m_cu; | ||||
public: | public: | ||||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | protected: | ||||
llvm::Optional<llvm::DWARFDebugRnglistTable> m_rnglist_table; | llvm::Optional<llvm::DWARFDebugRnglistTable> m_rnglist_table; | ||||
bool m_rnglist_table_done = false; | bool m_rnglist_table_done = false; | ||||
llvm::Optional<llvm::DWARFListTableHeader> m_loclist_table_header; | llvm::Optional<llvm::DWARFListTableHeader> m_loclist_table_header; | ||||
const DIERef::Section m_section; | const DIERef::Section m_section; | ||||
bool m_is_dwo; | bool m_is_dwo; | ||||
bool m_has_parsed_non_skeleton_unit; | bool m_has_parsed_non_skeleton_unit; | ||||
/// Value of DW_AT_GNU_dwo_id (v4) or dwo_id from CU header (v5). | /// Value of DW_AT_GNU_dwo_id (v4) or dwo_id from CU header (v5). | ||||
uint64_t m_dwo_id; | llvm::Optional<uint64_t> m_dwo_id; | ||||
labath: What's the relationship of this field and the m_is_dwo flag? Do we need both? | |||||
I think the "m_is_dwo" is set to true if this is a DWO file, where m_dwo_id is for the skeleton compile unit. So they are different and can't be derived from each other if I understand the code correctly. clayborg: I think the "m_is_dwo" is set to true if this is a DWO file, where m_dwo_id is for the skeleton… | |||||
Not Done ReplyInline Actionsok. makes sense. labath: ok. makes sense. | |||||
private: | private: | ||||
void ParseProducerInfo(); | void ParseProducerInfo(); | ||||
void ExtractDIEsRWLocked(); | void ExtractDIEsRWLocked(); | ||||
void ClearDIEsRWLocked(); | void ClearDIEsRWLocked(); | ||||
void AddUnitDIE(const DWARFDebugInfoEntry &cu_die); | void AddUnitDIE(const DWARFDebugInfoEntry &cu_die); | ||||
void SetDwoStrOffsetsBase(); | void SetDwoStrOffsetsBase(); | ||||
Show All 9 Lines |
What's the relationship of this field and the m_is_dwo flag? Do we need both?