9#ifndef LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFUNIT_H
10#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFUNIT_H
16#include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h"
17#include "llvm/DebugInfo/DWARF/DWARFDebugRnglists.h"
18#include "llvm/Support/RWMutex.h"
25class DWARFCompileUnit;
28class SymbolFileDWARFDwo;
43 llvm::iterator_range<DWARFDebugInfoEntry::collection::iterator>;
46 static llvm::Expected<DWARFUnitSP>
209 return GetUnitType() == llvm::dwarf::DW_UT_skeleton;
241 std::unique_ptr<llvm::DWARFLocationTable>
253 bool HasAny(llvm::ArrayRef<dw_tag_t> tags);
275 const llvm::DWARFUnitHeader &header,
276 const llvm::DWARFAbbreviationDeclarationSet &abbrevs,
308 const llvm::DWARFAbbreviationDeclarationSet *
m_abbrevs =
nullptr;
static llvm::raw_ostream & error(Stream &strm)
A class that describes a compilation unit.
llvm::sys::path::Style Style
A stream class that can stream formatted output to a file.
const DWARFDataExtractor & getOrLoadLocListsData()
DWARFDebugInfoEntry objects assume that they are living in one big vector and do pointer arithmetic o...
std::vector< DWARFDebugInfoEntry > collection
const DWARFUnit & operator=(const DWARFUnit &)=delete
FileSpec::Style GetPathStyle()
std::optional< dw_addr_t > m_addr_base
Value of DW_AT_addr_base.
DWARFBaseDIE GetUnitDIEOnly()
bool m_rnglist_table_done
void ExtractDIEsIfNeeded()
bool IsSkeletonUnit() const
Note that this check only works for DWARF5+.
std::unique_ptr< llvm::DWARFLocationTable > GetLocationTable(const DataExtractor &data) const
Return the location table for parsing the given location list data.
dw_offset_t GetAbbrevOffset() const
std::optional< FileSpec > m_file_spec
uint8_t GetAddressByteSize() const
void ExtractUnitDIEIfNeeded()
size_t GetLengthByteSize() const
Get the size in bytes of the length field in the header.
std::optional< uint64_t > GetHeaderDWOId()
Get the DWO ID from the DWARFUnitHeader only.
void ExtractUnitDIENoDwoIfNeeded()
std::optional< llvm::DWARFDebugRnglistTable > m_rnglist_table
lldb_private::CompileUnit * m_lldb_cu
const DWARFDebugInfoEntry * GetUnitDIEPtrOnly()
llvm::sys::RWMutex m_die_array_mutex
bool LinkToSkeletonUnit(DWARFUnit &skeleton_unit)
dw_offset_t m_line_table_offset
Value of DW_AT_stmt_list.
llvm::sys::RWMutex m_die_array_scoped_mutex
void SetStrOffsetsBase(dw_offset_t str_offsets_base)
dw_addr_t GetBaseAddress() const
std::atomic< bool > m_cancel_scopes
bool Verify(Stream *s) const
Status m_dwo_error
If we get an error when trying to load a .dwo file, save that error here.
void SetLoclistsBase(dw_addr_t loclists_base)
SymbolFileDWARF & GetSymbolFileDWARF() const
dw_offset_t GetLength() const
DIERef::Section GetDebugSection() const
void SetDwoStrOffsetsBase()
const DWARFDebugAranges & GetFunctionAranges()
dw_offset_t GetLineTableOffset()
dw_addr_t GetRangesBase() const
bool Supports_DW_AT_APPLE_objc_complete_type()
const DWARFDataExtractor & GetData() const
Get the data that contains the DIE information for this unit.
bool DW_AT_decl_file_attributes_are_invalid()
static llvm::Expected< DWARFUnitSP > extract(SymbolFileDWARF &dwarf2Data, lldb::user_id_t uid, const DWARFDataExtractor &debug_info, DIERef::Section section, lldb::offset_t *offset_ptr)
DWARFCompileUnit * GetSkeletonUnit()
Get the skeleton compile unit for a DWO file.
dw_addr_t ReadAddressFromDebugAddrSection(uint32_t index) const
const DWARFDebugInfoEntry * DIEPtr()
bool ContainsDIEOffset(dw_offset_t die_offset) const
llvm::iterator_range< DWARFDebugInfoEntry::collection::iterator > die_iterator_range
std::optional< FileSpec > m_comp_dir
dw_offset_t GetFirstDIEOffset() const
const Status & GetDwoError() const
Get the fission .dwo file specific error for this compile unit.
std::optional< uint64_t > m_language_type
llvm::StringRef PeekDIEName(dw_offset_t die_offset)
Returns the AT_Name of the DIE at die_offset, if it exists, without parsing the entire compile unit.
DWARFDebugInfoEntry::collection m_die_array
dw_addr_t GetStrOffsetsBase() const
void SetBaseAddress(dw_addr_t base_addr)
void ComputeCompDirAndGuessPathStyle()
std::optional< uint64_t > m_gnu_ranges_base
const llvm::DWARFAbbreviationDeclarationSet * m_abbrevs
void SetLLDBCompUnit(lldb_private::CompileUnit *cu)
DWARFUnit(const DWARFUnit &)=delete
lldb_private::CompileUnit * GetLLDBCompUnit() const
DWARFDebugInfoEntry m_first_die
size_t GetDebugInfoSize() const
dw_offset_t GetOffset() const
const DIERef::Section m_section
dw_offset_t GetNextUnitOffset() const
DWARFDataExtractor GetLocationData() const
uint16_t GetVersion() const
const std::optional< llvm::DWARFDebugRnglistTable > & GetRnglistTable()
die_iterator_range dies()
const FileSpec & GetAbsolutePath()
llvm::Expected< uint64_t > GetRnglistOffset(uint32_t Index)
Return a rangelist's offset based on an index.
std::unique_ptr< DWARFDebugAranges > m_func_aranges_up
dw_offset_t m_str_offsets_base
std::optional< uint64_t > GetLoclistOffset(uint32_t Index)
dw_addr_t m_ranges_base
Value of DW_AT_rnglists_base.
bool Supports_unnamed_objc_bitfields()
virtual void Dump(Stream *s) const =0
dw_addr_t m_loclists_base
Value of DW_AT_loclists_base.
void SetRangesBase(dw_addr_t ranges_base)
dw_addr_t GetAddrBase() const
uint32_t GetHeaderByteSize() const
Get the size in bytes of the unit header.
ScopedExtractDIEs ExtractDIEsScoped()
void SetAddrBase(dw_addr_t addr_base)
llvm::Expected< DWARFRangeList > FindRnglistFromIndex(uint32_t index)
Return a list of address ranges retrieved from an encoded range list whose offset is found via a tabl...
void ExtractDIEsRWLocked()
std::optional< llvm::DWARFListTableHeader > m_loclist_table_header
SymbolFileDWARF & m_dwarf
llvm::VersionTuple GetProducerVersion()
static uint8_t GetDefaultAddressSize()
virtual void BuildAddressRangeTable(DWARFDebugAranges *debug_aranges)=0
uint64_t GetDWARFLanguageType()
void ComputeAbsolutePath()
std::optional< uint64_t > m_dwo_id
Value of DW_AT_GNU_dwo_id (v4) or dwo_id from CU header (v5).
std::shared_ptr< DWARFUnit > m_dwo
std::optional< uint64_t > m_gnu_addr_base
llvm::VersionTuple m_producer_version
std::optional< uint64_t > GetStringOffsetSectionItem(uint32_t index) const
DWARFUnit & GetNonSkeletonUnit()
DWARFDIE GetDIE(dw_offset_t die_offset)
lldb::ByteOrder GetByteOrder() const
void AddUnitDIE(const DWARFDebugInfoEntry &cu_die)
void SetDwoError(const Status &error)
Set the fission .dwo file specific error for this compile unit.
llvm::sys::RWMutex m_first_die_mutex
llvm::Error ExtractHeader(SymbolFileDWARF &dwarf, const DWARFDataExtractor &data, lldb::offset_t *offset_ptr)
SymbolFileDWARFDwo * GetDwoSymbolFile(bool load_all_debug_info=true)
bool m_has_parsed_non_skeleton_unit
DWARFProducer GetProducer()
const FileSpec & GetCompilationDirectory()
std::optional< uint64_t > GetDWOId()
Get the DWO ID from the DWARFUnitHeader for DWARF5, or from the unit DIE's DW_AT_dwo_id or DW_AT_GNU_...
llvm::DWARFUnitHeader m_header
const llvm::DWARFAbbreviationDeclarationSet * GetAbbreviations() const
bool HasAny(llvm::ArrayRef< dw_tag_t > tags)
Returns true if any DIEs in the unit match any DW_TAG values in tags.
llvm::Expected< DWARFRangeList > FindRnglistFromOffset(dw_offset_t offset)
Return a list of address ranges resulting from a (possibly encoded) range list starting at a given of...
std::atomic< DWARFUnit * > m_skeleton_unit
DWARFDataExtractor GetRnglistData() const
FileSpec GetFile(size_t file_idx)
uint8_t GetUnitType() const
DWARFContext & GetDWARFContext()
#define DW_INVALID_OFFSET
std::shared_ptr< DWARFUnit > DWARFUnitSP
ByteOrder
Byte ordering definitions.
A mix in class that contains a generic user ID.