[Lldb-commits] [lldb] [lldb] Remove SymbolFilePDB and make the native one the default (PR #113647)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Thu Oct 24 22:10:49 PDT 2024
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/113647
>From 58d1a2900e452348bac00571989496df09fdcb71 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Thu, 24 Oct 2024 20:38:57 -0700
Subject: [PATCH 1/2] [lldb] Remove lldbPluginSymbolFilePDB
Remove lldbPluginSymbolFilePDB in favor of always using
lldbPluginSymbolFileNativePDB and make LLDB_USE_NATIVE_PDB_READER the
default. The non-native (DIA based) PDB library was unmaintained and
known to have issues.
---
lldb/source/Plugins/SymbolFile/CMakeLists.txt | 1 -
.../Plugins/SymbolFile/PDB/CMakeLists.txt | 18 -
.../Plugins/SymbolFile/PDB/PDBASTParser.cpp | 1455 ------------
.../Plugins/SymbolFile/PDB/PDBASTParser.h | 116 -
.../PDB/PDBLocationToDWARFExpression.cpp | 182 --
.../PDB/PDBLocationToDWARFExpression.h | 47 -
.../Plugins/SymbolFile/PDB/SymbolFilePDB.cpp | 2053 -----------------
.../Plugins/SymbolFile/PDB/SymbolFilePDB.h | 252 --
.../Plugins/TypeSystem/Clang/CMakeLists.txt | 2 +-
.../TypeSystem/Clang/TypeSystemClang.cpp | 9 -
.../TypeSystem/Clang/TypeSystemClang.h | 3 -
.../Minidump/Windows/Sigsegv/sigsegv.test | 2 +-
.../Windows/exception_access_violation.cpp | 4 +-
.../Shell/Process/Windows/process_load.cpp | 2 +-
.../NativePDB/ast-functions-msvc.cpp | 2 +-
.../SymbolFile/NativePDB/ast-functions.cpp | 2 +-
.../SymbolFile/NativePDB/ast-methods.cpp | 4 +-
.../Shell/SymbolFile/NativePDB/ast-types.cpp | 2 +-
.../Shell/SymbolFile/NativePDB/bitfields.cpp | 2 +-
lldb/test/Shell/SymbolFile/NativePDB/blocks.s | 2 +-
.../NativePDB/break-by-function.cpp | 2 +-
.../SymbolFile/NativePDB/break-by-line.cpp | 2 +-
.../SymbolFile/NativePDB/class_layout.cpp | 2 +-
.../SymbolFile/NativePDB/disassembly.cpp | 2 +-
.../NativePDB/function-types-builtins.cpp | 2 +-
.../NativePDB/function-types-calling-conv.cpp | 2 +-
.../NativePDB/function-types-classes.cpp | 2 +-
.../SymbolFile/NativePDB/global-classes.cpp | 2 +-
.../SymbolFile/NativePDB/global-ctor-dtor.cpp | 2 +-
.../SymbolFile/NativePDB/globals-bss.cpp | 2 +-
.../NativePDB/globals-fundamental.cpp | 2 +-
lldb/test/Shell/SymbolFile/NativePDB/icf.cpp | 2 +-
.../NativePDB/incomplete-tag-type.cpp | 2 +-
.../SymbolFile/NativePDB/inline_sites.test | 2 +-
.../NativePDB/inline_sites_live.cpp | 2 +-
.../Shell/SymbolFile/NativePDB/load-pdb.cpp | 2 +-
.../NativePDB/local-variables-registers.s | 2 +-
.../SymbolFile/NativePDB/local-variables.cpp | 2 +-
.../Shell/SymbolFile/NativePDB/locate-pdb.cpp | 4 +-
.../NativePDB/lookup-by-address.cpp | 2 +-
.../SymbolFile/NativePDB/lookup-by-types.cpp | 2 +-
.../NativePDB/nested-blocks-same-address.s | 2 +-
.../SymbolFile/NativePDB/nested-types.cpp | 2 +-
.../Shell/SymbolFile/NativePDB/s_constant.cpp | 2 +-
.../SymbolFile/NativePDB/source-list.cpp | 2 +-
.../NativePDB/stack_unwinding01.cpp | 2 +-
.../Shell/SymbolFile/NativePDB/tag-types.cpp | 2 +-
.../Shell/SymbolFile/NativePDB/typedefs.cpp | 2 +-
.../Shell/SymbolFile/PDB/ast-restore.test | 6 +-
.../test/Shell/SymbolFile/PDB/compilands.test | 3 +-
.../PDB/function-level-linking.test | 3 +-
.../SymbolFile/PDB/variables-locations.test | 3 +-
lldb/unittests/SymbolFile/CMakeLists.txt | 3 -
.../unittests/SymbolFile/DWARF/CMakeLists.txt | 1 -
.../SymbolFile/DWARF/SymbolFileDWARFTests.cpp | 5 +-
lldb/unittests/SymbolFile/PDB/CMakeLists.txt | 25 -
.../SymbolFile/PDB/Inputs/test-pdb-alt.cpp | 7 -
.../SymbolFile/PDB/Inputs/test-pdb-nested.h | 6 -
.../SymbolFile/PDB/Inputs/test-pdb-types.cpp | 77 -
.../SymbolFile/PDB/Inputs/test-pdb-types.exe | Bin 8192 -> 0 bytes
.../SymbolFile/PDB/Inputs/test-pdb-types.pdb | Bin 102400 -> 0 bytes
.../SymbolFile/PDB/Inputs/test-pdb.cpp | 9 -
.../SymbolFile/PDB/Inputs/test-pdb.exe | Bin 7168 -> 0 bytes
.../SymbolFile/PDB/Inputs/test-pdb.h | 10 -
.../SymbolFile/PDB/Inputs/test-pdb.pdb | Bin 110592 -> 0 bytes
.../SymbolFile/PDB/SymbolFilePDBTests.cpp | 628 -----
66 files changed, 47 insertions(+), 4957 deletions(-)
delete mode 100644 lldb/source/Plugins/SymbolFile/PDB/CMakeLists.txt
delete mode 100644 lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
delete mode 100644 lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h
delete mode 100644 lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
delete mode 100644 lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
delete mode 100644 lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
delete mode 100644 lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
delete mode 100644 lldb/unittests/SymbolFile/PDB/CMakeLists.txt
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-alt.cpp
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-nested.h
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.exe
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.pdb
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.cpp
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.exe
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.h
delete mode 100644 lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.pdb
delete mode 100644 lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
diff --git a/lldb/source/Plugins/SymbolFile/CMakeLists.txt b/lldb/source/Plugins/SymbolFile/CMakeLists.txt
index 106387b45ec1a9..6b0a3901cc4b9e 100644
--- a/lldb/source/Plugins/SymbolFile/CMakeLists.txt
+++ b/lldb/source/Plugins/SymbolFile/CMakeLists.txt
@@ -3,5 +3,4 @@ add_subdirectory(CTF)
add_subdirectory(DWARF)
add_subdirectory(JSON)
add_subdirectory(NativePDB)
-add_subdirectory(PDB)
add_subdirectory(Symtab)
diff --git a/lldb/source/Plugins/SymbolFile/PDB/CMakeLists.txt b/lldb/source/Plugins/SymbolFile/PDB/CMakeLists.txt
deleted file mode 100644
index ceeb173a99e1d6..00000000000000
--- a/lldb/source/Plugins/SymbolFile/PDB/CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-add_lldb_library(lldbPluginSymbolFilePDB PLUGIN
- PDBASTParser.cpp
- PDBLocationToDWARFExpression.cpp
- SymbolFilePDB.cpp
-
- LINK_LIBS
- lldbCore
- lldbPluginSymbolFileNativePDB
- lldbSymbol
- lldbUtility
- lldbPluginTypeSystemClang
- CLANG_LIBS
- clangAST
- clangLex
- LINK_COMPONENTS
- DebugInfoPDB
- Support
- )
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
deleted file mode 100644
index fa3530a0c22ff3..00000000000000
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ /dev/null
@@ -1,1455 +0,0 @@
-//===-- PDBASTParser.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 "PDBASTParser.h"
-
-#include "SymbolFilePDB.h"
-
-#include "clang/AST/CharUnits.h"
-#include "clang/AST/Decl.h"
-#include "clang/AST/DeclCXX.h"
-
-#include "Plugins/ExpressionParser/Clang/ClangASTMetadata.h"
-#include "Plugins/ExpressionParser/Clang/ClangUtil.h"
-#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
-#include "lldb/Core/Declaration.h"
-#include "lldb/Core/Module.h"
-#include "lldb/Symbol/SymbolFile.h"
-#include "lldb/Symbol/TypeMap.h"
-#include "lldb/Symbol/TypeSystem.h"
-#include "lldb/Utility/LLDBLog.h"
-#include "llvm/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
-#include "llvm/DebugInfo/PDB/IPDBLineNumber.h"
-#include "llvm/DebugInfo/PDB/IPDBSourceFile.h"
-#include "llvm/DebugInfo/PDB/PDBSymbol.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolFunc.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeArray.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBaseClass.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeBuiltin.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeEnum.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionArg.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeFunctionSig.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypePointer.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeTypedef.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolTypeUDT.h"
-
-#include "Plugins/Language/CPlusPlus/MSVCUndecoratedNameParser.h"
-#include <optional>
-
-using namespace lldb;
-using namespace lldb_private;
-using namespace llvm::pdb;
-
-static int TranslateUdtKind(PDB_UdtType pdb_kind) {
- switch (pdb_kind) {
- case PDB_UdtType::Class:
- return llvm::to_underlying(clang::TagTypeKind::Class);
- case PDB_UdtType::Struct:
- return llvm::to_underlying(clang::TagTypeKind::Struct);
- case PDB_UdtType::Union:
- return llvm::to_underlying(clang::TagTypeKind::Union);
- case PDB_UdtType::Interface:
- return llvm::to_underlying(clang::TagTypeKind::Interface);
- }
- llvm_unreachable("unsuported PDB UDT type");
-}
-
-static lldb::Encoding TranslateBuiltinEncoding(PDB_BuiltinType type) {
- switch (type) {
- case PDB_BuiltinType::Float:
- return lldb::eEncodingIEEE754;
- case PDB_BuiltinType::Int:
- case PDB_BuiltinType::Long:
- case PDB_BuiltinType::Char:
- return lldb::eEncodingSint;
- case PDB_BuiltinType::Bool:
- case PDB_BuiltinType::Char16:
- case PDB_BuiltinType::Char32:
- case PDB_BuiltinType::UInt:
- case PDB_BuiltinType::ULong:
- case PDB_BuiltinType::HResult:
- case PDB_BuiltinType::WCharT:
- return lldb::eEncodingUint;
- default:
- return lldb::eEncodingInvalid;
- }
-}
-
-static lldb::Encoding TranslateEnumEncoding(PDB_VariantType type) {
- switch (type) {
- case PDB_VariantType::Int8:
- case PDB_VariantType::Int16:
- case PDB_VariantType::Int32:
- case PDB_VariantType::Int64:
- return lldb::eEncodingSint;
-
- case PDB_VariantType::UInt8:
- case PDB_VariantType::UInt16:
- case PDB_VariantType::UInt32:
- case PDB_VariantType::UInt64:
- return lldb::eEncodingUint;
-
- default:
- break;
- }
-
- return lldb::eEncodingSint;
-}
-
-static CompilerType
-GetBuiltinTypeForPDBEncodingAndBitSize(TypeSystemClang &clang_ast,
- const PDBSymbolTypeBuiltin &pdb_type,
- Encoding encoding, uint32_t width) {
- clang::ASTContext &ast = clang_ast.getASTContext();
-
- switch (pdb_type.getBuiltinType()) {
- default:
- break;
- case PDB_BuiltinType::None:
- return CompilerType();
- case PDB_BuiltinType::Void:
- return clang_ast.GetBasicType(eBasicTypeVoid);
- case PDB_BuiltinType::Char:
- return clang_ast.GetBasicType(eBasicTypeChar);
- case PDB_BuiltinType::Bool:
- return clang_ast.GetBasicType(eBasicTypeBool);
- case PDB_BuiltinType::Long:
- if (width == ast.getTypeSize(ast.LongTy))
- return CompilerType(clang_ast.weak_from_this(),
- ast.LongTy.getAsOpaquePtr());
- if (width == ast.getTypeSize(ast.LongLongTy))
- return CompilerType(clang_ast.weak_from_this(),
- ast.LongLongTy.getAsOpaquePtr());
- break;
- case PDB_BuiltinType::ULong:
- if (width == ast.getTypeSize(ast.UnsignedLongTy))
- return CompilerType(clang_ast.weak_from_this(),
- ast.UnsignedLongTy.getAsOpaquePtr());
- if (width == ast.getTypeSize(ast.UnsignedLongLongTy))
- return CompilerType(clang_ast.weak_from_this(),
- ast.UnsignedLongLongTy.getAsOpaquePtr());
- break;
- case PDB_BuiltinType::WCharT:
- if (width == ast.getTypeSize(ast.WCharTy))
- return CompilerType(clang_ast.weak_from_this(),
- ast.WCharTy.getAsOpaquePtr());
- break;
- case PDB_BuiltinType::Char16:
- return CompilerType(clang_ast.weak_from_this(),
- ast.Char16Ty.getAsOpaquePtr());
- case PDB_BuiltinType::Char32:
- return CompilerType(clang_ast.weak_from_this(),
- ast.Char32Ty.getAsOpaquePtr());
- case PDB_BuiltinType::Float:
- // Note: types `long double` and `double` have same bit size in MSVC and
- // there is no information in the PDB to distinguish them. So when falling
- // back to default search, the compiler type of `long double` will be
- // represented by the one generated for `double`.
- break;
- }
- // If there is no match on PDB_BuiltinType, fall back to default search by
- // encoding and width only
- return clang_ast.GetBuiltinTypeForEncodingAndBitSize(encoding, width);
-}
-
-static ConstString GetPDBBuiltinTypeName(const PDBSymbolTypeBuiltin &pdb_type,
- CompilerType &compiler_type) {
- PDB_BuiltinType kind = pdb_type.getBuiltinType();
- switch (kind) {
- default:
- break;
- case PDB_BuiltinType::Currency:
- return ConstString("CURRENCY");
- case PDB_BuiltinType::Date:
- return ConstString("DATE");
- case PDB_BuiltinType::Variant:
- return ConstString("VARIANT");
- case PDB_BuiltinType::Complex:
- return ConstString("complex");
- case PDB_BuiltinType::Bitfield:
- return ConstString("bitfield");
- case PDB_BuiltinType::BSTR:
- return ConstString("BSTR");
- case PDB_BuiltinType::HResult:
- return ConstString("HRESULT");
- case PDB_BuiltinType::BCD:
- return ConstString("BCD");
- case PDB_BuiltinType::Char16:
- return ConstString("char16_t");
- case PDB_BuiltinType::Char32:
- return ConstString("char32_t");
- case PDB_BuiltinType::None:
- return ConstString("...");
- }
- return compiler_type.GetTypeName();
-}
-
-static bool AddSourceInfoToDecl(const PDBSymbol &symbol, Declaration &decl) {
- auto &raw_sym = symbol.getRawSymbol();
- auto first_line_up = raw_sym.getSrcLineOnTypeDefn();
-
- if (!first_line_up) {
- auto lines_up = symbol.getSession().findLineNumbersByAddress(
- raw_sym.getVirtualAddress(), raw_sym.getLength());
- if (!lines_up)
- return false;
- first_line_up = lines_up->getNext();
- if (!first_line_up)
- return false;
- }
- uint32_t src_file_id = first_line_up->getSourceFileId();
- auto src_file_up = symbol.getSession().getSourceFileById(src_file_id);
- if (!src_file_up)
- return false;
-
- FileSpec spec(src_file_up->getFileName());
- decl.SetFile(spec);
- decl.SetColumn(first_line_up->getColumnNumber());
- decl.SetLine(first_line_up->getLineNumber());
- return true;
-}
-
-static AccessType TranslateMemberAccess(PDB_MemberAccess access) {
- switch (access) {
- case PDB_MemberAccess::Private:
- return eAccessPrivate;
- case PDB_MemberAccess::Protected:
- return eAccessProtected;
- case PDB_MemberAccess::Public:
- return eAccessPublic;
- }
- return eAccessNone;
-}
-
-static AccessType GetDefaultAccessibilityForUdtKind(PDB_UdtType udt_kind) {
- switch (udt_kind) {
- case PDB_UdtType::Struct:
- case PDB_UdtType::Union:
- return eAccessPublic;
- case PDB_UdtType::Class:
- case PDB_UdtType::Interface:
- return eAccessPrivate;
- }
- llvm_unreachable("unsupported PDB UDT type");
-}
-
-static AccessType GetAccessibilityForUdt(const PDBSymbolTypeUDT &udt) {
- AccessType access = TranslateMemberAccess(udt.getAccess());
- if (access != lldb::eAccessNone || !udt.isNested())
- return access;
-
- auto parent = udt.getClassParent();
- if (!parent)
- return lldb::eAccessNone;
-
- auto parent_udt = llvm::dyn_cast<PDBSymbolTypeUDT>(parent.get());
- if (!parent_udt)
- return lldb::eAccessNone;
-
- return GetDefaultAccessibilityForUdtKind(parent_udt->getUdtKind());
-}
-
-static clang::MSInheritanceAttr::Spelling
-GetMSInheritance(const PDBSymbolTypeUDT &udt) {
- int base_count = 0;
- bool has_virtual = false;
-
- auto bases_enum = udt.findAllChildren<PDBSymbolTypeBaseClass>();
- if (bases_enum) {
- while (auto base = bases_enum->getNext()) {
- base_count++;
- has_virtual |= base->isVirtualBaseClass();
- }
- }
-
- if (has_virtual)
- return clang::MSInheritanceAttr::Keyword_virtual_inheritance;
- if (base_count > 1)
- return clang::MSInheritanceAttr::Keyword_multiple_inheritance;
- return clang::MSInheritanceAttr::Keyword_single_inheritance;
-}
-
-static std::unique_ptr<llvm::pdb::PDBSymbol>
-GetClassOrFunctionParent(const llvm::pdb::PDBSymbol &symbol) {
- const IPDBSession &session = symbol.getSession();
- const IPDBRawSymbol &raw = symbol.getRawSymbol();
- auto tag = symbol.getSymTag();
-
- // For items that are nested inside of a class, return the class that it is
- // nested inside of.
- // Note that only certain items can be nested inside of classes.
- switch (tag) {
- case PDB_SymType::Function:
- case PDB_SymType::Data:
- case PDB_SymType::UDT:
- case PDB_SymType::Enum:
- case PDB_SymType::FunctionSig:
- case PDB_SymType::Typedef:
- case PDB_SymType::BaseClass:
- case PDB_SymType::VTable: {
- auto class_parent_id = raw.getClassParentId();
- if (auto class_parent = session.getSymbolById(class_parent_id))
- return class_parent;
- break;
- }
- default:
- break;
- }
-
- // Otherwise, if it is nested inside of a function, return the function.
- // Note that only certain items can be nested inside of functions.
- switch (tag) {
- case PDB_SymType::Block:
- case PDB_SymType::Data: {
- auto lexical_parent_id = raw.getLexicalParentId();
- auto lexical_parent = session.getSymbolById(lexical_parent_id);
- if (!lexical_parent)
- return nullptr;
-
- auto lexical_parent_tag = lexical_parent->getSymTag();
- if (lexical_parent_tag == PDB_SymType::Function)
- return lexical_parent;
- if (lexical_parent_tag == PDB_SymType::Exe)
- return nullptr;
-
- return GetClassOrFunctionParent(*lexical_parent);
- }
- default:
- return nullptr;
- }
-}
-
-static clang::NamedDecl *
-GetDeclFromContextByName(const clang::ASTContext &ast,
- const clang::DeclContext &decl_context,
- llvm::StringRef name) {
- clang::IdentifierInfo &ident = ast.Idents.get(name);
- clang::DeclarationName decl_name = ast.DeclarationNames.getIdentifier(&ident);
- clang::DeclContext::lookup_result result = decl_context.lookup(decl_name);
- if (result.empty())
- return nullptr;
-
- return *result.begin();
-}
-
-static bool IsAnonymousNamespaceName(llvm::StringRef name) {
- return name == "`anonymous namespace'" || name == "`anonymous-namespace'";
-}
-
-static clang::CallingConv TranslateCallingConvention(PDB_CallingConv pdb_cc) {
- switch (pdb_cc) {
- case llvm::codeview::CallingConvention::NearC:
- return clang::CC_C;
- case llvm::codeview::CallingConvention::NearStdCall:
- return clang::CC_X86StdCall;
- case llvm::codeview::CallingConvention::NearFast:
- return clang::CC_X86FastCall;
- case llvm::codeview::CallingConvention::ThisCall:
- return clang::CC_X86ThisCall;
- case llvm::codeview::CallingConvention::NearVector:
- return clang::CC_X86VectorCall;
- case llvm::codeview::CallingConvention::NearPascal:
- return clang::CC_X86Pascal;
- default:
- assert(false && "Unknown calling convention");
- return clang::CC_C;
- }
-}
-
-PDBASTParser::PDBASTParser(lldb_private::TypeSystemClang &ast) : m_ast(ast) {}
-
-PDBASTParser::~PDBASTParser() = default;
-
-// DebugInfoASTParser interface
-
-lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
- Declaration decl;
- switch (type.getSymTag()) {
- case PDB_SymType::BaseClass: {
- auto symbol_file = m_ast.GetSymbolFile();
- if (!symbol_file)
- return nullptr;
-
- auto ty = symbol_file->ResolveTypeUID(type.getRawSymbol().getTypeId());
- return ty ? ty->shared_from_this() : nullptr;
- } break;
- case PDB_SymType::UDT: {
- auto udt = llvm::dyn_cast<PDBSymbolTypeUDT>(&type);
- assert(udt);
-
- // Note that, unnamed UDT being typedef-ed is generated as a UDT symbol
- // other than a Typedef symbol in PDB. For example,
- // typedef union { short Row; short Col; } Union;
- // is generated as a named UDT in PDB:
- // union Union { short Row; short Col; }
- // Such symbols will be handled here.
-
- // Some UDT with trival ctor has zero length. Just ignore.
- if (udt->getLength() == 0)
- return nullptr;
-
- // Ignore unnamed-tag UDTs.
- std::string name =
- std::string(MSVCUndecoratedNameParser::DropScope(udt->getName()));
- if (name.empty())
- return nullptr;
-
- auto decl_context = GetDeclContextContainingSymbol(type);
-
- // Check if such an UDT already exists in the current context.
- // This may occur with const or volatile types. There are separate type
- // symbols in PDB for types with const or volatile modifiers, but we need
- // to create only one declaration for them all.
- Type::ResolveState type_resolve_state;
- CompilerType clang_type =
- m_ast.GetTypeForIdentifier<clang::CXXRecordDecl>(name, decl_context);
- if (!clang_type.IsValid()) {
- auto access = GetAccessibilityForUdt(*udt);
-
- auto tag_type_kind = TranslateUdtKind(udt->getUdtKind());
-
- ClangASTMetadata metadata;
- metadata.SetUserID(type.getSymIndexId());
- metadata.SetIsDynamicCXXType(false);
-
- clang_type = m_ast.CreateRecordType(
- decl_context, OptionalClangModuleID(), access, name, tag_type_kind,
- lldb::eLanguageTypeC_plus_plus, metadata);
- assert(clang_type.IsValid());
-
- auto record_decl =
- m_ast.GetAsCXXRecordDecl(clang_type.GetOpaqueQualType());
- assert(record_decl);
- m_uid_to_decl[type.getSymIndexId()] = record_decl;
-
- auto inheritance_attr = clang::MSInheritanceAttr::CreateImplicit(
- m_ast.getASTContext(), GetMSInheritance(*udt));
- record_decl->addAttr(inheritance_attr);
-
- TypeSystemClang::StartTagDeclarationDefinition(clang_type);
-
- auto children = udt->findAllChildren();
- if (!children || children->getChildCount() == 0) {
- // PDB does not have symbol of forwarder. We assume we get an udt w/o
- // any fields. Just complete it at this point.
- TypeSystemClang::CompleteTagDeclarationDefinition(clang_type);
-
- TypeSystemClang::SetHasExternalStorage(clang_type.GetOpaqueQualType(),
- false);
-
- type_resolve_state = Type::ResolveState::Full;
- } else {
- // Add the type to the forward declarations. It will help us to avoid
- // an endless recursion in CompleteTypeFromUdt function.
- m_forward_decl_to_uid[record_decl] = type.getSymIndexId();
-
- TypeSystemClang::SetHasExternalStorage(clang_type.GetOpaqueQualType(),
- true);
-
- type_resolve_state = Type::ResolveState::Forward;
- }
- } else
- type_resolve_state = Type::ResolveState::Forward;
-
- if (udt->isConstType())
- clang_type = clang_type.AddConstModifier();
-
- if (udt->isVolatileType())
- clang_type = clang_type.AddVolatileModifier();
-
- AddSourceInfoToDecl(type, decl);
- return m_ast.GetSymbolFile()->MakeType(
- type.getSymIndexId(), ConstString(name), udt->getLength(), nullptr,
- LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl, clang_type,
- type_resolve_state);
- } break;
- case PDB_SymType::Enum: {
- auto enum_type = llvm::dyn_cast<PDBSymbolTypeEnum>(&type);
- assert(enum_type);
-
- std::string name =
- std::string(MSVCUndecoratedNameParser::DropScope(enum_type->getName()));
- auto decl_context = GetDeclContextContainingSymbol(type);
- uint64_t bytes = enum_type->getLength();
-
- // Check if such an enum already exists in the current context
- CompilerType ast_enum =
- m_ast.GetTypeForIdentifier<clang::EnumDecl>(name, decl_context);
- if (!ast_enum.IsValid()) {
- auto underlying_type_up = enum_type->getUnderlyingType();
- if (!underlying_type_up)
- return nullptr;
-
- lldb::Encoding encoding =
- TranslateBuiltinEncoding(underlying_type_up->getBuiltinType());
- // FIXME: Type of underlying builtin is always `Int`. We correct it with
- // the very first enumerator's encoding if any.
- auto first_child = enum_type->findOneChild<PDBSymbolData>();
- if (first_child)
- encoding = TranslateEnumEncoding(first_child->getValue().Type);
-
- CompilerType builtin_type;
- if (bytes > 0)
- builtin_type = GetBuiltinTypeForPDBEncodingAndBitSize(
- m_ast, *underlying_type_up, encoding, bytes * 8);
- else
- builtin_type = m_ast.GetBasicType(eBasicTypeInt);
-
- // FIXME: PDB does not have information about scoped enumeration (Enum
- // Class). Set it false for now.
- bool isScoped = false;
-
- ast_enum = m_ast.CreateEnumerationType(name, decl_context,
- OptionalClangModuleID(), decl,
- builtin_type, isScoped);
-
- auto enum_decl = TypeSystemClang::GetAsEnumDecl(ast_enum);
- assert(enum_decl);
- m_uid_to_decl[type.getSymIndexId()] = enum_decl;
-
- auto enum_values = enum_type->findAllChildren<PDBSymbolData>();
- if (enum_values) {
- while (auto enum_value = enum_values->getNext()) {
- if (enum_value->getDataKind() != PDB_DataKind::Constant)
- continue;
- AddEnumValue(ast_enum, *enum_value);
- }
- }
-
- if (TypeSystemClang::StartTagDeclarationDefinition(ast_enum))
- TypeSystemClang::CompleteTagDeclarationDefinition(ast_enum);
- }
-
- if (enum_type->isConstType())
- ast_enum = ast_enum.AddConstModifier();
-
- if (enum_type->isVolatileType())
- ast_enum = ast_enum.AddVolatileModifier();
-
- AddSourceInfoToDecl(type, decl);
- return m_ast.GetSymbolFile()->MakeType(
- type.getSymIndexId(), ConstString(name), bytes, nullptr,
- LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl, ast_enum,
- lldb_private::Type::ResolveState::Full);
- } break;
- case PDB_SymType::Typedef: {
- auto type_def = llvm::dyn_cast<PDBSymbolTypeTypedef>(&type);
- assert(type_def);
-
- SymbolFile *symbol_file = m_ast.GetSymbolFile();
- if (!symbol_file)
- return nullptr;
-
- lldb_private::Type *target_type =
- symbol_file->ResolveTypeUID(type_def->getTypeId());
- if (!target_type)
- return nullptr;
-
- std::string name =
- std::string(MSVCUndecoratedNameParser::DropScope(type_def->getName()));
- auto decl_ctx = GetDeclContextContainingSymbol(type);
-
- // Check if such a typedef already exists in the current context
- CompilerType ast_typedef =
- m_ast.GetTypeForIdentifier<clang::TypedefNameDecl>(name, decl_ctx);
- if (!ast_typedef.IsValid()) {
- CompilerType target_ast_type = target_type->GetFullCompilerType();
-
- ast_typedef = target_ast_type.CreateTypedef(
- name.c_str(), m_ast.CreateDeclContext(decl_ctx), 0);
- if (!ast_typedef)
- return nullptr;
-
- auto typedef_decl = TypeSystemClang::GetAsTypedefDecl(ast_typedef);
- assert(typedef_decl);
- m_uid_to_decl[type.getSymIndexId()] = typedef_decl;
- }
-
- if (type_def->isConstType())
- ast_typedef = ast_typedef.AddConstModifier();
-
- if (type_def->isVolatileType())
- ast_typedef = ast_typedef.AddVolatileModifier();
-
- AddSourceInfoToDecl(type, decl);
- std::optional<uint64_t> size;
- if (type_def->getLength())
- size = type_def->getLength();
- return m_ast.GetSymbolFile()->MakeType(
- type_def->getSymIndexId(), ConstString(name), size, nullptr,
- target_type->GetID(), lldb_private::Type::eEncodingIsTypedefUID, decl,
- ast_typedef, lldb_private::Type::ResolveState::Full);
- } break;
- case PDB_SymType::Function:
- case PDB_SymType::FunctionSig: {
- std::string name;
- PDBSymbolTypeFunctionSig *func_sig = nullptr;
- if (auto pdb_func = llvm::dyn_cast<PDBSymbolFunc>(&type)) {
- if (pdb_func->isCompilerGenerated())
- return nullptr;
-
- auto sig = pdb_func->getSignature();
- if (!sig)
- return nullptr;
- func_sig = sig.release();
- // Function type is named.
- name = std::string(
- MSVCUndecoratedNameParser::DropScope(pdb_func->getName()));
- } else if (auto pdb_func_sig =
- llvm::dyn_cast<PDBSymbolTypeFunctionSig>(&type)) {
- func_sig = const_cast<PDBSymbolTypeFunctionSig *>(pdb_func_sig);
- } else
- llvm_unreachable("Unexpected PDB symbol!");
-
- auto arg_enum = func_sig->getArguments();
- uint32_t num_args = arg_enum->getChildCount();
- std::vector<CompilerType> arg_list;
-
- bool is_variadic = func_sig->isCVarArgs();
- // Drop last variadic argument.
- if (is_variadic)
- --num_args;
- for (uint32_t arg_idx = 0; arg_idx < num_args; arg_idx++) {
- auto arg = arg_enum->getChildAtIndex(arg_idx);
- if (!arg)
- break;
-
- SymbolFile *symbol_file = m_ast.GetSymbolFile();
- if (!symbol_file)
- return nullptr;
-
- lldb_private::Type *arg_type =
- symbol_file->ResolveTypeUID(arg->getSymIndexId());
- // If there's some error looking up one of the dependent types of this
- // function signature, bail.
- if (!arg_type)
- return nullptr;
- CompilerType arg_ast_type = arg_type->GetFullCompilerType();
- arg_list.push_back(arg_ast_type);
- }
- lldbassert(arg_list.size() <= num_args);
-
- auto pdb_return_type = func_sig->getReturnType();
- SymbolFile *symbol_file = m_ast.GetSymbolFile();
- if (!symbol_file)
- return nullptr;
-
- lldb_private::Type *return_type =
- symbol_file->ResolveTypeUID(pdb_return_type->getSymIndexId());
- // If there's some error looking up one of the dependent types of this
- // function signature, bail.
- if (!return_type)
- return nullptr;
- CompilerType return_ast_type = return_type->GetFullCompilerType();
- uint32_t type_quals = 0;
- if (func_sig->isConstType())
- type_quals |= clang::Qualifiers::Const;
- if (func_sig->isVolatileType())
- type_quals |= clang::Qualifiers::Volatile;
- auto cc = TranslateCallingConvention(func_sig->getCallingConvention());
- CompilerType func_sig_ast_type =
- m_ast.CreateFunctionType(return_ast_type, arg_list.data(),
- arg_list.size(), is_variadic, type_quals, cc);
-
- AddSourceInfoToDecl(type, decl);
- return m_ast.GetSymbolFile()->MakeType(
- type.getSymIndexId(), ConstString(name), std::nullopt, nullptr,
- LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
- func_sig_ast_type, lldb_private::Type::ResolveState::Full);
- } break;
- case PDB_SymType::ArrayType: {
- auto array_type = llvm::dyn_cast<PDBSymbolTypeArray>(&type);
- assert(array_type);
- uint32_t num_elements = array_type->getCount();
- uint32_t element_uid = array_type->getElementTypeId();
- std::optional<uint64_t> bytes;
- if (uint64_t size = array_type->getLength())
- bytes = size;
-
- SymbolFile *symbol_file = m_ast.GetSymbolFile();
- if (!symbol_file)
- return nullptr;
-
- // If array rank > 0, PDB gives the element type at N=0. So element type
- // will parsed in the order N=0, N=1,..., N=rank sequentially.
- lldb_private::Type *element_type = symbol_file->ResolveTypeUID(element_uid);
- if (!element_type)
- return nullptr;
-
- CompilerType element_ast_type = element_type->GetForwardCompilerType();
- // If element type is UDT, it needs to be complete.
- if (TypeSystemClang::IsCXXClassType(element_ast_type) &&
- !element_ast_type.GetCompleteType()) {
- if (TypeSystemClang::StartTagDeclarationDefinition(element_ast_type)) {
- TypeSystemClang::CompleteTagDeclarationDefinition(element_ast_type);
- } else {
- // We are not able to start definition.
- return nullptr;
- }
- }
- CompilerType array_ast_type = m_ast.CreateArrayType(
- element_ast_type, num_elements, /*is_gnu_vector*/ false);
- TypeSP type_sp = m_ast.GetSymbolFile()->MakeType(
- array_type->getSymIndexId(), ConstString(), bytes, nullptr,
- LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
- array_ast_type, lldb_private::Type::ResolveState::Full);
- type_sp->SetEncodingType(element_type);
- return type_sp;
- } break;
- case PDB_SymType::BuiltinType: {
- auto *builtin_type = llvm::dyn_cast<PDBSymbolTypeBuiltin>(&type);
- assert(builtin_type);
- PDB_BuiltinType builtin_kind = builtin_type->getBuiltinType();
- if (builtin_kind == PDB_BuiltinType::None)
- return nullptr;
-
- std::optional<uint64_t> bytes;
- if (uint64_t size = builtin_type->getLength())
- bytes = size;
- Encoding encoding = TranslateBuiltinEncoding(builtin_kind);
- CompilerType builtin_ast_type = GetBuiltinTypeForPDBEncodingAndBitSize(
- m_ast, *builtin_type, encoding, bytes.value_or(0) * 8);
-
- if (builtin_type->isConstType())
- builtin_ast_type = builtin_ast_type.AddConstModifier();
-
- if (builtin_type->isVolatileType())
- builtin_ast_type = builtin_ast_type.AddVolatileModifier();
-
- auto type_name = GetPDBBuiltinTypeName(*builtin_type, builtin_ast_type);
-
- return m_ast.GetSymbolFile()->MakeType(
- builtin_type->getSymIndexId(), type_name, bytes, nullptr,
- LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
- builtin_ast_type, lldb_private::Type::ResolveState::Full);
- } break;
- case PDB_SymType::PointerType: {
- auto *pointer_type = llvm::dyn_cast<PDBSymbolTypePointer>(&type);
- assert(pointer_type);
-
- SymbolFile *symbol_file = m_ast.GetSymbolFile();
- if (!symbol_file)
- return nullptr;
-
- Type *pointee_type = symbol_file->ResolveTypeUID(
- pointer_type->getPointeeType()->getSymIndexId());
- if (!pointee_type)
- return nullptr;
-
- if (pointer_type->isPointerToDataMember() ||
- pointer_type->isPointerToMemberFunction()) {
- auto class_parent_uid = pointer_type->getRawSymbol().getClassParentId();
- auto class_parent_type = symbol_file->ResolveTypeUID(class_parent_uid);
- assert(class_parent_type);
-
- CompilerType pointer_ast_type;
- pointer_ast_type = TypeSystemClang::CreateMemberPointerType(
- class_parent_type->GetLayoutCompilerType(),
- pointee_type->GetForwardCompilerType());
- assert(pointer_ast_type);
-
- return m_ast.GetSymbolFile()->MakeType(
- pointer_type->getSymIndexId(), ConstString(),
- pointer_type->getLength(), nullptr, LLDB_INVALID_UID,
- lldb_private::Type::eEncodingIsUID, decl, pointer_ast_type,
- lldb_private::Type::ResolveState::Forward);
- }
-
- CompilerType pointer_ast_type;
- pointer_ast_type = pointee_type->GetFullCompilerType();
- if (pointer_type->isReference())
- pointer_ast_type = pointer_ast_type.GetLValueReferenceType();
- else if (pointer_type->isRValueReference())
- pointer_ast_type = pointer_ast_type.GetRValueReferenceType();
- else
- pointer_ast_type = pointer_ast_type.GetPointerType();
-
- if (pointer_type->isConstType())
- pointer_ast_type = pointer_ast_type.AddConstModifier();
-
- if (pointer_type->isVolatileType())
- pointer_ast_type = pointer_ast_type.AddVolatileModifier();
-
- if (pointer_type->isRestrictedType())
- pointer_ast_type = pointer_ast_type.AddRestrictModifier();
-
- return m_ast.GetSymbolFile()->MakeType(
- pointer_type->getSymIndexId(), ConstString(), pointer_type->getLength(),
- nullptr, LLDB_INVALID_UID, lldb_private::Type::eEncodingIsUID, decl,
- pointer_ast_type, lldb_private::Type::ResolveState::Full);
- } break;
- default:
- break;
- }
- return nullptr;
-}
-
-bool PDBASTParser::CompleteTypeFromPDB(
- lldb_private::CompilerType &compiler_type) {
- if (GetClangASTImporter().CanImport(compiler_type))
- return GetClangASTImporter().CompleteType(compiler_type);
-
- // Remove the type from the forward declarations to avoid
- // an endless recursion for types like a linked list.
- clang::CXXRecordDecl *record_decl =
- m_ast.GetAsCXXRecordDecl(compiler_type.GetOpaqueQualType());
- auto uid_it = m_forward_decl_to_uid.find(record_decl);
- if (uid_it == m_forward_decl_to_uid.end())
- return true;
-
- auto symbol_file = static_cast<SymbolFilePDB *>(
- m_ast.GetSymbolFile()->GetBackingSymbolFile());
- if (!symbol_file)
- return false;
-
- std::unique_ptr<PDBSymbol> symbol =
- symbol_file->GetPDBSession().getSymbolById(uid_it->getSecond());
- if (!symbol)
- return false;
-
- m_forward_decl_to_uid.erase(uid_it);
-
- TypeSystemClang::SetHasExternalStorage(compiler_type.GetOpaqueQualType(),
- false);
-
- switch (symbol->getSymTag()) {
- case PDB_SymType::UDT: {
- auto udt = llvm::dyn_cast<PDBSymbolTypeUDT>(symbol.get());
- if (!udt)
- return false;
-
- return CompleteTypeFromUDT(*symbol_file, compiler_type, *udt);
- }
- default:
- llvm_unreachable("not a forward clang type decl!");
- }
-}
-
-clang::Decl *
-PDBASTParser::GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) {
- uint32_t sym_id = symbol.getSymIndexId();
- auto it = m_uid_to_decl.find(sym_id);
- if (it != m_uid_to_decl.end())
- return it->second;
-
- auto symbol_file = static_cast<SymbolFilePDB *>(
- m_ast.GetSymbolFile()->GetBackingSymbolFile());
- if (!symbol_file)
- return nullptr;
-
- // First of all, check if the symbol is a member of a class. Resolve the full
- // class type and return the declaration from the cache if so.
- auto tag = symbol.getSymTag();
- if (tag == PDB_SymType::Data || tag == PDB_SymType::Function) {
- const IPDBSession &session = symbol.getSession();
- const IPDBRawSymbol &raw = symbol.getRawSymbol();
-
- auto class_parent_id = raw.getClassParentId();
- if (std::unique_ptr<PDBSymbol> class_parent =
- session.getSymbolById(class_parent_id)) {
- auto class_parent_type = symbol_file->ResolveTypeUID(class_parent_id);
- if (!class_parent_type)
- return nullptr;
-
- CompilerType class_parent_ct = class_parent_type->GetFullCompilerType();
-
- // Look a declaration up in the cache after completing the class
- clang::Decl *decl = m_uid_to_decl.lookup(sym_id);
- if (decl)
- return decl;
-
- // A declaration was not found in the cache. It means that the symbol
- // has the class parent, but the class doesn't have the symbol in its
- // children list.
- if (auto func = llvm::dyn_cast_or_null<PDBSymbolFunc>(&symbol)) {
- // Try to find a class child method with the same RVA and use its
- // declaration if found.
- if (uint32_t rva = func->getRelativeVirtualAddress()) {
- if (std::unique_ptr<ConcreteSymbolEnumerator<PDBSymbolFunc>>
- methods_enum =
- class_parent->findAllChildren<PDBSymbolFunc>()) {
- while (std::unique_ptr<PDBSymbolFunc> method =
- methods_enum->getNext()) {
- if (method->getRelativeVirtualAddress() == rva) {
- decl = m_uid_to_decl.lookup(method->getSymIndexId());
- if (decl)
- break;
- }
- }
- }
- }
-
- // If no class methods with the same RVA were found, then create a new
- // method. It is possible for template methods.
- if (!decl)
- decl = AddRecordMethod(*symbol_file, class_parent_ct, *func);
- }
-
- if (decl)
- m_uid_to_decl[sym_id] = decl;
-
- return decl;
- }
- }
-
- // If we are here, then the symbol is not belonging to a class and is not
- // contained in the cache. So create a declaration for it.
- switch (symbol.getSymTag()) {
- case PDB_SymType::Data: {
- auto data = llvm::dyn_cast<PDBSymbolData>(&symbol);
- assert(data);
-
- auto decl_context = GetDeclContextContainingSymbol(symbol);
- assert(decl_context);
-
- // May be the current context is a class really, but we haven't found
- // any class parent. This happens e.g. in the case of class static
- // variables - they has two symbols, one is a child of the class when
- // another is a child of the exe. So always complete the parent and use
- // an existing declaration if possible.
- if (auto parent_decl = llvm::dyn_cast_or_null<clang::TagDecl>(decl_context))
- m_ast.GetCompleteDecl(parent_decl);
-
- std::string name =
- std::string(MSVCUndecoratedNameParser::DropScope(data->getName()));
-
- // Check if the current context already contains the symbol with the name.
- clang::Decl *decl =
- GetDeclFromContextByName(m_ast.getASTContext(), *decl_context, name);
- if (!decl) {
- auto type = symbol_file->ResolveTypeUID(data->getTypeId());
- if (!type)
- return nullptr;
-
- decl = m_ast.CreateVariableDeclaration(
- decl_context, OptionalClangModuleID(), name.c_str(),
- ClangUtil::GetQualType(type->GetLayoutCompilerType()));
- }
-
- m_uid_to_decl[sym_id] = decl;
-
- return decl;
- }
- case PDB_SymType::Function: {
- auto func = llvm::dyn_cast<PDBSymbolFunc>(&symbol);
- assert(func);
-
- auto decl_context = GetDeclContextContainingSymbol(symbol);
- assert(decl_context);
-
- std::string name =
- std::string(MSVCUndecoratedNameParser::DropScope(func->getName()));
-
- Type *type = symbol_file->ResolveTypeUID(sym_id);
- if (!type)
- return nullptr;
-
- auto storage = func->isStatic() ? clang::StorageClass::SC_Static
- : clang::StorageClass::SC_None;
-
- auto decl = m_ast.CreateFunctionDeclaration(
- decl_context, OptionalClangModuleID(), name,
- type->GetForwardCompilerType(), storage, func->hasInlineAttribute());
-
- std::vector<clang::ParmVarDecl *> params;
- if (std::unique_ptr<PDBSymbolTypeFunctionSig> sig = func->getSignature()) {
- if (std::unique_ptr<ConcreteSymbolEnumerator<PDBSymbolTypeFunctionArg>>
- arg_enum = sig->findAllChildren<PDBSymbolTypeFunctionArg>()) {
- while (std::unique_ptr<PDBSymbolTypeFunctionArg> arg =
- arg_enum->getNext()) {
- Type *arg_type = symbol_file->ResolveTypeUID(arg->getTypeId());
- if (!arg_type)
- continue;
-
- clang::ParmVarDecl *param = m_ast.CreateParameterDeclaration(
- decl, OptionalClangModuleID(), nullptr,
- arg_type->GetForwardCompilerType(), clang::SC_None, true);
- if (param)
- params.push_back(param);
- }
- }
- }
- if (params.size())
- m_ast.SetFunctionParameters(decl, params);
-
- m_uid_to_decl[sym_id] = decl;
-
- return decl;
- }
- default: {
- // It's not a variable and not a function, check if it's a type
- Type *type = symbol_file->ResolveTypeUID(sym_id);
- if (!type)
- return nullptr;
-
- return m_uid_to_decl.lookup(sym_id);
- }
- }
-}
-
-clang::DeclContext *
-PDBASTParser::GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol) {
- if (symbol.getSymTag() == PDB_SymType::Function) {
- clang::DeclContext *result =
- llvm::dyn_cast_or_null<clang::FunctionDecl>(GetDeclForSymbol(symbol));
-
- if (result)
- m_decl_context_to_uid[result] = symbol.getSymIndexId();
-
- return result;
- }
-
- auto symbol_file = static_cast<SymbolFilePDB *>(
- m_ast.GetSymbolFile()->GetBackingSymbolFile());
- if (!symbol_file)
- return nullptr;
-
- auto type = symbol_file->ResolveTypeUID(symbol.getSymIndexId());
- if (!type)
- return nullptr;
-
- clang::DeclContext *result =
- m_ast.GetDeclContextForType(type->GetForwardCompilerType());
-
- if (result)
- m_decl_context_to_uid[result] = symbol.getSymIndexId();
-
- return result;
-}
-
-clang::DeclContext *PDBASTParser::GetDeclContextContainingSymbol(
- const llvm::pdb::PDBSymbol &symbol) {
- auto parent = GetClassOrFunctionParent(symbol);
- while (parent) {
- if (auto parent_context = GetDeclContextForSymbol(*parent))
- return parent_context;
-
- parent = GetClassOrFunctionParent(*parent);
- }
-
- // We can't find any class or function parent of the symbol. So analyze
- // the full symbol name. The symbol may be belonging to a namespace
- // or function (or even to a class if it's e.g. a static variable symbol).
-
- // TODO: Make clang to emit full names for variables in namespaces
- // (as MSVC does)
-
- std::string name(symbol.getRawSymbol().getName());
- MSVCUndecoratedNameParser parser(name);
- llvm::ArrayRef<MSVCUndecoratedNameSpecifier> specs = parser.GetSpecifiers();
- if (specs.empty())
- return m_ast.GetTranslationUnitDecl();
-
- auto symbol_file = static_cast<SymbolFilePDB *>(
- m_ast.GetSymbolFile()->GetBackingSymbolFile());
- if (!symbol_file)
- return m_ast.GetTranslationUnitDecl();
-
- auto global = symbol_file->GetPDBSession().getGlobalScope();
- if (!global)
- return m_ast.GetTranslationUnitDecl();
-
- bool has_type_or_function_parent = false;
- clang::DeclContext *curr_context = m_ast.GetTranslationUnitDecl();
- for (std::size_t i = 0; i < specs.size() - 1; i++) {
- // Check if there is a function or a type with the current context's name.
- if (std::unique_ptr<IPDBEnumSymbols> children_enum = global->findChildren(
- PDB_SymType::None, specs[i].GetFullName(), NS_CaseSensitive)) {
- while (IPDBEnumChildren<PDBSymbol>::ChildTypePtr child =
- children_enum->getNext()) {
- if (clang::DeclContext *child_context =
- GetDeclContextForSymbol(*child)) {
- // Note that `GetDeclContextForSymbol' retrieves
- // a declaration context for functions and types only,
- // so if we are here then `child_context' is guaranteed
- // a function or a type declaration context.
- has_type_or_function_parent = true;
- curr_context = child_context;
- }
- }
- }
-
- // If there were no functions or types above then retrieve a namespace with
- // the current context's name. There can be no namespaces inside a function
- // or a type. We check it to avoid fake namespaces such as `__l2':
- // `N0::N1::CClass::PrivateFunc::__l2::InnerFuncStruct'
- if (!has_type_or_function_parent) {
- std::string namespace_name = std::string(specs[i].GetBaseName());
- const char *namespace_name_c_str =
- IsAnonymousNamespaceName(namespace_name) ? nullptr
- : namespace_name.data();
- clang::NamespaceDecl *namespace_decl =
- m_ast.GetUniqueNamespaceDeclaration(
- namespace_name_c_str, curr_context, OptionalClangModuleID());
-
- m_parent_to_namespaces[curr_context].insert(namespace_decl);
- m_namespaces.insert(namespace_decl);
-
- curr_context = namespace_decl;
- }
- }
-
- return curr_context;
-}
-
-void PDBASTParser::ParseDeclsForDeclContext(
- const clang::DeclContext *decl_context) {
- auto symbol_file = static_cast<SymbolFilePDB *>(
- m_ast.GetSymbolFile()->GetBackingSymbolFile());
- if (!symbol_file)
- return;
-
- IPDBSession &session = symbol_file->GetPDBSession();
- auto symbol_up =
- session.getSymbolById(m_decl_context_to_uid.lookup(decl_context));
- auto global_up = session.getGlobalScope();
-
- PDBSymbol *symbol;
- if (symbol_up)
- symbol = symbol_up.get();
- else if (global_up)
- symbol = global_up.get();
- else
- return;
-
- if (auto children = symbol->findAllChildren())
- while (auto child = children->getNext())
- GetDeclForSymbol(*child);
-}
-
-clang::NamespaceDecl *
-PDBASTParser::FindNamespaceDecl(const clang::DeclContext *parent,
- llvm::StringRef name) {
- NamespacesSet *set;
- if (parent) {
- auto pit = m_parent_to_namespaces.find(parent);
- if (pit == m_parent_to_namespaces.end())
- return nullptr;
-
- set = &pit->second;
- } else {
- set = &m_namespaces;
- }
- assert(set);
-
- for (clang::NamespaceDecl *namespace_decl : *set)
- if (namespace_decl->getName() == name)
- return namespace_decl;
-
- for (clang::NamespaceDecl *namespace_decl : *set)
- if (namespace_decl->isAnonymousNamespace())
- return FindNamespaceDecl(namespace_decl, name);
-
- return nullptr;
-}
-
-bool PDBASTParser::AddEnumValue(CompilerType enum_type,
- const PDBSymbolData &enum_value) {
- Declaration decl;
- Variant v = enum_value.getValue();
- std::string name =
- std::string(MSVCUndecoratedNameParser::DropScope(enum_value.getName()));
- int64_t raw_value;
- switch (v.Type) {
- case PDB_VariantType::Int8:
- raw_value = v.Value.Int8;
- break;
- case PDB_VariantType::Int16:
- raw_value = v.Value.Int16;
- break;
- case PDB_VariantType::Int32:
- raw_value = v.Value.Int32;
- break;
- case PDB_VariantType::Int64:
- raw_value = v.Value.Int64;
- break;
- case PDB_VariantType::UInt8:
- raw_value = v.Value.UInt8;
- break;
- case PDB_VariantType::UInt16:
- raw_value = v.Value.UInt16;
- break;
- case PDB_VariantType::UInt32:
- raw_value = v.Value.UInt32;
- break;
- case PDB_VariantType::UInt64:
- raw_value = v.Value.UInt64;
- break;
- default:
- return false;
- }
- CompilerType underlying_type = m_ast.GetEnumerationIntegerType(enum_type);
- uint32_t byte_size = m_ast.getASTContext().getTypeSize(
- ClangUtil::GetQualType(underlying_type));
- auto enum_constant_decl = m_ast.AddEnumerationValueToEnumerationType(
- enum_type, decl, name.c_str(), raw_value, byte_size * 8);
- if (!enum_constant_decl)
- return false;
-
- m_uid_to_decl[enum_value.getSymIndexId()] = enum_constant_decl;
-
- return true;
-}
-
-bool PDBASTParser::CompleteTypeFromUDT(
- lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &compiler_type,
- llvm::pdb::PDBSymbolTypeUDT &udt) {
- ClangASTImporter::LayoutInfo layout_info;
- layout_info.bit_size = udt.getLength() * 8;
-
- auto nested_enums = udt.findAllChildren<PDBSymbolTypeUDT>();
- if (nested_enums)
- while (auto nested = nested_enums->getNext())
- symbol_file.ResolveTypeUID(nested->getSymIndexId());
-
- auto bases_enum = udt.findAllChildren<PDBSymbolTypeBaseClass>();
- if (bases_enum)
- AddRecordBases(symbol_file, compiler_type,
- TranslateUdtKind(udt.getUdtKind()), *bases_enum,
- layout_info);
-
- auto members_enum = udt.findAllChildren<PDBSymbolData>();
- if (members_enum)
- AddRecordMembers(symbol_file, compiler_type, *members_enum, layout_info);
-
- auto methods_enum = udt.findAllChildren<PDBSymbolFunc>();
- if (methods_enum)
- AddRecordMethods(symbol_file, compiler_type, *methods_enum);
-
- m_ast.AddMethodOverridesForCXXRecordType(compiler_type.GetOpaqueQualType());
- TypeSystemClang::BuildIndirectFields(compiler_type);
- TypeSystemClang::CompleteTagDeclarationDefinition(compiler_type);
-
- clang::CXXRecordDecl *record_decl =
- m_ast.GetAsCXXRecordDecl(compiler_type.GetOpaqueQualType());
- if (!record_decl)
- return static_cast<bool>(compiler_type);
-
- GetClangASTImporter().SetRecordLayout(record_decl, layout_info);
-
- return static_cast<bool>(compiler_type);
-}
-
-void PDBASTParser::AddRecordMembers(
- lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &record_type,
- PDBDataSymbolEnumerator &members_enum,
- lldb_private::ClangASTImporter::LayoutInfo &layout_info) {
- while (auto member = members_enum.getNext()) {
- if (member->isCompilerGenerated())
- continue;
-
- auto member_name = member->getName();
-
- auto member_type = symbol_file.ResolveTypeUID(member->getTypeId());
- if (!member_type)
- continue;
-
- auto member_comp_type = member_type->GetLayoutCompilerType();
- if (!member_comp_type.GetCompleteType()) {
- symbol_file.GetObjectFile()->GetModule()->ReportError(
- ":: Class '{0}' has a member '{1}' of type '{2}' "
- "which does not have a complete definition.",
- record_type.GetTypeName().GetCString(), member_name.c_str(),
- member_comp_type.GetTypeName().GetCString());
- if (TypeSystemClang::StartTagDeclarationDefinition(member_comp_type))
- TypeSystemClang::CompleteTagDeclarationDefinition(member_comp_type);
- }
-
- auto access = TranslateMemberAccess(member->getAccess());
-
- switch (member->getDataKind()) {
- case PDB_DataKind::Member: {
- auto location_type = member->getLocationType();
-
- auto bit_size = member->getLength();
- if (location_type == PDB_LocType::ThisRel)
- bit_size *= 8;
-
- auto decl = TypeSystemClang::AddFieldToRecordType(
- record_type, member_name.c_str(), member_comp_type, access, bit_size);
- if (!decl)
- continue;
-
- m_uid_to_decl[member->getSymIndexId()] = decl;
-
- auto offset = member->getOffset() * 8;
- if (location_type == PDB_LocType::BitField)
- offset += member->getBitPosition();
-
- layout_info.field_offsets.insert(std::make_pair(decl, offset));
-
- break;
- }
- case PDB_DataKind::StaticMember: {
- auto decl = TypeSystemClang::AddVariableToRecordType(
- record_type, member_name.c_str(), member_comp_type, access);
- if (!decl)
- continue;
-
- // Static constant members may be a const[expr] declaration.
- // Query the symbol's value as the variable initializer if valid.
- if (member_comp_type.IsConst()) {
- auto value = member->getValue();
- if (value.Type == llvm::pdb::Empty) {
- LLDB_LOG(GetLog(LLDBLog::AST),
- "Class '{0}' has member '{1}' of type '{2}' with an unknown "
- "constant size.",
- record_type.GetTypeName(), member_name,
- member_comp_type.GetTypeName());
- continue;
- }
-
- clang::QualType qual_type = decl->getType();
- unsigned type_width = m_ast.getASTContext().getIntWidth(qual_type);
- unsigned constant_width = value.getBitWidth();
-
- if (qual_type->isIntegralOrEnumerationType()) {
- if (type_width >= constant_width) {
- TypeSystemClang::SetIntegerInitializerForVariable(
- decl, value.toAPSInt().extOrTrunc(type_width));
- } else {
- LLDB_LOG(GetLog(LLDBLog::AST),
- "Class '{0}' has a member '{1}' of type '{2}' ({3} bits) "
- "which resolves to a wider constant value ({4} bits). "
- "Ignoring constant.",
- record_type.GetTypeName(), member_name,
- member_comp_type.GetTypeName(), type_width,
- constant_width);
- }
- } else {
- switch (member_comp_type.GetBasicTypeEnumeration()) {
- case lldb::eBasicTypeFloat:
- case lldb::eBasicTypeDouble:
- case lldb::eBasicTypeLongDouble:
- if (type_width == constant_width) {
- TypeSystemClang::SetFloatingInitializerForVariable(
- decl, value.toAPFloat());
- decl->setConstexpr(true);
- } else {
- LLDB_LOG(GetLog(LLDBLog::AST),
- "Class '{0}' has a member '{1}' of type '{2}' ({3} "
- "bits) which resolves to a constant value of mismatched "
- "width ({4} bits). Ignoring constant.",
- record_type.GetTypeName(), member_name,
- member_comp_type.GetTypeName(), type_width,
- constant_width);
- }
- break;
- default:
- break;
- }
- }
- }
-
- m_uid_to_decl[member->getSymIndexId()] = decl;
-
- break;
- }
- default:
- llvm_unreachable("unsupported PDB data kind");
- }
- }
-}
-
-void PDBASTParser::AddRecordBases(
- lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &record_type, int record_kind,
- PDBBaseClassSymbolEnumerator &bases_enum,
- lldb_private::ClangASTImporter::LayoutInfo &layout_info) const {
- std::vector<std::unique_ptr<clang::CXXBaseSpecifier>> base_classes;
-
- while (auto base = bases_enum.getNext()) {
- auto base_type = symbol_file.ResolveTypeUID(base->getTypeId());
- if (!base_type)
- continue;
-
- auto base_comp_type = base_type->GetFullCompilerType();
- if (!base_comp_type.GetCompleteType()) {
- symbol_file.GetObjectFile()->GetModule()->ReportError(
- ":: Class '{0}' has a base class '{1}' "
- "which does not have a complete definition.",
- record_type.GetTypeName().GetCString(),
- base_comp_type.GetTypeName().GetCString());
- if (TypeSystemClang::StartTagDeclarationDefinition(base_comp_type))
- TypeSystemClang::CompleteTagDeclarationDefinition(base_comp_type);
- }
-
- auto access = TranslateMemberAccess(base->getAccess());
-
- auto is_virtual = base->isVirtualBaseClass();
-
- std::unique_ptr<clang::CXXBaseSpecifier> base_spec =
- m_ast.CreateBaseClassSpecifier(
- base_comp_type.GetOpaqueQualType(), access, is_virtual,
- record_kind == llvm::to_underlying(clang::TagTypeKind::Class));
- lldbassert(base_spec);
-
- base_classes.push_back(std::move(base_spec));
-
- if (is_virtual)
- continue;
-
- auto decl = m_ast.GetAsCXXRecordDecl(base_comp_type.GetOpaqueQualType());
- if (!decl)
- continue;
-
- auto offset = clang::CharUnits::fromQuantity(base->getOffset());
- layout_info.base_offsets.insert(std::make_pair(decl, offset));
- }
-
- m_ast.TransferBaseClasses(record_type.GetOpaqueQualType(),
- std::move(base_classes));
-}
-
-void PDBASTParser::AddRecordMethods(lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &record_type,
- PDBFuncSymbolEnumerator &methods_enum) {
- while (std::unique_ptr<PDBSymbolFunc> method = methods_enum.getNext())
- if (clang::CXXMethodDecl *decl =
- AddRecordMethod(symbol_file, record_type, *method))
- m_uid_to_decl[method->getSymIndexId()] = decl;
-}
-
-clang::CXXMethodDecl *
-PDBASTParser::AddRecordMethod(lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &record_type,
- const llvm::pdb::PDBSymbolFunc &method) const {
- std::string name =
- std::string(MSVCUndecoratedNameParser::DropScope(method.getName()));
-
- Type *method_type = symbol_file.ResolveTypeUID(method.getSymIndexId());
- // MSVC specific __vecDelDtor.
- if (!method_type)
- return nullptr;
-
- CompilerType method_comp_type = method_type->GetFullCompilerType();
- if (!method_comp_type.GetCompleteType()) {
- symbol_file.GetObjectFile()->GetModule()->ReportError(
- ":: Class '{0}' has a method '{1}' whose type cannot be completed.",
- record_type.GetTypeName().GetCString(),
- method_comp_type.GetTypeName().GetCString());
- if (TypeSystemClang::StartTagDeclarationDefinition(method_comp_type))
- TypeSystemClang::CompleteTagDeclarationDefinition(method_comp_type);
- }
-
- AccessType access = TranslateMemberAccess(method.getAccess());
- if (access == eAccessNone)
- access = eAccessPublic;
-
- // TODO: get mangled name for the method.
- return m_ast.AddMethodToCXXRecordType(
- record_type.GetOpaqueQualType(), name.c_str(),
- /*mangled_name*/ nullptr, method_comp_type, access, method.isVirtual(),
- method.isStatic(), method.hasInlineAttribute(),
- /*is_explicit*/ false, // FIXME: Need this field in CodeView.
- /*is_attr_used*/ false,
- /*is_artificial*/ method.isCompilerGenerated());
-}
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h
deleted file mode 100644
index 06f317f4c4d929..00000000000000
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h
+++ /dev/null
@@ -1,116 +0,0 @@
-//===-- PDBASTParser.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 LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
-#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
-
-#include "lldb/lldb-forward.h"
-
-#include "Plugins/ExpressionParser/Clang/ClangASTImporter.h"
-
-class SymbolFilePDB;
-
-namespace clang {
-class CharUnits;
-class CXXRecordDecl;
-class FieldDecl;
-class RecordDecl;
-} // namespace clang
-
-namespace lldb_private {
-class TypeSystemClang;
-class CompilerType;
-} // namespace lldb_private
-
-namespace llvm {
-namespace pdb {
-template <typename ChildType> class ConcreteSymbolEnumerator;
-
-class PDBSymbol;
-class PDBSymbolData;
-class PDBSymbolFunc;
-class PDBSymbolTypeBaseClass;
-class PDBSymbolTypeBuiltin;
-class PDBSymbolTypeUDT;
-} // namespace pdb
-} // namespace llvm
-
-class PDBASTParser {
-public:
- PDBASTParser(lldb_private::TypeSystemClang &ast);
- ~PDBASTParser();
-
- lldb::TypeSP CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol &type);
- bool CompleteTypeFromPDB(lldb_private::CompilerType &compiler_type);
-
- clang::Decl *GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol);
-
- clang::DeclContext *
- GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol);
- clang::DeclContext *
- GetDeclContextContainingSymbol(const llvm::pdb::PDBSymbol &symbol);
-
- void ParseDeclsForDeclContext(const clang::DeclContext *decl_context);
-
- clang::NamespaceDecl *FindNamespaceDecl(const clang::DeclContext *parent,
- llvm::StringRef name);
-
- lldb_private::ClangASTImporter &GetClangASTImporter() {
- return m_ast_importer;
- }
-
-private:
- typedef llvm::DenseMap<clang::CXXRecordDecl *, lldb::user_id_t>
- CXXRecordDeclToUidMap;
- typedef llvm::DenseMap<lldb::user_id_t, clang::Decl *> UidToDeclMap;
- typedef std::set<clang::NamespaceDecl *> NamespacesSet;
- typedef llvm::DenseMap<clang::DeclContext *, NamespacesSet>
- ParentToNamespacesMap;
- typedef llvm::DenseMap<clang::DeclContext *, lldb::user_id_t>
- DeclContextToUidMap;
- typedef llvm::pdb::ConcreteSymbolEnumerator<llvm::pdb::PDBSymbolData>
- PDBDataSymbolEnumerator;
- typedef llvm::pdb::ConcreteSymbolEnumerator<llvm::pdb::PDBSymbolTypeBaseClass>
- PDBBaseClassSymbolEnumerator;
- typedef llvm::pdb::ConcreteSymbolEnumerator<llvm::pdb::PDBSymbolFunc>
- PDBFuncSymbolEnumerator;
-
- bool AddEnumValue(lldb_private::CompilerType enum_type,
- const llvm::pdb::PDBSymbolData &data);
- bool CompleteTypeFromUDT(lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &compiler_type,
- llvm::pdb::PDBSymbolTypeUDT &udt);
- void
- AddRecordMembers(lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &record_type,
- PDBDataSymbolEnumerator &members_enum,
- lldb_private::ClangASTImporter::LayoutInfo &layout_info);
- void
- AddRecordBases(lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &record_type, int record_kind,
- PDBBaseClassSymbolEnumerator &bases_enum,
- lldb_private::ClangASTImporter::LayoutInfo &layout_info) const;
- void AddRecordMethods(lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &record_type,
- PDBFuncSymbolEnumerator &methods_enum);
- clang::CXXMethodDecl *
- AddRecordMethod(lldb_private::SymbolFile &symbol_file,
- lldb_private::CompilerType &record_type,
- const llvm::pdb::PDBSymbolFunc &method) const;
-
- lldb_private::TypeSystemClang &m_ast;
- lldb_private::ClangASTImporter m_ast_importer;
-
- CXXRecordDeclToUidMap m_forward_decl_to_uid;
- UidToDeclMap m_uid_to_decl;
- ParentToNamespacesMap m_parent_to_namespaces;
- NamespacesSet m_namespaces;
- DeclContextToUidMap m_decl_context_to_uid;
-};
-
-#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
deleted file mode 100644
index 95add31385df6f..00000000000000
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-//===-- PDBLocationToDWARFExpression.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 "PDBLocationToDWARFExpression.h"
-
-#include "lldb/Core/Section.h"
-#include "lldb/Core/dwarf.h"
-#include "lldb/Expression/DWARFExpression.h"
-#include "lldb/Symbol/Variable.h"
-#include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/StreamBuffer.h"
-
-#include "llvm/DebugInfo/CodeView/CodeView.h"
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-
-#include "Plugins/SymbolFile/NativePDB/CodeViewRegisterMapping.h"
-#include "Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.h"
-
-using namespace lldb;
-using namespace lldb_private;
-using namespace lldb_private::npdb;
-using namespace lldb_private::dwarf;
-using namespace llvm::pdb;
-
-static std::unique_ptr<IPDBFrameData>
-GetCorrespondingFrameData(const IPDBSession &session,
- const Variable::RangeList &ranges) {
- auto enumFrameData = session.getFrameData();
- if (!enumFrameData)
- return nullptr;
-
- std::unique_ptr<IPDBFrameData> found;
- while (auto fd = enumFrameData->getNext()) {
- Range<lldb::addr_t, lldb::addr_t> fdRange(fd->getVirtualAddress(),
- fd->getLengthBlock());
-
- for (size_t i = 0; i < ranges.GetSize(); i++) {
- auto range = ranges.GetEntryAtIndex(i);
- if (!range)
- continue;
-
- if (!range->DoesIntersect(fdRange))
- continue;
-
- found = std::move(fd);
-
- break;
- }
- }
-
- return found;
-}
-
-static bool EmitVFrameEvaluationDWARFExpression(
- llvm::StringRef program, llvm::Triple::ArchType arch_type, Stream &stream) {
- // VFrame value always stored in $TO pseudo-register
- return TranslateFPOProgramToDWARFExpression(program, "$T0", arch_type,
- stream);
-}
-
-DWARFExpression ConvertPDBLocationToDWARFExpression(
- ModuleSP module, const PDBSymbolData &symbol,
- const Variable::RangeList &ranges, bool &is_constant) {
- is_constant = true;
-
- if (!module)
- return DWARFExpression();
-
- const ArchSpec &architecture = module->GetArchitecture();
- llvm::Triple::ArchType arch_type = architecture.GetMachine();
- ByteOrder byte_order = architecture.GetByteOrder();
- uint32_t address_size = architecture.GetAddressByteSize();
- uint32_t byte_size = architecture.GetDataByteSize();
- if (byte_order == eByteOrderInvalid || address_size == 0)
- return DWARFExpression();
-
- RegisterKind register_kind = eRegisterKindDWARF;
- StreamBuffer<32> stream(Stream::eBinary, address_size, byte_order);
- switch (symbol.getLocationType()) {
- case PDB_LocType::Static:
- case PDB_LocType::TLS: {
- stream.PutHex8(DW_OP_addr);
-
- SectionList *section_list = module->GetSectionList();
- if (!section_list)
- return DWARFExpression();
-
- uint32_t section_id = symbol.getAddressSection();
-
- auto section = section_list->FindSectionByID(section_id);
- if (!section)
- return DWARFExpression();
-
- uint32_t offset = symbol.getAddressOffset();
- stream.PutMaxHex64(section->GetFileAddress() + offset, address_size,
- byte_order);
-
- is_constant = false;
-
- break;
- }
- case PDB_LocType::RegRel: {
- uint32_t reg_num;
- auto reg_id = symbol.getRegisterId();
- if (reg_id == llvm::codeview::RegisterId::VFRAME) {
- if (auto fd = GetCorrespondingFrameData(symbol.getSession(), ranges)) {
- if (EmitVFrameEvaluationDWARFExpression(fd->getProgram(), arch_type,
- stream)) {
- int32_t offset = symbol.getOffset();
- stream.PutHex8(DW_OP_consts);
- stream.PutSLEB128(offset);
- stream.PutHex8(DW_OP_plus);
-
- register_kind = eRegisterKindLLDB;
-
- is_constant = false;
- break;
- }
- }
-
- register_kind = eRegisterKindGeneric;
- reg_num = LLDB_REGNUM_GENERIC_FP;
- } else {
- register_kind = eRegisterKindLLDB;
- reg_num = GetLLDBRegisterNumber(arch_type, reg_id);
- if (reg_num == LLDB_INVALID_REGNUM)
- return DWARFExpression();
- }
-
- if (reg_num > 31) {
- stream.PutHex8(DW_OP_bregx);
- stream.PutULEB128(reg_num);
- } else
- stream.PutHex8(DW_OP_breg0 + reg_num);
-
- int32_t offset = symbol.getOffset();
- stream.PutSLEB128(offset);
-
- is_constant = false;
-
- break;
- }
- case PDB_LocType::Enregistered: {
- register_kind = eRegisterKindLLDB;
- uint32_t reg_num = GetLLDBRegisterNumber(arch_type, symbol.getRegisterId());
- if (reg_num == LLDB_INVALID_REGNUM)
- return DWARFExpression();
-
- if (reg_num > 31) {
- stream.PutHex8(DW_OP_regx);
- stream.PutULEB128(reg_num);
- } else
- stream.PutHex8(DW_OP_reg0 + reg_num);
-
- is_constant = false;
-
- break;
- }
- case PDB_LocType::Constant: {
- Variant value = symbol.getValue();
- stream.PutRawBytes(&value.Value, sizeof(value.Value),
- endian::InlHostByteOrder());
- break;
- }
- default:
- return DWARFExpression();
- }
-
- DataBufferSP buffer =
- std::make_shared<DataBufferHeap>(stream.GetData(), stream.GetSize());
- DataExtractor extractor(buffer, byte_order, address_size, byte_size);
- DWARFExpression result(extractor);
- result.SetRegisterKind(register_kind);
-
- return result;
-}
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h b/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
deleted file mode 100644
index fd0fef03e2c867..00000000000000
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.h
+++ /dev/null
@@ -1,47 +0,0 @@
-//===-- PDBLocationToDWARFExpression.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 LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBLOCATIONTODWARFEXPRESSION_H
-#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_PDBLOCATIONTODWARFEXPRESSION_H
-
-#include "lldb/Core/Module.h"
-#include "lldb/Symbol/Variable.h"
-
-namespace lldb_private {
-class DWARFExpression;
-}
-
-namespace llvm {
-namespace pdb {
-class PDBSymbolData;
-}
-} // namespace llvm
-
-/// Converts a location information from a PDB symbol to a DWARF expression
-///
-/// \param[in] module
-/// The module \a symbol belongs to.
-///
-/// \param[in] symbol
-/// The symbol with a location information to convert.
-///
-/// \param[in] ranges
-/// Ranges where this variable is valid.
-///
-/// \param[out] is_constant
-/// Set to \b true if the result expression is a constant value data,
-/// and \b false if it is a DWARF bytecode.
-///
-/// \return
-/// The DWARF expression corresponding to the location data of \a symbol.
-lldb_private::DWARFExpression
-ConvertPDBLocationToDWARFExpression(lldb::ModuleSP module,
- const llvm::pdb::PDBSymbolData &symbol,
- const lldb_private::Variable::RangeList &ranges,
- bool &is_constant);
-#endif
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
deleted file mode 100644
index 4fc48b4d133382..00000000000000
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ /dev/null
@@ -1,2053 +0,0 @@
-//===-- SymbolFilePDB.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 "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" // for LLVM_ENABLE_DIA_SDK
-#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
-
-using namespace lldb;
-using namespace lldb_private;
-using namespace llvm::pdb;
-
-LLDB_PLUGIN_DEFINE(SymbolFilePDB)
-
-char SymbolFilePDB::ID;
-
-namespace {
-lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
- switch (lang) {
- case PDB_Lang::Cpp:
- return lldb::LanguageType::eLanguageTypeC_plus_plus;
- case PDB_Lang::C:
- return lldb::LanguageType::eLanguageTypeC;
- case PDB_Lang::Swift:
- return lldb::LanguageType::eLanguageTypeSwift;
- case PDB_Lang::Rust:
- return lldb::LanguageType::eLanguageTypeRust;
- case PDB_Lang::ObjC:
- return lldb::LanguageType::eLanguageTypeObjC;
- case PDB_Lang::ObjCpp:
- return lldb::LanguageType::eLanguageTypeObjC_plus_plus;
- default:
- return lldb::LanguageType::eLanguageTypeUnknown;
- }
-}
-
-bool ShouldAddLine(uint32_t requested_line, uint32_t actual_line,
- uint32_t addr_length) {
- return ((requested_line == 0 || actual_line == requested_line) &&
- addr_length > 0);
-}
-} // namespace
-
-static bool ShouldUseNativeReader() {
-#if defined(_WIN32)
-#if LLVM_ENABLE_DIA_SDK
- llvm::StringRef use_native = ::getenv("LLDB_USE_NATIVE_PDB_READER");
- if (!use_native.equals_insensitive("on") &&
- !use_native.equals_insensitive("yes") &&
- !use_native.equals_insensitive("1") &&
- !use_native.equals_insensitive("true"))
- return false;
-#endif
-#endif
- return true;
-}
-
-void SymbolFilePDB::Initialize() {
- if (ShouldUseNativeReader()) {
- npdb::SymbolFileNativePDB::Initialize();
- } else {
- PluginManager::RegisterPlugin(GetPluginNameStatic(),
- GetPluginDescriptionStatic(), CreateInstance,
- DebuggerInitialize);
- }
-}
-
-void SymbolFilePDB::Terminate() {
- if (ShouldUseNativeReader()) {
- npdb::SymbolFileNativePDB::Terminate();
- } else {
- PluginManager::UnregisterPlugin(CreateInstance);
- }
-}
-
-void SymbolFilePDB::DebuggerInitialize(lldb_private::Debugger &debugger) {}
-
-llvm::StringRef SymbolFilePDB::GetPluginDescriptionStatic() {
- return "Microsoft PDB debug symbol file reader.";
-}
-
-lldb_private::SymbolFile *
-SymbolFilePDB::CreateInstance(ObjectFileSP objfile_sp) {
- return new SymbolFilePDB(std::move(objfile_sp));
-}
-
-SymbolFilePDB::SymbolFilePDB(lldb::ObjectFileSP objfile_sp)
- : SymbolFileCommon(std::move(objfile_sp)), m_session_up(), m_global_scope_up() {}
-
-SymbolFilePDB::~SymbolFilePDB() = default;
-
-uint32_t SymbolFilePDB::CalculateAbilities() {
- uint32_t abilities = 0;
- if (!m_objfile_sp)
- return 0;
-
- if (!m_session_up) {
- // Lazily load and match the PDB file, but only do this once.
- std::string exePath = m_objfile_sp->GetFileSpec().GetPath();
- auto error = loadDataForEXE(PDB_ReaderType::DIA, llvm::StringRef(exePath),
- m_session_up);
- if (error) {
- llvm::consumeError(std::move(error));
- auto module_sp = m_objfile_sp->GetModule();
- if (!module_sp)
- return 0;
- // See if any symbol file is specified through `--symfile` option.
- FileSpec symfile = module_sp->GetSymbolFileFileSpec();
- if (!symfile)
- return 0;
- error = loadDataForPDB(PDB_ReaderType::DIA,
- llvm::StringRef(symfile.GetPath()), m_session_up);
- if (error) {
- llvm::consumeError(std::move(error));
- return 0;
- }
- }
- }
- if (!m_session_up)
- return 0;
-
- auto enum_tables_up = m_session_up->getEnumTables();
- if (!enum_tables_up)
- return 0;
- while (auto table_up = enum_tables_up->getNext()) {
- if (table_up->getItemCount() == 0)
- continue;
- auto type = table_up->getTableType();
- switch (type) {
- case PDB_TableType::Symbols:
- // This table represents a store of symbols with types listed in
- // PDBSym_Type
- abilities |= (CompileUnits | Functions | Blocks | GlobalVariables |
- LocalVariables | VariableTypes);
- break;
- case PDB_TableType::LineNumbers:
- abilities |= LineTables;
- break;
- default:
- break;
- }
- }
- return abilities;
-}
-
-void SymbolFilePDB::InitializeObject() {
- lldb::addr_t obj_load_address =
- m_objfile_sp->GetBaseAddress().GetFileAddress();
- lldbassert(obj_load_address && obj_load_address != LLDB_INVALID_ADDRESS);
- m_session_up->setLoadAddress(obj_load_address);
- if (!m_global_scope_up)
- m_global_scope_up = m_session_up->getGlobalScope();
- lldbassert(m_global_scope_up.get());
-}
-
-uint32_t SymbolFilePDB::CalculateNumCompileUnits() {
- auto compilands = m_global_scope_up->findAllChildren<PDBSymbolCompiland>();
- if (!compilands)
- return 0;
-
- // The linker could link *.dll (compiland language = LINK), or import
- // *.dll. For example, a compiland with name `Import:KERNEL32.dll` could be
- // found as a child of the global scope (PDB executable). Usually, such
- // compilands contain `thunk` symbols in which we are not interested for
- // now. However we still count them in the compiland list. If we perform
- // any compiland related activity, like finding symbols through
- // llvm::pdb::IPDBSession methods, such compilands will all be searched
- // automatically no matter whether we include them or not.
- uint32_t compile_unit_count = compilands->getChildCount();
-
- // The linker can inject an additional "dummy" compilation unit into the
- // PDB. Ignore this special compile unit for our purposes, if it is there.
- // It is always the last one.
- auto last_compiland_up = compilands->getChildAtIndex(compile_unit_count - 1);
- lldbassert(last_compiland_up.get());
- std::string name = last_compiland_up->getName();
- if (name == "* Linker *")
- --compile_unit_count;
- return compile_unit_count;
-}
-
-void SymbolFilePDB::GetCompileUnitIndex(
- const llvm::pdb::PDBSymbolCompiland &pdb_compiland, uint32_t &index) {
- auto results_up = m_global_scope_up->findAllChildren<PDBSymbolCompiland>();
- if (!results_up)
- return;
- auto uid = pdb_compiland.getSymIndexId();
- for (uint32_t cu_idx = 0; cu_idx < GetNumCompileUnits(); ++cu_idx) {
- auto compiland_up = results_up->getChildAtIndex(cu_idx);
- if (!compiland_up)
- continue;
- if (compiland_up->getSymIndexId() == uid) {
- index = cu_idx;
- return;
- }
- }
- index = UINT32_MAX;
-}
-
-std::unique_ptr<llvm::pdb::PDBSymbolCompiland>
-SymbolFilePDB::GetPDBCompilandByUID(uint32_t uid) {
- return m_session_up->getConcreteSymbolById<PDBSymbolCompiland>(uid);
-}
-
-lldb::CompUnitSP SymbolFilePDB::ParseCompileUnitAtIndex(uint32_t index) {
- if (index >= GetNumCompileUnits())
- return CompUnitSP();
-
- // Assuming we always retrieve same compilands listed in same order through
- // `PDBSymbolExe::findAllChildren` method, otherwise using `index` to get a
- // compile unit makes no sense.
- auto results = m_global_scope_up->findAllChildren<PDBSymbolCompiland>();
- if (!results)
- return CompUnitSP();
- auto compiland_up = results->getChildAtIndex(index);
- if (!compiland_up)
- return CompUnitSP();
- return ParseCompileUnitForUID(compiland_up->getSymIndexId(), index);
-}
-
-lldb::LanguageType SymbolFilePDB::ParseLanguage(CompileUnit &comp_unit) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- auto compiland_up = GetPDBCompilandByUID(comp_unit.GetID());
- if (!compiland_up)
- return lldb::eLanguageTypeUnknown;
- auto details = compiland_up->findOneChild<PDBSymbolCompilandDetails>();
- if (!details)
- return lldb::eLanguageTypeUnknown;
- return TranslateLanguage(details->getLanguage());
-}
-
-lldb_private::Function *
-SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(const PDBSymbolFunc &pdb_func,
- CompileUnit &comp_unit) {
- if (FunctionSP result = comp_unit.FindFunctionByUID(pdb_func.getSymIndexId()))
- return result.get();
-
- auto file_vm_addr = pdb_func.getVirtualAddress();
- if (file_vm_addr == LLDB_INVALID_ADDRESS || file_vm_addr == 0)
- return nullptr;
-
- auto func_length = pdb_func.getLength();
- AddressRange func_range =
- AddressRange(file_vm_addr, func_length,
- GetObjectFile()->GetModule()->GetSectionList());
- if (!func_range.GetBaseAddress().IsValid())
- return nullptr;
-
- lldb_private::Type *func_type = ResolveTypeUID(pdb_func.getSymIndexId());
- if (!func_type)
- return nullptr;
-
- user_id_t func_type_uid = pdb_func.getSignatureId();
-
- Mangled mangled = GetMangledForPDBFunc(pdb_func);
-
- FunctionSP func_sp =
- std::make_shared<Function>(&comp_unit, pdb_func.getSymIndexId(),
- func_type_uid, mangled, func_type, func_range);
-
- comp_unit.AddFunction(func_sp);
-
- LanguageType lang = ParseLanguage(comp_unit);
- auto type_system_or_err = GetTypeSystemForLanguage(lang);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to parse PDBFunc: {0}");
- return nullptr;
- }
-
- auto ts = *type_system_or_err;
- TypeSystemClang *clang_type_system =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_type_system)
- return nullptr;
- clang_type_system->GetPDBParser()->GetDeclForSymbol(pdb_func);
-
- return func_sp.get();
-}
-
-size_t SymbolFilePDB::ParseFunctions(CompileUnit &comp_unit) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- size_t func_added = 0;
- auto compiland_up = GetPDBCompilandByUID(comp_unit.GetID());
- if (!compiland_up)
- return 0;
- auto results_up = compiland_up->findAllChildren<PDBSymbolFunc>();
- if (!results_up)
- return 0;
- while (auto pdb_func_up = results_up->getNext()) {
- auto func_sp = comp_unit.FindFunctionByUID(pdb_func_up->getSymIndexId());
- if (!func_sp) {
- if (ParseCompileUnitFunctionForPDBFunc(*pdb_func_up, comp_unit))
- ++func_added;
- }
- }
- return func_added;
-}
-
-bool SymbolFilePDB::ParseLineTable(CompileUnit &comp_unit) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- if (comp_unit.GetLineTable())
- return true;
- return ParseCompileUnitLineTable(comp_unit, 0);
-}
-
-bool SymbolFilePDB::ParseDebugMacros(CompileUnit &comp_unit) {
- // PDB doesn't contain information about macros
- return false;
-}
-
-bool SymbolFilePDB::ParseSupportFiles(
- CompileUnit &comp_unit, lldb_private::SupportFileList &support_files) {
-
- // In theory this is unnecessary work for us, because all of this information
- // is easily (and quickly) accessible from DebugInfoPDB, so caching it a
- // second time seems like a waste. Unfortunately, there's no good way around
- // this short of a moderate refactor since SymbolVendor depends on being able
- // to cache this list.
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- auto compiland_up = GetPDBCompilandByUID(comp_unit.GetID());
- if (!compiland_up)
- return false;
- auto files = m_session_up->getSourceFilesForCompiland(*compiland_up);
- if (!files || files->getChildCount() == 0)
- return false;
-
- while (auto file = files->getNext()) {
- FileSpec spec(file->getFileName(), FileSpec::Style::windows);
- support_files.AppendIfUnique(spec);
- }
-
- return true;
-}
-
-bool SymbolFilePDB::ParseImportedModules(
- const lldb_private::SymbolContext &sc,
- std::vector<SourceModule> &imported_modules) {
- // PDB does not yet support module debug info
- return false;
-}
-
-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) {
- assert(pdb_symbol && parent_block);
-
- size_t num_added = 0;
- switch (pdb_symbol->getSymTag()) {
- case PDB_SymType::Block:
- case PDB_SymType::Function: {
- Block *block = nullptr;
- auto &raw_sym = pdb_symbol->getRawSymbol();
- if (auto *pdb_func = llvm::dyn_cast<PDBSymbolFunc>(pdb_symbol)) {
- if (pdb_func->hasNoInlineAttribute())
- break;
- if (is_top_parent)
- block = parent_block;
- else
- break;
- } else if (llvm::isa<PDBSymbolBlock>(pdb_symbol)) {
- auto uid = pdb_symbol->getSymIndexId();
- if (parent_block->FindBlockByID(uid))
- break;
- if (raw_sym.getVirtualAddress() < func_file_vm_addr)
- break;
-
- auto block_sp = std::make_shared<Block>(pdb_symbol->getSymIndexId());
- parent_block->AddChild(block_sp);
- block = block_sp.get();
- } else
- llvm_unreachable("Unexpected PDB symbol!");
-
- block->AddRange(Block::Range(
- raw_sym.getVirtualAddress() - func_file_vm_addr, raw_sym.getLength()));
- block->FinalizeRanges();
- ++num_added;
-
- auto results_up = pdb_symbol->findAllChildren();
- if (!results_up)
- break;
- while (auto symbol_up = results_up->getNext()) {
- num_added += ParseFunctionBlocksForPDBSymbol(
- func_file_vm_addr, symbol_up.get(), block, false);
- }
- } break;
- default:
- break;
- }
- return num_added;
-}
-
-size_t SymbolFilePDB::ParseBlocksRecursive(Function &func) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- size_t num_added = 0;
- auto uid = func.GetID();
- auto pdb_func_up = m_session_up->getConcreteSymbolById<PDBSymbolFunc>(uid);
- if (!pdb_func_up)
- return 0;
- Block &parent_block = func.GetBlock(false);
- num_added = ParseFunctionBlocksForPDBSymbol(
- pdb_func_up->getVirtualAddress(), pdb_func_up.get(), &parent_block, true);
- return num_added;
-}
-
-size_t SymbolFilePDB::ParseTypes(CompileUnit &comp_unit) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
-
- size_t num_added = 0;
- auto compiland = GetPDBCompilandByUID(comp_unit.GetID());
- if (!compiland)
- return 0;
-
- auto ParseTypesByTagFn = [&num_added, this](const PDBSymbol &raw_sym) {
- std::unique_ptr<IPDBEnumSymbols> results;
- PDB_SymType tags_to_search[] = {PDB_SymType::Enum, PDB_SymType::Typedef,
- PDB_SymType::UDT};
- for (auto tag : tags_to_search) {
- results = raw_sym.findAllChildren(tag);
- if (!results || results->getChildCount() == 0)
- continue;
- while (auto symbol = results->getNext()) {
- switch (symbol->getSymTag()) {
- case PDB_SymType::Enum:
- case PDB_SymType::UDT:
- case PDB_SymType::Typedef:
- break;
- default:
- continue;
- }
-
- // This should cause the type to get cached and stored in the `m_types`
- // lookup.
- if (auto type = ResolveTypeUID(symbol->getSymIndexId())) {
- // Resolve the type completely to avoid a completion
- // (and so a list change, which causes an iterators invalidation)
- // during a TypeList dumping
- type->GetFullCompilerType();
- ++num_added;
- }
- }
- }
- };
-
- ParseTypesByTagFn(*compiland);
-
- // Also parse global types particularly coming from this compiland.
- // Unfortunately, PDB has no compiland information for each global type. We
- // have to parse them all. But ensure we only do this once.
- static bool parse_all_global_types = false;
- if (!parse_all_global_types) {
- ParseTypesByTagFn(*m_global_scope_up);
- parse_all_global_types = true;
- }
- return num_added;
-}
-
-size_t
-SymbolFilePDB::ParseVariablesForContext(const lldb_private::SymbolContext &sc) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- if (!sc.comp_unit)
- return 0;
-
- size_t num_added = 0;
- if (sc.function) {
- auto pdb_func = m_session_up->getConcreteSymbolById<PDBSymbolFunc>(
- sc.function->GetID());
- if (!pdb_func)
- return 0;
-
- num_added += ParseVariables(sc, *pdb_func);
- sc.function->GetBlock(false).SetDidParseVariables(true, true);
- } else if (sc.comp_unit) {
- auto compiland = GetPDBCompilandByUID(sc.comp_unit->GetID());
- if (!compiland)
- return 0;
-
- if (sc.comp_unit->GetVariableList(false))
- return 0;
-
- auto results = m_global_scope_up->findAllChildren<PDBSymbolData>();
- if (results && results->getChildCount()) {
- while (auto result = results->getNext()) {
- auto cu_id = GetCompilandId(*result);
- // FIXME: We are not able to determine variable's compile unit.
- if (cu_id == 0)
- continue;
-
- if (cu_id == sc.comp_unit->GetID())
- num_added += ParseVariables(sc, *result);
- }
- }
-
- // FIXME: A `file static` or `global constant` variable appears both in
- // compiland's children and global scope's children with unexpectedly
- // different symbol's Id making it ambiguous.
-
- // FIXME: 'local constant', for example, const char var[] = "abc", declared
- // in a function scope, can't be found in PDB.
-
- // Parse variables in this compiland.
- num_added += ParseVariables(sc, *compiland);
- }
-
- return num_added;
-}
-
-lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- auto find_result = m_types.find(type_uid);
- if (find_result != m_types.end())
- return find_result->second.get();
-
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to ResolveTypeUID: {0}");
- return nullptr;
- }
-
- auto ts = *type_system_or_err;
- TypeSystemClang *clang_type_system =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_type_system)
- return nullptr;
- PDBASTParser *pdb = clang_type_system->GetPDBParser();
- if (!pdb)
- return nullptr;
-
- auto pdb_type = m_session_up->getSymbolById(type_uid);
- if (pdb_type == nullptr)
- return nullptr;
-
- lldb::TypeSP result = pdb->CreateLLDBTypeFromPDBType(*pdb_type);
- if (result) {
- m_types.insert(std::make_pair(type_uid, result));
- }
- return result.get();
-}
-
-std::optional<SymbolFile::ArrayInfo> SymbolFilePDB::GetDynamicArrayInfoForUID(
- lldb::user_id_t type_uid, const lldb_private::ExecutionContext *exe_ctx) {
- return std::nullopt;
-}
-
-bool SymbolFilePDB::CompleteType(lldb_private::CompilerType &compiler_type) {
- std::lock_guard<std::recursive_mutex> guard(
- GetObjectFile()->GetModule()->GetMutex());
-
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to get dynamic array info for UID: {0}");
- return false;
- }
- auto ts = *type_system_or_err;
- TypeSystemClang *clang_ast_ctx =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
-
- if (!clang_ast_ctx)
- return false;
-
- PDBASTParser *pdb = clang_ast_ctx->GetPDBParser();
- if (!pdb)
- return false;
-
- return pdb->CompleteTypeFromPDB(compiler_type);
-}
-
-lldb_private::CompilerDecl SymbolFilePDB::GetDeclForUID(lldb::user_id_t uid) {
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to get decl for UID: {0}");
- return CompilerDecl();
- }
- auto ts = *type_system_or_err;
- TypeSystemClang *clang_ast_ctx =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_ast_ctx)
- return CompilerDecl();
-
- PDBASTParser *pdb = clang_ast_ctx->GetPDBParser();
- if (!pdb)
- return CompilerDecl();
-
- auto symbol = m_session_up->getSymbolById(uid);
- if (!symbol)
- return CompilerDecl();
-
- auto decl = pdb->GetDeclForSymbol(*symbol);
- if (!decl)
- return CompilerDecl();
-
- return clang_ast_ctx->GetCompilerDecl(decl);
-}
-
-lldb_private::CompilerDeclContext
-SymbolFilePDB::GetDeclContextForUID(lldb::user_id_t uid) {
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to get DeclContext for UID: {0}");
- return CompilerDeclContext();
- }
-
- auto ts = *type_system_or_err;
- TypeSystemClang *clang_ast_ctx =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_ast_ctx)
- return CompilerDeclContext();
-
- PDBASTParser *pdb = clang_ast_ctx->GetPDBParser();
- if (!pdb)
- return CompilerDeclContext();
-
- auto symbol = m_session_up->getSymbolById(uid);
- if (!symbol)
- return CompilerDeclContext();
-
- auto decl_context = pdb->GetDeclContextForSymbol(*symbol);
- if (!decl_context)
- return GetDeclContextContainingUID(uid);
-
- return clang_ast_ctx->CreateDeclContext(decl_context);
-}
-
-lldb_private::CompilerDeclContext
-SymbolFilePDB::GetDeclContextContainingUID(lldb::user_id_t uid) {
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to get DeclContext containing UID: {0}");
- return CompilerDeclContext();
- }
-
- auto ts = *type_system_or_err;
- TypeSystemClang *clang_ast_ctx =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_ast_ctx)
- return CompilerDeclContext();
-
- PDBASTParser *pdb = clang_ast_ctx->GetPDBParser();
- if (!pdb)
- return CompilerDeclContext();
-
- auto symbol = m_session_up->getSymbolById(uid);
- if (!symbol)
- return CompilerDeclContext();
-
- auto decl_context = pdb->GetDeclContextContainingSymbol(*symbol);
- assert(decl_context);
-
- return clang_ast_ctx->CreateDeclContext(decl_context);
-}
-
-void SymbolFilePDB::ParseDeclsForContext(
- lldb_private::CompilerDeclContext decl_ctx) {
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to parse decls for context: {0}");
- return;
- }
-
- auto ts = *type_system_or_err;
- TypeSystemClang *clang_ast_ctx =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_ast_ctx)
- return;
-
- PDBASTParser *pdb = clang_ast_ctx->GetPDBParser();
- if (!pdb)
- return;
-
- pdb->ParseDeclsForDeclContext(
- static_cast<clang::DeclContext *>(decl_ctx.GetOpaqueDeclContext()));
-}
-
-uint32_t
-SymbolFilePDB::ResolveSymbolContext(const lldb_private::Address &so_addr,
- SymbolContextItem resolve_scope,
- lldb_private::SymbolContext &sc) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- uint32_t resolved_flags = 0;
- if (resolve_scope & eSymbolContextCompUnit ||
- resolve_scope & eSymbolContextVariable ||
- resolve_scope & eSymbolContextFunction ||
- resolve_scope & eSymbolContextBlock ||
- resolve_scope & eSymbolContextLineEntry) {
- auto cu_sp = GetCompileUnitContainsAddress(so_addr);
- if (!cu_sp) {
- if (resolved_flags & eSymbolContextVariable) {
- // TODO: Resolve variables
- }
- return 0;
- }
- sc.comp_unit = cu_sp.get();
- resolved_flags |= eSymbolContextCompUnit;
- lldbassert(sc.module_sp == cu_sp->GetModule());
- }
-
- if (resolve_scope & eSymbolContextFunction ||
- resolve_scope & eSymbolContextBlock) {
- addr_t file_vm_addr = so_addr.GetFileAddress();
- auto symbol_up =
- m_session_up->findSymbolByAddress(file_vm_addr, PDB_SymType::Function);
- if (symbol_up) {
- auto *pdb_func = llvm::dyn_cast<PDBSymbolFunc>(symbol_up.get());
- assert(pdb_func);
- auto func_uid = pdb_func->getSymIndexId();
- sc.function = sc.comp_unit->FindFunctionByUID(func_uid).get();
- if (sc.function == nullptr)
- sc.function =
- ParseCompileUnitFunctionForPDBFunc(*pdb_func, *sc.comp_unit);
- if (sc.function) {
- resolved_flags |= eSymbolContextFunction;
- if (resolve_scope & eSymbolContextBlock) {
- auto block_symbol = m_session_up->findSymbolByAddress(
- file_vm_addr, PDB_SymType::Block);
- auto block_id = block_symbol ? block_symbol->getSymIndexId()
- : sc.function->GetID();
- sc.block = sc.function->GetBlock(true).FindBlockByID(block_id);
- if (sc.block)
- resolved_flags |= eSymbolContextBlock;
- }
- }
- }
- }
-
- if (resolve_scope & eSymbolContextLineEntry) {
- if (auto *line_table = sc.comp_unit->GetLineTable()) {
- Address addr(so_addr);
- if (line_table->FindLineEntryByAddress(addr, sc.line_entry))
- resolved_flags |= eSymbolContextLineEntry;
- }
- }
-
- return resolved_flags;
-}
-
-uint32_t SymbolFilePDB::ResolveSymbolContext(
- const lldb_private::SourceLocationSpec &src_location_spec,
- SymbolContextItem resolve_scope, lldb_private::SymbolContextList &sc_list) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- const size_t old_size = sc_list.GetSize();
- const FileSpec &file_spec = src_location_spec.GetFileSpec();
- const uint32_t line = src_location_spec.GetLine().value_or(0);
- if (resolve_scope & lldb::eSymbolContextCompUnit) {
- // Locate all compilation units with line numbers referencing the specified
- // file. For example, if `file_spec` is <vector>, then this should return
- // all source files and header files that reference <vector>, either
- // directly or indirectly.
- auto compilands = m_session_up->findCompilandsForSourceFile(
- file_spec.GetPath(), PDB_NameSearchFlags::NS_CaseInsensitive);
-
- if (!compilands)
- return 0;
-
- // For each one, either find its previously parsed data or parse it afresh
- // and add it to the symbol context list.
- while (auto compiland = compilands->getNext()) {
- // If we're not checking inlines, then don't add line information for
- // this file unless the FileSpec matches. For inline functions, we don't
- // have to match the FileSpec since they could be defined in headers
- // other than file specified in FileSpec.
- if (!src_location_spec.GetCheckInlines()) {
- std::string source_file = compiland->getSourceFileFullPath();
- if (source_file.empty())
- continue;
- FileSpec this_spec(source_file, FileSpec::Style::windows);
- bool need_full_match = !file_spec.GetDirectory().IsEmpty();
- if (FileSpec::Compare(file_spec, this_spec, need_full_match) != 0)
- continue;
- }
-
- SymbolContext sc;
- auto cu = ParseCompileUnitForUID(compiland->getSymIndexId());
- if (!cu)
- continue;
- sc.comp_unit = cu.get();
- sc.module_sp = cu->GetModule();
-
- // If we were asked to resolve line entries, add all entries to the line
- // table that match the requested line (or all lines if `line` == 0).
- if (resolve_scope & (eSymbolContextFunction | eSymbolContextBlock |
- eSymbolContextLineEntry)) {
- bool has_line_table = ParseCompileUnitLineTable(*sc.comp_unit, line);
-
- if ((resolve_scope & eSymbolContextLineEntry) && !has_line_table) {
- // The query asks for line entries, but we can't get them for the
- // compile unit. This is not normal for `line` = 0. So just assert
- // it.
- assert(line && "Couldn't get all line entries!\n");
-
- // Current compiland does not have the requested line. Search next.
- continue;
- }
-
- if (resolve_scope & (eSymbolContextFunction | eSymbolContextBlock)) {
- if (!has_line_table)
- continue;
-
- auto *line_table = sc.comp_unit->GetLineTable();
- lldbassert(line_table);
-
- uint32_t num_line_entries = line_table->GetSize();
- // Skip the terminal line entry.
- --num_line_entries;
-
- // If `line `!= 0, see if we can resolve function for each line entry
- // in the line table.
- for (uint32_t line_idx = 0; line && line_idx < num_line_entries;
- ++line_idx) {
- if (!line_table->GetLineEntryAtIndex(line_idx, sc.line_entry))
- continue;
-
- auto file_vm_addr =
- sc.line_entry.range.GetBaseAddress().GetFileAddress();
- if (file_vm_addr == LLDB_INVALID_ADDRESS || file_vm_addr == 0)
- continue;
-
- auto symbol_up = m_session_up->findSymbolByAddress(
- file_vm_addr, PDB_SymType::Function);
- if (symbol_up) {
- auto func_uid = symbol_up->getSymIndexId();
- sc.function = sc.comp_unit->FindFunctionByUID(func_uid).get();
- if (sc.function == nullptr) {
- auto pdb_func = llvm::dyn_cast<PDBSymbolFunc>(symbol_up.get());
- assert(pdb_func);
- sc.function = ParseCompileUnitFunctionForPDBFunc(*pdb_func,
- *sc.comp_unit);
- }
- if (sc.function && (resolve_scope & eSymbolContextBlock)) {
- Block &block = sc.function->GetBlock(true);
- sc.block = block.FindBlockByID(sc.function->GetID());
- }
- }
- sc_list.Append(sc);
- }
- } else if (has_line_table) {
- // We can parse line table for the compile unit. But no query to
- // resolve function or block. We append `sc` to the list anyway.
- sc_list.Append(sc);
- }
- } else {
- // No query for line entry, function or block. But we have a valid
- // compile unit, append `sc` to the list.
- sc_list.Append(sc);
- }
- }
- }
- return sc_list.GetSize() - old_size;
-}
-
-std::string SymbolFilePDB::GetMangledForPDBData(const PDBSymbolData &pdb_data) {
- // Cache public names at first
- if (m_public_names.empty())
- if (auto result_up =
- m_global_scope_up->findAllChildren(PDB_SymType::PublicSymbol))
- while (auto symbol_up = result_up->getNext())
- if (auto addr = symbol_up->getRawSymbol().getVirtualAddress())
- m_public_names[addr] = symbol_up->getRawSymbol().getName();
-
- // Look up the name in the cache
- return m_public_names.lookup(pdb_data.getVirtualAddress());
-}
-
-VariableSP SymbolFilePDB::ParseVariableForPDBData(
- const lldb_private::SymbolContext &sc,
- const llvm::pdb::PDBSymbolData &pdb_data) {
- VariableSP var_sp;
- uint32_t var_uid = pdb_data.getSymIndexId();
- auto result = m_variables.find(var_uid);
- if (result != m_variables.end())
- return result->second;
-
- ValueType scope = eValueTypeInvalid;
- bool is_static_member = false;
- bool is_external = false;
- bool is_artificial = false;
-
- switch (pdb_data.getDataKind()) {
- case PDB_DataKind::Global:
- scope = eValueTypeVariableGlobal;
- is_external = true;
- break;
- case PDB_DataKind::Local:
- scope = eValueTypeVariableLocal;
- break;
- case PDB_DataKind::FileStatic:
- scope = eValueTypeVariableStatic;
- break;
- case PDB_DataKind::StaticMember:
- is_static_member = true;
- scope = eValueTypeVariableStatic;
- break;
- case PDB_DataKind::Member:
- scope = eValueTypeVariableStatic;
- break;
- case PDB_DataKind::Param:
- scope = eValueTypeVariableArgument;
- break;
- case PDB_DataKind::Constant:
- scope = eValueTypeConstResult;
- break;
- default:
- break;
- }
-
- switch (pdb_data.getLocationType()) {
- case PDB_LocType::TLS:
- scope = eValueTypeVariableThreadLocal;
- break;
- case PDB_LocType::RegRel: {
- // It is a `this` pointer.
- if (pdb_data.getDataKind() == PDB_DataKind::ObjectPtr) {
- scope = eValueTypeVariableArgument;
- is_artificial = true;
- }
- } break;
- default:
- break;
- }
-
- Declaration decl;
- if (!is_artificial && !pdb_data.isCompilerGenerated()) {
- if (auto lines = pdb_data.getLineNumbers()) {
- if (auto first_line = lines->getNext()) {
- uint32_t src_file_id = first_line->getSourceFileId();
- auto src_file = m_session_up->getSourceFileById(src_file_id);
- if (src_file) {
- FileSpec spec(src_file->getFileName());
- decl.SetFile(spec);
- decl.SetColumn(first_line->getColumnNumber());
- decl.SetLine(first_line->getLineNumber());
- }
- }
- }
- }
-
- Variable::RangeList ranges;
- SymbolContextScope *context_scope = sc.comp_unit;
- if (scope == eValueTypeVariableLocal || scope == eValueTypeVariableArgument) {
- if (sc.function) {
- Block &function_block = sc.function->GetBlock(true);
- Block *block =
- function_block.FindBlockByID(pdb_data.getLexicalParentId());
- if (!block)
- block = &function_block;
-
- context_scope = block;
-
- for (size_t i = 0, num_ranges = block->GetNumRanges(); i < num_ranges;
- ++i) {
- AddressRange range;
- if (!block->GetRangeAtIndex(i, range))
- continue;
-
- ranges.Append(range.GetBaseAddress().GetFileAddress(),
- range.GetByteSize());
- }
- }
- }
-
- SymbolFileTypeSP type_sp =
- std::make_shared<SymbolFileType>(*this, pdb_data.getTypeId());
-
- auto var_name = pdb_data.getName();
- auto mangled = GetMangledForPDBData(pdb_data);
- auto mangled_cstr = mangled.empty() ? nullptr : mangled.c_str();
-
- bool is_constant;
- ModuleSP module_sp = GetObjectFile()->GetModule();
- DWARFExpressionList location(module_sp,
- ConvertPDBLocationToDWARFExpression(
- module_sp, pdb_data, ranges, is_constant),
- nullptr);
-
- var_sp = std::make_shared<Variable>(
- var_uid, var_name.c_str(), mangled_cstr, type_sp, scope, context_scope,
- ranges, &decl, location, is_external, is_artificial, is_constant,
- is_static_member);
-
- m_variables.insert(std::make_pair(var_uid, var_sp));
- return var_sp;
-}
-
-size_t
-SymbolFilePDB::ParseVariables(const lldb_private::SymbolContext &sc,
- const llvm::pdb::PDBSymbol &pdb_symbol,
- lldb_private::VariableList *variable_list) {
- size_t num_added = 0;
-
- if (auto pdb_data = llvm::dyn_cast<PDBSymbolData>(&pdb_symbol)) {
- VariableListSP local_variable_list_sp;
-
- auto result = m_variables.find(pdb_data->getSymIndexId());
- if (result != m_variables.end()) {
- if (variable_list)
- variable_list->AddVariableIfUnique(result->second);
- } else {
- // Prepare right VariableList for this variable.
- if (auto lexical_parent = pdb_data->getLexicalParent()) {
- switch (lexical_parent->getSymTag()) {
- case PDB_SymType::Exe:
- assert(sc.comp_unit);
- [[fallthrough]];
- case PDB_SymType::Compiland: {
- if (sc.comp_unit) {
- local_variable_list_sp = sc.comp_unit->GetVariableList(false);
- if (!local_variable_list_sp) {
- local_variable_list_sp = std::make_shared<VariableList>();
- sc.comp_unit->SetVariableList(local_variable_list_sp);
- }
- }
- } break;
- case PDB_SymType::Block:
- case PDB_SymType::Function: {
- if (sc.function) {
- Block *block = sc.function->GetBlock(true).FindBlockByID(
- lexical_parent->getSymIndexId());
- if (block) {
- local_variable_list_sp = block->GetBlockVariableList(false);
- if (!local_variable_list_sp) {
- local_variable_list_sp = std::make_shared<VariableList>();
- block->SetVariableList(local_variable_list_sp);
- }
- }
- }
- } break;
- default:
- break;
- }
- }
-
- if (local_variable_list_sp) {
- if (auto var_sp = ParseVariableForPDBData(sc, *pdb_data)) {
- local_variable_list_sp->AddVariableIfUnique(var_sp);
- if (variable_list)
- variable_list->AddVariableIfUnique(var_sp);
- ++num_added;
- PDBASTParser *ast = GetPDBAstParser();
- if (ast)
- ast->GetDeclForSymbol(*pdb_data);
- }
- }
- }
- }
-
- if (auto results = pdb_symbol.findAllChildren()) {
- while (auto result = results->getNext())
- num_added += ParseVariables(sc, *result, variable_list);
- }
-
- return num_added;
-}
-
-void SymbolFilePDB::FindGlobalVariables(
- lldb_private::ConstString name, const CompilerDeclContext &parent_decl_ctx,
- uint32_t max_matches, lldb_private::VariableList &variables) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
- return;
- if (name.IsEmpty())
- return;
-
- auto results = m_global_scope_up->findAllChildren<PDBSymbolData>();
- if (!results)
- return;
-
- uint32_t matches = 0;
- size_t old_size = variables.GetSize();
- while (auto result = results->getNext()) {
- auto pdb_data = llvm::dyn_cast<PDBSymbolData>(result.get());
- if (max_matches > 0 && matches >= max_matches)
- break;
-
- SymbolContext sc;
- sc.module_sp = m_objfile_sp->GetModule();
- lldbassert(sc.module_sp.get());
-
- if (name.GetStringRef() !=
- MSVCUndecoratedNameParser::DropScope(pdb_data->getName()))
- continue;
-
- sc.comp_unit = ParseCompileUnitForUID(GetCompilandId(*pdb_data)).get();
- // FIXME: We are not able to determine the compile unit.
- if (sc.comp_unit == nullptr)
- continue;
-
- if (parent_decl_ctx.IsValid() &&
- GetDeclContextContainingUID(result->getSymIndexId()) != parent_decl_ctx)
- continue;
-
- ParseVariables(sc, *pdb_data, &variables);
- matches = variables.GetSize() - old_size;
- }
-}
-
-void SymbolFilePDB::FindGlobalVariables(
- const lldb_private::RegularExpression ®ex, uint32_t max_matches,
- lldb_private::VariableList &variables) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- if (!regex.IsValid())
- return;
- auto results = m_global_scope_up->findAllChildren<PDBSymbolData>();
- if (!results)
- return;
-
- uint32_t matches = 0;
- size_t old_size = variables.GetSize();
- while (auto pdb_data = results->getNext()) {
- if (max_matches > 0 && matches >= max_matches)
- break;
-
- auto var_name = pdb_data->getName();
- if (var_name.empty())
- continue;
- if (!regex.Execute(var_name))
- continue;
- SymbolContext sc;
- sc.module_sp = m_objfile_sp->GetModule();
- lldbassert(sc.module_sp.get());
-
- sc.comp_unit = ParseCompileUnitForUID(GetCompilandId(*pdb_data)).get();
- // FIXME: We are not able to determine the compile unit.
- if (sc.comp_unit == nullptr)
- continue;
-
- ParseVariables(sc, *pdb_data, &variables);
- matches = variables.GetSize() - old_size;
- }
-}
-
-bool SymbolFilePDB::ResolveFunction(const llvm::pdb::PDBSymbolFunc &pdb_func,
- bool include_inlines,
- lldb_private::SymbolContextList &sc_list) {
- lldb_private::SymbolContext sc;
- sc.comp_unit = ParseCompileUnitForUID(pdb_func.getCompilandId()).get();
- if (!sc.comp_unit)
- return false;
- sc.module_sp = sc.comp_unit->GetModule();
- sc.function = ParseCompileUnitFunctionForPDBFunc(pdb_func, *sc.comp_unit);
- if (!sc.function)
- return false;
-
- sc_list.Append(sc);
- return true;
-}
-
-bool SymbolFilePDB::ResolveFunction(uint32_t uid, bool include_inlines,
- lldb_private::SymbolContextList &sc_list) {
- auto pdb_func_up = m_session_up->getConcreteSymbolById<PDBSymbolFunc>(uid);
- if (!pdb_func_up && !(include_inlines && pdb_func_up->hasInlineAttribute()))
- return false;
- return ResolveFunction(*pdb_func_up, include_inlines, sc_list);
-}
-
-void SymbolFilePDB::CacheFunctionNames() {
- if (!m_func_full_names.IsEmpty())
- return;
-
- std::map<uint64_t, uint32_t> addr_ids;
-
- if (auto results_up = m_global_scope_up->findAllChildren<PDBSymbolFunc>()) {
- while (auto pdb_func_up = results_up->getNext()) {
- if (pdb_func_up->isCompilerGenerated())
- continue;
-
- auto name = pdb_func_up->getName();
- auto demangled_name = pdb_func_up->getUndecoratedName();
- if (name.empty() && demangled_name.empty())
- continue;
-
- auto uid = pdb_func_up->getSymIndexId();
- if (!demangled_name.empty() && pdb_func_up->getVirtualAddress())
- addr_ids.insert(std::make_pair(pdb_func_up->getVirtualAddress(), uid));
-
- if (auto parent = pdb_func_up->getClassParent()) {
-
- // PDB have symbols for class/struct methods or static methods in Enum
- // Class. We won't bother to check if the parent is UDT or Enum here.
- m_func_method_names.Append(ConstString(name), uid);
-
- // To search a method name, like NS::Class:MemberFunc, LLDB searches
- // its base name, i.e. MemberFunc by default. Since PDBSymbolFunc does
- // not have information of this, we extract base names and cache them
- // by our own effort.
- llvm::StringRef basename = MSVCUndecoratedNameParser::DropScope(name);
- if (!basename.empty())
- m_func_base_names.Append(ConstString(basename), uid);
- else {
- m_func_base_names.Append(ConstString(name), uid);
- }
-
- if (!demangled_name.empty())
- m_func_full_names.Append(ConstString(demangled_name), uid);
-
- } else {
- // Handle not-method symbols.
-
- // The function name might contain namespace, or its lexical scope.
- llvm::StringRef basename = MSVCUndecoratedNameParser::DropScope(name);
- if (!basename.empty())
- m_func_base_names.Append(ConstString(basename), uid);
- else
- m_func_base_names.Append(ConstString(name), uid);
-
- if (name == "main") {
- m_func_full_names.Append(ConstString(name), uid);
-
- if (!demangled_name.empty() && name != demangled_name) {
- m_func_full_names.Append(ConstString(demangled_name), uid);
- m_func_base_names.Append(ConstString(demangled_name), uid);
- }
- } else if (!demangled_name.empty()) {
- m_func_full_names.Append(ConstString(demangled_name), uid);
- } else {
- m_func_full_names.Append(ConstString(name), uid);
- }
- }
- }
- }
-
- if (auto results_up =
- m_global_scope_up->findAllChildren<PDBSymbolPublicSymbol>()) {
- while (auto pub_sym_up = results_up->getNext()) {
- if (!pub_sym_up->isFunction())
- continue;
- auto name = pub_sym_up->getName();
- if (name.empty())
- continue;
-
- if (CPlusPlusLanguage::IsCPPMangledName(name.c_str())) {
- // PDB public symbol has mangled name for its associated function.
- if (auto vm_addr = pub_sym_up->getVirtualAddress()) {
- if (auto it = addr_ids.find(vm_addr); it != addr_ids.end())
- // Cache mangled name.
- m_func_full_names.Append(ConstString(name), it->second);
- }
- }
- }
- }
- // Sort them before value searching is working properly
- m_func_full_names.Sort();
- m_func_full_names.SizeToFit();
- m_func_method_names.Sort();
- m_func_method_names.SizeToFit();
- m_func_base_names.Sort();
- m_func_base_names.SizeToFit();
-}
-
-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) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- ConstString name = lookup_info.GetLookupName();
- FunctionNameType name_type_mask = lookup_info.GetNameTypeMask();
- lldbassert((name_type_mask & eFunctionNameTypeAuto) == 0);
-
- if (name_type_mask & eFunctionNameTypeFull)
- name = lookup_info.GetName();
-
- if (name_type_mask == eFunctionNameTypeNone)
- return;
- if (!DeclContextMatchesThisSymbolFile(parent_decl_ctx))
- return;
- if (name.IsEmpty())
- return;
-
- if (name_type_mask & eFunctionNameTypeFull ||
- name_type_mask & eFunctionNameTypeBase ||
- name_type_mask & eFunctionNameTypeMethod) {
- CacheFunctionNames();
-
- std::set<uint32_t> resolved_ids;
- auto ResolveFn = [this, &name, parent_decl_ctx, include_inlines, &sc_list,
- &resolved_ids](UniqueCStringMap<uint32_t> &Names) {
- std::vector<uint32_t> ids;
- if (!Names.GetValues(name, ids))
- return;
-
- for (uint32_t id : ids) {
- if (resolved_ids.find(id) != resolved_ids.end())
- continue;
-
- if (parent_decl_ctx.IsValid() &&
- GetDeclContextContainingUID(id) != parent_decl_ctx)
- continue;
-
- if (ResolveFunction(id, include_inlines, sc_list))
- resolved_ids.insert(id);
- }
- };
- if (name_type_mask & eFunctionNameTypeFull) {
- ResolveFn(m_func_full_names);
- ResolveFn(m_func_base_names);
- ResolveFn(m_func_method_names);
- }
- if (name_type_mask & eFunctionNameTypeBase)
- ResolveFn(m_func_base_names);
- if (name_type_mask & eFunctionNameTypeMethod)
- ResolveFn(m_func_method_names);
- }
-}
-
-void SymbolFilePDB::FindFunctions(const lldb_private::RegularExpression ®ex,
- bool include_inlines,
- lldb_private::SymbolContextList &sc_list) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- if (!regex.IsValid())
- return;
-
- CacheFunctionNames();
-
- std::set<uint32_t> resolved_ids;
- auto ResolveFn = [®ex, include_inlines, &sc_list, &resolved_ids,
- this](UniqueCStringMap<uint32_t> &Names) {
- std::vector<uint32_t> ids;
- if (Names.GetValues(regex, ids)) {
- for (auto id : ids) {
- if (resolved_ids.find(id) == resolved_ids.end())
- if (ResolveFunction(id, include_inlines, sc_list))
- resolved_ids.insert(id);
- }
- }
- };
- ResolveFn(m_func_full_names);
- ResolveFn(m_func_base_names);
-}
-
-void SymbolFilePDB::GetMangledNamesForFunction(
- const std::string &scope_qualified_name,
- std::vector<lldb_private::ConstString> &mangled_names) {}
-
-void SymbolFilePDB::AddSymbols(lldb_private::Symtab &symtab) {
- std::set<lldb::addr_t> sym_addresses;
- for (size_t i = 0; i < symtab.GetNumSymbols(); i++)
- sym_addresses.insert(symtab.SymbolAtIndex(i)->GetFileAddress());
-
- auto results = m_global_scope_up->findAllChildren<PDBSymbolPublicSymbol>();
- if (!results)
- return;
-
- auto section_list = m_objfile_sp->GetSectionList();
- if (!section_list)
- return;
-
- while (auto pub_symbol = results->getNext()) {
- auto section_id = pub_symbol->getAddressSection();
-
- auto section = section_list->FindSectionByID(section_id);
- if (!section)
- continue;
-
- auto offset = pub_symbol->getAddressOffset();
-
- auto file_addr = section->GetFileAddress() + offset;
- if (sym_addresses.find(file_addr) != sym_addresses.end())
- continue;
- sym_addresses.insert(file_addr);
-
- auto size = pub_symbol->getLength();
- symtab.AddSymbol(
- Symbol(pub_symbol->getSymIndexId(), // symID
- pub_symbol->getName().c_str(), // name
- pub_symbol->isCode() ? eSymbolTypeCode : eSymbolTypeData, // type
- true, // external
- false, // is_debug
- false, // is_trampoline
- false, // is_artificial
- section, // section_sp
- offset, // value
- size, // size
- size != 0, // size_is_valid
- false, // contains_linker_annotations
- 0 // flags
- ));
- }
-
- symtab.Finalize();
-}
-
-void SymbolFilePDB::DumpClangAST(Stream &s) {
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to dump ClangAST: {0}");
- return;
- }
-
- auto ts = *type_system_or_err;
- TypeSystemClang *clang_type_system =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_type_system)
- return;
- clang_type_system->Dump(s.AsRawOstream());
-}
-
-void SymbolFilePDB::FindTypesByRegex(
- const lldb_private::RegularExpression ®ex, uint32_t max_matches,
- lldb_private::TypeMap &types) {
- // When searching by regex, we need to go out of our way to limit the search
- // space as much as possible since this searches EVERYTHING in the PDB,
- // manually doing regex comparisons. PDB library isn't optimized for regex
- // searches or searches across multiple symbol types at the same time, so the
- // best we can do is to search enums, then typedefs, then classes one by one,
- // and do a regex comparison against each of them.
- PDB_SymType tags_to_search[] = {PDB_SymType::Enum, PDB_SymType::Typedef,
- PDB_SymType::UDT};
- std::unique_ptr<IPDBEnumSymbols> results;
-
- uint32_t matches = 0;
-
- for (auto tag : tags_to_search) {
- results = m_global_scope_up->findAllChildren(tag);
- if (!results)
- continue;
-
- while (auto result = results->getNext()) {
- if (max_matches > 0 && matches >= max_matches)
- break;
-
- std::string type_name;
- if (auto enum_type = llvm::dyn_cast<PDBSymbolTypeEnum>(result.get()))
- type_name = enum_type->getName();
- else if (auto typedef_type =
- llvm::dyn_cast<PDBSymbolTypeTypedef>(result.get()))
- type_name = typedef_type->getName();
- else if (auto class_type = llvm::dyn_cast<PDBSymbolTypeUDT>(result.get()))
- type_name = class_type->getName();
- else {
- // We're looking only for types that have names. Skip symbols, as well
- // as unnamed types such as arrays, pointers, etc.
- continue;
- }
-
- if (!regex.Execute(type_name))
- continue;
-
- // This should cause the type to get cached and stored in the `m_types`
- // lookup.
- if (!ResolveTypeUID(result->getSymIndexId()))
- continue;
-
- auto iter = m_types.find(result->getSymIndexId());
- if (iter == m_types.end())
- continue;
- types.Insert(iter->second);
- ++matches;
- }
- }
-}
-
-void SymbolFilePDB::FindTypes(const lldb_private::TypeQuery &query,
- lldb_private::TypeResults &type_results) {
-
- // Make sure we haven't already searched this SymbolFile before.
- if (type_results.AlreadySearched(this))
- return;
-
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
-
- std::unique_ptr<IPDBEnumSymbols> results;
- llvm::StringRef basename = query.GetTypeBasename().GetStringRef();
- if (basename.empty())
- return;
- results = m_global_scope_up->findAllChildren(PDB_SymType::None);
- if (!results)
- return;
-
- while (auto result = results->getNext()) {
-
- switch (result->getSymTag()) {
- case PDB_SymType::Enum:
- case PDB_SymType::UDT:
- case PDB_SymType::Typedef:
- break;
- default:
- // We're looking only for types that have names. Skip symbols, as well
- // as unnamed types such as arrays, pointers, etc.
- continue;
- }
-
- if (MSVCUndecoratedNameParser::DropScope(
- result->getRawSymbol().getName()) != basename)
- continue;
-
- // This should cause the type to get cached and stored in the `m_types`
- // lookup.
- if (!ResolveTypeUID(result->getSymIndexId()))
- continue;
-
- auto iter = m_types.find(result->getSymIndexId());
- if (iter == m_types.end())
- continue;
- // We resolved a type. Get the fully qualified name to ensure it matches.
- ConstString name = iter->second->GetQualifiedName();
- TypeQuery type_match(name.GetStringRef(), TypeQueryOptions::e_exact_match);
- if (query.ContextMatches(type_match.GetContextRef())) {
- type_results.InsertUnique(iter->second);
- if (type_results.Done(query))
- return;
- }
- }
-}
-
-void SymbolFilePDB::GetTypesForPDBSymbol(const llvm::pdb::PDBSymbol &pdb_symbol,
- uint32_t type_mask,
- TypeCollection &type_collection) {
- bool can_parse = false;
- switch (pdb_symbol.getSymTag()) {
- case PDB_SymType::ArrayType:
- can_parse = ((type_mask & eTypeClassArray) != 0);
- break;
- case PDB_SymType::BuiltinType:
- can_parse = ((type_mask & eTypeClassBuiltin) != 0);
- break;
- case PDB_SymType::Enum:
- can_parse = ((type_mask & eTypeClassEnumeration) != 0);
- break;
- case PDB_SymType::Function:
- case PDB_SymType::FunctionSig:
- can_parse = ((type_mask & eTypeClassFunction) != 0);
- break;
- case PDB_SymType::PointerType:
- can_parse = ((type_mask & (eTypeClassPointer | eTypeClassBlockPointer |
- eTypeClassMemberPointer)) != 0);
- break;
- case PDB_SymType::Typedef:
- can_parse = ((type_mask & eTypeClassTypedef) != 0);
- break;
- case PDB_SymType::UDT: {
- auto *udt = llvm::dyn_cast<PDBSymbolTypeUDT>(&pdb_symbol);
- assert(udt);
- can_parse = (udt->getUdtKind() != PDB_UdtType::Interface &&
- ((type_mask & (eTypeClassClass | eTypeClassStruct |
- eTypeClassUnion)) != 0));
- } break;
- default:
- break;
- }
-
- if (can_parse) {
- if (auto *type = ResolveTypeUID(pdb_symbol.getSymIndexId())) {
- if (!llvm::is_contained(type_collection, type))
- type_collection.push_back(type);
- }
- }
-
- auto results_up = pdb_symbol.findAllChildren();
- while (auto symbol_up = results_up->getNext())
- GetTypesForPDBSymbol(*symbol_up, type_mask, type_collection);
-}
-
-void SymbolFilePDB::GetTypes(lldb_private::SymbolContextScope *sc_scope,
- TypeClass type_mask,
- lldb_private::TypeList &type_list) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- TypeCollection type_collection;
- CompileUnit *cu =
- sc_scope ? sc_scope->CalculateSymbolContextCompileUnit() : nullptr;
- if (cu) {
- auto compiland_up = GetPDBCompilandByUID(cu->GetID());
- if (!compiland_up)
- return;
- GetTypesForPDBSymbol(*compiland_up, type_mask, type_collection);
- } else {
- for (uint32_t cu_idx = 0; cu_idx < GetNumCompileUnits(); ++cu_idx) {
- auto cu_sp = ParseCompileUnitAtIndex(cu_idx);
- if (cu_sp) {
- if (auto compiland_up = GetPDBCompilandByUID(cu_sp->GetID()))
- GetTypesForPDBSymbol(*compiland_up, type_mask, type_collection);
- }
- }
- }
-
- for (auto type : type_collection) {
- type->GetForwardCompilerType();
- type_list.Insert(type->shared_from_this());
- }
-}
-
-llvm::Expected<lldb::TypeSystemSP>
-SymbolFilePDB::GetTypeSystemForLanguage(lldb::LanguageType language) {
- auto type_system_or_err =
- m_objfile_sp->GetModule()->GetTypeSystemForLanguage(language);
- if (type_system_or_err) {
- if (auto ts = *type_system_or_err)
- ts->SetSymbolFile(this);
- }
- return type_system_or_err;
-}
-
-PDBASTParser *SymbolFilePDB::GetPDBAstParser() {
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to get PDB AST parser: {0}");
- return nullptr;
- }
-
- auto ts = *type_system_or_err;
- auto *clang_type_system =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_type_system)
- return nullptr;
-
- return clang_type_system->GetPDBParser();
-}
-
-lldb_private::CompilerDeclContext
-SymbolFilePDB::FindNamespace(lldb_private::ConstString name,
- const CompilerDeclContext &parent_decl_ctx, bool) {
- std::lock_guard<std::recursive_mutex> guard(GetModuleMutex());
- auto type_system_or_err =
- GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to find namespace {1}: {0}", name.AsCString());
- return CompilerDeclContext();
- }
- auto ts = *type_system_or_err;
- auto *clang_type_system =
- llvm::dyn_cast_or_null<TypeSystemClang>(ts.get());
- if (!clang_type_system)
- return CompilerDeclContext();
-
- PDBASTParser *pdb = clang_type_system->GetPDBParser();
- if (!pdb)
- return CompilerDeclContext();
-
- clang::DeclContext *decl_context = nullptr;
- if (parent_decl_ctx)
- decl_context = static_cast<clang::DeclContext *>(
- parent_decl_ctx.GetOpaqueDeclContext());
-
- auto namespace_decl =
- pdb->FindNamespaceDecl(decl_context, name.GetStringRef());
- if (!namespace_decl)
- return CompilerDeclContext();
-
- return clang_type_system->CreateDeclContext(namespace_decl);
-}
-
-IPDBSession &SymbolFilePDB::GetPDBSession() { return *m_session_up; }
-
-const IPDBSession &SymbolFilePDB::GetPDBSession() const {
- return *m_session_up;
-}
-
-lldb::CompUnitSP SymbolFilePDB::ParseCompileUnitForUID(uint32_t id,
- uint32_t index) {
- auto found_cu = m_comp_units.find(id);
- if (found_cu != m_comp_units.end())
- return found_cu->second;
-
- auto compiland_up = GetPDBCompilandByUID(id);
- if (!compiland_up)
- return CompUnitSP();
-
- lldb::LanguageType lang;
- auto details = compiland_up->findOneChild<PDBSymbolCompilandDetails>();
- if (!details)
- lang = lldb::eLanguageTypeC_plus_plus;
- else
- lang = TranslateLanguage(details->getLanguage());
-
- if (lang == lldb::LanguageType::eLanguageTypeUnknown)
- return CompUnitSP();
-
- std::string path = compiland_up->getSourceFileFullPath();
- if (path.empty())
- return CompUnitSP();
-
- // Don't support optimized code for now, DebugInfoPDB does not return this
- // information.
- LazyBool optimized = eLazyBoolNo;
- auto cu_sp = std::make_shared<CompileUnit>(m_objfile_sp->GetModule(), nullptr,
- path.c_str(), id, lang, optimized);
-
- if (!cu_sp)
- return CompUnitSP();
-
- m_comp_units.insert(std::make_pair(id, cu_sp));
- if (index == UINT32_MAX)
- GetCompileUnitIndex(*compiland_up, index);
- lldbassert(index != UINT32_MAX);
- SetCompileUnitAtIndex(index, cu_sp);
- return cu_sp;
-}
-
-bool SymbolFilePDB::ParseCompileUnitLineTable(CompileUnit &comp_unit,
- uint32_t match_line) {
- auto compiland_up = GetPDBCompilandByUID(comp_unit.GetID());
- if (!compiland_up)
- return false;
-
- // LineEntry needs the *index* of the file into the list of support files
- // returned by ParseCompileUnitSupportFiles. But the underlying SDK gives us
- // a globally unique idenfitifier in the namespace of the PDB. So, we have
- // to do a mapping so that we can hand out indices.
- llvm::DenseMap<uint32_t, uint32_t> index_map;
- BuildSupportFileIdToSupportFileIndexMap(*compiland_up, index_map);
- auto line_table = std::make_unique<LineTable>(&comp_unit);
-
- // Find contributions to `compiland` from all source and header files.
- auto files = m_session_up->getSourceFilesForCompiland(*compiland_up);
- if (!files)
- return false;
-
- // For each source and header file, create a LineSequence for contributions
- // to the compiland from that file, and add the sequence.
- while (auto file = files->getNext()) {
- std::unique_ptr<LineSequence> sequence(
- line_table->CreateLineSequenceContainer());
- auto lines = m_session_up->findLineNumbers(*compiland_up, *file);
- if (!lines)
- continue;
- int entry_count = lines->getChildCount();
-
- uint64_t prev_addr;
- uint32_t prev_length;
- uint32_t prev_line;
- uint32_t prev_source_idx;
-
- for (int i = 0; i < entry_count; ++i) {
- auto line = lines->getChildAtIndex(i);
-
- uint64_t lno = line->getLineNumber();
- uint64_t addr = line->getVirtualAddress();
- uint32_t length = line->getLength();
- uint32_t source_id = line->getSourceFileId();
- uint32_t col = line->getColumnNumber();
- uint32_t source_idx = index_map[source_id];
-
- // There was a gap between the current entry and the previous entry if
- // the addresses don't perfectly line up.
- bool is_gap = (i > 0) && (prev_addr + prev_length < addr);
-
- // Before inserting the current entry, insert a terminal entry at the end
- // of the previous entry's address range if the current entry resulted in
- // a gap from the previous entry.
- if (is_gap && ShouldAddLine(match_line, prev_line, prev_length)) {
- line_table->AppendLineEntryToSequence(
- sequence.get(), prev_addr + prev_length, prev_line, 0,
- prev_source_idx, false, false, false, false, true);
-
- line_table->InsertSequence(sequence.get());
- sequence = line_table->CreateLineSequenceContainer();
- }
-
- if (ShouldAddLine(match_line, lno, length)) {
- bool is_statement = line->isStatement();
- bool is_prologue = false;
- bool is_epilogue = false;
- auto func =
- m_session_up->findSymbolByAddress(addr, PDB_SymType::Function);
- if (func) {
- auto prologue = func->findOneChild<PDBSymbolFuncDebugStart>();
- if (prologue)
- is_prologue = (addr == prologue->getVirtualAddress());
-
- auto epilogue = func->findOneChild<PDBSymbolFuncDebugEnd>();
- if (epilogue)
- is_epilogue = (addr == epilogue->getVirtualAddress());
- }
-
- line_table->AppendLineEntryToSequence(sequence.get(), addr, lno, col,
- source_idx, is_statement, false,
- is_prologue, is_epilogue, false);
- }
-
- prev_addr = addr;
- prev_length = length;
- prev_line = lno;
- prev_source_idx = source_idx;
- }
-
- if (entry_count > 0 && ShouldAddLine(match_line, prev_line, prev_length)) {
- // The end is always a terminal entry, so insert it regardless.
- line_table->AppendLineEntryToSequence(
- sequence.get(), prev_addr + prev_length, prev_line, 0,
- prev_source_idx, false, false, false, false, true);
- }
-
- line_table->InsertSequence(sequence.get());
- }
-
- if (line_table->GetSize()) {
- comp_unit.SetLineTable(line_table.release());
- return true;
- }
- return false;
-}
-
-void SymbolFilePDB::BuildSupportFileIdToSupportFileIndexMap(
- const PDBSymbolCompiland &compiland,
- llvm::DenseMap<uint32_t, uint32_t> &index_map) const {
- // This is a hack, but we need to convert the source id into an index into
- // the support files array. We don't want to do path comparisons to avoid
- // basename / full path issues that may or may not even be a problem, so we
- // use the globally unique source file identifiers. Ideally we could use the
- // global identifiers everywhere, but LineEntry currently assumes indices.
- auto source_files = m_session_up->getSourceFilesForCompiland(compiland);
- if (!source_files)
- return;
-
- int index = 0;
- while (auto file = source_files->getNext()) {
- uint32_t source_id = file->getUniqueId();
- index_map[source_id] = index++;
- }
-}
-
-lldb::CompUnitSP SymbolFilePDB::GetCompileUnitContainsAddress(
- const lldb_private::Address &so_addr) {
- lldb::addr_t file_vm_addr = so_addr.GetFileAddress();
- if (file_vm_addr == LLDB_INVALID_ADDRESS || file_vm_addr == 0)
- return nullptr;
-
- // If it is a PDB function's vm addr, this is the first sure bet.
- if (auto lines =
- m_session_up->findLineNumbersByAddress(file_vm_addr, /*Length=*/1)) {
- if (auto first_line = lines->getNext())
- return ParseCompileUnitForUID(first_line->getCompilandId());
- }
-
- // Otherwise we resort to section contributions.
- if (auto sec_contribs = m_session_up->getSectionContribs()) {
- while (auto section = sec_contribs->getNext()) {
- auto va = section->getVirtualAddress();
- if (file_vm_addr >= va && file_vm_addr < va + section->getLength())
- return ParseCompileUnitForUID(section->getCompilandId());
- }
- }
- return nullptr;
-}
-
-Mangled
-SymbolFilePDB::GetMangledForPDBFunc(const llvm::pdb::PDBSymbolFunc &pdb_func) {
- Mangled mangled;
- auto func_name = pdb_func.getName();
- auto func_undecorated_name = pdb_func.getUndecoratedName();
- std::string func_decorated_name;
-
- // Seek from public symbols for non-static function's decorated name if any.
- // For static functions, they don't have undecorated names and aren't exposed
- // in Public Symbols either.
- if (!func_undecorated_name.empty()) {
- auto result_up = m_global_scope_up->findChildren(
- PDB_SymType::PublicSymbol, func_undecorated_name,
- PDB_NameSearchFlags::NS_UndecoratedName);
- if (result_up) {
- while (auto symbol_up = result_up->getNext()) {
- // For a public symbol, it is unique.
- lldbassert(result_up->getChildCount() == 1);
- if (auto *pdb_public_sym =
- llvm::dyn_cast_or_null<PDBSymbolPublicSymbol>(
- symbol_up.get())) {
- if (pdb_public_sym->isFunction()) {
- func_decorated_name = pdb_public_sym->getName();
- break;
- }
- }
- }
- }
- }
- if (!func_decorated_name.empty()) {
- mangled.SetMangledName(ConstString(func_decorated_name));
-
- // For MSVC, format of C function's decorated name depends on calling
- // convention. Unfortunately none of the format is recognized by current
- // LLDB. For example, `_purecall` is a __cdecl C function. From PDB,
- // `__purecall` is retrieved as both its decorated and undecorated name
- // (using PDBSymbolFunc::getUndecoratedName method). However `__purecall`
- // string is not treated as mangled in LLDB (neither `?` nor `_Z` prefix).
- // Mangled::GetDemangledName method will fail internally and caches an
- // empty string as its undecorated name. So we will face a contradiction
- // here for the same symbol:
- // non-empty undecorated name from PDB
- // empty undecorated name from LLDB
- if (!func_undecorated_name.empty() && mangled.GetDemangledName().IsEmpty())
- mangled.SetDemangledName(ConstString(func_undecorated_name));
-
- // LLDB uses several flags to control how a C++ decorated name is
- // undecorated for MSVC. See `safeUndecorateName` in Class Mangled. So the
- // yielded name could be different from what we retrieve from
- // PDB source unless we also apply same flags in getting undecorated
- // name through PDBSymbolFunc::getUndecoratedNameEx method.
- if (!func_undecorated_name.empty() &&
- mangled.GetDemangledName() != ConstString(func_undecorated_name))
- mangled.SetDemangledName(ConstString(func_undecorated_name));
- } else if (!func_undecorated_name.empty()) {
- mangled.SetDemangledName(ConstString(func_undecorated_name));
- } else if (!func_name.empty())
- mangled.SetValue(ConstString(func_name));
-
- return mangled;
-}
-
-bool SymbolFilePDB::DeclContextMatchesThisSymbolFile(
- const lldb_private::CompilerDeclContext &decl_ctx) {
- if (!decl_ctx.IsValid())
- return true;
-
- TypeSystem *decl_ctx_type_system = decl_ctx.GetTypeSystem();
- if (!decl_ctx_type_system)
- return false;
- auto type_system_or_err = GetTypeSystemForLanguage(
- decl_ctx_type_system->GetMinimumLanguage(nullptr));
- if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(
- GetLog(LLDBLog::Symbols), std::move(err),
- "Unable to determine if DeclContext matches this symbol file: {0}");
- return false;
- }
-
- if (decl_ctx_type_system == type_system_or_err->get())
- return true; // The type systems match, return true
-
- return false;
-}
-
-uint32_t SymbolFilePDB::GetCompilandId(const llvm::pdb::PDBSymbolData &data) {
- static const auto pred_upper = [](uint32_t lhs, SecContribInfo rhs) {
- return lhs < rhs.Offset;
- };
-
- // Cache section contributions
- if (m_sec_contribs.empty()) {
- if (auto SecContribs = m_session_up->getSectionContribs()) {
- while (auto SectionContrib = SecContribs->getNext()) {
- auto comp_id = SectionContrib->getCompilandId();
- if (!comp_id)
- continue;
-
- auto sec = SectionContrib->getAddressSection();
- auto &sec_cs = m_sec_contribs[sec];
-
- auto offset = SectionContrib->getAddressOffset();
- auto it = llvm::upper_bound(sec_cs, offset, pred_upper);
-
- auto size = SectionContrib->getLength();
- sec_cs.insert(it, {offset, size, comp_id});
- }
- }
- }
-
- // Check by line number
- if (auto Lines = data.getLineNumbers()) {
- if (auto FirstLine = Lines->getNext())
- return FirstLine->getCompilandId();
- }
-
- // Retrieve section + offset
- uint32_t DataSection = data.getAddressSection();
- uint32_t DataOffset = data.getAddressOffset();
- if (DataSection == 0) {
- if (auto RVA = data.getRelativeVirtualAddress())
- m_session_up->addressForRVA(RVA, DataSection, DataOffset);
- }
-
- if (DataSection) {
- // Search by section contributions
- auto &sec_cs = m_sec_contribs[DataSection];
- auto it = llvm::upper_bound(sec_cs, DataOffset, pred_upper);
- if (it != sec_cs.begin()) {
- --it;
- if (DataOffset < it->Offset + it->Size)
- return it->CompilandId;
- }
- } else {
- // Search in lexical tree
- auto LexParentId = data.getLexicalParentId();
- while (auto LexParent = m_session_up->getSymbolById(LexParentId)) {
- if (LexParent->getSymTag() == PDB_SymType::Exe)
- break;
- if (LexParent->getSymTag() == PDB_SymType::Compiland)
- return LexParentId;
- LexParentId = LexParent->getRawSymbol().getLexicalParentId();
- }
- }
-
- return 0;
-}
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
deleted file mode 100644
index ea495c575f1f1a..00000000000000
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ /dev/null
@@ -1,252 +0,0 @@
-//===-- SymbolFilePDB.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 LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_SYMBOLFILEPDB_H
-#define LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_SYMBOLFILEPDB_H
-
-#include "lldb/Core/UniqueCStringMap.h"
-#include "lldb/Symbol/SymbolFile.h"
-#include "lldb/Symbol/VariableList.h"
-#include "lldb/Utility/UserID.h"
-
-#include "llvm/ADT/DenseMap.h"
-#include "llvm/DebugInfo/PDB/IPDBSession.h"
-#include "llvm/DebugInfo/PDB/PDB.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
-#include <optional>
-
-class PDBASTParser;
-
-class SymbolFilePDB : public lldb_private::SymbolFileCommon {
- /// LLVM RTTI support.
- static char ID;
-
-public:
- /// LLVM RTTI support.
- /// \{
- bool isA(const void *ClassID) const override {
- return ClassID == &ID || SymbolFileCommon::isA(ClassID);
- }
- static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
- /// \}
-
- // Static Functions
- static void Initialize();
-
- static void Terminate();
-
- static void DebuggerInitialize(lldb_private::Debugger &debugger);
-
- static llvm::StringRef GetPluginNameStatic() { return "pdb"; }
-
- static llvm::StringRef GetPluginDescriptionStatic();
-
- static lldb_private::SymbolFile *
- CreateInstance(lldb::ObjectFileSP objfile_sp);
-
- // Constructors and Destructors
- SymbolFilePDB(lldb::ObjectFileSP objfile_sp);
-
- ~SymbolFilePDB() override;
-
- uint32_t CalculateAbilities() override;
-
- void InitializeObject() override;
-
- // Compile Unit function calls
-
- lldb::LanguageType
- ParseLanguage(lldb_private::CompileUnit &comp_unit) override;
-
- size_t ParseFunctions(lldb_private::CompileUnit &comp_unit) override;
-
- bool ParseLineTable(lldb_private::CompileUnit &comp_unit) override;
-
- bool ParseDebugMacros(lldb_private::CompileUnit &comp_unit) override;
-
- bool ParseSupportFiles(lldb_private::CompileUnit &comp_unit,
- lldb_private::SupportFileList &support_files) override;
-
- size_t ParseTypes(lldb_private::CompileUnit &comp_unit) override;
-
- bool ParseImportedModules(
- const lldb_private::SymbolContext &sc,
- std::vector<lldb_private::SourceModule> &imported_modules) override;
-
- size_t ParseBlocksRecursive(lldb_private::Function &func) override;
-
- size_t
- ParseVariablesForContext(const lldb_private::SymbolContext &sc) override;
-
- lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
- std::optional<ArrayInfo> GetDynamicArrayInfoForUID(
- lldb::user_id_t type_uid,
- const lldb_private::ExecutionContext *exe_ctx) override;
-
- bool CompleteType(lldb_private::CompilerType &compiler_type) override;
-
- lldb_private::CompilerDecl GetDeclForUID(lldb::user_id_t uid) override;
-
- lldb_private::CompilerDeclContext
- GetDeclContextForUID(lldb::user_id_t uid) override;
-
- lldb_private::CompilerDeclContext
- GetDeclContextContainingUID(lldb::user_id_t uid) override;
-
- void
- ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override;
-
- uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr,
- lldb::SymbolContextItem resolve_scope,
- lldb_private::SymbolContext &sc) override;
-
- uint32_t ResolveSymbolContext(
- const lldb_private::SourceLocationSpec &src_location_spec,
- lldb::SymbolContextItem resolve_scope,
- lldb_private::SymbolContextList &sc_list) override;
-
- void
- FindGlobalVariables(lldb_private::ConstString name,
- const lldb_private::CompilerDeclContext &parent_decl_ctx,
- uint32_t max_matches,
- lldb_private::VariableList &variables) override;
-
- void FindGlobalVariables(const lldb_private::RegularExpression ®ex,
- uint32_t max_matches,
- lldb_private::VariableList &variables) override;
-
- void FindFunctions(const lldb_private::Module::LookupInfo &lookup_info,
- const lldb_private::CompilerDeclContext &parent_decl_ctx,
- bool include_inlines,
- lldb_private::SymbolContextList &sc_list) override;
-
- void FindFunctions(const lldb_private::RegularExpression ®ex,
- bool include_inlines,
- lldb_private::SymbolContextList &sc_list) override;
-
- void GetMangledNamesForFunction(
- const std::string &scope_qualified_name,
- std::vector<lldb_private::ConstString> &mangled_names) override;
-
- void AddSymbols(lldb_private::Symtab &symtab) override;
- void FindTypes(const lldb_private::TypeQuery &match,
- lldb_private::TypeResults &results) override;
- void FindTypesByRegex(const lldb_private::RegularExpression ®ex,
- uint32_t max_matches, lldb_private::TypeMap &types);
-
- void GetTypes(lldb_private::SymbolContextScope *sc_scope,
- lldb::TypeClass type_mask,
- lldb_private::TypeList &type_list) override;
-
- llvm::Expected<lldb::TypeSystemSP>
- GetTypeSystemForLanguage(lldb::LanguageType language) override;
-
- lldb_private::CompilerDeclContext
- FindNamespace(lldb_private::ConstString name,
- const lldb_private::CompilerDeclContext &parent_decl_ctx,
- bool only_root_namespaces) override;
-
- llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
-
- llvm::pdb::IPDBSession &GetPDBSession();
-
- const llvm::pdb::IPDBSession &GetPDBSession() const;
-
- void DumpClangAST(lldb_private::Stream &s) override;
-
-private:
- struct SecContribInfo {
- uint32_t Offset;
- uint32_t Size;
- uint32_t CompilandId;
- };
- using SecContribsMap = std::map<uint32_t, std::vector<SecContribInfo>>;
-
- uint32_t CalculateNumCompileUnits() override;
-
- lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
-
- lldb::CompUnitSP ParseCompileUnitForUID(uint32_t id,
- uint32_t index = UINT32_MAX);
-
- bool ParseCompileUnitLineTable(lldb_private::CompileUnit &comp_unit,
- uint32_t match_line);
-
- void BuildSupportFileIdToSupportFileIndexMap(
- const llvm::pdb::PDBSymbolCompiland &pdb_compiland,
- llvm::DenseMap<uint32_t, uint32_t> &index_map) const;
-
- void FindTypesByName(llvm::StringRef name,
- const lldb_private::CompilerDeclContext &parent_decl_ctx,
- uint32_t max_matches, lldb_private::TypeMap &types);
-
- std::string GetMangledForPDBData(const llvm::pdb::PDBSymbolData &pdb_data);
-
- lldb::VariableSP
- ParseVariableForPDBData(const lldb_private::SymbolContext &sc,
- const llvm::pdb::PDBSymbolData &pdb_data);
-
- size_t ParseVariables(const lldb_private::SymbolContext &sc,
- const llvm::pdb::PDBSymbol &pdb_data,
- lldb_private::VariableList *variable_list = nullptr);
-
- lldb::CompUnitSP
- GetCompileUnitContainsAddress(const lldb_private::Address &so_addr);
-
- typedef std::vector<lldb_private::Type *> TypeCollection;
-
- void GetTypesForPDBSymbol(const llvm::pdb::PDBSymbol &pdb_symbol,
- uint32_t type_mask,
- TypeCollection &type_collection);
-
- lldb_private::Function *
- ParseCompileUnitFunctionForPDBFunc(const llvm::pdb::PDBSymbolFunc &pdb_func,
- lldb_private::CompileUnit &comp_unit);
-
- void GetCompileUnitIndex(const llvm::pdb::PDBSymbolCompiland &pdb_compiland,
- uint32_t &index);
-
- PDBASTParser *GetPDBAstParser();
-
- std::unique_ptr<llvm::pdb::PDBSymbolCompiland>
- GetPDBCompilandByUID(uint32_t uid);
-
- lldb_private::Mangled
- GetMangledForPDBFunc(const llvm::pdb::PDBSymbolFunc &pdb_func);
-
- bool ResolveFunction(const llvm::pdb::PDBSymbolFunc &pdb_func,
- bool include_inlines,
- lldb_private::SymbolContextList &sc_list);
-
- bool ResolveFunction(uint32_t uid, bool include_inlines,
- lldb_private::SymbolContextList &sc_list);
-
- void CacheFunctionNames();
-
- bool DeclContextMatchesThisSymbolFile(
- const lldb_private::CompilerDeclContext &decl_ctx);
-
- uint32_t GetCompilandId(const llvm::pdb::PDBSymbolData &data);
-
- llvm::DenseMap<uint32_t, lldb::CompUnitSP> m_comp_units;
- llvm::DenseMap<uint32_t, lldb::TypeSP> m_types;
- llvm::DenseMap<uint32_t, lldb::VariableSP> m_variables;
- llvm::DenseMap<uint64_t, std::string> m_public_names;
-
- SecContribsMap m_sec_contribs;
-
- std::vector<lldb::TypeSP> m_builtin_types;
- std::unique_ptr<llvm::pdb::IPDBSession> m_session_up;
- std::unique_ptr<llvm::pdb::PDBSymbolExe> m_global_scope_up;
-
- lldb_private::UniqueCStringMap<uint32_t> m_func_full_names;
- lldb_private::UniqueCStringMap<uint32_t> m_func_base_names;
- lldb_private::UniqueCStringMap<uint32_t> m_func_method_names;
-};
-
-#endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_PDB_SYMBOLFILEPDB_H
diff --git a/lldb/source/Plugins/TypeSystem/Clang/CMakeLists.txt b/lldb/source/Plugins/TypeSystem/Clang/CMakeLists.txt
index 37a3142da7274e..5bad2b517f0685 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/CMakeLists.txt
+++ b/lldb/source/Plugins/TypeSystem/Clang/CMakeLists.txt
@@ -8,7 +8,7 @@ add_lldb_library(lldbPluginTypeSystemClang PLUGIN
lldbUtility
lldbPluginExpressionParserClang
lldbPluginSymbolFileDWARF
- lldbPluginSymbolFilePDB
+ lldbPluginSymbolFileNativePDB
lldbPluginObjCRuntime
CLANG_LIBS
clangAST
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index f5063175d6e070..a2378fa7d6269e 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -77,7 +77,6 @@
#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
#include "Plugins/SymbolFile/DWARF/DWARFASTParserClang.h"
-#include "Plugins/SymbolFile/PDB/PDBASTParser.h"
#include "Plugins/SymbolFile/NativePDB/PdbAstBuilder.h"
#include <cstdio>
@@ -9075,12 +9074,6 @@ DWARFASTParser *TypeSystemClang::GetDWARFParser() {
return m_dwarf_ast_parser_up.get();
}
-PDBASTParser *TypeSystemClang::GetPDBParser() {
- if (!m_pdb_ast_parser_up)
- m_pdb_ast_parser_up = std::make_unique<PDBASTParser>(*this);
- return m_pdb_ast_parser_up.get();
-}
-
npdb::PdbAstBuilder *TypeSystemClang::GetNativePDBParser() {
if (!m_native_pdb_ast_parser_up)
m_native_pdb_ast_parser_up = std::make_unique<npdb::PdbAstBuilder>(*this);
@@ -9098,8 +9091,6 @@ bool TypeSystemClang::LayoutRecordType(
lldb_private::ClangASTImporter *importer = nullptr;
if (m_dwarf_ast_parser_up)
importer = &m_dwarf_ast_parser_up->GetClangASTImporter();
- if (!importer && m_pdb_ast_parser_up)
- importer = &m_pdb_ast_parser_up->GetClangASTImporter();
if (!importer && m_native_pdb_ast_parser_up)
importer = &m_native_pdb_ast_parser_up->GetClangASTImporter();
if (!importer)
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index e39aedec7e3902..2d1cc779ff87ec 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -41,7 +41,6 @@
#include "lldb/lldb-enumerations.h"
class DWARFASTParserClang;
-class PDBASTParser;
namespace clang {
class FileManager;
@@ -521,7 +520,6 @@ class TypeSystemClang : public TypeSystem {
// TypeSystem methods
plugin::dwarf::DWARFASTParser *GetDWARFParser() override;
- PDBASTParser *GetPDBParser() override;
npdb::PdbAstBuilder *GetNativePDBParser() override;
// TypeSystemClang callbacks for external source lookups.
@@ -1192,7 +1190,6 @@ class TypeSystemClang : public TypeSystem {
std::unique_ptr<clang::HeaderSearch> m_header_search_up;
std::unique_ptr<clang::ModuleMap> m_module_map_up;
std::unique_ptr<DWARFASTParserClang> m_dwarf_ast_parser_up;
- std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up;
std::unique_ptr<npdb::PdbAstBuilder> m_native_pdb_ast_parser_up;
std::unique_ptr<clang::MangleContext> m_mangle_ctx_up;
uint32_t m_pointer_byte_size = 0;
diff --git a/lldb/test/Shell/Minidump/Windows/Sigsegv/sigsegv.test b/lldb/test/Shell/Minidump/Windows/Sigsegv/sigsegv.test
index e3f1e33e0ff0fc..bdfa72d83f9c8f 100644
--- a/lldb/test/Shell/Minidump/Windows/Sigsegv/sigsegv.test
+++ b/lldb/test/Shell/Minidump/Windows/Sigsegv/sigsegv.test
@@ -1,7 +1,7 @@
// REQUIRES: x86
// RUN: cd %p/Inputs
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 \
+// RUN: \
// RUN: %lldb -c sigsegv.dmp -s sigsegv.lldbinit | FileCheck %s
CHECK: * thread #1, stop reason = Exception 0xc0000005 encountered at address 0x7ff7a13110d9
diff --git a/lldb/test/Shell/Process/Windows/exception_access_violation.cpp b/lldb/test/Shell/Process/Windows/exception_access_violation.cpp
index 4835b498ee4dfd..fdc42dd5c9eee4 100644
--- a/lldb/test/Shell/Process/Windows/exception_access_violation.cpp
+++ b/lldb/test/Shell/Process/Windows/exception_access_violation.cpp
@@ -2,8 +2,8 @@
// REQUIRES: system-windows
// RUN: %build --compiler=clang-cl -o %t.exe -- %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "run" -- write | FileCheck --check-prefix=WRITE %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "run" -- read | FileCheck --check-prefix=READ %s
+// RUN: %lldb -f %t.exe -o "run" -- write | FileCheck --check-prefix=WRITE %s
+// RUN: %lldb -f %t.exe -o "run" -- read | FileCheck --check-prefix=READ %s
#include <string.h>
diff --git a/lldb/test/Shell/Process/Windows/process_load.cpp b/lldb/test/Shell/Process/Windows/process_load.cpp
index 43bf45865f9bae..7e1a582b62e960 100644
--- a/lldb/test/Shell/Process/Windows/process_load.cpp
+++ b/lldb/test/Shell/Process/Windows/process_load.cpp
@@ -2,7 +2,7 @@
// REQUIRES: system-windows
// RUN: %build --compiler=clang-cl -o %t.exe -- %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "b main" -o "process launch" -o "process load kernel32.dll" | FileCheck %s
+// RUN: %lldb -f %t.exe -o "b main" -o "process launch" -o "process load kernel32.dll" | FileCheck %s
int main(int argc, char *argv[]) {
return 0;
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
index b8154168aff3d1..c0ae6e73f36d8b 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions-msvc.cpp
@@ -3,5 +3,5 @@
// RUN: %build --compiler=msvc --nodefaultlib -o %t.exe -- %S/ast-functions.cpp
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %S/ast-functions.cpp
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
index 7eb7a2cbe7d9a4..635f5843e712c2 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-functions.cpp
@@ -4,7 +4,7 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/ast-functions.lldbinit 2>&1 | FileCheck %s
static int static_fn() {
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
index f2be33aae8163b..91bd5bb810c8e3 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-methods.cpp
@@ -3,10 +3,10 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -GR- -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/ast-methods.lldbinit 2>&1 | FileCheck %s --check-prefix=AST
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols --dump-ast %t.exe | FileCheck %s --check-prefix=SYMBOL
+// RUN: lldb-test symbols --dump-ast %t.exe | FileCheck %s --check-prefix=SYMBOL
struct Struct {
void simple_method() {}
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp b/lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
index 5554881716184f..ac0d87e95dbf97 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
@@ -4,7 +4,7 @@
// Test various interesting cases for AST reconstruction.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/ast-types.lldbinit 2>&1 | FileCheck %s
// Test trivial versions of each tag type.
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp b/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp
index bfa3cbc819472e..72085f019e4d84 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/bitfields.cpp
@@ -4,7 +4,7 @@
// Test various interesting cases for AST reconstruction.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/bitfields.lldbinit 2>&1 | FileCheck %s
// Test trivial versions of each tag type.
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/blocks.s b/lldb/test/Shell/SymbolFile/NativePDB/blocks.s
index 7a124702e47571..1f753a22372c3d 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/blocks.s
+++ b/lldb/test/Shell/SymbolFile/NativePDB/blocks.s
@@ -4,7 +4,7 @@
// Test block range is set.
// RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %s > %t.obj
// RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe /base:0x140000000
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb %t.exe -o "image lookup -a 0x140001014 -v" -o "exit" | FileCheck %s
+// RUN: %lldb %t.exe -o "image lookup -a 0x140001014 -v" -o "exit" | FileCheck %s
// CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001044)
// CHECK-NEXT: FuncType: id = {{.*}}, byte-size = 0, compiler_type = "int (void)"
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp b/lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp
index 1768f127c9fa47..a580d574a9ca36 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/break-by-function.cpp
@@ -4,7 +4,7 @@
// Test that we can set simple breakpoints using PDB on any platform.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/break-by-function.lldbinit | FileCheck %s
// Use different indentation style for each overload so that the starting
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp b/lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp
index ebb7114b985e67..90ac633b01632c 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/break-by-line.cpp
@@ -4,7 +4,7 @@
// Test that we can set simple breakpoints using PDB on any platform.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/break-by-line.lldbinit | FileCheck %s
// This is a separate test from break-by-function.cpp because this test is
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/class_layout.cpp b/lldb/test/Shell/SymbolFile/NativePDB/class_layout.cpp
index 0941dc7c51d01f..36bfdb9a8e5655 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/class_layout.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/class_layout.cpp
@@ -4,7 +4,7 @@
// Make sure class layout is correct.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/class_layout.lldbinit 2>&1 | FileCheck %s
// CHECK: (lldb) expr a
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp b/lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp
index 7d0c0b8e684ba0..db3b85fa7e59f8 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/disassembly.cpp
@@ -4,7 +4,7 @@
// Test that we can show disassembly and source.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s
// Some context lines before the function.
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/function-types-builtins.cpp b/lldb/test/Shell/SymbolFile/NativePDB/function-types-builtins.cpp
index 69d8d17179fe9c..b2ef45feb4d01e 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/function-types-builtins.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/function-types-builtins.cpp
@@ -3,7 +3,7 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/function-types-builtins.lldbinit | FileCheck %s
// Test that we can display function signatures with simple builtin
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp b/lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp
index 42fd21637ea8a7..92fa4394e860d4 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/function-types-calling-conv.cpp
@@ -3,7 +3,7 @@
// RUN: %clang_cl --target=i386-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/function-types-calling-conv.lldbinit | FileCheck %s
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/function-types-classes.cpp b/lldb/test/Shell/SymbolFile/NativePDB/function-types-classes.cpp
index ca2a84de7698a4..c0de1ce6df4fd5 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/function-types-classes.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/function-types-classes.cpp
@@ -4,7 +4,7 @@
// Test that we can display function signatures with class types.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/function-types-classes.lldbinit | FileCheck %s
// This is just some unimportant helpers needed so that we can get reference and
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/global-classes.cpp b/lldb/test/Shell/SymbolFile/NativePDB/global-classes.cpp
index 8f4aab6a8585d3..8016d5200d410d 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/global-classes.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/global-classes.cpp
@@ -5,7 +5,7 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 \
// RUN: -Xclang -fkeep-static-consts -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/globals-classes.lldbinit | FileCheck %s
enum class EnumType : unsigned {
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp b/lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp
index 15b4d330fabb0c..5f6c68d69023ef 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/global-ctor-dtor.cpp
@@ -4,7 +4,7 @@
// Global ctor and dtor should be globals decls.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -GS- -fno-addrsig -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb -force
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols --dump-ast %t.exe | FileCheck %s
+// RUN: lldb-test symbols --dump-ast %t.exe | FileCheck %s
struct A {
~A() {};
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/globals-bss.cpp b/lldb/test/Shell/SymbolFile/NativePDB/globals-bss.cpp
index 9c65c26499cd11..7f508ecb31b4d4 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/globals-bss.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/globals-bss.cpp
@@ -5,7 +5,7 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
// RUN: llvm-readobj -S %t.exe | FileCheck --check-prefix=BSS %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
int GlobalVariable = 0;
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/globals-fundamental.cpp b/lldb/test/Shell/SymbolFile/NativePDB/globals-fundamental.cpp
index 2787e65928319c..299dd0b02671dc 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/globals-fundamental.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/globals-fundamental.cpp
@@ -5,7 +5,7 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 \
// RUN: -Xclang -fkeep-static-consts -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/globals-fundamental.lldbinit | FileCheck %s
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/icf.cpp b/lldb/test/Shell/SymbolFile/NativePDB/icf.cpp
index d9a7373bb12d66..d1e8732b688694 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/icf.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/icf.cpp
@@ -4,7 +4,7 @@
// Test lldb finds the correct parent context decl for functions and class methods when icf happens.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -GS- -fno-addrsig -c /Fo%t.obj -- %s
// RUN: lld-link -opt:icf -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols --dump-ast %t.exe | FileCheck %s
+// RUN: lldb-test symbols --dump-ast %t.exe | FileCheck %s
struct A {
int f1(int x) {
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp b/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp
index 8c168286903014..7bc7e618667f7e 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/incomplete-tag-type.cpp
@@ -4,7 +4,7 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -c /Fo%t1.obj -- %p/Inputs/incomplete-tag-type.cpp
// RUN: %clang_cl --target=x86_64-windows-msvc /O1 /Z7 -c /Fo%t2.obj -- %s
// RUN: lld-link /debug:full /nodefaultlib /entry:main %t1.obj %t2.obj /out:%t.exe /pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o \
+// RUN: %lldb -f %t.exe -o \
// RUN: "settings set interpreter.stop-command-source-on-error false" \
// RUN: -o "expression b" -o "expression d" -o "expression static_e_ref" -o "exit" 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test
index f1cf5ffdf70373..6293148d90ce41 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test
+++ b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites.test
@@ -3,7 +3,7 @@
# RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %p/Inputs/inline_sites.s > %t.obj
# RUN: lld-link -debug:full -nodefaultlib -entry:main -base:0x140000000 %t.obj -out:%t.exe
-# RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+# RUN: %lldb -f %t.exe -s \
# RUN: %p/Inputs/inline_sites.lldbinit 2>&1 | FileCheck %s
# CHECK: (lldb) image dump line-table a.cpp -v
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
index 767149ea18c468..df6353e28303a3 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/inline_sites_live.cpp
@@ -2,7 +2,7 @@
// REQUIRES: system-windows
// RUN: %build -o %t.exe -- %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/inline_sites_live.lldbinit 2>&1 | FileCheck %s
void use(int) {}
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/load-pdb.cpp b/lldb/test/Shell/SymbolFile/NativePDB/load-pdb.cpp
index 8840a1242a044a..3ff1dffab07750 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/load-pdb.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/load-pdb.cpp
@@ -10,7 +10,7 @@
// RUN: -out:%t/executable/foo.exe -pdb:%t/executable/foo.pdb
// Rename the PDB file so that the name is different from the name inside the executable (foo.exe).
// RUN: mv %t/executable/foo.pdb %t/executable/bar.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb %t/executable/foo.exe \
+// RUN: %lldb %t/executable/foo.exe \
// RUN: -o "target symbols add %t/executable/bar.pdb" \
// RUN: -o "b main" \
// RUN: -o "image dump symfile" -o "quit" | FileCheck %s
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/local-variables-registers.s b/lldb/test/Shell/SymbolFile/NativePDB/local-variables-registers.s
index ad2d0704cdf41a..85d92a2447939f 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/local-variables-registers.s
+++ b/lldb/test/Shell/SymbolFile/NativePDB/local-variables-registers.s
@@ -3,7 +3,7 @@
# RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %s > %t.obj
# RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe /base:0x140000000
-# RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+# RUN: %lldb -f %t.exe -s \
# RUN: %p/Inputs/local-variables-registers.lldbinit 2>&1 | FileCheck %s
# This file is compiled from following source file:
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp b/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp
index 9aa25adf6bcc7d..f6576090b4f327 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/local-variables.cpp
@@ -2,7 +2,7 @@
// REQUIRES: system-windows
// RUN: %build -o %t.exe -- %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/local-variables.lldbinit 2>&1 | FileCheck %s
int Function(int Param1, char Param2) {
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp b/lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp
index 7b3f6f97679612..c0739e4dfaba4a 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/locate-pdb.cpp
@@ -17,12 +17,12 @@
// RUN: -out:%t/executable/foo.exe -pdb:%t/symbols/bar.pdb
// Find the PDB in its build location
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t/executable/foo.exe -s \
+// RUN: %lldb -f %t/executable/foo.exe -s \
// RUN: %p/Inputs/locate-pdb.lldbinit | FileCheck %s
// Also find the PDB when it's adjacent to the executable
// RUN: mv -f %t/symbols/bar.pdb %t/executable/bar.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t/executable/foo.exe -s \
+// RUN: %lldb -f %t/executable/foo.exe -s \
// RUN: %p/Inputs/locate-pdb.lldbinit | FileCheck %s
int main(int argc, char** argv) {
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/lookup-by-address.cpp b/lldb/test/Shell/SymbolFile/NativePDB/lookup-by-address.cpp
index a2c00a48bf9ead..36434b3860703f 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/lookup-by-address.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/lookup-by-address.cpp
@@ -3,7 +3,7 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -GR- -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -base:0x400000 -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -O "target create %t.exe" -o "image lookup -a 0x401000" -o "exit" | FileCheck %s --check-prefix=ADDRESS
+// RUN: %lldb -O "target create %t.exe" -o "image lookup -a 0x401000" -o "exit" | FileCheck %s --check-prefix=ADDRESS
int main(int argc, char **argv) {
return 0;
}
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/lookup-by-types.cpp b/lldb/test/Shell/SymbolFile/NativePDB/lookup-by-types.cpp
index f3aea8115f3858..d0352718937342 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/lookup-by-types.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/lookup-by-types.cpp
@@ -1,7 +1,7 @@
// clang-format off
// RUN: %build -o %t.exe -- %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/lookup-by-types.lldbinit 2>&1 | FileCheck %s
class B;
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/nested-blocks-same-address.s b/lldb/test/Shell/SymbolFile/NativePDB/nested-blocks-same-address.s
index 0ab76dacdaded0..dc3ee844fe3647 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/nested-blocks-same-address.s
+++ b/lldb/test/Shell/SymbolFile/NativePDB/nested-blocks-same-address.s
@@ -4,7 +4,7 @@
# Test when nested S_BLOCK32 have same address range, ResolveSymbolContext should return the innnermost block.
# RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %s > %t.obj
# RUN: lld-link /debug:full /nodefaultlib /entry:main %t.obj /out:%t.exe /base:0x140000000
-# RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -o "image lookup -a 0x14000103c -v" -o "exit" | FileCheck %s
+# RUN: %lldb -f %t.exe -o "image lookup -a 0x14000103c -v" -o "exit" | FileCheck %s
# This file is compiled from following source file:
# $ clang-cl /Z7 /GS- /c /O2 test.cpp /Fatest.s
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/nested-types.cpp b/lldb/test/Shell/SymbolFile/NativePDB/nested-types.cpp
index b188b9f6806fc5..f725037a220d9c 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/nested-types.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/nested-types.cpp
@@ -5,7 +5,7 @@
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 \
// RUN: -Xclang -fkeep-static-consts -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/nested-types.lldbinit 2>&1 | FileCheck %s
struct S {
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/s_constant.cpp b/lldb/test/Shell/SymbolFile/NativePDB/s_constant.cpp
index ac3ecbbbf09dfd..32785b3b25caeb 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/s_constant.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/s_constant.cpp
@@ -5,7 +5,7 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-win32 %p/Inputs/s_constant.s > %t.obj
// RUN: %build --compiler=clang-cl --nodefaultlib --mode=link -o %t.exe -- %t.obj
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/s_constant.lldbinit | FileCheck %s
// clang-cl cannot generate S_CONSTANT records, but we need to test that we can
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp b/lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp
index fb749c145aca91..73a32bde986dc6 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/source-list.cpp
@@ -4,7 +4,7 @@
// Test that we can set display source of functions.
// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/source-list.lldbinit | FileCheck %s
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp b/lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp
index e96e3ed6a0107c..9e799fb635a2fb 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/stack_unwinding01.cpp
@@ -2,7 +2,7 @@
// REQUIRES: lld, system-windows
// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/stack_unwinding01.lldbinit 2>&1 | FileCheck %s
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/tag-types.cpp b/lldb/test/Shell/SymbolFile/NativePDB/tag-types.cpp
index 03cf25d0d4c03c..2d20375745ec3e 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/tag-types.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/tag-types.cpp
@@ -4,7 +4,7 @@
// Test that we can display tag types.
// RUN: %clang_cl --target=x86_64-windows-msvc -GS- -Od -Z7 -c /Fo%t.obj -- %s
// RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
+// RUN: %lldb -f %t.exe -s \
// RUN: %p/Inputs/tag-types.lldbinit | FileCheck %s
// Test struct
diff --git a/lldb/test/Shell/SymbolFile/NativePDB/typedefs.cpp b/lldb/test/Shell/SymbolFile/NativePDB/typedefs.cpp
index e303a4f43636de..17d23660c33dbb 100644
--- a/lldb/test/Shell/SymbolFile/NativePDB/typedefs.cpp
+++ b/lldb/test/Shell/SymbolFile/NativePDB/typedefs.cpp
@@ -2,7 +2,7 @@
// REQUIRES: system-windows
// RUN: %build --compiler=clang-cl --nodefaultlib -o %t.exe -- %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -dump-ast %t.exe | FileCheck %s
+// RUN: lldb-test symbols -dump-ast %t.exe | FileCheck %s
namespace A {
namespace B {
diff --git a/lldb/test/Shell/SymbolFile/PDB/ast-restore.test b/lldb/test/Shell/SymbolFile/PDB/ast-restore.test
index 2763f460702443..f1ea7c930ae5b7 100644
--- a/lldb/test/Shell/SymbolFile/PDB/ast-restore.test
+++ b/lldb/test/Shell/SymbolFile/PDB/ast-restore.test
@@ -1,11 +1,9 @@
REQUIRES: system-windows, msvc
RUN: %build --compiler=msvc --nodefaultlib --output=%t.exe %S/Inputs/AstRestoreTest.cpp
-RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s
-RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s
+RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=ENUM %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=GLOBAL %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=BASE %s
-RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=CLASS %s
-RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=CLASS %s
+RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=CLASS %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=INNER %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=TEMPLATE %s
RUN: lldb-test symbols -dump-ast %t.exe | FileCheck --check-prefix=FOO %s
diff --git a/lldb/test/Shell/SymbolFile/PDB/compilands.test b/lldb/test/Shell/SymbolFile/PDB/compilands.test
index ecee5eb50d3990..e4da21cb09cbe8 100644
--- a/lldb/test/Shell/SymbolFile/PDB/compilands.test
+++ b/lldb/test/Shell/SymbolFile/PDB/compilands.test
@@ -1,8 +1,7 @@
REQUIRES: system-windows, msvc
RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --output=%T/CompilandsTest.cpp.obj %S/Inputs/CompilandsTest.cpp
RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --output=%T/CompilandsTest.cpp.exe %T/CompilandsTest.cpp.obj
-RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s
-RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s
+RUN: lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s
; Link default libraries
diff --git a/lldb/test/Shell/SymbolFile/PDB/function-level-linking.test b/lldb/test/Shell/SymbolFile/PDB/function-level-linking.test
index ec0ef57440070e..8797ed0f40ed07 100644
--- a/lldb/test/Shell/SymbolFile/PDB/function-level-linking.test
+++ b/lldb/test/Shell/SymbolFile/PDB/function-level-linking.test
@@ -1,5 +1,4 @@
REQUIRES: system-windows, lld
RUN: %clang_cl_host /c /Zi /Gy %S/Inputs/FunctionLevelLinkingTest.cpp /o %t.obj
RUN: lld-link /debug:full /nodefaultlib /entry:main /order:@%S/Inputs/FunctionLevelLinkingTest.ord %t.obj /out:%t.exe
-RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb-test symbols -verify %t.exe
-RUN: env LLDB_USE_NATIVE_PDB_READER=0 lldb-test symbols -verify %t.exe
+RUN: lldb-test symbols -verify %t.exe
diff --git a/lldb/test/Shell/SymbolFile/PDB/variables-locations.test b/lldb/test/Shell/SymbolFile/PDB/variables-locations.test
index b5bfc6fe81af9b..8c7687dc1af828 100644
--- a/lldb/test/Shell/SymbolFile/PDB/variables-locations.test
+++ b/lldb/test/Shell/SymbolFile/PDB/variables-locations.test
@@ -1,7 +1,6 @@
REQUIRES: system-windows, lld
RUN: %build --compiler=clang-cl --output=%t.exe %S/Inputs/VariablesLocationsTest.cpp
-RUN: env LLDB_USE_NATIVE_PDB_READER=0 %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s
-RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s
+RUN: %lldb -b -s %S/Inputs/VariablesLocationsTest.script -- %t.exe | FileCheck %s
CHECK: g_var = 2222
diff --git a/lldb/unittests/SymbolFile/CMakeLists.txt b/lldb/unittests/SymbolFile/CMakeLists.txt
index 804555f8c901ca..cce69c29823959 100644
--- a/lldb/unittests/SymbolFile/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/CMakeLists.txt
@@ -1,5 +1,2 @@
add_subdirectory(DWARF)
add_subdirectory(NativePDB)
-if (LLVM_ENABLE_DIA_SDK)
- add_subdirectory(PDB)
-endif()
diff --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index d5b0be7ea2a28c..4c0dc7d093f367 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -13,7 +13,6 @@ add_lldb_unittest(SymbolFileDWARFTests
lldbSymbol
lldbPluginObjectFilePECOFF
lldbPluginSymbolFileDWARF
- lldbPluginSymbolFilePDB
lldbPluginTypeSystemClang
lldbPluginPlatformMacOSX
lldbUtilityHelpers
diff --git a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
index 37ecfea26f36cc..37ea9392146bed 100644
--- a/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
+++ b/lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp
@@ -10,8 +10,6 @@
#include "llvm/ADT/STLExtras.h"
#include "llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
@@ -19,7 +17,6 @@
#include "Plugins/SymbolFile/DWARF/DWARFDataExtractor.h"
#include "Plugins/SymbolFile/DWARF/DWARFDebugAranges.h"
#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
-#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
#include "TestingSupport/SubsystemRAII.h"
#include "TestingSupport/TestUtilities.h"
@@ -43,7 +40,7 @@ using llvm::DWARFDebugArangeSet;
class SymbolFileDWARFTests : public testing::Test {
SubsystemRAII<FileSystem, HostInfo, ObjectFilePECOFF, SymbolFileDWARF,
- TypeSystemClang, SymbolFilePDB>
+ TypeSystemClang>
subsystems;
public:
diff --git a/lldb/unittests/SymbolFile/PDB/CMakeLists.txt b/lldb/unittests/SymbolFile/PDB/CMakeLists.txt
deleted file mode 100644
index 8fc2167ee6ba27..00000000000000
--- a/lldb/unittests/SymbolFile/PDB/CMakeLists.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-add_lldb_unittest(SymbolFilePDBTests
- SymbolFilePDBTests.cpp
-
- LINK_LIBS
- lldbCore
- lldbHost
- lldbSymbol
- lldbPluginObjectFilePECOFF
- lldbPluginSymbolFileDWARF
- lldbPluginSymbolFilePDB
- lldbPluginTypeSystemClang
- lldbUtilityHelpers
- LLVMTestingSupport
- LINK_COMPONENTS
- Support
- DebugInfoPDB
- )
-
-set(test_inputs
- test-pdb.exe
- test-pdb.pdb
- test-pdb-types.exe
- test-pdb-types.pdb)
-
-add_unittest_inputs(SymbolFilePDBTests "${test_inputs}")
diff --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-alt.cpp b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-alt.cpp
deleted file mode 100644
index 33d7df0e4a82a9..00000000000000
--- a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-alt.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-// Compile with "cl /c /Zi /GR- test-pdb-alt.cpp"
-// Link with "link test-pdb.obj test-pdb-alt.obj /debug /nodefaultlib
-// /entry:main /out:test-pdb.exe"
-
-#include "test-pdb.h"
-
-int bar(int n) { return n - 1; }
diff --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-nested.h b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-nested.h
deleted file mode 100644
index 9d3995558233f6..00000000000000
--- a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-nested.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef TEST_PDB_NESTED_H
-#define TEST_PDB_NESTED_H
-
-inline int baz(int n) { return n + 1; }
-
-#endif
diff --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
deleted file mode 100644
index a6e087fbf79803..00000000000000
--- a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Compile with "cl /c /Zi /GR- /EHsc test-pdb-types.cpp"
-// Link with "link test-pdb-types.obj /debug /nodefaultlib /entry:main
-// /out:test-pdb-types.exe"
-
-// Sizes of builtin types
-static const int sizeof_char = sizeof(char);
-static const int sizeof_uchar = sizeof(unsigned char);
-static const int sizeof_short = sizeof(short);
-static const int sizeof_ushort = sizeof(unsigned short);
-static const int sizeof_int = sizeof(int);
-static const int sizeof_uint = sizeof(unsigned int);
-static const int sizeof_long = sizeof(long);
-static const int sizeof_ulong = sizeof(unsigned long);
-static const int sizeof_longlong = sizeof(long long);
-static const int sizeof_ulonglong = sizeof(unsigned long long);
-static const int sizeof_int64 = sizeof(__int64);
-static const int sizeof_uint64 = sizeof(unsigned __int64);
-static const int sizeof_float = sizeof(float);
-static const int sizeof_double = sizeof(double);
-static const int sizeof_bool = sizeof(bool);
-static const int sizeof_wchar = sizeof(wchar_t);
-
-enum Enum {
- EValue1 = 1,
- EValue2 = 2,
-};
-
-enum ShortEnum : short { ESValue1 = 1, ESValue2 = 2 };
-
-namespace NS {
-class NSClass {
- float f;
- double d;
-};
-} // namespace NS
-
-class Class {
-public:
- class NestedClass {
- Enum e;
- };
- ShortEnum se;
-};
-
-int test_func(int a, int b) { return a + b; }
-
-typedef Class ClassTypedef;
-typedef NS::NSClass NSClassTypedef;
-typedef int (*FuncPointerTypedef)();
-typedef int (*VariadicFuncPointerTypedef)(char, ...);
-FuncPointerTypedef GlobalFunc;
-VariadicFuncPointerTypedef GlobalVariadicFunc;
-int GlobalArray[10];
-
-static const int sizeof_NSClass = sizeof(NS::NSClass);
-static const int sizeof_Class = sizeof(Class);
-static const int sizeof_NestedClass = sizeof(Class::NestedClass);
-static const int sizeof_Enum = sizeof(Enum);
-static const int sizeof_ShortEnum = sizeof(ShortEnum);
-static const int sizeof_ClassTypedef = sizeof(ClassTypedef);
-static const int sizeof_NSClassTypedef = sizeof(NSClassTypedef);
-static const int sizeof_FuncPointerTypedef = sizeof(FuncPointerTypedef);
-static const int sizeof_VariadicFuncPointerTypedef =
- sizeof(VariadicFuncPointerTypedef);
-static const int sizeof_GlobalArray = sizeof(GlobalArray);
-
-int main(int argc, char **argv) {
- ShortEnum e1;
- Enum e2;
- Class c1;
- Class::NestedClass c2;
- NS::NSClass c3;
-
- ClassTypedef t1;
- NSClassTypedef t2;
- return test_func(1, 2);
-}
diff --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.exe b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.exe
deleted file mode 100644
index a6a0560eb66676d37b7cdd75619130df81bd0d9a..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 8192
zcmeI1&1=+95Wr`<R_e#DTk+!}no15uXsA6%@f2#5EmT~(J=q|eY=RABlaOS=JqVVH
zP*%aC$9iAHLy=mjSghco^`s{cUR&_se-LN#Q3A at I1cjY}nKy4{^7hRydz#$7`y7e@
za0E4q05)(Xkz?E6yvB6-(q<XfkL`_Z6z2BE7M83)@O<~aueF4x<~VLB=%(Pe9l>%0
z<xX8_xrQl~O2 at _Y=;igv?;pS3dzxu)Yw_6*?t5Emyv|$ACCX(tsoexHo(#i_Z*LZ}
z*iX0&Cx*(W;50@~Ceh&vuB6yXfh_q$07uD3$yV at iL(QWUp|PAjls=2m<dAHkx->%W
z?@~LwLXv9$jF2}8Fr7sHij_k1L5L at H=rW|#d)fzju?PSS$v3o61NcHYyhGghxj21j
zWMm{IWpIO{82FQ5_`T#Mh0_GJhKfw#0%}fVI?p$4x0&|dz$DdOM9ql|Fq7M|`ws~0
zk{n#aUp^Q`6L0fobwRAG&WR&kMXYpjEq>~5f5;V7vx4f%kMT`<$#3bOvHvQHqUy at d
zc)m9G7`se>2`~XBzyz286JP>NfC(@GCcp%kz#tI7Apy((K_Hu@()30}Rj#6*PwtlG
zXsmh$bq#ZCX)dW?J6~7o+YjIApWXf0mye>}S at H1|8iFa;)wUOezNxiT+ctEy?O0)G
z24SGqJ1yO{Z&|jf)|44_*74dHrQC#P=o4YbGXos8>M>k8i<G55fkLSOC7vkvhs0SX
dkRu at Dw<8U8cPbZTcc2Kw-zNvEV{SGh at C)5GdWHZ1
diff --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.pdb b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb-types.pdb
deleted file mode 100644
index 1a249e3635ce49676b6319660540925bd779f5aa..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 102400
zcmeHQe{dXEegE#AEGbTGOG at lGPH@hS<M>A;OSU6BM~F|B<j9HTD3R<q=0M)NTS=Gf
z-Cp<h6w6bBW*Raf1tw+qgLYtslx8NK(v~um0&O7-v``8()9I8@(rM_>Au!V+GU+r-
zL)_2z?c2T8-6lQTI28Ck`>S{F`@Zk{-uvu#-|qMA+qdJzyz5k*880=wYk23*)cE9~
z)V{v{{#7eCj7$<j7f}MyHK0WhhpYWa{t5zufFK|U2m*qDARq_`0)l`bAP5Kog1|2c
z0?)j9PJ$pH2nYg#fFK|U2m*qDARq_`0)l`bAPD at 5Bd|Y7zv4ZV?g;{dfFK|U2m*qD
zARq_`0)l`bAP5Kog23fpA29awS_Q20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unittests/SymbolFile/PDB/Inputs/test-pdb.cpp
+++ /dev/null
@@ -1,9 +0,0 @@
-// Compile with "cl /c /Zi /GR- test-pdb.cpp"
-// Link with "link test-pdb.obj /debug /nodefaultlib /entry:main
-// /out:test-pdb.exe"
-
-#include "test-pdb.h"
-
-int __cdecl _purecall(void) { return 0; }
-
-int main(int argc, char **argv) { return foo(argc) + bar(argc); }
diff --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.exe b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.exe
deleted file mode 100644
index 3a2c64504ed93cac431ec01d4615b0856b47cef9..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 7168
zcmeI1ziSjx5XWb8K`)v+H3S74H)5$v#6nHAgpCkMaLvUOx{CK>F{^vK$L`*tr36Jd
zFqRe;Dbh+HSOl?%7%YMTYat}%22$idSZCh;$dMvRVL-wR%)B=<-}m;t&voy{AAW!w
z0Cb~A5x^3TWU7e!2htWVeJ#S5p0$A`X>4s^a at z9chUY%>%5}L~b{sd5E2iu<9oceZ
z?OsW)yERiO6i!`9wjLcixn6i=y-$4u?AbGzZ@`P$UK}T^>NNHCo<tu37?X1F_S^5N
zw6_Ue(rKv((1(>1akc*}j^u-stMR-mYo{^*9oqx}EeGlwA*6M*Sd7^~#e+=+$dhUi
z;MT$FLo1ZPd>Np6k<LU;cTLWXGhs5oQ^l*5gEGJ>-c{V4H0MP-3n~IpJkxfo$yu=g
zq`!#XVJg6IN6OP<MBo?MRts;m^_s#b3O6ZS#vr=;h6nBK8_SP>WE#w;+9P>A{2WEm
z%u08Ar#+s(AI`^F?&p&ZEiFPl%4e3Pq#oybXvGV58_5?EeVFRA5A%cxFaajO1egF5
zU;<2l2`~XBzyz286F5c$@L7WGpAtylQ0eK<K-aFLUx+`E_IfexN1wyqT+)jb94AUz
zY4zOm at AkX!?n3M1{MFlk)+NNE4H>>yHEg?8Hv-qSeVo=RM$@r^!1M#(D7~szT>Fk?
qn})6p8>3F6iB;-dYt$+Vx`0c+3ppDTI0^#de~P2nnD_ke3H$}V436;t
diff --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.h b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.h
deleted file mode 100644
index c935de334d73e2..00000000000000
--- a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef TEST_PDB_H
-#define TEST_PDB_H
-
-#include "test-pdb-nested.h"
-
-int bar(int n);
-
-inline int foo(int n) { return baz(n) + 1; }
-
-#endif
diff --git a/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.pdb b/lldb/unittests/SymbolFile/PDB/Inputs/test-pdb.pdb
deleted file mode 100644
index f43d334d215a780e420337a61342242ee903141b..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 110592
zcmeHQ4Qw38b$+`?O4L6|S+Yzy@>-S?{g|ht%*YCBTSt+UO^K8ki;@-fYG!%2Bu~D(
zJ?!mKKWQDda8g%o0>gEHByCW)NrR$EVdn>JnmTBlCP8YnXpk2Dv6I$8-Nq>b1XSFh
zMH{8x+nv4JyIaa9Qn6(BjWnE{_h#PAeDij8-^}dXXg2NGC40&>26hkZ+GUI$J80Y$
zPbAi?>>4~qaP34og3a)ca~$p_KajtIfFK|U2m*qDARq_`0)l`bAP5Kof`B0K20`G<
z|NB#Mf`A|(2nYg#fFK|U2m*qDARq_`0)l`b at FquKUyNi1;7#7g(mX*x5D)|e0YN|z
z5CjAPK|l}?1Ox#=VAb<I+CJW^fPMa+N5H7Gcwr2G{dj%2jI>Ust);ehmoL~s#!AxL
zi^#lkj(J)qe>=c at 9lUB<onnZ`Db}fP;4%uPo1L}jM;GTgu2I^~lYgyK-Yl5YRt9m0
zmV?`-v%FU1pO~0UPnfRjWGBn6RqE at rX03udQL@WU+UgJJeSPk^qBUVre1HFgz5aDF
zGG($(U@}SbU6nePiWX|&*RPa4Z_)gD)JIqKS$+lev5Rgt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L8s$qtj={H2OYl
z^cP<x`ki0a=;=P4PQzCIz`w`HK|1Xov|McC>%IG>eu97?AP5Kof`A|(2nYg#fFK|U
z2m=345a2`nw!>p-n at -})j`jFV|4Ho8XNP5V8iW6B_#gNrI*afzEPK!3K!>MrJq{k9
z3CQ0C at b>{Xz^{jAxorMJq<0#?YJ_Xy*TC~{!SksA%i;M9cRneAHxl0nFHR5;1Ox#=
zKoAfF1OY)n5D)|e0YN|z5CpD10-LVBNRcQA2m*qDARq_`0)l`bAP5Kof`A|(2nYg#
jfFK|U2m*qDARq_`0)l`bAP5Kof`A|(2nYhNGXnny+MJlZ
diff --git a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp b/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
deleted file mode 100644
index 4379ffac9d744e..00000000000000
--- a/lldb/unittests/SymbolFile/PDB/SymbolFilePDBTests.cpp
+++ /dev/null
@@ -1,628 +0,0 @@
-//===-- PythonDataObjectsTests.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 "gtest/gtest.h"
-
-#include "llvm/ADT/STLExtras.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolData.h"
-#include "llvm/DebugInfo/PDB/PDBSymbolExe.h"
-#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Testing/Support/Error.h"
-
-#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h"
-#include "Plugins/SymbolFile/DWARF/SymbolFileDWARF.h"
-#include "Plugins/SymbolFile/PDB/SymbolFilePDB.h"
-#include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
-#include "TestingSupport/TestUtilities.h"
-#include "lldb/Core/Address.h"
-#include "lldb/Core/Module.h"
-#include "lldb/Core/ModuleSpec.h"
-#include "lldb/Host/FileSystem.h"
-#include "lldb/Host/HostInfo.h"
-#include "lldb/Symbol/CompileUnit.h"
-#include "lldb/Symbol/LineTable.h"
-#include "lldb/Symbol/TypeMap.h"
-#include "lldb/Utility/ArchSpec.h"
-#include "lldb/Utility/FileSpec.h"
-
-#if defined(_WIN32)
-#include "lldb/Host/windows/windows.h"
-#include <objbase.h>
-#endif
-
-#include <algorithm>
-
-using namespace lldb_private;
-
-class SymbolFilePDBTests : public testing::Test {
-public:
- void SetUp() override {
-// Initialize and TearDown the plugin every time, so we get a brand new
-// AST every time so that modifications to the AST from each test don't
-// leak into the next test.
-#if defined(_WIN32)
- ::CoInitializeEx(nullptr, COINIT_MULTITHREADED);
-#endif
-
- FileSystem::Initialize();
- HostInfo::Initialize();
- ObjectFilePECOFF::Initialize();
- plugin::dwarf::SymbolFileDWARF::Initialize();
- TypeSystemClang::Initialize();
- SymbolFilePDB::Initialize();
-
- m_pdb_test_exe = GetInputFilePath("test-pdb.exe");
- m_types_test_exe = GetInputFilePath("test-pdb-types.exe");
- }
-
- void TearDown() override {
- SymbolFilePDB::Terminate();
- TypeSystemClang::Initialize();
- plugin::dwarf::SymbolFileDWARF::Terminate();
- ObjectFilePECOFF::Terminate();
- HostInfo::Terminate();
- FileSystem::Terminate();
-
-#if defined(_WIN32)
- ::CoUninitialize();
-#endif
- }
-
-protected:
- std::string m_pdb_test_exe;
- std::string m_types_test_exe;
-
- bool FileSpecMatchesAsBaseOrFull(const FileSpec &left,
- const FileSpec &right) const {
- // If the filenames don't match, the paths can't be equal
- if (!left.FileEquals(right))
- return false;
- // If BOTH have a directory, also compare the directories.
- if (left.GetDirectory() && right.GetDirectory())
- return left.DirectoryEquals(right);
-
- // If one has a directory but not the other, they match.
- return true;
- }
-
- void VerifyLineEntry(lldb::ModuleSP module, const SymbolContext &sc,
- const FileSpec &spec, LineTable <, uint32_t line,
- lldb::addr_t addr) {
- LineEntry entry;
- Address address;
- EXPECT_TRUE(module->ResolveFileAddress(addr, address));
-
- EXPECT_TRUE(lt.FindLineEntryByAddress(address, entry));
- EXPECT_EQ(line, entry.line);
- EXPECT_EQ(address, entry.range.GetBaseAddress());
-
- EXPECT_TRUE(FileSpecMatchesAsBaseOrFull(spec, entry.GetFile()));
- }
-
- bool ContainsCompileUnit(const SymbolContextList &sc_list,
- const FileSpec &spec) const {
- for (size_t i = 0; i < sc_list.GetSize(); ++i) {
- const SymbolContext &sc = sc_list[i];
- if (FileSpecMatchesAsBaseOrFull(sc.comp_unit->GetPrimaryFile(), spec))
- return true;
- }
- return false;
- }
-
- uint64_t GetGlobalConstantInteger(llvm::pdb::IPDBSession &session,
- llvm::StringRef var) const {
- auto global = session.getGlobalScope();
- auto results =
- global->findChildren(llvm::pdb::PDB_SymType::Data, var,
- llvm::pdb::PDB_NameSearchFlags::NS_Default);
- uint32_t count = results->getChildCount();
- if (count == 0)
- return -1;
-
- auto item = results->getChildAtIndex(0);
- auto symbol = llvm::dyn_cast<llvm::pdb::PDBSymbolData>(item.get());
- if (!symbol)
- return -1;
- llvm::pdb::Variant value = symbol->getValue();
- switch (value.Type) {
- case llvm::pdb::PDB_VariantType::Int16:
- return value.Value.Int16;
- case llvm::pdb::PDB_VariantType::Int32:
- return value.Value.Int32;
- case llvm::pdb::PDB_VariantType::UInt16:
- return value.Value.UInt16;
- case llvm::pdb::PDB_VariantType::UInt32:
- return value.Value.UInt32;
- default:
- return 0;
- }
- }
-};
-
-TEST_F(SymbolFilePDBTests, TestAbilitiesForPDB) {
- // Test that when we have PDB debug info, SymbolFilePDB is used.
- FileSpec fspec(m_pdb_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFile *symfile = module->GetSymbolFile();
- EXPECT_NE(nullptr, symfile);
- EXPECT_EQ(symfile->GetPluginName(), SymbolFilePDB::GetPluginNameStatic());
-
- uint32_t expected_abilities = SymbolFile::kAllAbilities;
- EXPECT_EQ(expected_abilities, symfile->CalculateAbilities());
-}
-
-TEST_F(SymbolFilePDBTests, TestResolveSymbolContextBasename) {
- // Test that attempting to call ResolveSymbolContext with only a basename
- // finds all full paths
- // with the same basename
- FileSpec fspec(m_pdb_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFile *symfile = module->GetSymbolFile();
-
- FileSpec header_spec("test-pdb.cpp");
- SymbolContextList sc_list;
- SourceLocationSpec location_spec(header_spec, /*line=*/0);
- uint32_t result_count = symfile->ResolveSymbolContext(
- location_spec, lldb::eSymbolContextCompUnit, sc_list);
- EXPECT_EQ(1u, result_count);
- EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
-}
-
-TEST_F(SymbolFilePDBTests, TestResolveSymbolContextFullPath) {
- // Test that attempting to call ResolveSymbolContext with a full path only
- // finds the one source
- // file that matches the full path.
- FileSpec fspec(m_pdb_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFile *symfile = module->GetSymbolFile();
-
- FileSpec header_spec(
- R"spec(D:\src\llvm\tools\lldb\unittests\SymbolFile\PDB\Inputs\test-pdb.cpp)spec");
- SymbolContextList sc_list;
- SourceLocationSpec location_spec(header_spec, /*line=*/0);
- uint32_t result_count = symfile->ResolveSymbolContext(
- location_spec, lldb::eSymbolContextCompUnit, sc_list);
- EXPECT_GE(1u, result_count);
- EXPECT_TRUE(ContainsCompileUnit(sc_list, header_spec));
-}
-
-TEST_F(SymbolFilePDBTests, TestLookupOfHeaderFileWithInlines) {
- // Test that when looking up a header file via ResolveSymbolContext (i.e. a
- // file that was not by itself
- // compiled, but only contributes to the combined code of other source files),
- // a SymbolContext is returned
- // for each compiland which has line contributions from the requested header.
- FileSpec fspec(m_pdb_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFile *symfile = module->GetSymbolFile();
-
- FileSpec header_specs[] = {FileSpec("test-pdb.h"),
- FileSpec("test-pdb-nested.h")};
- FileSpec main_cpp_spec("test-pdb.cpp");
- FileSpec alt_cpp_spec("test-pdb-alt.cpp");
- for (const auto &hspec : header_specs) {
- SymbolContextList sc_list;
- SourceLocationSpec location_spec(hspec, /*line=*/0, /*column=*/std::nullopt,
- /*check_inlines=*/true);
- uint32_t result_count = symfile->ResolveSymbolContext(
- location_spec, lldb::eSymbolContextCompUnit, sc_list);
- EXPECT_EQ(2u, result_count);
- EXPECT_TRUE(ContainsCompileUnit(sc_list, main_cpp_spec));
- EXPECT_TRUE(ContainsCompileUnit(sc_list, alt_cpp_spec));
- }
-}
-
-TEST_F(SymbolFilePDBTests, TestLookupOfHeaderFileWithNoInlines) {
- // Test that when looking up a header file via ResolveSymbolContext (i.e. a
- // file that was not by itself
- // compiled, but only contributes to the combined code of other source files),
- // that if check_inlines
- // is false, no SymbolContexts are returned.
- FileSpec fspec(m_pdb_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFile *symfile = module->GetSymbolFile();
-
- FileSpec header_specs[] = {FileSpec("test-pdb.h"),
- FileSpec("test-pdb-nested.h")};
- for (const auto &hspec : header_specs) {
- SymbolContextList sc_list;
- SourceLocationSpec location_spec(hspec, /*line=*/0);
- uint32_t result_count = symfile->ResolveSymbolContext(
- location_spec, lldb::eSymbolContextCompUnit, sc_list);
- EXPECT_EQ(0u, result_count);
- }
-}
-
-TEST_F(SymbolFilePDBTests, TestLineTablesMatchAll) {
- // Test that when calling ResolveSymbolContext with a line number of 0, all
- // line entries from
- // the specified files are returned.
- FileSpec fspec(m_pdb_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFile *symfile = module->GetSymbolFile();
-
- FileSpec source_file("test-pdb.cpp");
- FileSpec header1("test-pdb.h");
- FileSpec header2("test-pdb-nested.h");
- uint32_t cus = symfile->GetNumCompileUnits();
- EXPECT_EQ(2u, cus);
-
- SymbolContextList sc_list;
- lldb::SymbolContextItem scope =
- lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
-
- SourceLocationSpec location_spec(
- source_file, /*line=*/0, /*column=*/std::nullopt, /*check_inlines=*/true);
- uint32_t count = symfile->ResolveSymbolContext(location_spec, scope, sc_list);
- EXPECT_EQ(1u, count);
- SymbolContext sc;
- EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
-
- LineTable *lt = sc.comp_unit->GetLineTable();
- EXPECT_NE(nullptr, lt);
- count = lt->GetSize();
- // We expect one extra entry for termination (per function)
- EXPECT_EQ(16u, count);
-
- VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040);
- VerifyLineEntry(module, sc, source_file, *lt, 8, 0x401043);
- VerifyLineEntry(module, sc, source_file, *lt, 9, 0x401045);
-
- VerifyLineEntry(module, sc, source_file, *lt, 13, 0x401050);
- VerifyLineEntry(module, sc, source_file, *lt, 14, 0x401054);
- VerifyLineEntry(module, sc, source_file, *lt, 15, 0x401070);
-
- VerifyLineEntry(module, sc, header1, *lt, 9, 0x401090);
- VerifyLineEntry(module, sc, header1, *lt, 10, 0x401093);
- VerifyLineEntry(module, sc, header1, *lt, 11, 0x4010a2);
-
- VerifyLineEntry(module, sc, header2, *lt, 5, 0x401080);
- VerifyLineEntry(module, sc, header2, *lt, 6, 0x401083);
- VerifyLineEntry(module, sc, header2, *lt, 7, 0x401089);
-}
-
-TEST_F(SymbolFilePDBTests, TestLineTablesMatchSpecific) {
- // Test that when calling ResolveSymbolContext with a specific line number,
- // only line entries
- // which match the requested line are returned.
- FileSpec fspec(m_pdb_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFile *symfile = module->GetSymbolFile();
-
- FileSpec source_file("test-pdb.cpp");
- FileSpec header1("test-pdb.h");
- FileSpec header2("test-pdb-nested.h");
- uint32_t cus = symfile->GetNumCompileUnits();
- EXPECT_EQ(2u, cus);
-
- SymbolContextList sc_list;
- lldb::SymbolContextItem scope =
- lldb::eSymbolContextCompUnit | lldb::eSymbolContextLineEntry;
-
- // First test with line 7, and verify that only line 7 entries are added.
- SourceLocationSpec location_spec(
- source_file, /*line=*/7, /*column=*/std::nullopt, /*check_inlines=*/true);
- uint32_t count = symfile->ResolveSymbolContext(location_spec, scope, sc_list);
- EXPECT_EQ(1u, count);
- SymbolContext sc;
- EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
-
- LineTable *lt = sc.comp_unit->GetLineTable();
- EXPECT_NE(nullptr, lt);
- count = lt->GetSize();
- // We expect one extra entry for termination
- EXPECT_EQ(3u, count);
-
- VerifyLineEntry(module, sc, source_file, *lt, 7, 0x401040);
- VerifyLineEntry(module, sc, header2, *lt, 7, 0x401089);
-
- sc_list.Clear();
- // Then test with line 9, and verify that only line 9 entries are added.
- location_spec = SourceLocationSpec(
- source_file, /*line=*/9, /*column=*/std::nullopt, /*check_inlines=*/true);
- count = symfile->ResolveSymbolContext(location_spec, scope, sc_list);
- EXPECT_EQ(1u, count);
- EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
-
- lt = sc.comp_unit->GetLineTable();
- EXPECT_NE(nullptr, lt);
- count = lt->GetSize();
- // We expect one extra entry for termination
- EXPECT_EQ(3u, count);
-
- VerifyLineEntry(module, sc, source_file, *lt, 9, 0x401045);
- VerifyLineEntry(module, sc, header1, *lt, 9, 0x401090);
-}
-
-TEST_F(SymbolFilePDBTests, TestSimpleClassTypes) {
- FileSpec fspec(m_types_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFilePDB *symfile =
- static_cast<SymbolFilePDB *>(module->GetSymbolFile());
- llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
- TypeResults query_results;
- symfile->FindTypes(TypeQuery("Class"), query_results);
- TypeMap &results = query_results.GetTypeMap();
- EXPECT_EQ(1u, results.GetSize());
- lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
- EXPECT_EQ(ConstString("Class"), udt_type->GetName());
- CompilerType compiler_type = udt_type->GetForwardCompilerType();
- EXPECT_TRUE(TypeSystemClang::IsClassType(compiler_type.GetOpaqueQualType()));
- EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_Class"),
- udt_type->GetByteSize(nullptr));
-}
-
-TEST_F(SymbolFilePDBTests, TestNestedClassTypes) {
- FileSpec fspec(m_types_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFilePDB *symfile =
- static_cast<SymbolFilePDB *>(module->GetSymbolFile());
- llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-
- auto clang_ast_ctx_or_err =
- symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- ASSERT_THAT_EXPECTED(clang_ast_ctx_or_err, llvm::Succeeded());
-
- auto clang_ast_ctx =
- llvm::dyn_cast_or_null<TypeSystemClang>(clang_ast_ctx_or_err->get());
- EXPECT_NE(nullptr, clang_ast_ctx);
-
- TypeResults query_results;
- symfile->FindTypes(TypeQuery("Class"), query_results);
- TypeMap &results = query_results.GetTypeMap();
-
- EXPECT_EQ(1u, results.GetSize());
-
- auto Class = results.GetTypeAtIndex(0);
- EXPECT_TRUE(Class);
- EXPECT_TRUE(Class->IsValidType());
-
- auto ClassCompilerType = Class->GetFullCompilerType();
- EXPECT_TRUE(ClassCompilerType.IsValid());
-
- auto ClassDeclCtx = clang_ast_ctx->GetDeclContextForType(ClassCompilerType);
- EXPECT_NE(nullptr, ClassDeclCtx);
-
- // There are two symbols for nested classes: one belonging to enclosing class
- // and one is global. We process correctly this case and create the same
- // compiler type for both, but `FindTypes` may return more than one type
- // (with the same compiler type) because the symbols have different IDs.
-
- auto ClassCompilerDeclCtx = CompilerDeclContext(clang_ast_ctx, ClassDeclCtx);
- TypeResults query_results_nested;
- symfile->FindTypes(
- TypeQuery(ClassCompilerDeclCtx, ConstString("NestedClass")),
- query_results_nested);
- TypeMap &more_results = query_results_nested.GetTypeMap();
- EXPECT_LE(1u, more_results.GetSize());
-
- lldb::TypeSP udt_type = more_results.GetTypeAtIndex(0);
- EXPECT_EQ(ConstString("NestedClass"), udt_type->GetName());
-
- CompilerType compiler_type = udt_type->GetForwardCompilerType();
- EXPECT_TRUE(TypeSystemClang::IsClassType(compiler_type.GetOpaqueQualType()));
-
- EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_NestedClass"),
- udt_type->GetByteSize(nullptr));
-}
-
-TEST_F(SymbolFilePDBTests, TestClassInNamespace) {
- FileSpec fspec(m_types_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFilePDB *symfile =
- static_cast<SymbolFilePDB *>(module->GetSymbolFile());
- llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
- auto clang_ast_ctx_or_err =
- symfile->GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
- ASSERT_THAT_EXPECTED(clang_ast_ctx_or_err, llvm::Succeeded());
-
- auto clang_ast_ctx =
- llvm::dyn_cast_or_null<TypeSystemClang>(clang_ast_ctx_or_err->get());
- EXPECT_NE(nullptr, clang_ast_ctx);
-
- clang::ASTContext &ast_ctx = clang_ast_ctx->getASTContext();
-
- auto tu = ast_ctx.getTranslationUnitDecl();
- EXPECT_NE(nullptr, tu);
-
- symfile->ParseDeclsForContext(CompilerDeclContext(
- clang_ast_ctx, static_cast<clang::DeclContext *>(tu)));
-
- auto ns_namespace_decl_ctx =
- symfile->FindNamespace(ConstString("NS"), CompilerDeclContext(), true);
- EXPECT_TRUE(ns_namespace_decl_ctx.IsValid());
-
- TypeResults query_results;
- symfile->FindTypes(TypeQuery(ns_namespace_decl_ctx, ConstString("NSClass")),
- query_results);
- TypeMap &results = query_results.GetTypeMap();
- EXPECT_EQ(1u, results.GetSize());
-
- lldb::TypeSP udt_type = results.GetTypeAtIndex(0);
- EXPECT_EQ(ConstString("NSClass"), udt_type->GetName());
-
- CompilerType compiler_type = udt_type->GetForwardCompilerType();
- EXPECT_TRUE(TypeSystemClang::IsClassType(compiler_type.GetOpaqueQualType()));
-
- EXPECT_EQ(GetGlobalConstantInteger(session, "sizeof_NSClass"),
- udt_type->GetByteSize(nullptr));
-}
-
-TEST_F(SymbolFilePDBTests, TestEnumTypes) {
- FileSpec fspec(m_types_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFilePDB *symfile =
- static_cast<SymbolFilePDB *>(module->GetSymbolFile());
- llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
- const char *EnumsToCheck[] = {"Enum", "ShortEnum"};
- for (auto Enum : EnumsToCheck) {
-
- TypeResults query_results;
- symfile->FindTypes(TypeQuery(Enum), query_results);
- TypeMap &results = query_results.GetTypeMap();
- EXPECT_EQ(1u, results.GetSize());
- lldb::TypeSP enum_type = results.GetTypeAtIndex(0);
- EXPECT_EQ(ConstString(Enum), enum_type->GetName());
- CompilerType compiler_type = enum_type->GetFullCompilerType();
- EXPECT_TRUE(TypeSystemClang::IsEnumType(compiler_type.GetOpaqueQualType()));
- clang::EnumDecl *enum_decl = TypeSystemClang::GetAsEnumDecl(compiler_type);
- EXPECT_NE(nullptr, enum_decl);
- EXPECT_EQ(2, std::distance(enum_decl->enumerator_begin(),
- enum_decl->enumerator_end()));
-
- std::string sizeof_var = "sizeof_";
- sizeof_var.append(Enum);
- EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var),
- enum_type->GetByteSize(nullptr));
- }
-}
-
-TEST_F(SymbolFilePDBTests, TestArrayTypes) {
- // In order to get this test working, we need to support lookup by symbol
- // name. Because array
- // types themselves do not have names, only the symbols have names (i.e. the
- // name of the array).
-}
-
-TEST_F(SymbolFilePDBTests, TestFunctionTypes) {
- // In order to get this test working, we need to support lookup by symbol
- // name. Because array
- // types themselves do not have names, only the symbols have names (i.e. the
- // name of the array).
-}
-
-TEST_F(SymbolFilePDBTests, TestTypedefs) {
- FileSpec fspec(m_types_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFilePDB *symfile =
- static_cast<SymbolFilePDB *>(module->GetSymbolFile());
- llvm::pdb::IPDBSession &session = symfile->GetPDBSession();
-
- const char *TypedefsToCheck[] = {"ClassTypedef", "NSClassTypedef",
- "FuncPointerTypedef",
- "VariadicFuncPointerTypedef"};
- for (auto Typedef : TypedefsToCheck) {
- TypeResults query_results;
- symfile->FindTypes(TypeQuery(Typedef), query_results);
- TypeMap &results = query_results.GetTypeMap();
- EXPECT_EQ(1u, results.GetSize());
- lldb::TypeSP typedef_type = results.GetTypeAtIndex(0);
- EXPECT_EQ(ConstString(Typedef), typedef_type->GetName());
- CompilerType compiler_type = typedef_type->GetFullCompilerType();
- auto clang_type_system =
- compiler_type.GetTypeSystem().dyn_cast_or_null<TypeSystemClang>();
- EXPECT_TRUE(
- clang_type_system->IsTypedefType(compiler_type.GetOpaqueQualType()));
-
- std::string sizeof_var = "sizeof_";
- sizeof_var.append(Typedef);
- EXPECT_EQ(GetGlobalConstantInteger(session, sizeof_var),
- typedef_type->GetByteSize(nullptr));
- }
-}
-
-TEST_F(SymbolFilePDBTests, TestRegexNameMatch) {
- FileSpec fspec(m_types_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFilePDB *symfile =
- static_cast<SymbolFilePDB *>(module->GetSymbolFile());
- TypeMap results;
-
- symfile->FindTypesByRegex(RegularExpression(".*"), 0, results);
- EXPECT_GT(results.GetSize(), 1u);
-
- // We expect no exception thrown if the given regex can't be compiled
- results.Clear();
- symfile->FindTypesByRegex(RegularExpression("**"), 0, results);
- EXPECT_EQ(0u, results.GetSize());
-}
-
-TEST_F(SymbolFilePDBTests, TestMaxMatches) {
- FileSpec fspec(m_types_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFilePDB *symfile =
- static_cast<SymbolFilePDB *>(module->GetSymbolFile());
-
- // Make a type query object we can use for all types and for one type
- TypeQuery query("NestedClass");
- {
- // Find all types that match
- TypeResults query_results;
- symfile->FindTypes(query, query_results);
- TypeMap &results = query_results.GetTypeMap();
- // We expect to find Class::NestedClass and ClassTypedef::NestedClass.
- EXPECT_EQ(results.GetSize(), 2u);
- }
- {
- // Find a single type that matches
- query.SetFindOne(true);
- TypeResults query_results;
- symfile->FindTypes(query, query_results);
- TypeMap &results = query_results.GetTypeMap();
- EXPECT_EQ(results.GetSize(), 1u);
- }
-}
-
-TEST_F(SymbolFilePDBTests, TestNullName) {
- FileSpec fspec(m_types_test_exe);
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolFilePDB *symfile =
- static_cast<SymbolFilePDB *>(module->GetSymbolFile());
-
- TypeResults query_results;
- symfile->FindTypes(TypeQuery(llvm::StringRef()), query_results);
- TypeMap &results = query_results.GetTypeMap();
- EXPECT_EQ(0u, results.GetSize());
-}
-
-TEST_F(SymbolFilePDBTests, TestFindSymbolsWithNameAndType) {
- FileSpec fspec(m_pdb_test_exe.c_str());
- ArchSpec aspec("i686-pc-windows");
- lldb::ModuleSP module = std::make_shared<Module>(fspec, aspec);
-
- SymbolContextList sc_list;
- module->FindSymbolsWithNameAndType(ConstString("?foo@@YAHH at Z"),
- lldb::eSymbolTypeAny, sc_list);
- EXPECT_EQ(1u, sc_list.GetSize());
-
- SymbolContext sc;
- EXPECT_TRUE(sc_list.GetContextAtIndex(0, sc));
- EXPECT_STREQ("int foo(int)",
- sc.GetFunctionName(Mangled::ePreferDemangled).AsCString());
-}
>From c11f8f87156e630f9fed1e5bc615217353bba56d Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere <jonas at devlieghere.com>
Date: Thu, 24 Oct 2024 22:10:33 -0700
Subject: [PATCH 2/2] Move PDB tests to NativePDB
---
.../SymbolFile/{PDB => NativePDB}/Inputs/AstRestoreTest.cpp | 0
.../{PDB => NativePDB}/Inputs/CallingConventionsTest.cpp | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/ClassLayoutTest.cpp | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/CompilandsTest.cpp | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/ExpressionsTest.cpp | 0
.../{PDB => NativePDB}/Inputs/ExpressionsTest0.script | 0
.../{PDB => NativePDB}/Inputs/ExpressionsTest1.script | 0
.../{PDB => NativePDB}/Inputs/ExpressionsTest2.script | 0
.../Shell/SymbolFile/{PDB => NativePDB}/Inputs/FuncSymbols.cpp | 0
.../{PDB => NativePDB}/Inputs/FuncSymbolsTestMain.cpp | 0
.../{PDB => NativePDB}/Inputs/FunctionLevelLinkingTest.cpp | 0
.../{PDB => NativePDB}/Inputs/FunctionLevelLinkingTest.h | 0
.../{PDB => NativePDB}/Inputs/FunctionLevelLinkingTest.ord | 0
.../{PDB => NativePDB}/Inputs/FunctionNestedBlockTest.cpp | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/PointerTypeTest.cpp | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/SimpleTypesTest.cpp | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/TypeQualsTest.cpp | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/UdtLayoutTest.cpp | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/UdtLayoutTest.script | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/VBases.cpp | 0
.../Shell/SymbolFile/{PDB => NativePDB}/Inputs/VBases.script | 0
.../{PDB => NativePDB}/Inputs/VariablesLocationsTest.cpp | 0
.../{PDB => NativePDB}/Inputs/VariablesLocationsTest.script | 0
.../SymbolFile/{PDB => NativePDB}/Inputs/VariablesTest.cpp | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/ast-restore.test | 0
.../SymbolFile/{PDB => NativePDB}/calling-conventions-arm.test | 0
.../SymbolFile/{PDB => NativePDB}/calling-conventions-x86.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/class-layout.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/compilands.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/enums-layout.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/expressions.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/func-symbols.test | 0
.../SymbolFile/{PDB => NativePDB}/function-level-linking.test | 0
.../SymbolFile/{PDB => NativePDB}/function-nested-block.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/pointers.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/type-quals.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/typedefs.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/udt-layout.test | 0
.../SymbolFile/{PDB => NativePDB}/variables-locations.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/variables.test | 0
lldb/test/Shell/SymbolFile/{PDB => NativePDB}/vbases.test | 0
lldb/test/Shell/SymbolFile/PDB/lit.local.cfg | 2 --
42 files changed, 2 deletions(-)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/AstRestoreTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/CallingConventionsTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/ClassLayoutTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/CompilandsTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/ExpressionsTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/ExpressionsTest0.script (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/ExpressionsTest1.script (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/ExpressionsTest2.script (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/FuncSymbols.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/FuncSymbolsTestMain.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/FunctionLevelLinkingTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/FunctionLevelLinkingTest.h (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/FunctionLevelLinkingTest.ord (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/FunctionNestedBlockTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/PointerTypeTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/SimpleTypesTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/TypeQualsTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/UdtLayoutTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/UdtLayoutTest.script (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/VBases.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/VBases.script (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/VariablesLocationsTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/VariablesLocationsTest.script (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/Inputs/VariablesTest.cpp (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/ast-restore.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/calling-conventions-arm.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/calling-conventions-x86.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/class-layout.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/compilands.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/enums-layout.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/expressions.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/func-symbols.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/function-level-linking.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/function-nested-block.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/pointers.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/type-quals.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/typedefs.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/udt-layout.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/variables-locations.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/variables.test (100%)
rename lldb/test/Shell/SymbolFile/{PDB => NativePDB}/vbases.test (100%)
delete mode 100644 lldb/test/Shell/SymbolFile/PDB/lit.local.cfg
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/AstRestoreTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/AstRestoreTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/AstRestoreTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/AstRestoreTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/CallingConventionsTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/CallingConventionsTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/CallingConventionsTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/ClassLayoutTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/ClassLayoutTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/ClassLayoutTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/CompilandsTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/CompilandsTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/CompilandsTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/CompilandsTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/ExpressionsTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/ExpressionsTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest0.script b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/ExpressionsTest0.script
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest0.script
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/ExpressionsTest0.script
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest1.script b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/ExpressionsTest1.script
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest1.script
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/ExpressionsTest1.script
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest2.script b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/ExpressionsTest2.script
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/ExpressionsTest2.script
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/ExpressionsTest2.script
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbols.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/FuncSymbols.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbols.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/FuncSymbols.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbolsTestMain.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/FuncSymbolsTestMain.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/FuncSymbolsTestMain.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/FuncSymbolsTestMain.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/FunctionLevelLinkingTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/FunctionLevelLinkingTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.h b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/FunctionLevelLinkingTest.h
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.h
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/FunctionLevelLinkingTest.h
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.ord b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/FunctionLevelLinkingTest.ord
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionLevelLinkingTest.ord
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/FunctionLevelLinkingTest.ord
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/FunctionNestedBlockTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/FunctionNestedBlockTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/FunctionNestedBlockTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/PointerTypeTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/PointerTypeTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/PointerTypeTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/PointerTypeTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/SimpleTypesTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/SimpleTypesTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/SimpleTypesTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/TypeQualsTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/TypeQualsTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/TypeQualsTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/TypeQualsTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/UdtLayoutTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/UdtLayoutTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/UdtLayoutTest.script
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/UdtLayoutTest.script
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/UdtLayoutTest.script
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/VBases.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/VBases.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.script b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/VBases.script
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/VBases.script
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/VBases.script
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/VariablesLocationsTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/VariablesLocationsTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.script b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/VariablesLocationsTest.script
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesLocationsTest.script
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/VariablesLocationsTest.script
diff --git a/lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesTest.cpp b/lldb/test/Shell/SymbolFile/NativePDB/Inputs/VariablesTest.cpp
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/Inputs/VariablesTest.cpp
rename to lldb/test/Shell/SymbolFile/NativePDB/Inputs/VariablesTest.cpp
diff --git a/lldb/test/Shell/SymbolFile/PDB/ast-restore.test b/lldb/test/Shell/SymbolFile/NativePDB/ast-restore.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/ast-restore.test
rename to lldb/test/Shell/SymbolFile/NativePDB/ast-restore.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test b/lldb/test/Shell/SymbolFile/NativePDB/calling-conventions-arm.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/calling-conventions-arm.test
rename to lldb/test/Shell/SymbolFile/NativePDB/calling-conventions-arm.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test b/lldb/test/Shell/SymbolFile/NativePDB/calling-conventions-x86.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/calling-conventions-x86.test
rename to lldb/test/Shell/SymbolFile/NativePDB/calling-conventions-x86.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/class-layout.test b/lldb/test/Shell/SymbolFile/NativePDB/class-layout.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/class-layout.test
rename to lldb/test/Shell/SymbolFile/NativePDB/class-layout.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/compilands.test b/lldb/test/Shell/SymbolFile/NativePDB/compilands.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/compilands.test
rename to lldb/test/Shell/SymbolFile/NativePDB/compilands.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/enums-layout.test b/lldb/test/Shell/SymbolFile/NativePDB/enums-layout.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/enums-layout.test
rename to lldb/test/Shell/SymbolFile/NativePDB/enums-layout.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/expressions.test b/lldb/test/Shell/SymbolFile/NativePDB/expressions.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/expressions.test
rename to lldb/test/Shell/SymbolFile/NativePDB/expressions.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/func-symbols.test b/lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/func-symbols.test
rename to lldb/test/Shell/SymbolFile/NativePDB/func-symbols.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/function-level-linking.test b/lldb/test/Shell/SymbolFile/NativePDB/function-level-linking.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/function-level-linking.test
rename to lldb/test/Shell/SymbolFile/NativePDB/function-level-linking.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/function-nested-block.test b/lldb/test/Shell/SymbolFile/NativePDB/function-nested-block.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/function-nested-block.test
rename to lldb/test/Shell/SymbolFile/NativePDB/function-nested-block.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/pointers.test b/lldb/test/Shell/SymbolFile/NativePDB/pointers.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/pointers.test
rename to lldb/test/Shell/SymbolFile/NativePDB/pointers.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/type-quals.test b/lldb/test/Shell/SymbolFile/NativePDB/type-quals.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/type-quals.test
rename to lldb/test/Shell/SymbolFile/NativePDB/type-quals.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/typedefs.test b/lldb/test/Shell/SymbolFile/NativePDB/typedefs.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/typedefs.test
rename to lldb/test/Shell/SymbolFile/NativePDB/typedefs.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/udt-layout.test b/lldb/test/Shell/SymbolFile/NativePDB/udt-layout.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/udt-layout.test
rename to lldb/test/Shell/SymbolFile/NativePDB/udt-layout.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/variables-locations.test b/lldb/test/Shell/SymbolFile/NativePDB/variables-locations.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/variables-locations.test
rename to lldb/test/Shell/SymbolFile/NativePDB/variables-locations.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/variables.test b/lldb/test/Shell/SymbolFile/NativePDB/variables.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/variables.test
rename to lldb/test/Shell/SymbolFile/NativePDB/variables.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/vbases.test b/lldb/test/Shell/SymbolFile/NativePDB/vbases.test
similarity index 100%
rename from lldb/test/Shell/SymbolFile/PDB/vbases.test
rename to lldb/test/Shell/SymbolFile/NativePDB/vbases.test
diff --git a/lldb/test/Shell/SymbolFile/PDB/lit.local.cfg b/lldb/test/Shell/SymbolFile/PDB/lit.local.cfg
deleted file mode 100644
index c9b378b7a8a5a9..00000000000000
--- a/lldb/test/Shell/SymbolFile/PDB/lit.local.cfg
+++ /dev/null
@@ -1,2 +0,0 @@
-if 'lldb-repro' in config.available_features:
- config.unsupported = True
More information about the lldb-commits
mailing list