#include "DWARFUnit.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/LLDBAssert.h"
#include "lldb/Utility/StreamString.h"
#include "lldb/Utility/Timer.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h"
#include "llvm/Object/Error.h"
#include "DWARFCompileUnit.h"
#include "DWARFDebugAranges.h"
#include "DWARFDebugInfo.h"
#include "DWARFTypeUnit.h"
#include "LogChannelDWARF.h"
#include "SymbolFileDWARFDwo.h"
#include <optional>
usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacelldb_private::dwarf;
usingnamespacelldb_private::plugin::dwarf;
extern int g_verbose;
DWARFUnit::DWARFUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid,
const llvm::DWARFUnitHeader &header,
const llvm::DWARFAbbreviationDeclarationSet &abbrevs,
DIERef::Section section, bool is_dwo)
: … { … }
DWARFUnit::~DWARFUnit() = default;
void DWARFUnit::ExtractUnitDIENoDwoIfNeeded() { … }
void DWARFUnit::ExtractUnitDIEIfNeeded() { … }
void DWARFUnit::ExtractDIEsIfNeeded() { … }
DWARFUnit::ScopedExtractDIEs DWARFUnit::ExtractDIEsScoped() { … }
DWARFUnit::ScopedExtractDIEs::ScopedExtractDIEs(DWARFUnit &cu) : … { … }
DWARFUnit::ScopedExtractDIEs::~ScopedExtractDIEs() { … }
DWARFUnit::ScopedExtractDIEs::ScopedExtractDIEs(ScopedExtractDIEs &&rhs)
: … { … }
DWARFUnit::ScopedExtractDIEs &
DWARFUnit::ScopedExtractDIEs::operator=(DWARFUnit::ScopedExtractDIEs &&rhs) { … }
void DWARFUnit::ExtractDIEsRWLocked() { … }
void DWARFUnit::SetDwoStrOffsetsBase() { … }
std::optional<uint64_t> DWARFUnit::GetDWOId() { … }
void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry &cu_die) { … }
size_t DWARFUnit::GetDebugInfoSize() const { … }
const llvm::DWARFAbbreviationDeclarationSet *
DWARFUnit::GetAbbreviations() const { … }
dw_offset_t DWARFUnit::GetAbbrevOffset() const { … }
dw_offset_t DWARFUnit::GetLineTableOffset() { … }
void DWARFUnit::SetAddrBase(dw_addr_t addr_base) { … }
template <typename ListTableType>
static llvm::Expected<ListTableType>
ParseListTableHeader(const llvm::DWARFDataExtractor &data, uint64_t offset,
DwarfFormat format) { … }
void DWARFUnit::SetLoclistsBase(dw_addr_t loclists_base) { … }
std::unique_ptr<llvm::DWARFLocationTable>
DWARFUnit::GetLocationTable(const DataExtractor &data) const { … }
DWARFDataExtractor DWARFUnit::GetLocationData() const { … }
DWARFDataExtractor DWARFUnit::GetRnglistData() const { … }
void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) { … }
const std::optional<llvm::DWARFDebugRnglistTable> &
DWARFUnit::GetRnglistTable() { … }
llvm::Expected<uint64_t> DWARFUnit::GetRnglistOffset(uint32_t Index) { … }
void DWARFUnit::SetStrOffsetsBase(dw_offset_t str_offsets_base) { … }
dw_addr_t DWARFUnit::ReadAddressFromDebugAddrSection(uint32_t index) const { … }
void DWARFUnit::ClearDIEsRWLocked() { … }
lldb::ByteOrder DWARFUnit::GetByteOrder() const { … }
void DWARFUnit::SetBaseAddress(dw_addr_t base_addr) { … }
static bool CompareDIEOffset(const DWARFDebugInfoEntry &die,
const dw_offset_t die_offset) { … }
DWARFDIE
DWARFUnit::GetDIE(dw_offset_t die_offset) { … }
llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) { … }
DWARFUnit &DWARFUnit::GetNonSkeletonUnit() { … }
uint8_t DWARFUnit::GetAddressByteSize(const DWARFUnit *cu) { … }
uint8_t DWARFUnit::GetDefaultAddressSize() { … }
DWARFCompileUnit *DWARFUnit::GetSkeletonUnit() { … }
bool DWARFUnit::LinkToSkeletonUnit(DWARFUnit &skeleton_unit) { … }
bool DWARFUnit::Supports_DW_AT_APPLE_objc_complete_type() { … }
bool DWARFUnit::DW_AT_decl_file_attributes_are_invalid() { … }
bool DWARFUnit::Supports_unnamed_objc_bitfields() { … }
void DWARFUnit::ParseProducerInfo() { … }
DWARFProducer DWARFUnit::GetProducer() { … }
llvm::VersionTuple DWARFUnit::GetProducerVersion() { … }
uint64_t DWARFUnit::GetDWARFLanguageType() { … }
bool DWARFUnit::GetIsOptimized() { … }
FileSpec::Style DWARFUnit::GetPathStyle() { … }
const FileSpec &DWARFUnit::GetCompilationDirectory() { … }
const FileSpec &DWARFUnit::GetAbsolutePath() { … }
FileSpec DWARFUnit::GetFile(size_t file_idx) { … }
static llvm::StringRef
removeHostnameFromPathname(llvm::StringRef path_from_dwarf) { … }
void DWARFUnit::ComputeCompDirAndGuessPathStyle() { … }
void DWARFUnit::ComputeAbsolutePath() { … }
SymbolFileDWARFDwo *DWARFUnit::GetDwoSymbolFile(bool load_all_debug_info) { … }
const DWARFDebugAranges &DWARFUnit::GetFunctionAranges() { … }
llvm::Expected<DWARFUnitSP>
DWARFUnit::extract(SymbolFileDWARF &dwarf, user_id_t uid,
const DWARFDataExtractor &debug_info,
DIERef::Section section, lldb::offset_t *offset_ptr) { … }
const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const { … }
uint32_t DWARFUnit::GetHeaderByteSize() const { … }
std::optional<uint64_t>
DWARFUnit::GetStringOffsetSectionItem(uint32_t index) const { … }
llvm::Expected<DWARFRangeList>
DWARFUnit::FindRnglistFromOffset(dw_offset_t offset) { … }
llvm::Expected<DWARFRangeList> DWARFUnit::FindRnglistFromIndex(uint32_t index) { … }
bool DWARFUnit::HasAny(llvm::ArrayRef<dw_tag_t> tags) { … }