#include "SymbolFilePDB.h"
#include "PDBASTParser.h"
#include "PDBLocationToDWARFExpression.h"
#include "clang/Lex/Lexer.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Symbol/TypeMap.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "lldb/Utility/RegularExpression.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
#include "llvm/DebugInfo/PDB/GenericError.h"
#include "llvm/DebugInfo/PDB/IPDBDataStream.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
#include "llvm/DebugInfo/PDB/IPDBSectionContrib.h"
#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
#include "llvm/DebugInfo/PDB/IPDBTable.h"
#include "llvm/DebugInfo/PDB/PDBSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolBlock.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompiland.h"
#include "llvm/DebugInfo/PDB/PDBSymbolCompilandDetails.h"
#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugEnd.h"
#include "llvm/DebugInfo/PDB/PDBSymbolFuncDebugStart.h"
#include "llvm/DebugInfo/PDB/PDBSymbolPublicSymbol.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
#include "Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h"
#include "Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h"
#if defined(_WIN32)
#include "llvm/Config/llvm-config.h"
#include <optional>
#endif
usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacellvm::pdb;
LLDB_PLUGIN_DEFINE(…)
char SymbolFilePDB::ID;
namespace {
lldb::LanguageType TranslateLanguage(PDB_Lang lang) { … }
bool ShouldAddLine(uint32_t requested_line, uint32_t actual_line,
uint32_t addr_length) { … }
}
static bool ShouldUseNativeReader() { … }
void SymbolFilePDB::Initialize() { … }
void SymbolFilePDB::Terminate() { … }
void SymbolFilePDB::DebuggerInitialize(lldb_private::Debugger &debugger) { … }
llvm::StringRef SymbolFilePDB::GetPluginDescriptionStatic() { … }
lldb_private::SymbolFile *
SymbolFilePDB::CreateInstance(ObjectFileSP objfile_sp) { … }
SymbolFilePDB::SymbolFilePDB(lldb::ObjectFileSP objfile_sp)
: … { … }
SymbolFilePDB::~SymbolFilePDB() = default;
uint32_t SymbolFilePDB::CalculateAbilities() { … }
void SymbolFilePDB::InitializeObject() { … }
uint32_t SymbolFilePDB::CalculateNumCompileUnits() { … }
void SymbolFilePDB::GetCompileUnitIndex(
const llvm::pdb::PDBSymbolCompiland &pdb_compiland, uint32_t &index) { … }
std::unique_ptr<llvm::pdb::PDBSymbolCompiland>
SymbolFilePDB::GetPDBCompilandByUID(uint32_t uid) { … }
lldb::CompUnitSP SymbolFilePDB::ParseCompileUnitAtIndex(uint32_t index) { … }
lldb::LanguageType SymbolFilePDB::ParseLanguage(CompileUnit &comp_unit) { … }
lldb_private::Function *
SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(const PDBSymbolFunc &pdb_func,
CompileUnit &comp_unit) { … }
size_t SymbolFilePDB::ParseFunctions(CompileUnit &comp_unit) { … }
bool SymbolFilePDB::ParseLineTable(CompileUnit &comp_unit) { … }
bool SymbolFilePDB::ParseDebugMacros(CompileUnit &comp_unit) { … }
bool SymbolFilePDB::ParseSupportFiles(
CompileUnit &comp_unit, lldb_private::SupportFileList &support_files) { … }
bool SymbolFilePDB::ParseImportedModules(
const lldb_private::SymbolContext &sc,
std::vector<SourceModule> &imported_modules) { … }
static size_t ParseFunctionBlocksForPDBSymbol(
uint64_t func_file_vm_addr, const llvm::pdb::PDBSymbol *pdb_symbol,
lldb_private::Block *parent_block, bool is_top_parent) { … }
size_t SymbolFilePDB::ParseBlocksRecursive(Function &func) { … }
size_t SymbolFilePDB::ParseTypes(CompileUnit &comp_unit) { … }
size_t
SymbolFilePDB::ParseVariablesForContext(const lldb_private::SymbolContext &sc) { … }
lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) { … }
std::optional<SymbolFile::ArrayInfo> SymbolFilePDB::GetDynamicArrayInfoForUID(
lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) { … }
bool SymbolFilePDB::CompleteType(lldb_private::CompilerType &compiler_type) { … }
lldb_private::CompilerDecl SymbolFilePDB::GetDeclForUID(lldb::user_id_t uid) { … }
lldb_private::CompilerDeclContext
SymbolFilePDB::GetDeclContextForUID(lldb::user_id_t uid) { … }
lldb_private::CompilerDeclContext
SymbolFilePDB::GetDeclContextContainingUID(lldb::user_id_t uid) { … }
void SymbolFilePDB::ParseDeclsForContext(
lldb_private::CompilerDeclContext decl_ctx) { … }
uint32_t
SymbolFilePDB::ResolveSymbolContext(const lldb_private::Address &so_addr,
SymbolContextItem resolve_scope,
lldb_private::SymbolContext &sc) { … }
uint32_t SymbolFilePDB::ResolveSymbolContext(
const lldb_private::SourceLocationSpec &src_location_spec,
SymbolContextItem resolve_scope, lldb_private::SymbolContextList &sc_list) { … }
std::string SymbolFilePDB::GetMangledForPDBData(const PDBSymbolData &pdb_data) { … }
VariableSP SymbolFilePDB::ParseVariableForPDBData(
const lldb_private::SymbolContext &sc,
const llvm::pdb::PDBSymbolData &pdb_data) { … }
size_t
SymbolFilePDB::ParseVariables(const lldb_private::SymbolContext &sc,
const llvm::pdb::PDBSymbol &pdb_symbol,
lldb_private::VariableList *variable_list) { … }
void SymbolFilePDB::FindGlobalVariables(
lldb_private::ConstString name, const CompilerDeclContext &parent_decl_ctx,
uint32_t max_matches, lldb_private::VariableList &variables) { … }
void SymbolFilePDB::FindGlobalVariables(
const lldb_private::RegularExpression ®ex, uint32_t max_matches,
lldb_private::VariableList &variables) { … }
bool SymbolFilePDB::ResolveFunction(const llvm::pdb::PDBSymbolFunc &pdb_func,
bool include_inlines,
lldb_private::SymbolContextList &sc_list) { … }
bool SymbolFilePDB::ResolveFunction(uint32_t uid, bool include_inlines,
lldb_private::SymbolContextList &sc_list) { … }
void SymbolFilePDB::CacheFunctionNames() { … }
void SymbolFilePDB::FindFunctions(
const lldb_private::Module::LookupInfo &lookup_info,
const lldb_private::CompilerDeclContext &parent_decl_ctx,
bool include_inlines,
lldb_private::SymbolContextList &sc_list) { … }
void SymbolFilePDB::FindFunctions(const lldb_private::RegularExpression ®ex,
bool include_inlines,
lldb_private::SymbolContextList &sc_list) { … }
void SymbolFilePDB::GetMangledNamesForFunction(
const std::string &scope_qualified_name,
std::vector<lldb_private::ConstString> &mangled_names) { … }
void SymbolFilePDB::AddSymbols(lldb_private::Symtab &symtab) { … }
void SymbolFilePDB::DumpClangAST(Stream &s) { … }
void SymbolFilePDB::FindTypesByRegex(
const lldb_private::RegularExpression ®ex, uint32_t max_matches,
lldb_private::TypeMap &types) { … }
void SymbolFilePDB::FindTypes(const lldb_private::TypeQuery &query,
lldb_private::TypeResults &type_results) { … }
void SymbolFilePDB::GetTypesForPDBSymbol(const llvm::pdb::PDBSymbol &pdb_symbol,
uint32_t type_mask,
TypeCollection &type_collection) { … }
void SymbolFilePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope,
TypeClass type_mask,
lldb_private::TypeList &type_list) { … }
llvm::Expected<lldb::TypeSystemSP>
SymbolFilePDB::GetTypeSystemForLanguage(lldb::LanguageType language) { … }
PDBASTParser *SymbolFilePDB::GetPDBAstParser() { … }
lldb_private::CompilerDeclContext
SymbolFilePDB::FindNamespace(lldb_private::ConstString name,
const CompilerDeclContext &parent_decl_ctx, bool) { … }
IPDBSession &SymbolFilePDB::GetPDBSession() { … }
const IPDBSession &SymbolFilePDB::GetPDBSession() const { … }
lldb::CompUnitSP SymbolFilePDB::ParseCompileUnitForUID(uint32_t id,
uint32_t index) { … }
bool SymbolFilePDB::ParseCompileUnitLineTable(CompileUnit &comp_unit,
uint32_t match_line) { … }
void SymbolFilePDB::BuildSupportFileIdToSupportFileIndexMap(
const PDBSymbolCompiland &compiland,
llvm::DenseMap<uint32_t, uint32_t> &index_map) const { … }
lldb::CompUnitSP SymbolFilePDB::GetCompileUnitContainsAddress(
const lldb_private::Address &so_addr) { … }
Mangled
SymbolFilePDB::GetMangledForPDBFunc(const llvm::pdb::PDBSymbolFunc &pdb_func) { … }
bool SymbolFilePDB::DeclContextMatchesThisSymbolFile(
const lldb_private::CompilerDeclContext &decl_ctx) { … }
uint32_t SymbolFilePDB::GetCompilandId(const llvm::pdb::PDBSymbolData &data) { … }