Summary: With the last round of refactors, supporting type units in dwo files becomes almost trivial. This patch contains a couple of small fixes, which taken as a whole make type units work in the split dwarf scenario (both DWARF4 and DWARF5): - DWARFContext: make sure we actually read the debug_types.dwo section - DWARFUnit: set string offsets base on all units in the dwo file, not just the main CU - ManualDWARFIndex: index all units in the file - SymbolFileDWARFDwo: Search for the single compile unit in the file, as we can no longer assume it will be the first one The last part makes it obvious that there is still some work to be done here, namely that we do not support dwo files with multiple compile units. That is something that should be easier after the DIERef refactors, but it still requires more work. Tests are added for the type units+split dwarf + dwarf4/5 scenarios, as well as a test that checks we behave reasonably in the presence of dwo files with multiple CUs. Reviewers: clayborg, JDevlieghere, aprantl Subscribers: arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D63643 llvm-svn: 364274
80 lines
2.5 KiB
C++
80 lines
2.5 KiB
C++
//===-- SymbolFileDWARFDwo.h ------------------------------------*- C++ -*-===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SymbolFileDWARFDwo_SymbolFileDWARFDwo_h_
|
|
#define SymbolFileDWARFDwo_SymbolFileDWARFDwo_h_
|
|
|
|
#include "SymbolFileDWARF.h"
|
|
|
|
class SymbolFileDWARFDwo : public SymbolFileDWARF {
|
|
public:
|
|
SymbolFileDWARFDwo(lldb::ObjectFileSP objfile, DWARFCompileUnit &dwarf_cu);
|
|
|
|
~SymbolFileDWARFDwo() override = default;
|
|
|
|
lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit &dwarf_cu) override;
|
|
|
|
DWARFCompileUnit *GetCompileUnit();
|
|
|
|
DWARFUnit *
|
|
GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) override;
|
|
|
|
lldb_private::DWARFExpression::LocationListFormat
|
|
GetLocationListFormat() const override;
|
|
|
|
size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name,
|
|
DIEArray &method_die_offsets) override;
|
|
|
|
lldb_private::TypeSystem *
|
|
GetTypeSystemForLanguage(lldb::LanguageType language) override;
|
|
|
|
DWARFDIE
|
|
GetDIE(const DIERef &die_ref) override;
|
|
|
|
std::unique_ptr<SymbolFileDWARFDwo>
|
|
GetDwoSymbolFileForCompileUnit(DWARFUnit &dwarf_cu,
|
|
const DWARFDebugInfoEntry &cu_die) override {
|
|
return nullptr;
|
|
}
|
|
|
|
DWARFCompileUnit *GetBaseCompileUnit() override { return &m_base_dwarf_cu; }
|
|
|
|
llvm::Optional<uint32_t> GetDwoNum() override { return GetID() >> 32; }
|
|
|
|
protected:
|
|
void LoadSectionData(lldb::SectionType sect_type,
|
|
lldb_private::DWARFDataExtractor &data) override;
|
|
|
|
DIEToTypePtr &GetDIEToType() override;
|
|
|
|
DIEToVariableSP &GetDIEToVariable() override;
|
|
|
|
DIEToClangType &GetForwardDeclDieToClangType() override;
|
|
|
|
ClangTypeToDIE &GetForwardDeclClangTypeToDie() override;
|
|
|
|
UniqueDWARFASTTypeMap &GetUniqueDWARFASTTypeMap() override;
|
|
|
|
lldb::TypeSP FindDefinitionTypeForDWARFDeclContext(
|
|
const DWARFDeclContext &die_decl_ctx) override;
|
|
|
|
lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(
|
|
const DWARFDIE &die, lldb_private::ConstString type_name,
|
|
bool must_be_implementation) override;
|
|
|
|
SymbolFileDWARF &GetBaseSymbolFile();
|
|
|
|
DWARFCompileUnit *ComputeCompileUnit();
|
|
|
|
lldb::ObjectFileSP m_obj_file_sp;
|
|
DWARFCompileUnit &m_base_dwarf_cu;
|
|
DWARFCompileUnit *m_cu = nullptr;
|
|
};
|
|
|
|
#endif // SymbolFileDWARFDwo_SymbolFileDWARFDwo_h_
|