[Lldb-commits] [lldb] r349673 - [NativePDB] Fix a use after free and enable corresponding native test.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 19 11:45:30 PST 2018


Author: zturner
Date: Wed Dec 19 11:45:30 2018
New Revision: 349673

URL: http://llvm.org/viewvc/llvm-project?rev=349673&view=rev
Log:
[NativePDB] Fix a use after free and enable corresponding native test.

We had a use after free where we were assigning the result of a function
that returned a string to a StringRef.  After fixing this use after
free, one of the DIA PDB tests now passes with the native PDB reader,
so we enable the test under native mode as well.  The goal is to
eventually make all the tests pass under both, at which point we can
disable them all under DIA mode.

Modified:
    lldb/trunk/lit/SymbolFile/PDB/compilands.test
    lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp

Modified: lldb/trunk/lit/SymbolFile/PDB/compilands.test
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/PDB/compilands.test?rev=349673&r1=349672&r2=349673&view=diff
==============================================================================
--- lldb/trunk/lit/SymbolFile/PDB/compilands.test (original)
+++ lldb/trunk/lit/SymbolFile/PDB/compilands.test Wed Dec 19 11:45:30 2018
@@ -1,7 +1,8 @@
 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: lldb-test symbols %T/CompilandsTest.cpp.exe | FileCheck %s
+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
 
 ; Link default libraries
 

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=349673&r1=349672&r2=349673&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp Wed Dec 19 11:45:30 2018
@@ -419,7 +419,7 @@ SymbolFileNativePDB::CreateCompileUnit(c
   if (cci.m_compile_opts && cci.m_compile_opts->hasOptimizations())
     optimized = eLazyBoolYes;
 
-  llvm::StringRef source_file_name =
+  llvm::SmallString<64> source_file_name =
       m_index->compilands().GetMainSourceFile(cci);
   FileSpec fs(source_file_name);
 




More information about the lldb-commits mailing list