[Lldb-commits] [lldb] r268545 - Update for llvm change to add pdb namespace.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed May 4 13:33:54 PDT 2016


Author: zturner
Date: Wed May  4 15:33:53 2016
New Revision: 268545

URL: http://llvm.org/viewvc/llvm-project?rev=268545&view=rev
Log:
Update for llvm change to add pdb namespace.

r268544 moves all PDB reading code into a pdb namespace,
so LLDB needs to be updated to take this into account.

Modified:
    lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp
    lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
    lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h
    lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
    lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h

Modified: lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp?rev=268545&r1=268544&r2=268545&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Live/DebuggerThread.cpp Wed May  4 15:33:53 2016
@@ -379,7 +379,7 @@ DebuggerThread::HandleExceptionEvent(con
         {
             WINLOG_IFANY(WINDOWS_LOG_EVENT | WINDOWS_LOG_EXCEPTION | WINDOWS_LOG_PROCESS,
                             "Breakpoint exception is cue to detach from process 0x%x",
-                            m_pid_to_detach);
+                            m_pid_to_detach.load());
             ::DebugActiveProcessStop(m_pid_to_detach);
             m_detached = true;
         }

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp?rev=268545&r1=268544&r2=268545&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp Wed May  4 15:33:53 2016
@@ -32,6 +32,7 @@
 using namespace lldb;
 using namespace lldb_private;
 using namespace llvm;
