aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/SymbolFile/PDB
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/SymbolFile/PDB')
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp25
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp1
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp56
-rw-r--r--lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h4
4 files changed, 49 insertions, 37 deletions
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
index f45287fd0fff..c3f424d06c54 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -22,13 +22,15 @@
#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"
@@ -709,7 +711,7 @@ lldb::TypeSP PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type) {
bytes = size;
Encoding encoding = TranslateBuiltinEncoding(builtin_kind);
CompilerType builtin_ast_type = GetBuiltinTypeForPDBEncodingAndBitSize(
- m_ast, *builtin_type, encoding, bytes.getValueOr(0) * 8);
+ m_ast, *builtin_type, encoding, bytes.value_or(0) * 8);
if (builtin_type->isConstType())
builtin_ast_type = builtin_ast_type.AddConstModifier();
@@ -799,7 +801,8 @@ bool PDBASTParser::CompleteTypeFromPDB(
if (uid_it == m_forward_decl_to_uid.end())
return true;
- auto symbol_file = static_cast<SymbolFilePDB *>(m_ast.GetSymbolFile());
+ auto symbol_file = static_cast<SymbolFilePDB *>(
+ m_ast.GetSymbolFile()->GetBackingSymbolFile());
if (!symbol_file)
return false;
@@ -833,7 +836,8 @@ PDBASTParser::GetDeclForSymbol(const llvm::pdb::PDBSymbol &symbol) {
if (it != m_uid_to_decl.end())
return it->second;
- auto symbol_file = static_cast<SymbolFilePDB *>(m_ast.GetSymbolFile());
+ auto symbol_file = static_cast<SymbolFilePDB *>(
+ m_ast.GetSymbolFile()->GetBackingSymbolFile());
if (!symbol_file)
return nullptr;
@@ -999,7 +1003,8 @@ PDBASTParser::GetDeclContextForSymbol(const llvm::pdb::PDBSymbol &symbol) {
return result;
}
- auto symbol_file = static_cast<SymbolFilePDB *>(m_ast.GetSymbolFile());
+ auto symbol_file = static_cast<SymbolFilePDB *>(
+ m_ast.GetSymbolFile()->GetBackingSymbolFile());
if (!symbol_file)
return nullptr;
@@ -1039,7 +1044,8 @@ clang::DeclContext *PDBASTParser::GetDeclContextContainingSymbol(
if (specs.empty())
return m_ast.GetTranslationUnitDecl();
- auto symbol_file = static_cast<SymbolFilePDB *>(m_ast.GetSymbolFile());
+ auto symbol_file = static_cast<SymbolFilePDB *>(
+ m_ast.GetSymbolFile()->GetBackingSymbolFile());
if (!symbol_file)
return m_ast.GetTranslationUnitDecl();
@@ -1092,7 +1098,8 @@ clang::DeclContext *PDBASTParser::GetDeclContextContainingSymbol(
void PDBASTParser::ParseDeclsForDeclContext(
const clang::DeclContext *decl_context) {
- auto symbol_file = static_cast<SymbolFilePDB *>(m_ast.GetSymbolFile());
+ auto symbol_file = static_cast<SymbolFilePDB *>(
+ m_ast.GetSymbolFile()->GetBackingSymbolFile());
if (!symbol_file)
return;
@@ -1298,7 +1305,7 @@ void PDBASTParser::AddRecordMembers(
TypeSystemClang::SetIntegerInitializerForVariable(
decl, value.toAPSInt().extOrTrunc(type_width));
} else {
- LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST),
+ 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.",
@@ -1316,7 +1323,7 @@ void PDBASTParser::AddRecordMembers(
decl, value.toAPFloat());
decl->setConstexpr(true);
} else {
- LLDB_LOG(GetLogIfAllCategoriesSet(LIBLLDB_LOG_AST),
+ 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.",
diff --git a/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp b/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
index 330188e29f00..96e9de704e41 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp
@@ -25,6 +25,7 @@
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>
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index a40b6ec9a635..bd3d16aad6c2 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -24,9 +24,11 @@
#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/DebugInfo/PDB/ConcreteSymbolEnumerator.h"
#include "llvm/DebugInfo/PDB/GenericError.h"
#include "llvm/DebugInfo/PDB/IPDBDataStream.h"
#include "llvm/DebugInfo/PDB/IPDBEnumChildren.h"
@@ -44,7 +46,9 @@
#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"
@@ -53,7 +57,7 @@
#include "Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h"
#if defined(_WIN32)
-#include "llvm/Config/config.h"
+#include "llvm/Config/llvm-config.h"
#endif
using namespace lldb;
@@ -73,6 +77,8 @@ lldb::LanguageType TranslateLanguage(PDB_Lang lang) {
return lldb::LanguageType::eLanguageTypeC;
case PDB_Lang::Swift:
return lldb::LanguageType::eLanguageTypeSwift;
+ case PDB_Lang::Rust:
+ return lldb::LanguageType::eLanguageTypeRust;
default:
return lldb::LanguageType::eLanguageTypeUnknown;
}
@@ -129,7 +135,7 @@ SymbolFilePDB::CreateInstance(ObjectFileSP objfile_sp) {
}
SymbolFilePDB::SymbolFilePDB(lldb::ObjectFileSP objfile_sp)
- : SymbolFile(std::move(objfile_sp)), m_session_up(), m_global_scope_up() {}
+ : SymbolFileCommon(std::move(objfile_sp)), m_session_up(), m_global_scope_up() {}
SymbolFilePDB::~SymbolFilePDB() = default;
@@ -307,8 +313,8 @@ SymbolFilePDB::ParseCompileUnitFunctionForPDBFunc(const PDBSymbolFunc &pdb_func,
LanguageType lang = ParseLanguage(comp_unit);
auto type_system_or_err = GetTypeSystemForLanguage(lang);
if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to parse PDBFunc");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to parse PDBFunc");
return nullptr;
}
@@ -557,8 +563,8 @@ lldb_private::Type *SymbolFilePDB::ResolveTypeUID(lldb::user_id_t type_uid) {
auto type_system_or_err =
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to ResolveTypeUID");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to ResolveTypeUID");
return nullptr;
}
@@ -594,8 +600,8 @@ bool SymbolFilePDB::CompleteType(lldb_private::CompilerType &compiler_type) {
auto type_system_or_err =
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to get dynamic array info for UID");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to get dynamic array info for UID");
return false;
}
@@ -616,8 +622,8 @@ 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(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to get decl for UID");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to get decl for UID");
return CompilerDecl();
}
@@ -646,8 +652,8 @@ 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(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to get DeclContext for UID");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to get DeclContext for UID");
return CompilerDeclContext();
}
@@ -676,8 +682,8 @@ 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(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to get DeclContext containing UID");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to get DeclContext containing UID");
return CompilerDeclContext();
}
@@ -705,8 +711,8 @@ void SymbolFilePDB::ParseDeclsForContext(
auto type_system_or_err =
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to parse decls for context");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to parse decls for context");
return;
}
@@ -791,7 +797,7 @@ uint32_t SymbolFilePDB::ResolveSymbolContext(
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().getValueOr(0);
+ 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
@@ -1445,8 +1451,8 @@ 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(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to dump ClangAST");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to dump ClangAST");
return;
}
@@ -1658,8 +1664,8 @@ PDBASTParser *SymbolFilePDB::GetPDBAstParser() {
auto type_system_or_err =
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to get PDB AST parser");
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to get PDB AST parser");
return nullptr;
}
@@ -1678,9 +1684,8 @@ SymbolFilePDB::FindNamespace(lldb_private::ConstString name,
auto type_system_or_err =
GetTypeSystemForLanguage(lldb::eLanguageTypeC_plus_plus);
if (auto err = type_system_or_err.takeError()) {
- LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err), "Unable to find namespace {}",
- name.AsCString());
+ LLDB_LOG_ERROR(GetLog(LLDBLog::Symbols), std::move(err),
+ "Unable to find namespace {}", name.AsCString());
return CompilerDeclContext();
}
@@ -1974,8 +1979,7 @@ bool SymbolFilePDB::DeclContextMatchesThisSymbolFile(
decl_ctx_type_system->GetMinimumLanguage(nullptr));
if (auto err = type_system_or_err.takeError()) {
LLDB_LOG_ERROR(
- lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_SYMBOLS),
- std::move(err),
+ GetLog(LLDBLog::Symbols), std::move(err),
"Unable to determine if DeclContext matches this symbol file");
return false;
}
diff --git a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
index 69f1d268edfd..5d4b51ba2e19 100644
--- a/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ b/lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -21,7 +21,7 @@
class PDBASTParser;
-class SymbolFilePDB : public lldb_private::SymbolFile {
+class SymbolFilePDB : public lldb_private::SymbolFileCommon {
/// LLVM RTTI support.
static char ID;
@@ -29,7 +29,7 @@ public:
/// LLVM RTTI support.
/// \{
bool isA(const void *ClassID) const override {
- return ClassID == &ID || SymbolFile::isA(ClassID);
+ return ClassID == &ID || SymbolFileCommon::isA(ClassID);
}
static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
/// \}