llvm/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

//===-- DWARFUnit.cpp -----------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#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;

// Parses first DIE of a compile unit, excluding DWO.
void DWARFUnit::ExtractUnitDIENoDwoIfNeeded() {}

// Parses first DIE of a compile unit including DWO.
void DWARFUnit::ExtractUnitDIEIfNeeded() {}

// Parses a compile unit and indexes its DIEs if it hasn't already been done.
// It will leave this compile unit extracted forever.
void DWARFUnit::ExtractDIEsIfNeeded() {}

// Parses a compile unit and indexes its DIEs if it hasn't already been done.
// It will clear this compile unit after returned instance gets out of scope,
// no other ScopedExtractDIEs instance is running for this compile unit
// and no ExtractDIEsIfNeeded() has been executed during this ScopedExtractDIEs
// lifetime.
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) {}

// Parses a compile unit and indexes its DIEs, m_die_array_mutex must be
// held R/W and m_die_array must be empty.
void DWARFUnit::ExtractDIEsRWLocked() {}

// 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
// .debug_str_offsets. At the same time, the corresponding split debug unit also
// may use DW_FORM_strx* forms pointing to its own .debug_str_offsets.dwo and
// for that case, we should find the offset (skip the section header).
void DWARFUnit::SetDwoStrOffsetsBase() {}

std::optional<uint64_t> DWARFUnit::GetDWOId() {}

// m_die_array_mutex must be already held as read/write.
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) {}

// Parse the rangelist table header, including the optional array of offsets
// following it (DWARF v5 and later).
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() {}

// This function is called only for DW_FORM_rnglistx.
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 {}

// It may be called only with m_die_array_mutex held R/W.
void DWARFUnit::ClearDIEsRWLocked() {}

lldb::ByteOrder DWARFUnit::GetByteOrder() const {}

void DWARFUnit::SetBaseAddress(dw_addr_t base_addr) {}

// Compare function DWARFDebugAranges::Range structures
static bool CompareDIEOffset(const DWARFDebugInfoEntry &die,
                             const dw_offset_t die_offset) {}

// GetDIE()
//
// Get the DIE (Debug Information Entry) with the specified offset by first
// checking if the DIE is contained within this compile unit and grabbing the
// DIE from this compile unit. Otherwise we grab the DIE from the DWARF file.
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) {}

// DWARF2/3 suggests the form hostname:pathname for compilation directory.
// Remove the host part if present.
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) {}