[Lldb-commits] [lldb] r344429 - Try to fix some failures on MacOSX with the NativePDB patch.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Fri Oct 12 15:57:40 PDT 2018


Author: zturner
Date: Fri Oct 12 15:57:40 2018
New Revision: 344429

URL: http://llvm.org/viewvc/llvm-project?rev=344429&view=rev
Log:
Try to fix some failures on MacOSX with the NativePDB patch.

This adds -- before any filenames, so that /U doesn't get interpreted
as a command line.

It also adds better error checking, so that we don't get assertions
on the failure path when a file fails to parse as a PDB.

Modified:
    lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
    lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
    lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
    lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp?rev=344429&r1=344428&r2=344429&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/disassembly.cpp Fri Oct 12 15:57:40 2018
@@ -1,8 +1,8 @@
 // clang-format off
 
 // Test that we can show disassembly and source.
-// RUN: clang-cl /Z7 /GS- /GR- /c %s /Fo%t.obj
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb %t.obj
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
 // RUN:     %p/Inputs/disassembly.lldbinit | FileCheck %s
 

Modified: lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp?rev=344429&r1=344428&r2=344429&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/simple-breakpoints.cpp Fri Oct 12 15:57:40 2018
@@ -1,8 +1,8 @@
 // clang-format off
 
 // Test that we can set simple breakpoints using PDB on any platform.
-// RUN: clang-cl /Z7 /GS- /GR- /c %s /Fo%t.obj
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb %t.obj
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
 // RUN:     %p/Inputs/breakpoints.lldbinit | FileCheck %s
 

Modified: lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp?rev=344429&r1=344428&r2=344429&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/source-list.cpp Fri Oct 12 15:57:40 2018
@@ -1,8 +1,8 @@
 // clang-format off
 
 // Test that we can set display source of functions.
-// RUN: clang-cl /Z7 /GS- /GR- /c %s /Fo%t.obj
-// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb %t.obj
+// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s 
+// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe /PDB:%t.pdb -- %t.obj
 // RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
 // RUN:     %p/Inputs/source-list.lldbinit | FileCheck %s
 

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp?rev=344429&r1=344428&r2=344429&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Fri Oct 12 15:57:40 2018
@@ -70,10 +70,14 @@ static std::unique_ptr<PDBFile> loadPDBF
       std::move(Buffer), llvm::support::little);
 
   auto File = llvm::make_unique<PDBFile>(Path, std::move(Stream), Allocator);
-  if (auto EC = File->parseFileHeaders())
+  if (auto EC = File->parseFileHeaders()) {
+    llvm::consumeError(std::move(EC));
     return nullptr;
-  if (auto EC = File->parseStreamData())
+  }
+  if (auto EC = File->parseStreamData()) {
+    llvm::consumeError(std::move(EC));
     return nullptr;
+  }
 
   return File;
 }
@@ -109,6 +113,9 @@ loadMatchingPDBFile(std::string exe_path
   if (ec || magic != llvm::file_magic::pdb)
     return nullptr;
   std::unique_ptr<PDBFile> pdb = loadPDBFile(pdb_file, allocator);
+  if (!pdb)
+    return nullptr;
+
   auto expected_info = pdb->getPDBInfoStream();
   if (!expected_info) {
     llvm::consumeError(expected_info.takeError());




More information about the lldb-commits mailing list