+using namespace llvm::pdb;
 
 namespace
 {
@@ -85,7 +86,7 @@ PDBASTParser::~PDBASTParser()
 // DebugInfoASTParser interface
 
 lldb::TypeSP
-PDBASTParser::CreateLLDBTypeFromPDBType(const llvm::PDBSymbol &type)
+PDBASTParser::CreateLLDBTypeFromPDBType(const PDBSymbol &type)
 {
     // PDB doesn't maintain enough information to robustly rebuild the entire
     // tree, and this is most problematic when it comes to figure out the
@@ -194,7 +195,7 @@ PDBASTParser::CreateLLDBTypeFromPDBType(
 }
 
 bool
-PDBASTParser::AddEnumValue(CompilerType enum_type, const llvm::PDBSymbolData &enum_value) const
+PDBASTParser::AddEnumValue(CompilerType enum_type, const PDBSymbolData &enum_value) const
 {
     Declaration decl;
     Variant v = enum_value.getValue();

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h?rev=268545&r1=268544&r2=268545&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.h Wed May  4 15:33:53 2016
@@ -30,10 +30,13 @@ class CompilerType;
 
 namespace llvm
 {
+namespace pdb
+{
 class PDBSymbol;
 class PDBSymbolData;
 class PDBSymbolTypeBuiltin;
 }
+}
 
 class PDBASTParser
 {
@@ -42,11 +45,11 @@ public:
     ~PDBASTParser();
 
     lldb::TypeSP
-    CreateLLDBTypeFromPDBType(const llvm::PDBSymbol &type);
+    CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol &type);
 
 private:
     bool
-    AddEnumValue(lldb_private::CompilerType enum_type, const llvm::PDBSymbolData &data) const;
+    AddEnumValue(lldb_private::CompilerType enum_type, const llvm::pdb::PDBSymbolData &data) const;
 
     lldb_private::ClangASTContext &m_ast;
     lldb_private::ClangASTImporter m_ast_importer;

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp?rev=268545&r1=268544&r2=268545&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp Wed May  4 15:33:53 2016
@@ -39,16 +39,18 @@
 #include <regex>
 
 using namespace lldb_private;
+using namespace llvm::pdb;
 
 namespace
 {
-    lldb::LanguageType TranslateLanguage(llvm::PDB_Lang lang)
+lldb::LanguageType
+TranslateLanguage(PDB_Lang lang)
+{
+    switch (lang)
     {
-        switch (lang)
-        {
-        case llvm::PDB_Lang::Cpp:
+        case PDB_Lang::Cpp:
             return lldb::LanguageType::eLanguageTypeC_plus_plus;
-        case llvm::PDB_Lang::C:
+        case PDB_Lang::C:
             return lldb::LanguageType::eLanguageTypeC;
         default:
             return lldb::LanguageType::eLanguageTypeUnknown;
@@ -115,8 +117,8 @@ SymbolFilePDB::CalculateAbilities()
     {
         // Lazily load and match the PDB file, but only do this once.
         std::string exePath = m_obj_file->GetFileSpec().GetPath();
-        auto error = llvm::loadDataForEXE(llvm::PDB_ReaderType::DIA, llvm::StringRef(exePath), m_session_up);
-        if (error != llvm::PDB_ErrorCode::Success)
+        auto error = loadDataForEXE(PDB_ReaderType::DIA, llvm::StringRef(exePath), m_session_up);
+        if (error != PDB_ErrorCode::Success)
             return 0;
     }
     return CompileUnits | LineTables;
@@ -139,7 +141,7 @@ SymbolFilePDB::GetNumCompileUnits()
     if (m_cached_compile_unit_count == 0)
     {
         auto global = m_session_up->getGlobalScope();
-        auto compilands = global->findAllChildren<llvm::PDBSymbolCompiland>();
+        auto compilands = global->findAllChildren<PDBSymbolCompiland>();
         m_cached_compile_unit_count = compilands->getChildCount();
 
         // The linker can inject an additional "dummy" compilation unit into the PDB.
@@ -157,7 +159,7 @@ lldb::CompUnitSP
 SymbolFilePDB::ParseCompileUnitAtIndex(uint32_t index)
 {
     auto global = m_session_up->getGlobalScope();
-    auto compilands = global->findAllChildren<llvm::PDBSymbolCompiland>();
+    auto compilands = global->findAllChildren<PDBSymbolCompiland>();
     auto cu = compilands->getChildAtIndex(index);
 
     uint32_t id = cu->getSymIndexId();
@@ -173,10 +175,10 @@ SymbolFilePDB::ParseCompileUnitLanguage(
     if (!sc.comp_unit)
         return lldb::eLanguageTypeUnknown;
 
-    auto cu = m_session_up->getConcreteSymbolById<llvm::PDBSymbolCompiland>(sc.comp_unit->GetID());
+    auto cu = m_session_up->getConcreteSymbolById<PDBSymbolCompiland>(sc.comp_unit->GetID());
     if (!cu)
         return lldb::eLanguageTypeUnknown;
-    auto details = cu->findOneChild<llvm::PDBSymbolCompilandDetails>();
+    auto details = cu->findOneChild<PDBSymbolCompilandDetails>();
     if (!details)
         return lldb::eLanguageTypeUnknown;
     return TranslateLanguage(details->getLanguage());
@@ -213,7 +215,7 @@ SymbolFilePDB::ParseCompileUnitSupportFi
     // (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.
-    auto cu = m_session_up->getConcreteSymbolById<llvm::PDBSymbolCompiland>(sc.comp_unit->GetID());
+    auto cu = m_session_up->getConcreteSymbolById<PDBSymbolCompiland>(sc.comp_unit->GetID());
     if (!cu)
         return false;
     auto files = m_session_up->getSourceFilesForCompiland(*cu);
@@ -330,7 +332,7 @@ SymbolFilePDB::ResolveSymbolContext(cons
         // `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(), llvm::PDB_NameSearchFlags::NS_CaseInsensitive);
+            m_session_up->findCompilandsForSourceFile(file_spec.GetPath(), PDB_NameSearchFlags::NS_CaseInsensitive);
 
         // For each one, either find get its previously parsed data, or parse it afresh and add it to
         // the symbol context list.
@@ -347,7 +349,7 @@ SymbolFilePDB::ResolveSymbolContext(cons
                 // for now, although we need to find a long term solution.
                 std::string source_file = compiland->getSourceFileName();
                 auto pdb_file = m_session_up->findOneSourceFile(compiland.get(), source_file,
-                                                                llvm::PDB_NameSearchFlags::NS_CaseInsensitive);
+                                                                PDB_NameSearchFlags::NS_CaseInsensitive);
                 source_file = pdb_file->getFileName();
                 FileSpec this_spec(source_file, false, FileSpec::ePathSyntaxWindows);
                 if (!file_spec.FileEquals(this_spec))
@@ -438,9 +440,9 @@ SymbolFilePDB::FindTypesByRegex(const st
     // 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 compare against all
     // of them.
-    llvm::PDB_SymType tags_to_search[] = {llvm::PDB_SymType::Enum, llvm::PDB_SymType::Typedef, llvm::PDB_SymType::UDT};
+    PDB_SymType tags_to_search[] = {PDB_SymType::Enum, PDB_SymType::Typedef, PDB_SymType::UDT};
     auto global = m_session_up->getGlobalScope();
-    std::unique_ptr<llvm::IPDBEnumSymbols> results;
+    std::unique_ptr<IPDBEnumSymbols> results;
 
     std::regex re(regex);
 
@@ -455,11 +457,11 @@ SymbolFilePDB::FindTypesByRegex(const st
                 break;
 
             std::string type_name;
-            if (auto enum_type = llvm::dyn_cast<llvm::PDBSymbolTypeEnum>(result.get()))
+            if (auto enum_type = llvm::dyn_cast<PDBSymbolTypeEnum>(result.get()))
                 type_name = enum_type->getName();
-            else if (auto typedef_type = llvm::dyn_cast<llvm::PDBSymbolTypeTypedef>(result.get()))
+            else if (auto typedef_type = llvm::dyn_cast<PDBSymbolTypeTypedef>(result.get()))
                 type_name = typedef_type->getName();
-            else if (auto class_type = llvm::dyn_cast<llvm::PDBSymbolTypeUDT>(result.get()))
+            else if (auto class_type = llvm::dyn_cast<PDBSymbolTypeUDT>(result.get()))
                 type_name = class_type->getName();
             else
             {
@@ -488,8 +490,8 @@ void
 SymbolFilePDB::FindTypesByName(const std::string &name, uint32_t max_matches, lldb_private::TypeMap &types)
 {
     auto global = m_session_up->getGlobalScope();
-    std::unique_ptr<llvm::IPDBEnumSymbols> results;
-    results = global->findChildren(llvm::PDB_SymType::None, name.c_str(), llvm::PDB_NameSearchFlags::NS_Default);
+    std::unique_ptr<IPDBEnumSymbols> results;
+    results = global->findChildren(PDB_SymType::None, name.c_str(), PDB_NameSearchFlags::NS_Default);
 
     uint32_t matches = 0;
 
@@ -499,9 +501,9 @@ SymbolFilePDB::FindTypesByName(const std
             break;
         switch (result->getSymTag())
         {
-            case llvm::PDB_SymType::Enum:
-            case llvm::PDB_SymType::UDT:
-            case llvm::PDB_SymType::Typedef:
+            case PDB_SymType::Enum:
+            case PDB_SymType::UDT:
+            case PDB_SymType::Typedef:
                 break;
             default:
                 // We're only looking for types that have names.  Skip symbols, as well as
@@ -570,13 +572,13 @@ SymbolFilePDB::GetPluginVersion()
     return 1;
 }
 
-llvm::IPDBSession &
+IPDBSession &
 SymbolFilePDB::GetPDBSession()
 {
     return *m_session_up;
 }
 
-const llvm::IPDBSession &
+const IPDBSession &
 SymbolFilePDB::GetPDBSession() const
 {
     return *m_session_up;
@@ -589,19 +591,19 @@ SymbolFilePDB::ParseCompileUnitForSymInd
     if (found_cu != m_comp_units.end())
         return found_cu->second;
 
-    auto cu = m_session_up->getConcreteSymbolById<llvm::PDBSymbolCompiland>(id);
+    auto cu = m_session_up->getConcreteSymbolById<PDBSymbolCompiland>(id);
 
     // `getSourceFileName` returns the basename of the original source file used to generate this compiland.  It does
     // not return the full path.  Currently the only way to get that is to do a basename lookup to get the
     // IPDBSourceFile, but this is ambiguous in the case of two source files with the same name contributing to the
     // same compiland. This is a moderately extreme edge case, so we consider this ok for now, although we need to find
     // a long term solution.
-    auto file = m_session_up->findOneSourceFile(cu.get(), cu->getSourceFileName(),
-                                                llvm::PDB_NameSearchFlags::NS_CaseInsensitive);
+    auto file =
+        m_session_up->findOneSourceFile(cu.get(), cu->getSourceFileName(), PDB_NameSearchFlags::NS_CaseInsensitive);
     std::string path = file->getFileName();
 
     lldb::LanguageType lang;
-    auto details = cu->findOneChild<llvm::PDBSymbolCompilandDetails>();
+    auto details = cu->findOneChild<PDBSymbolCompilandDetails>();
     if (!details)
         lang = lldb::eLanguageTypeC_plus_plus;
     else
@@ -618,7 +620,7 @@ bool
 SymbolFilePDB::ParseCompileUnitLineTable(const lldb_private::SymbolContext &sc, uint32_t match_line)
 {
     auto global = m_session_up->getGlobalScope();
-    auto cu = m_session_up->getConcreteSymbolById<llvm::PDBSymbolCompiland>(sc.comp_unit->GetID());
+    auto cu = m_session_up->getConcreteSymbolById<PDBSymbolCompiland>(sc.comp_unit->GetID());
 
     // 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
@@ -673,13 +675,13 @@ SymbolFilePDB::ParseCompileUnitLineTable
                 bool is_statement = line->isStatement();
                 bool is_prologue = false;
                 bool is_epilogue = false;
-                auto func = m_session_up->findSymbolByAddress(addr, llvm::PDB_SymType::Function);
+                auto func = m_session_up->findSymbolByAddress(addr, PDB_SymType::Function);
                 if (func)
                 {
-                    auto prologue = func->findOneChild<llvm::PDBSymbolFuncDebugStart>();
+                    auto prologue = func->findOneChild<PDBSymbolFuncDebugStart>();
                     is_prologue = (addr == prologue->getVirtualAddress());
 
-                    auto epilogue = func->findOneChild<llvm::PDBSymbolFuncDebugEnd>();
+                    auto epilogue = func->findOneChild<PDBSymbolFuncDebugEnd>();
                     is_epilogue = (addr == epilogue->getVirtualAddress());
                 }
 
@@ -708,7 +710,7 @@ SymbolFilePDB::ParseCompileUnitLineTable
 }
 
 void
-SymbolFilePDB::BuildSupportFileIdToSupportFileIndexMap(const llvm::PDBSymbolCompiland &cu,
+SymbolFilePDB::BuildSupportFileIdToSupportFileIndexMap(const PDBSymbolCompiland &cu,
                                                        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

Modified: lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h?rev=268545&r1=268544&r2=268545&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h Wed May  4 15:33:53 2016
@@ -169,10 +169,10 @@ public:
     uint32_t
     GetPluginVersion() override;
 
-    llvm::IPDBSession &
+    llvm::pdb::IPDBSession &
     GetPDBSession();
 
-    const llvm::IPDBSession &
+    const llvm::pdb::IPDBSession &
     GetPDBSession() const;
 
 private:
@@ -183,7 +183,7 @@ private:
     ParseCompileUnitLineTable(const lldb_private::SymbolContext &sc, uint32_t match_line);
 
     void
-    BuildSupportFileIdToSupportFileIndexMap(const llvm::PDBSymbolCompiland &cu,
+    BuildSupportFileIdToSupportFileIndexMap(const llvm::pdb::PDBSymbolCompiland &cu,
                                             llvm::DenseMap<uint32_t, uint32_t> &index_map) const;
 
     void
@@ -196,7 +196,7 @@ private:
     llvm::DenseMap<uint32_t, lldb::TypeSP> m_types;
 
     std::vector<lldb::TypeSP> m_builtin_types;
-    std::unique_ptr<llvm::IPDBSession> m_session_up;
+    std::unique_ptr<llvm::pdb::IPDBSession> m_session_up;
     uint32_t m_cached_compile_unit_count;
     std::unique_ptr<lldb_private::CompilerDeclContext> m_tu_decl_ctx_up;
 };




More information about the lldb-commits mailing list