[Lldb-commits] [lldb] r346466 - Revert "[FileSystem] Make use of FS in TildeExpressionResolver"

2018-11-08 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Nov  8 17:59:28 2018
New Revision: 346466

URL: http://llvm.org/viewvc/llvm-project?rev=346466=rev
Log:
Revert "[FileSystem] Make use of FS in TildeExpressionResolver"

The whole point of this change was making it possible to resolve paths
without depending on the FileSystem, which is not what I did here. Not
sure what I was thinking...

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/source/Target/TargetList.cpp
lldb/trunk/source/Utility/TildeExpressionResolver.cpp
lldb/trunk/unittests/Host/FileSystemTest.cpp
lldb/trunk/unittests/Interpreter/TestCompletion.cpp
lldb/trunk/unittests/TestingSupport/MockTildeExpressionResolver.cpp
lldb/trunk/unittests/TestingSupport/MockTildeExpressionResolver.h
lldb/trunk/unittests/Utility/TildeExpressionResolverTest.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346466=346465=346466=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Nov  8 17:59:28 2018
@@ -132,8 +132,7 @@ public:
   void *callback_baton);
 
   std::error_code GetRealPath(const llvm::Twine ,
-  llvm::SmallVectorImpl ,
-  bool expand_tilde) const;
+  llvm::SmallVectorImpl ) const;
 
 private:
   static llvm::Optional ();

Modified: lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h?rev=346466=346465=346466=diff
==
--- lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h (original)
+++ lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h Thu Nov  8 
17:59:28 2018
@@ -18,10 +18,8 @@ template  class SmallVectorI
 }
 
 namespace lldb_private {
-class FileSystem;
 class TildeExpressionResolver {
 public:
-  TildeExpressionResolver(FileSystem ) : m_fs(fs) {}
   virtual ~TildeExpressionResolver();
 
   /// Resolve a Tilde Expression contained according to bash rules.
@@ -54,20 +52,14 @@ public:
   /// the username portion with the matched result.
   bool ResolveFullPath(llvm::StringRef Expr,
llvm::SmallVectorImpl );
-
-protected:
-  FileSystem _fs;
 };
 
 class StandardTildeExpressionResolver : public TildeExpressionResolver {
 public:
-  StandardTildeExpressionResolver(FileSystem )
-  : TildeExpressionResolver(fs) {}
-
   bool ResolveExact(llvm::StringRef Expr,
 llvm::SmallVectorImpl ) override;
   bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> ) 
override;
 };
-} // namespace lldb_private
+}
 
 #endif // #ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=346466=346465=346466=diff
==
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Thu Nov  8 17:59:28 2018
@@ -231,7 +231,7 @@ static int DiskFilesOrDirectories(const
 static int DiskFilesOrDirectories(CompletionRequest ,
   bool only_directories) {
   request.SetWordComplete(false);
-  StandardTildeExpressionResolver resolver(FileSystem::Instance());
+  StandardTildeExpressionResolver resolver;
   StringList matches;
   DiskFilesOrDirectories(request.GetCursorArgumentPrefix(), only_directories,
  matches, resolver);

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=346466=346465=346466=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov  8 17:59:28 2018
@@ -183,9 +183,8 @@ std::error_code FileSystem::MakeAbsolute
 }
 
 std::error_code FileSystem::GetRealPath(const Twine ,
-SmallVectorImpl ,
-bool expand_tilde) const {
-  return m_fs->getRealPath(path, output, expand_tilde);
+SmallVectorImpl ) const {
+  return m_fs->getRealPath(path, output);
 }
 
 void FileSystem::Resolve(SmallVectorImpl ) {
@@ -194,8 +193,8 @@ void FileSystem::Resolve(SmallVectorImpl
 
   // Resolve tilde.
   SmallString<128> original_path(path.begin(), 

[Lldb-commits] [lldb] r346459 - Fix a test whose output changed.

2018-11-08 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov  8 17:09:10 2018
New Revision: 346459

URL: http://llvm.org/viewvc/llvm-project?rev=346459=rev
Log:
Fix a test whose output changed.

A previous commit fixed an issue with our AST generation where
we were outputting enum decls incorrectly.  But we forgot to
update the test output.  This patch updates the test output
accordingly.

Modified:
lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp

Modified: lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp?rev=346459=346458=346459=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp Thu Nov  8 17:09:10 
2018
@@ -304,8 +304,8 @@ constexpr References ReferencesInstance;
 // CHECK: | |-FieldDecl {{.*}} o 'long long'
 // CHECK: | `-FieldDecl {{.*}} p 'int [5]'
 // CHECK: |-EnumDecl {{.*}} EnumType
-// CHECK: | |-EnumConstantDecl {{.*}} A 'unsigned int'
-// CHECK: | `-EnumConstantDecl {{.*}} B 'unsigned int'
+// CHECK: | |-EnumConstantDecl {{.*}} A 'EnumType'
+// CHECK: | `-EnumConstantDecl {{.*}} B 'EnumType'
 // CHECK: |-CXXRecordDecl {{.*}} struct DerivedClass definition
 // CHECK: | |-public 'BaseClass'
 // CHECK: | `-FieldDecl {{.*}} DerivedMember 'int'


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346457 - [FileSystem] Make use of FS in TildeExpressionResolver

2018-11-08 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Nov  8 16:50:50 2018
New Revision: 346457

URL: http://llvm.org/viewvc/llvm-project?rev=346457=rev
Log:
[FileSystem] Make use of FS in TildeExpressionResolver

In order to call real_path from the TildeExpressionResolver we need
access to the FileSystem. Since the resolver lives under utility we have
to pass in the FS.

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h
lldb/trunk/source/Commands/CommandCompletions.cpp
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/source/Target/TargetList.cpp
lldb/trunk/source/Utility/TildeExpressionResolver.cpp
lldb/trunk/unittests/Host/FileSystemTest.cpp
lldb/trunk/unittests/Interpreter/TestCompletion.cpp
lldb/trunk/unittests/TestingSupport/MockTildeExpressionResolver.cpp
lldb/trunk/unittests/TestingSupport/MockTildeExpressionResolver.h
lldb/trunk/unittests/Utility/TildeExpressionResolverTest.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=346457=346456=346457=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Thu Nov  8 16:50:50 2018
@@ -132,7 +132,8 @@ public:
   void *callback_baton);
 
   std::error_code GetRealPath(const llvm::Twine ,
-  llvm::SmallVectorImpl ) const;
+  llvm::SmallVectorImpl ,
+  bool expand_tilde) const;
 
 private:
   static llvm::Optional ();

Modified: lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h?rev=346457=346456=346457=diff
==
--- lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h (original)
+++ lldb/trunk/include/lldb/Utility/TildeExpressionResolver.h Thu Nov  8 
16:50:50 2018
@@ -18,8 +18,10 @@ template  class SmallVectorI
 }
 
 namespace lldb_private {
+class FileSystem;
 class TildeExpressionResolver {
 public:
+  TildeExpressionResolver(FileSystem ) : m_fs(fs) {}
   virtual ~TildeExpressionResolver();
 
   /// Resolve a Tilde Expression contained according to bash rules.
@@ -52,14 +54,20 @@ public:
   /// the username portion with the matched result.
   bool ResolveFullPath(llvm::StringRef Expr,
llvm::SmallVectorImpl );
+
+protected:
+  FileSystem _fs;
 };
 
 class StandardTildeExpressionResolver : public TildeExpressionResolver {
 public:
+  StandardTildeExpressionResolver(FileSystem )
+  : TildeExpressionResolver(fs) {}
+
   bool ResolveExact(llvm::StringRef Expr,
 llvm::SmallVectorImpl ) override;
   bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> ) 
override;
 };
-}
+} // namespace lldb_private
 
 #endif // #ifndef LLDB_UTILITY_TILDE_EXPRESSION_RESOLVER_H

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=346457=346456=346457=diff
==
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Thu Nov  8 16:50:50 2018
@@ -231,7 +231,7 @@ static int DiskFilesOrDirectories(const
 static int DiskFilesOrDirectories(CompletionRequest ,
   bool only_directories) {
   request.SetWordComplete(false);
-  StandardTildeExpressionResolver resolver;
+  StandardTildeExpressionResolver resolver(FileSystem::Instance());
   StringList matches;
   DiskFilesOrDirectories(request.GetCursorArgumentPrefix(), only_directories,
  matches, resolver);

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=346457=346456=346457=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Thu Nov  8 16:50:50 2018
@@ -183,8 +183,9 @@ std::error_code FileSystem::MakeAbsolute
 }
 
 std::error_code FileSystem::GetRealPath(const Twine ,
-SmallVectorImpl ) const {
-  return m_fs->getRealPath(path, output);
+SmallVectorImpl ,
+bool expand_tilde) const {
+  return m_fs->getRealPath(path, output, expand_tilde);
 }
 
 void FileSystem::Resolve(SmallVectorImpl ) {
@@ -193,8 +194,8 @@ void FileSystem::Resolve(SmallVectorImpl
 
   // Resolve tilde.
   SmallString<128> original_path(path.begin(), path.end());
-  

[Lldb-commits] [lldb] r346456 - Fix CMake build when building with -fmodules-local-submodule-visibility.

2018-11-08 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Thu Nov  8 16:49:18 2018
New Revision: 346456

URL: http://llvm.org/viewvc/llvm-project?rev=346456=rev
Log:
Fix CMake build when building with -fmodules-local-submodule-visibility.

Modified:
lldb/trunk/source/Host/CMakeLists.txt

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=346456=346455=346456=diff
==
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Thu Nov  8 16:49:18 2018
@@ -11,7 +11,9 @@ endmacro()
 # Objective-C++ files in lldb (which slows down the build process).
 macro(remove_module_flags)
   string(REGEX REPLACE "-fmodules-cache-path=[^ ]+" "" CMAKE_CXX_FLAGS 
"${CMAKE_CXX_FLAGS}")
+  string(REGEX REPLACE "-fmodules-local-submodule-visibility" "" 
CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
   string(REGEX REPLACE "-fmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+  string(REGEX REPLACE "-gmodules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
   string(REGEX REPLACE "-fcxx-modules" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 endmacro()
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346449 - Update FileSpec constructor signature

2018-11-08 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Thu Nov  8 15:21:00 2018
New Revision: 346449

URL: http://llvm.org/viewvc/llvm-project?rev=346449=rev
Log:
Update FileSpec constructor signature

Modified:
lldb/trunk/source/Host/android/HostInfoAndroid.cpp

Modified: lldb/trunk/source/Host/android/HostInfoAndroid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/android/HostInfoAndroid.cpp?rev=346449=346448=346449=diff
==
--- lldb/trunk/source/Host/android/HostInfoAndroid.cpp (original)
+++ lldb/trunk/source/Host/android/HostInfoAndroid.cpp Thu Nov  8 15:21:00 2018
@@ -40,8 +40,11 @@ FileSpec HostInfoAndroid::ResolveLibrary
   static const char *const default_lib64_path[] = {"/vendor/lib64",
"/system/lib64", nullptr};
 
-  if (module_path.empty() || module_path[0] == '/')
-return FileSpec(module_path.c_str(), true);
+  if (module_path.empty() || module_path[0] == '/') {
+FileSpec file_spec(module_path.c_str());
+FileSystem::Instance().Resolve(file_spec);
+return file_spec;
+  }
 
   SmallVector ld_paths;
 


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346444 - Revert "Fix bug in PE/COFF plugin and ValueObjectVariable."

2018-11-08 Thread Davide Italiano via lldb-commits
Author: davide
Date: Thu Nov  8 14:47:40 2018
New Revision: 346444

URL: http://llvm.org/viewvc/llvm-project?rev=346444=rev
Log:
Revert "Fix bug in PE/COFF plugin and ValueObjectVariable."

It breaks some tests on MacOS.

Removed:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
lldb/trunk/source/Core/ValueObjectVariable.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Removed: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit?rev=346443=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit (removed)
@@ -1,3 +0,0 @@
-target variable GlobalVariable
-
-quit

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346444=346443=346444=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Thu Nov  8 
14:47:40 2018
@@ -89,23 +89,22 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: (TrivialC) TC = {}
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
-// CHECK: (TrivialE) TE = TE_A
-// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
-// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
+// CHECK: (TrivialE) TE = 
+// CHECK: (A::B::C) ABCInt = (ABCMember = )
+// CHECK: (A::B::C) ABCFloat = (ABCMember = )
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = )
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = , 
CPtr = )
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = )
 // CHECK: (A::D) AD = {}
-// CHECK: (A::D::E) ADE = (ADDMember = 0)
+// CHECK: (A::D::E) ADE = (ADDMember = )
 // CHECK: Dumping clang ast for 1 modules.
 // CHECK: TranslationUnitDecl {{.*}}
 // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
 // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
 // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
 // CHECK: |-EnumDecl {{.*}} TrivialE
-// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'int'
 // CHECK: |-NamespaceDecl {{.*}} A
 // CHECK: | |-NamespaceDecl {{.*}} B
 // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition

Removed: lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp?rev=346443=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp (removed)
@@ -1,35 +0,0 @@
-// clang-format off
-// REQUIRES: lld
-
-// Make sure we can read variables from BSS
-// 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: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
-// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
-// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
-
-int GlobalVariable = 0;
-
-int main(int argc, char **argv) {
-  return 0;
-}
-
-// BSS:   Section {
-// BSS: Number: 3
-// BSS: Name: .data
-// BSS-NEXT:VirtualSize: 0x4
-// BSS-NEXT:VirtualAddress:
-// BSS-NEXT:RawDataSize: 0
-// BSS-NEXT:PointerToRawData: 0x0
-// BSS-NEXT:PointerToRelocations: 0x0
-// BSS-NEXT:PointerToLineNumbers: 0x0
-// BSS-NEXT:RelocationCount: 0
-// BSS-NEXT:LineNumberCount: 0
-// BSS-NEXT:Characteristics [ (0xC040)
-// BSS-NEXT:  IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
-// BSS-NEXT:  IMAGE_SCN_MEM_READ (0x4000)
-// BSS-NEXT:  IMAGE_SCN_MEM_WRITE (0x8000)
-// BSS-NEXT:]
-// BSS-NEXT:  }
-
-// CHECK: (int) GlobalVariable = 0

Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=346444=346443=346444=diff
==
--- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp Thu Nov  8 14:47:40 2018
@@ -66,16 +66,9 @@ ValueObjectVariable::~ValueObjectVariabl
 
 CompilerType ValueObjectVariable::GetCompilerTypeImpl() {

[Lldb-commits] [lldb] r346443 - Change $CURRENT_ARCH settings in xcode project file to hardcoded

2018-11-08 Thread Jason Molenda via lldb-commits
Author: jmolenda
Date: Thu Nov  8 14:41:19 2018
New Revision: 346443

URL: http://llvm.org/viewvc/llvm-project?rev=346443=rev
Log:
Change $CURRENT_ARCH settings in xcode project file to hardcoded
"x86_64" - used for finding the llvm build directory.  Newer
Xcodes do not define CURRENT_ARCH.

Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=346443=346442=346443=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu Nov  8 14:41:19 2018
@@ -7433,7 +7433,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
-   shellScript = "/usr/bin/python 
$SRCROOT/scripts/Xcode/package-clang-headers.py $TARGET_BUILD_DIR 
$LLVM_BUILD_DIR/$CURRENT_ARCH\n";
+   shellScript = "/usr/bin/python 
$SRCROOT/scripts/Xcode/package-clang-headers.py $TARGET_BUILD_DIR 
$LLVM_BUILD_DIR/x86_64\n";
};
4C3326CA18B2A2B800EB5DD7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
@@ -7469,7 +7469,7 @@
inputPaths = (
"$(BUILT_PRODUCTS_DIR)/lldb.py",

"$(SRCROOT)/source/Interpreter/embedded_interpreter.py",
-   
"$(OBJECT_FILE_DIR_normal)/$(CURRENT_ARCH)/LLDBWrapPython.o",
+   
"$(OBJECT_FILE_DIR_normal)/x86_64/LLDBWrapPython.o",
);
name = "Finish swig wrapper classes (lldb)";
outputPaths = (
@@ -8611,7 +8611,7 @@
LLDB_ZLIB_LDFLAGS = "-lz";
LLVM_BUILD_DIR = 
"$(SRCROOT)/llvm-build/$(LLVM_CONFIGURATION)";
LLVM_BUILD_DIRTREE = "$(SRCROOT)/llvm-build";
-   LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
+   LLVM_BUILD_DIR_ARCH = "x86_64/";
LLVM_CONFIGURATION = "Release+Asserts";
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
ONLY_ACTIVE_ARCH = YES;
@@ -8701,7 +8701,7 @@
LLDB_ZLIB_LDFLAGS = "-lz";
LLVM_BUILD_DIR = 
"$(SRCROOT)/llvm-build/$(LLVM_CONFIGURATION)";
LLVM_BUILD_DIRTREE = "$(SRCROOT)/llvm-build";
-   LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
+   LLVM_BUILD_DIR_ARCH = "x86_64/";
LLVM_CONFIGURATION = "Release+Asserts";
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
ONLY_ACTIVE_ARCH = YES;
@@ -9859,7 +9859,7 @@
LLDB_ZLIB_LDFLAGS = "-lz";
LLVM_BUILD_DIR = "$(OBJROOT)/llvm";
LLVM_BUILD_DIRTREE = "$(OBJROOT)/llvm-build";
-   LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
+   LLVM_BUILD_DIR_ARCH = "x86_64/";
LLVM_CONFIGURATION = Release;
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
OTHER_CFLAGS = (
@@ -10575,7 +10575,7 @@
LLDB_ZLIB_LDFLAGS = "-lz";
LLVM_BUILD_DIR = 
"$(SRCROOT)/llvm-build/$(LLVM_CONFIGURATION)";
LLVM_BUILD_DIRTREE = "$(SRCROOT)/llvm-build";
-   LLVM_BUILD_DIR_ARCH = "$(CURRENT_ARCH)/";
+   LLVM_BUILD_DIR_ARCH = "x86_64/";
LLVM_CONFIGURATION = "Debug+Asserts";
LLVM_SOURCE_DIR = "$(SRCROOT)/llvm";
ONLY_ACTIVE_ARCH = YES;


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346441 - [lldb] Silence unhandled enums warning.

2018-11-08 Thread Jorge Gorbe Moya via lldb-commits
Author: jgorbe
Date: Thu Nov  8 14:04:58 2018
New Revision: 346441

URL: http://llvm.org/viewvc/llvm-project?rev=346441=rev
Log:
[lldb] Silence unhandled enums warning.

The warning was introduced by r346392, which introduces new builtin
types (to support cl_intel_device_side_avc_motion_estimation OpenCL
extension).

Note that this patch only inserts empty cases to silence the warning and
unblock our integrate, does not aim to add support for the new types in
lldb.

Modified:
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=346441=346440=346441=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Thu Nov  8 14:04:58 2018
@@ -5113,6 +5113,20 @@ lldb::Encoding ClangASTContext::GetEncod
 case clang::BuiltinType::Kind::PseudoObject:
 case clang::BuiltinType::Kind::UnknownAny:
   break;
+
+case clang::BuiltinType::OCLIntelSubgroupAVCMcePayload:
+case clang::BuiltinType::OCLIntelSubgroupAVCImePayload:
+case clang::BuiltinType::OCLIntelSubgroupAVCRefPayload:
+case clang::BuiltinType::OCLIntelSubgroupAVCSicPayload:
+case clang::BuiltinType::OCLIntelSubgroupAVCMceResult:
+case clang::BuiltinType::OCLIntelSubgroupAVCImeResult:
+case clang::BuiltinType::OCLIntelSubgroupAVCRefResult:
+case clang::BuiltinType::OCLIntelSubgroupAVCSicResult:
+case clang::BuiltinType::OCLIntelSubgroupAVCImeResultSingleRefStreamout:
+case clang::BuiltinType::OCLIntelSubgroupAVCImeResultDualRefStreamout:
+case clang::BuiltinType::OCLIntelSubgroupAVCImeSingleRefStreamin:
+case clang::BuiltinType::OCLIntelSubgroupAVCImeDualRefStreamin:
+  break;
 }
 break;
   // All pointer types are represented as unsigned integer encodings. We may


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Greg Clayton via lldb-commits
Another way to think about this is if you have a SBValue that represents a 
class instances in an IDE, if no one turns it open to see the children, why do 
we need to complete the type? We should have to. The type should be able to 
complete itself if and when we need to know some information. This already 
works fine for classes, we just need to make it work for enums. Just complete 
the type before we need access to the enumerators. For a SBValue that contains 
a enum type:

SBValue var = frame.FindVariable("myEnumVar");

If I call:

SBType var_type = var.GetType();

"var_type" doesn't need be completed yet. Even:

const char *n = var_type.GetName();

Doesn't require a full type. Now for getting the value:

const char *value = var.GetValue();

We don't need to complete a class type as the class has no value. If this is a 
pointer to anything (enum, class, struct, union) we don't need to complete the 
type to show the pointer value. For an enum we do need it. But the type should 
complete itself in the code that knows it needs to full type.

Asking the type about itself might also cause the type to complete itself:

auto num_fields = var_type.GetNumFields();

Would cause a class type to complete itself probably down in the TypeSystem 
class (ClangASTContext).

So after thinking about this some more, the proposed fix you had was not the 
right one. We just need to fix the ClangASTContext to complete the type before 
it tries to use it.

Question: did you use the clang external AST source like the DWARF plug-in 
stuff did to complete the types?

> On Nov 8, 2018, at 1:40 PM, Greg Clayton  wrote:
> 
> Looks like this test was testing the functionality that you changed. It it 
> expecting that a type won't be complete until you ask for more info about it 
> (like asking about a child). Since PDB is not completing the type up front, 
> we need to change LLDB or make your previous case work even when handing out 
> a forward type.
> 
> So the question is: do we expect types to be able to complete themselves on 
> the fly anywhere? I believe we should be able to hand out a type as a forward 
> declaration and have it complete itself at any point when it is needed. I 
> know classes already do this when they need to know more. Maybe the AST 
> doesn't treat enums like classes where it will complete the type through the 
> external AST class.
> 
> The correct fix is to probably call 
> 
> bool CompilerType::GetCompleteType() const;
> 
> Before you need to access the enumerators in an enumeration.
> 
> 
> 
>> On Nov 8, 2018, at 1:17 PM, Zachary Turner via lldb-commits 
>> mailto:lldb-commits@lists.llvm.org>> wrote:
>> 
>> +greg.
>> 
>> Greg, is the test wrong here or the patch?  If it’s the test let’s just fix 
>> the test, otherwise we can revert the patch until we figure it out.
>> 
>> It seems related to my change to use the layout type instead of the forward 
>> type.
>> 
>> On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano > > wrote:
>> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner > > wrote:
>> >
>> > I’m ooo for at least 2 hours. Is it a test failure or a compilation 
>> > failure?
>> 
>> 
>> FAIL: test_with_run_command_gmodules 
>> (TestTypeCompletion.TypeCompletionTestCase)
>> 
>>Check that types only get completed when necessary.
>> --
>> Traceback (most recent call last):
>>   File 
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
>> line 1744, in test_method
>> return attrvalue(self)
>>   File 
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
>> line 113, in wrapper
>> func(*args, **kwargs)
>>   File 
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
>> line 55, in test_with_run_command 'vector complete but it should
>> not be')
>> AssertionError: True is not False : vector complete but it should not be
>> 
>> 
>> Do you want me to revert this in the meanwhile?
>> 
>> --Davide
>> ___
>> lldb-commits mailing list
>> lldb-commits@lists.llvm.org 
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
> 

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Greg Clayton via lldb-commits
Looks like this test was testing the functionality that you changed. It it 
expecting that a type won't be complete until you ask for more info about it 
(like asking about a child). Since PDB is not completing the type up front, we 
need to change LLDB or make your previous case work even when handing out a 
forward type.

So the question is: do we expect types to be able to complete themselves on the 
fly anywhere? I believe we should be able to hand out a type as a forward 
declaration and have it complete itself at any point when it is needed. I know 
classes already do this when they need to know more. Maybe the AST doesn't 
treat enums like classes where it will complete the type through the external 
AST class.

The correct fix is to probably call 

bool CompilerType::GetCompleteType() const;

Before you need to access the enumerators in an enumeration.



> On Nov 8, 2018, at 1:17 PM, Zachary Turner via lldb-commits 
>  wrote:
> 
> +greg.
> 
> Greg, is the test wrong here or the patch?  If it’s the test let’s just fix 
> the test, otherwise we can revert the patch until we figure it out.
> 
> It seems related to my change to use the layout type instead of the forward 
> type.
> 
> On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano  > wrote:
> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner  > wrote:
> >
> > I’m ooo for at least 2 hours. Is it a test failure or a compilation failure?
> 
> 
> FAIL: test_with_run_command_gmodules 
> (TestTypeCompletion.TypeCompletionTestCase)
> 
>Check that types only get completed when necessary.
> --
> Traceback (most recent call last):
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
> line 1744, in test_method
> return attrvalue(self)
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
> line 113, in wrapper
> func(*args, **kwargs)
>   File 
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
> line 55, in test_with_run_command 'vector complete but it should
> not be')
> AssertionError: True is not False : vector complete but it should not be
> 
> 
> Do you want me to revert this in the meanwhile?
> 
> --Davide
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Davide Italiano via lldb-commits
Cool. I see several tests failing (so there might be multiple issues).

Failing Tests (9):
LLDB :: tools/lldb-mi/symbol/symbol-list-lines.test
lldb-Suite ::
functionalities/breakpoint/scripted_bkpt/TestScriptedResolver.py
lldb-Suite :: functionalities/type_completion/TestTypeCompletion.py
lldb-Suite :: lang/objc/hidden-ivars/TestHiddenIvars.py
lldb-Suite :: lang/objc/ivar-IMP/TestObjCiVarIMP.py
lldb-Suite :: lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
lldb-Suite :: macosx/add-dsym/TestAddDsymMidExecutionCommand.py
lldb-Suite ::
macosx/find-dsym/bundle-with-dot-in-filename/TestBundleWithDotInFilename.py
lldb-Suite :: macosx/find-dsym/deep-bundle/TestDeepBundle.py

  Expected Passes: 1325
  Unsupported Tests  : 43
  Unexpected Failures: 9


I guess a bisect and revert is in order here.

--
Davide
On Thu, Nov 8, 2018 at 1:27 PM Zachary Turner  wrote:
>
> Go ahead and revert to green until i get back
> On Thu, Nov 8, 2018 at 1:17 PM Zachary Turner  wrote:
>>
>> +greg.
>>
>> Greg, is the test wrong here or the patch?  If it’s the test let’s just fix 
>> the test, otherwise we can revert the patch until we figure it out.
>>
>> It seems related to my change to use the layout type instead of the forward 
>> type.
>>
>> On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano  wrote:
>>>
>>> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner  wrote:
>>> >
>>> > I’m ooo for at least 2 hours. Is it a test failure or a compilation 
>>> > failure?
>>>
>>>
>>> FAIL: test_with_run_command_gmodules 
>>> (TestTypeCompletion.TypeCompletionTestCase)
>>>
>>>Check that types only get completed when necessary.
>>> --
>>> Traceback (most recent call last):
>>>   File 
>>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
>>> line 1744, in test_method
>>> return attrvalue(self)
>>>   File 
>>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
>>> line 113, in wrapper
>>> func(*args, **kwargs)
>>>   File 
>>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
>>> line 55, in test_with_run_command 'vector complete but it should
>>> not be')
>>> AssertionError: True is not False : vector complete but it should not be
>>>
>>>
>>> Do you want me to revert this in the meanwhile?
>>>
>>> --Davide
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54272: Extract construction of DataBufferLLVM into FileSystem

2018-11-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, zturner, davide.
JDevlieghere added a project: LLDB.

This moves construction of data buffers into the FileSystem class. Like some of 
the previous refactorings we don't translate the path yet because the 
functionality hasn't been landed in LLVM yet.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54272

Files:
  include/lldb/Host/FileSystem.h
  include/lldb/Utility/DataBufferLLVM.h
  source/API/SBSection.cpp
  source/Commands/CommandObjectMemory.cpp
  source/Core/SourceManager.cpp
  source/Host/common/FileSystem.cpp
  source/Host/common/Host.cpp
  source/Host/linux/Host.cpp
  source/Interpreter/OptionValueFileSpec.cpp
  
source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
  source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  source/Plugins/Process/elf-core/ProcessElfCore.cpp
  source/Plugins/Process/mach-core/ProcessMachCore.cpp
  source/Plugins/Process/minidump/ProcessMinidump.cpp
  source/Symbol/ObjectFile.cpp
  source/Utility/DataBufferLLVM.cpp
  unittests/Process/minidump/MinidumpParserTest.cpp

Index: unittests/Process/minidump/MinidumpParserTest.cpp
===
--- unittests/Process/minidump/MinidumpParserTest.cpp
+++ unittests/Process/minidump/MinidumpParserTest.cpp
@@ -18,7 +18,6 @@
 #include "TestingSupport/TestUtilities.h"
 #include "lldb/Target/MemoryRegionInfo.h"
 #include "lldb/Utility/ArchSpec.h"
-#include "lldb/Utility/DataBufferLLVM.h"
 #include "lldb/Utility/DataExtractor.h"
 #include "lldb/Utility/FileSpec.h"
 #include "llvm/ADT/ArrayRef.h"
@@ -40,7 +39,8 @@
 public:
   void SetUpData(const char *minidump_filename) {
 std::string filename = GetInputFilePath(minidump_filename);
-auto BufferPtr = DataBufferLLVM::CreateSliceFromPath(filename, -1, 0);
+auto BufferPtr =
+FileSystem::Instance().CreateDataBufferFromPath(filename, -1, 0);
 ASSERT_NE(BufferPtr, nullptr);
 llvm::Optional optional_parser =
 MinidumpParser::Create(BufferPtr);
@@ -54,7 +54,7 @@
   void InvalidMinidump(const char *minidump_filename, uint64_t load_size) {
 std::string filename = GetInputFilePath(minidump_filename);
 auto BufferPtr =
-DataBufferLLVM::CreateSliceFromPath(filename, load_size, 0);
+FileSystem::Instance().CreateDataBufferFromPath(filename, load_size, 0);
 ASSERT_NE(BufferPtr, nullptr);
 
 llvm::Optional optional_parser =
Index: source/Utility/DataBufferLLVM.cpp
===
--- source/Utility/DataBufferLLVM.cpp
+++ source/Utility/DataBufferLLVM.cpp
@@ -27,34 +27,6 @@
 
 DataBufferLLVM::~DataBufferLLVM() {}
 
-std::shared_ptr
-DataBufferLLVM::CreateSliceFromPath(const llvm::Twine , uint64_t Size,
-uint64_t Offset) {
-  // If the file resides non-locally, pass the volatile flag so that we don't
-  // mmap it.
-  bool IsVolatile = !llvm::sys::fs::is_local(Path);
-
-  auto Buffer =
-  llvm::WritableMemoryBuffer::getFileSlice(Path, Size, Offset, IsVolatile);
-  if (!Buffer)
-return nullptr;
-  return std::shared_ptr(
-  new DataBufferLLVM(std::move(*Buffer)));
-}
-
-std::shared_ptr
-DataBufferLLVM::CreateFromPath(const llvm::Twine ) {
-  // If the file resides non-locally, pass the volatile flag so that we don't
-  // mmap it.
-  bool IsVolatile = !llvm::sys::fs::is_local(Path);
-
-  auto Buffer = llvm::WritableMemoryBuffer::getFile(Path, -1, IsVolatile);
-  if (!Buffer)
-return nullptr;
-  return std::shared_ptr(
-  new DataBufferLLVM(std::move(*Buffer)));
-}
-
 uint8_t *DataBufferLLVM::GetBytes() {
   return reinterpret_cast(Buffer->getBufferStart());
 }
Index: source/Symbol/ObjectFile.cpp
===
--- source/Symbol/ObjectFile.cpp
+++ source/Symbol/ObjectFile.cpp
@@ -19,7 +19,6 @@
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/DataBuffer.h"
 #include "lldb/Utility/DataBufferHeap.h"
-#include "lldb/Utility/DataBufferLLVM.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/Timer.h"
@@ -75,8 +74,8 @@
 // container plug-ins can use these bytes to see if they can parse this
 // file.
 if (file_size > 0) {
-  data_sp =
-  DataBufferLLVM::CreateSliceFromPath(file->GetPath(), 512, file_offset);
+  data_sp = FileSystem::Instance().CreateDataBufferFromPath(
+  file->GetPath(), 512, file_offset);
   data_offset = 0;
 }
   }
@@ -120,8 +119,8 @@
 }
 // We failed to find any cached object files in the container plug-
 // ins, so lets read the first 512 bytes and try again below...
-data_sp = DataBufferLLVM::CreateSliceFromPath(archive_file.GetPath(),
-  

Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Zachary Turner via lldb-commits
Go ahead and revert to green until i get back
On Thu, Nov 8, 2018 at 1:17 PM Zachary Turner  wrote:

> +greg.
>
> Greg, is the test wrong here or the patch?  If it’s the test let’s just
> fix the test, otherwise we can revert the patch until we figure it out.
>
> It seems related to my change to use the layout type instead of the
> forward type.
>
> On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano 
> wrote:
>
>> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner 
>> wrote:
>> >
>> > I’m ooo for at least 2 hours. Is it a test failure or a compilation
>> failure?
>>
>>
>> FAIL: test_with_run_command_gmodules
>> (TestTypeCompletion.TypeCompletionTestCase)
>>
>>Check that types only get completed when necessary.
>> --
>> Traceback (most recent call last):
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
>> line 1744, in test_method
>> return attrvalue(self)
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
>> line 113, in wrapper
>> func(*args, **kwargs)
>>   File
>> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
>> line 55, in test_with_run_command 'vector complete but it should
>> not be')
>> AssertionError: True is not False : vector complete but it should not
>> be
>>
>>
>> Do you want me to revert this in the meanwhile?
>>
>> --Davide
>>
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Zachary Turner via lldb-commits
+greg.

Greg, is the test wrong here or the patch?  If it’s the test let’s just fix
the test, otherwise we can revert the patch until we figure it out.

It seems related to my change to use the layout type instead of the forward
type.

On Thu, Nov 8, 2018 at 1:03 PM Davide Italiano 
wrote:

> On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner  wrote:
> >
> > I’m ooo for at least 2 hours. Is it a test failure or a compilation
> failure?
>
>
> FAIL: test_with_run_command_gmodules
> (TestTypeCompletion.TypeCompletionTestCase)
>
>Check that types only get completed when necessary.
> --
> Traceback (most recent call last):
>   File
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
> line 1744, in test_method
> return attrvalue(self)
>   File
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
> line 113, in wrapper
> func(*args, **kwargs)
>   File
> "/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
> line 55, in test_with_run_command 'vector complete but it should
> not be')
> AssertionError: True is not False : vector complete but it should not be
>
>
> Do you want me to revert this in the meanwhile?
>
> --Davide
>
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Davide Italiano via lldb-commits
On Thu, Nov 8, 2018 at 12:59 PM Zachary Turner  wrote:
>
> I’m ooo for at least 2 hours. Is it a test failure or a compilation failure?


FAIL: test_with_run_command_gmodules (TestTypeCompletion.TypeCompletionTestCase)

   Check that types only get completed when necessary.
--
Traceback (most recent call last):
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/lldbtest.py",
line 1744, in test_method
return attrvalue(self)
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/decorators.py",
line 113, in wrapper
func(*args, **kwargs)
  File 
"/Users/davide/work/llvm-project-20170507/lldb/packages/Python/lldbsuite/test/functionalities/type_completion/TestTypeCompletion.py",
line 55, in test_with_run_command 'vector complete but it should
not be')
AssertionError: True is not False : vector complete but it should not be


Do you want me to revert this in the meanwhile?

--Davide
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Zachary Turner via lldb-commits
I’m ooo for at least 2 hours. Is it a test failure or a compilation failure?
On Thu, Nov 8, 2018 at 12:56 PM Davide Italiano 
wrote:

> Zach, either this or your previous commit broke MacOS.
> Can you please take a look?
> Feel free to ping me (here or on IRC) if you need any help.
>
> http://green.lab.llvm.org/green/job/lldb-cmake/12343/
>
> --
> Davide
> On Thu, Nov 8, 2018 at 10:52 AM Zachary Turner via lldb-commits
>  wrote:
> >
> > Author: zturner
> > Date: Thu Nov  8 10:50:31 2018
> > New Revision: 346430
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=346430=rev
> > Log:
> > Fix bug in PE/COFF plugin and ValueObjectVariable.
> >
> > There are two bugs here.  The first is that MSVC and clang-cl
> > emit their bss section under the name '.data' instead of '.bss'
> > but with the size and file offset set to 0.  ObjectFilePECOFF
> > didn't handle this, and would only recognize a section as bss
> > if it was actually called '.bss'.  The effect of this is that
> > if we tried to print the value of a variable that lived in BSS
> > we would fail.
> >
> > The second bug is that ValueObjectVariable was only returning
> > the forward type, which is insufficient to print the value of an
> > enum.  So we bump this up to the layout type.
> >
> > Differential Revision: https://reviews.llvm.org/D54241
> >
> > Added:
> > lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
> > lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
> > Modified:
> > lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
> > lldb/trunk/source/Core/ValueObjectVariable.cpp
> > lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
> >
> > Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit?rev=346430=auto
> >
> ==
> > --- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
> (added)
> > +++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit Thu
> Nov  8 10:50:31 2018
> > @@ -0,0 +1,3 @@
> > +target variable GlobalVariable
> > +
> > +quit
> >
> > Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346430=346429=346430=diff
> >
> ==
> > --- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
> > +++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Thu Nov
> 8 10:50:31 2018
> > @@ -89,22 +89,23 @@ Anonymous>::D AnonABCVoidD;
> >  // CHECK: (TrivialC) TC = {}
> >  // CHECK: (TrivialS) TS = {}
> >  // CHECK: (TrivialU) TU = {}
> > -// CHECK: (TrivialE) TE = 
> > -// CHECK: (A::B::C) ABCInt = (ABCMember =  failed>)
> > -// CHECK: (A::B::C) ABCFloat = (ABCMember =  {{.*}} failed>)
> > -// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember =  memory from {{.*}} failed>)
> > +// CHECK: (TrivialE) TE = TE_A
> > +// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
> > +// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
> > +// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember =
> 0x)
> >  // CHECK: (A::C<0>) AC0 = {}
> >  // CHECK: (A::C<-1>) ACNeg1 = {}
> > -// CHECK: (A::C<0>::D) AC0D = (ACDMember =  failed>, CPtr = )
> > -// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember =  failed>, CPtr = )
> > +// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
> > +// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr =
> 0x)
> >  // CHECK: (A::D) AD = {}
> > -// CHECK: (A::D::E) ADE = (ADDMember = )
> > +// CHECK: (A::D::E) ADE = (ADDMember = 0)
> >  // CHECK: Dumping clang ast for 1 modules.
> >  // CHECK: TranslationUnitDecl {{.*}}
> >  // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
> >  // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
> >  // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
> >  // CHECK: |-EnumDecl {{.*}} TrivialE
> > +// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'int'
> >  // CHECK: |-NamespaceDecl {{.*}} A
> >  // CHECK: | |-NamespaceDecl {{.*}} B
> >  // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition
> >
> > Added: lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp?rev=346430=auto
> >
> ==
> > --- lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp (added)
> > +++ lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp Thu Nov  8
> 10:50:31 2018
> > @@ -0,0 +1,35 @@
> > +// clang-format off
> > +// REQUIRES: lld
> > +
> > +// Make sure we can read variables from BSS
> > +// RUN: clang-cl /Z7 /GS- /GR- /c /Fo%t.obj -- %s
> > +// RUN: lld-link /DEBUG /nodefaultlib /entry:main /OUT:%t.exe
> 

Re: [Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Davide Italiano via lldb-commits
Zach, either this or your previous commit broke MacOS.
Can you please take a look?
Feel free to ping me (here or on IRC) if you need any help.

http://green.lab.llvm.org/green/job/lldb-cmake/12343/

--
Davide
On Thu, Nov 8, 2018 at 10:52 AM Zachary Turner via lldb-commits
 wrote:
>
> Author: zturner
> Date: Thu Nov  8 10:50:31 2018
> New Revision: 346430
>
> URL: http://llvm.org/viewvc/llvm-project?rev=346430=rev
> Log:
> Fix bug in PE/COFF plugin and ValueObjectVariable.
>
> There are two bugs here.  The first is that MSVC and clang-cl
> emit their bss section under the name '.data' instead of '.bss'
> but with the size and file offset set to 0.  ObjectFilePECOFF
> didn't handle this, and would only recognize a section as bss
> if it was actually called '.bss'.  The effect of this is that
> if we tried to print the value of a variable that lived in BSS
> we would fail.
>
> The second bug is that ValueObjectVariable was only returning
> the forward type, which is insufficient to print the value of an
> enum.  So we bump this up to the layout type.
>
> Differential Revision: https://reviews.llvm.org/D54241
>
> Added:
> lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
> lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
> Modified:
> lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
> lldb/trunk/source/Core/ValueObjectVariable.cpp
> lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
>
> Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit?rev=346430=auto
> ==
> --- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit (added)
> +++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit Thu Nov  
> 8 10:50:31 2018
> @@ -0,0 +1,3 @@
> +target variable GlobalVariable
> +
> +quit
>
> Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346430=346429=346430=diff
> ==
> --- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
> +++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Thu Nov  8 
> 10:50:31 2018
> @@ -89,22 +89,23 @@ Anonymous>::D AnonABCVoidD;
>  // CHECK: (TrivialC) TC = {}
>  // CHECK: (TrivialS) TS = {}
>  // CHECK: (TrivialU) TU = {}
> -// CHECK: (TrivialE) TE = 
> -// CHECK: (A::B::C) ABCInt = (ABCMember =  failed>)
> -// CHECK: (A::B::C) ABCFloat = (ABCMember =  failed>)
> -// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember =  from {{.*}} failed>)
> +// CHECK: (TrivialE) TE = TE_A
> +// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
> +// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
> +// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
> 0x)
>  // CHECK: (A::C<0>) AC0 = {}
>  // CHECK: (A::C<-1>) ACNeg1 = {}
> -// CHECK: (A::C<0>::D) AC0D = (ACDMember = , 
> CPtr = )
> -// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember =  failed>, CPtr = )
> +// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
> +// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
>  // CHECK: (A::D) AD = {}
> -// CHECK: (A::D::E) ADE = (ADDMember = )
> +// CHECK: (A::D::E) ADE = (ADDMember = 0)
>  // CHECK: Dumping clang ast for 1 modules.
>  // CHECK: TranslationUnitDecl {{.*}}
>  // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
>  // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
>  // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
>  // CHECK: |-EnumDecl {{.*}} TrivialE
> +// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'int'
>  // CHECK: |-NamespaceDecl {{.*}} A
>  // CHECK: | |-NamespaceDecl {{.*}} B
>  // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition
>
> Added: lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp?rev=346430=auto
> ==
> --- lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp (added)
> +++ lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp Thu Nov  8 10:50:31 
> 2018
> @@ -0,0 +1,35 @@
> +// clang-format off
> +// REQUIRES: lld
> +
> +// Make sure we can read variables from BSS
> +// 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: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
> +// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
> +// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
> +
> +int GlobalVariable = 0;
> +
> +int main(int argc, char **argv) {
> +  return 0;
> +}
> +
> +// BSS:   Section {
> +// BSS: 

[Lldb-commits] [lldb] r346435 - [lldb] Fix initialization order warnings.

2018-11-08 Thread Jorge Gorbe Moya via lldb-commits
Author: jgorbe
Date: Thu Nov  8 11:57:59 2018
New Revision: 346435

URL: http://llvm.org/viewvc/llvm-project?rev=346435=rev
Log:
[lldb] Fix initialization order warnings.

Moved the declaration of m_kind below the declaration of cvclass,
cvunion and cvenum. This order is necessary because in one of the
constructors the initialization of m_kind depends on the value of
cvclass.

third_party/llvm/llvm/tools/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp:50:7:
 error: field 'cvclass' will be initialized after field 'm_kind' 
[-Werror,-Wreorder]
: cvclass(std::move(c)),
  ^
third_party/llvm/llvm/tools/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp:51:14:
 error: field 'cvclass' is uninitialized when used here 
[-Werror,-Wuninitialized]
  m_kind(cvclass.Kind == TypeRecordKind::Struct ? Struct : Class) {}

Modified:
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h

Modified: lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h?rev=346435=346434=346435=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h Thu Nov  8 
11:57:59 2018
@@ -56,12 +56,12 @@ private:
   CVTagRecord(llvm::codeview::ClassRecord &);
   CVTagRecord(llvm::codeview::UnionRecord &);
   CVTagRecord(llvm::codeview::EnumRecord &);
-  Kind m_kind;
   union {
 llvm::codeview::ClassRecord cvclass;
 llvm::codeview::EnumRecord cvenum;
 llvm::codeview::UnionRecord cvunion;
   };
+  Kind m_kind;
 };
 
 struct SegmentOffset {


___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54241: Fix bug in printing ValueObjects and in PE/COFF Plugin

2018-11-08 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB346430: Fix bug in PE/COFF plugin and 
ValueObjectVariable. (authored by zturner, committed by ).
Herald added subscribers: teemperor, abidh.

Changed prior to commit:
  https://reviews.llvm.org/D54241?vs=173194=173199#toc

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54241

Files:
  lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
  lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lit/SymbolFile/NativePDB/globals-bss.cpp
  source/Core/ValueObjectVariable.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -710,7 +710,10 @@
llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
((const_sect_name == g_data_sect_name) ||
 (const_sect_name == g_DATA_sect_name))) {
-  section_type = eSectionTypeData;
+  if (m_sect_headers[idx].size == 0 && m_sect_headers[idx].offset == 0)
+section_type = eSectionTypeZeroFill;
+  else
+section_type = eSectionTypeData;
 } else if (m_sect_headers[idx].flags &
llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA &&
((const_sect_name == g_bss_sect_name) ||
@@ -1053,6 +1056,7 @@
 }
 
 ObjectFile::Strata ObjectFilePECOFF::CalculateStrata() { return eStrataUser; }
+
 //--
 // PluginInterface protocol
 //--
Index: source/Core/ValueObjectVariable.cpp
===
--- source/Core/ValueObjectVariable.cpp
+++ source/Core/ValueObjectVariable.cpp
@@ -66,9 +66,16 @@
 
 CompilerType ValueObjectVariable::GetCompilerTypeImpl() {
   Type *var_type = m_variable_sp->GetType();
-  if (var_type)
-return var_type->GetForwardCompilerType();
-  return CompilerType();
+  if (!var_type)
+return CompilerType();
+
+  // It's important to return the layout type here.  If we have an enum then the
+  // symbol file plugin may have decided to complete it lazily, in which case a
+  // forward type won't be sufficient to display the variable.  On the other
+  // hand, if we have a pointer to a class type, then getting the full type will
+  // resolve the class type, which is too much.  The layout type is both
+  // necessary and sufficient.
+  return var_type->GetLayoutCompilerType();
 }
 
 ConstString ValueObjectVariable::GetTypeName() {
Index: lit/SymbolFile/NativePDB/ast-reconstruction.cpp
===
--- lit/SymbolFile/NativePDB/ast-reconstruction.cpp
+++ lit/SymbolFile/NativePDB/ast-reconstruction.cpp
@@ -89,22 +89,23 @@
 // CHECK: (TrivialC) TC = {}
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
-// CHECK: (TrivialE) TE = 
-// CHECK: (A::B::C) ABCInt = (ABCMember = )
-// CHECK: (A::B::C) ABCFloat = (ABCMember = )
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = )
+// CHECK: (TrivialE) TE = TE_A
+// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
+// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 0x)
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = , CPtr = )
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = )
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
 // CHECK: (A::D) AD = {}
-// CHECK: (A::D::E) ADE = (ADDMember = )
+// CHECK: (A::D::E) ADE = (ADDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.
 // CHECK: TranslationUnitDecl {{.*}}
 // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
 // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
 // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
 // CHECK: |-EnumDecl {{.*}} TrivialE
+// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'int'
 // CHECK: |-NamespaceDecl {{.*}} A
 // CHECK: | |-NamespaceDecl {{.*}} B
 // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition
Index: lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
===
--- lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
+++ lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
@@ -0,0 +1,3 @@
+target variable GlobalVariable
+
+quit
Index: lit/SymbolFile/NativePDB/globals-bss.cpp
===
--- lit/SymbolFile/NativePDB/globals-bss.cpp
+++ lit/SymbolFile/NativePDB/globals-bss.cpp
@@ -0,0 +1,35 @@
+// clang-format off
+// REQUIRES: lld
+
+// Make sure we can 

[Lldb-commits] [lldb] r346430 - Fix bug in PE/COFF plugin and ValueObjectVariable.

2018-11-08 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov  8 10:50:31 2018
New Revision: 346430

URL: http://llvm.org/viewvc/llvm-project?rev=346430=rev
Log:
Fix bug in PE/COFF plugin and ValueObjectVariable.

There are two bugs here.  The first is that MSVC and clang-cl
emit their bss section under the name '.data' instead of '.bss'
but with the size and file offset set to 0.  ObjectFilePECOFF
didn't handle this, and would only recognize a section as bss
if it was actually called '.bss'.  The effect of this is that
if we tried to print the value of a variable that lived in BSS
we would fail.

The second bug is that ValueObjectVariable was only returning
the forward type, which is insufficient to print the value of an
enum.  So we bump this up to the layout type.

Differential Revision: https://reviews.llvm.org/D54241

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
lldb/trunk/source/Core/ValueObjectVariable.cpp
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit?rev=346430=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit Thu Nov  8 
10:50:31 2018
@@ -0,0 +1,3 @@
+target variable GlobalVariable
+
+quit

Modified: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346430=346429=346430=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Thu Nov  8 
10:50:31 2018
@@ -89,22 +89,23 @@ Anonymous>::D AnonABCVoidD;
 // CHECK: (TrivialC) TC = {}
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
-// CHECK: (TrivialE) TE = 
-// CHECK: (A::B::C) ABCInt = (ABCMember = )
-// CHECK: (A::B::C) ABCFloat = (ABCMember = )
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = )
+// CHECK: (TrivialE) TE = TE_A
+// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
+// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 
0x)
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = , 
CPtr = )
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = )
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 0x)
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x)
 // CHECK: (A::D) AD = {}
-// CHECK: (A::D::E) ADE = (ADDMember = )
+// CHECK: (A::D::E) ADE = (ADDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.
 // CHECK: TranslationUnitDecl {{.*}}
 // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
 // CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
 // CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
 // CHECK: |-EnumDecl {{.*}} TrivialE
+// CHECK: | `-EnumConstantDecl {{.*}} TE_A 'int'
 // CHECK: |-NamespaceDecl {{.*}} A
 // CHECK: | |-NamespaceDecl {{.*}} B
 // CHECK: | | |-CXXRecordDecl {{.*}} struct C definition

Added: lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp?rev=346430=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/globals-bss.cpp Thu Nov  8 10:50:31 2018
@@ -0,0 +1,35 @@
+// clang-format off
+// REQUIRES: lld
+
+// Make sure we can read variables from BSS
+// 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: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
+
+int GlobalVariable = 0;
+
+int main(int argc, char **argv) {
+  return 0;
+}
+
+// BSS:   Section {
+// BSS: Number: 3
+// BSS: Name: .data
+// BSS-NEXT:VirtualSize: 0x4
+// BSS-NEXT:VirtualAddress:
+// BSS-NEXT:RawDataSize: 0
+// BSS-NEXT:PointerToRawData: 0x0
+// BSS-NEXT:PointerToRelocations: 0x0
+// BSS-NEXT:PointerToLineNumbers: 0x0
+// BSS-NEXT:RelocationCount: 0
+// BSS-NEXT:LineNumberCount: 0
+// BSS-NEXT:Characteristics [ (0xC040)
+// BSS-NEXT:  IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+// BSS-NEXT:  IMAGE_SCN_MEM_READ (0x4000)
+// BSS-NEXT:  IMAGE_SCN_MEM_WRITE 

[Lldb-commits] [PATCH] D54216: [NativePDB] Improve support for reconstructing a clang AST from PDB debug info

2018-11-08 Thread Zachary Turner via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL346429: [NativePDB] Higher fidelity reconstruction of AST 
from Debug Info. (authored by zturner, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54216?vs=172989=173198#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54216

Files:
  lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit
  lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit
  lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit
  lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp
  lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h

Index: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
===
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeRecord.h
@@ -429,6 +429,10 @@
 return (Options & ClassOptions::ForwardReference) != ClassOptions::None;
   }
 
+  bool containsNestedClass() const {
+return (Options & ClassOptions::ContainsNestedClass) != ClassOptions::None;
+  }
+
   bool isScoped() const {
 return (Options & ClassOptions::Scoped) != ClassOptions::None;
   }
Index: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
===
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
@@ -0,0 +1,131 @@
+// clang-format off
+// REQUIRES: lld
+
+// Test various interesting cases for AST reconstruction.
+// 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/ast-reconstruction.lldbinit 2>&1 | FileCheck %s
+
+// Test trivial versions of each tag type.
+class TrivialC {};
+struct TrivialS {};
+union TrivialU {};
+enum TrivialE {TE_A};
+
+// Test reconstruction of DeclContext hierarchies.
+namespace A {
+  namespace B {
+template
+struct C {
+  T ABCMember;
+};
+
+// Let's try a template specialization with a different implementation
+template<>
+struct C {
+  void *ABCSpecializationMember;
+};
+  }
+
+  // Let's make sure we can distinguish classes and namespaces.  Also let's try
+  // a non-type template parameter.
+  template
+  struct C {
+class D {
+  int ACDMember = 0;
+  C *CPtr = nullptr;
+};
+  };
+
+  struct D {
+// Let's make a nested class with the same name as another nested class
+// elsewhere, and confirm that they appear in the right DeclContexts in
+// the AST.
+struct E {
+  int ADDMember;
+};
+  };
+}
+
+
+// Let's try an anonymous namespace.
+namespace {
+  template
+  struct Anonymous {
+int AnonymousMember;
+// And a nested class within an anonymous namespace
+struct D {
+  int AnonymousDMember;
+};
+  };
+}
+
+TrivialC TC;
+TrivialS TS;
+TrivialU TU;
+TrivialE TE;
+
+A::B::C ABCInt;
+A::B::C ABCFloat;
+A::B::C ABCVoid;
+
+A::C<0> AC0;
+A::C<-1> ACNeg1;
+
+A::C<0>::D AC0D;
+A::C<-1>::D ACNeg1D;
+A::D AD;
+A::D::E ADE;
+
+// FIXME: Anonymous namespaces aren't working correctly.
+Anonymous AnonInt;
+Anonymous> AnonABCVoid;
+Anonymous>::D AnonABCVoidD;
+
+// FIXME: Enum size isn't being correctly determined.
+// FIXME: Can't read memory for variable values.
+
+// CHECK: (TrivialC) TC = {}
+// CHECK: (TrivialS) TS = {}
+// CHECK: (TrivialU) TU = {}
+// CHECK: (TrivialE) TE = 
+// CHECK: (A::B::C) ABCInt = (ABCMember = )
+// CHECK: (A::B::C) ABCFloat = (ABCMember = )
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = )
+// CHECK: (A::C<0>) AC0 = {}
+// CHECK: (A::C<-1>) ACNeg1 = {}
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = , CPtr = )
+// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = )
+// CHECK: (A::D) AD = {}
+// CHECK: (A::D::E) ADE = (ADDMember = )
+// CHECK: Dumping clang ast for 1 modules.
+// CHECK: TranslationUnitDecl {{.*}}
+// CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
+// CHECK: |-CXXRecordDecl {{.*}} struct TrivialS definition
+// CHECK: |-CXXRecordDecl {{.*}} union TrivialU definition
+// CHECK: |-EnumDecl {{.*}} TrivialE
+// CHECK: |-NamespaceDecl {{.*}} A
+// CHECK: | |-NamespaceDecl {{.*}} B
+// CHECK: | | |-CXXRecordDecl {{.*}} struct C definition
+// CHECK: | | | `-FieldDecl {{.*}} ABCMember 'int'
+// CHECK: | | |-CXXRecordDecl {{.*}} struct C 

[Lldb-commits] [lldb] r346429 - [NativePDB] Higher fidelity reconstruction of AST from Debug Info.

2018-11-08 Thread Zachary Turner via lldb-commits
Author: zturner
Date: Thu Nov  8 10:50:11 2018
New Revision: 346429

URL: http://llvm.org/viewvc/llvm-project?rev=346429=rev
Log:
[NativePDB] Higher fidelity reconstruction of AST from Debug Info.

In order to accurately put a type into the correct location in the AST
we construct from debug info, we need to be able to determine what
DeclContext (namespace, global, nested class, etc) that it goes into.
PDB doesn't contain this mapping.  It does, however, contain the reverse
mapping.  That is, for a given class type T, you can determine all
classes Q1, Q2, ..., Qn that are nested inside of T.  We need to know,
for a given class type Q, what type T is it nested inside of.

This patch builds this map as a pre-processing step when we first
load the PDB by scanning every type.  Initial tests show that while
this can be slow in debug builds of LLDB, it is quite fast in release
builds (less than 2 seconds for a ~1GB PDB, and it only needs to happen
once).

Furthermore, having this pre-processing step in place allows us to
repurpose it for building up other kinds of indexing to it down the
line.  For the time being, this gives us very accurate reconstruction
of the DeclContext hierarchy.

Differential Revision: https://reviews.llvm.org/D54216

Added:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
Modified:
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit
lldb/trunk/lit/SymbolFile/NativePDB/function-types-classes.cpp
lldb/trunk/lit/SymbolFile/NativePDB/global-classes.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h

Added: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit?rev=346429=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit 
(added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/ast-reconstruction.lldbinit Thu 
Nov  8 10:50:11 2018
@@ -0,0 +1,20 @@
+target variable TC
+target variable TS
+target variable TU
+target variable TE
+
+target variable ABCInt
+target variable ABCFloat
+target variable ABCVoid
+
+target variable AC0
+target variable ACNeg1
+
+target variable AC0D
+target variable ACNeg1D
+target variable AD
+target variable ADE
+
+target modules dump ast
+
+quit

Modified: 
lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit?rev=346429=346428=346429=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit 
(original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/function-types-classes.lldbinit 
Thu Nov  8 10:50:11 2018
@@ -9,4 +9,6 @@ target variable h
 target variable i
 target variable incomplete
 
+target modules dump ast
+
 quit

Modified: lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit?rev=346429=346428=346429=diff
==
--- lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit 
(original)
+++ lldb/trunk/lit/SymbolFile/NativePDB/Inputs/globals-classes.lldbinit Thu Nov 
 8 10:50:11 2018
@@ -11,4 +11,6 @@ target variable -T UnnamedClassInstance
 target variable -T PointersInstance
 target variable -T ReferencesInstance
 
+target modules dump ast
+
 quit
\ No newline at end of file

Added: lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp?rev=346429=auto
==
--- lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp (added)
+++ lldb/trunk/lit/SymbolFile/NativePDB/ast-reconstruction.cpp Thu Nov  8 
10:50:11 2018
@@ -0,0 +1,131 @@
+// clang-format off
+// REQUIRES: lld
+
+// Test various interesting cases for AST reconstruction.
+// 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/ast-reconstruction.lldbinit 2>&1 | FileCheck %s
+
+// Test trivial versions of each tag type.
+class TrivialC {};
+struct TrivialS {};
+union TrivialU {};

[Lldb-commits] [PATCH] D54216: [NativePDB] Improve support for reconstructing a clang AST from PDB debug info

2018-11-08 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov added a comment.

In https://reviews.llvm.org/D54216#1291852, @zturner wrote:

> I checked on clang.pdb.  For my local build of LLVM this about 780MB.  It's 
> quite slow in debug build (14 seconds for `ParseSectionContribs` and 60 
> seconds for `PreprocessTpiStream`), but in release build the combined total 
> is less than 2 seconds for both function calls


I think that less than 2 seconds for a 780MB PDB in release is very good! Thank 
you!


https://reviews.llvm.org/D54216



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] r346428 - Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter.

2018-11-08 Thread Shafik Yaghmour via lldb-commits
Author: shafik
Date: Thu Nov  8 10:42:00 2018
New Revision: 346428

URL: http://llvm.org/viewvc/llvm-project?rev=346428=rev
Log:
Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove 
redundant parameter which can be calculated from other parameter.

rdar://problem/43822994

Differential Revision: https://reviews.llvm.org/D54003

Added:
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py

lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
Modified:
lldb/trunk/include/lldb/Symbol/ClangASTContext.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
lldb/trunk/source/Symbol/ClangASTContext.cpp

Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=346428=346427=346428=diff
==
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Thu Nov  8 10:42:00 2018
@@ -903,9 +903,8 @@ public:
   // Modifying Enumeration types
   //--
   clang::EnumConstantDecl *AddEnumerationValueToEnumerationType(
-  lldb::opaque_compiler_type_t type,
-  const CompilerType _qual_type, const Declaration ,
-  const char *name, int64_t enum_value, uint32_t enum_value_bit_size);
+  const CompilerType _type, const Declaration , const char *name,
+  int64_t enum_value, uint32_t enum_value_bit_size);
 
   CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type);
 

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile?rev=346428=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
 Thu Nov  8 10:42:00 2018
@@ -0,0 +1,6 @@
+LEVEL = ../../make
+
+CXX_SOURCES := main.cpp
+CXXFLAGS += -std=c++11
+
+include $(LEVEL)/Makefile.rules

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py?rev=346428=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
 Thu Nov  8 10:42:00 2018
@@ -0,0 +1,44 @@
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ExprXValuePrintingTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test(self):
+self.build()
+
+self.main_source = "main.cpp"
+self.main_source_spec = lldb.SBFileSpec(self.main_source)
+(target, process, thread, bkpt) = 
lldbutil.run_to_source_breakpoint(self,
+  '// Set break point at this line.', 
self.main_source_spec)
+frame = thread.GetFrameAtIndex(0)
+
+self.expect("expr f == Foo::FooBar",
+substrs=['(bool) $0 = true'])
+
+value = frame.EvaluateExpression("f == Foo::FooBar")
+self.assertTrue(value.IsValid())
+self.assertTrue(value.GetError().Success())
+self.assertEqual(value.GetValueAsUnsigned(), 1)
+
+value = frame.EvaluateExpression("b == BarBar")
+self.assertTrue(value.IsValid())
+self.assertTrue(value.GetError().Success())
+self.assertEqual(value.GetValueAsUnsigned(), 1)
+
+## b is not a Foo
+value = frame.EvaluateExpression("b == Foo::FooBar")
+self.assertTrue(value.IsValid())
+self.assertFalse(value.GetError().Success())
+
+## integral is not implicitly convertible to a scoped enum
+value = frame.EvaluateExpression("1 == Foo::FooBar")
+self.assertTrue(value.IsValid())
+self.assertFalse(value.GetError().Success())

Added: 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
URL: 

[Lldb-commits] [PATCH] D54003: Refactor ClangASTContext::AddEnumerationValueToEnumerationType() to remove redundant parameter which can be calculated from other parameter

2018-11-08 Thread Shafik Yaghmour via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL346428: Refactor 
ClangASTContext::AddEnumerationValueToEnumerationType() to remove… (authored by 
shafik, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54003?vs=173083=173197#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D54003

Files:
  lldb/trunk/include/lldb/Symbol/ClangASTContext.h
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/Makefile
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
  
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/main.cpp
  lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/trunk/source/Plugins/SymbolFile/NativePDB/UdtRecordCompleter.cpp
  lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
  lldb/trunk/source/Symbol/ClangASTContext.cpp

Index: lldb/trunk/source/Symbol/ClangASTContext.cpp
===
--- lldb/trunk/source/Symbol/ClangASTContext.cpp
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp
@@ -8876,43 +8876,55 @@
 }
 
 clang::EnumConstantDecl *ClangASTContext::AddEnumerationValueToEnumerationType(
-lldb::opaque_compiler_type_t type,
-const CompilerType _clang_type, const Declaration ,
-const char *name, int64_t enum_value, uint32_t enum_value_bit_size) {
-  if (type && enumerator_clang_type.IsValid() && name && name[0]) {
-clang::QualType enum_qual_type(GetCanonicalQualType(type));
-
-bool is_signed = false;
-enumerator_clang_type.IsIntegerType(is_signed);
-const clang::Type *clang_type = enum_qual_type.getTypePtr();
-if (clang_type) {
-  const clang::EnumType *enutype =
-  llvm::dyn_cast(clang_type);
+const CompilerType _type, const Declaration , const char *name,
+int64_t enum_value, uint32_t enum_value_bit_size) {
+
+  if (!enum_type || ConstString(name).IsEmpty())
+return nullptr;
+
+  lldbassert(enum_type.GetTypeSystem() == static_cast(this));
+
+  lldb::opaque_compiler_type_t enum_opaque_compiler_type =
+  enum_type.GetOpaqueQualType();
+
+  if (!enum_opaque_compiler_type)
+return nullptr;
+
+  CompilerType underlying_type =
+  GetEnumerationIntegerType(enum_type.GetOpaqueQualType());
+
+  clang::QualType enum_qual_type(
+  GetCanonicalQualType(enum_opaque_compiler_type));
+
+  bool is_signed = false;
+  underlying_type.IsIntegerType(is_signed);
+  const clang::Type *clang_type = enum_qual_type.getTypePtr();
 
-  if (enutype) {
-llvm::APSInt enum_llvm_apsint(enum_value_bit_size, is_signed);
-enum_llvm_apsint = enum_value;
-clang::EnumConstantDecl *enumerator_decl =
-clang::EnumConstantDecl::Create(
-*getASTContext(), enutype->getDecl(), clang::SourceLocation(),
-name ? ()->Idents.get(name)
- : nullptr, // Identifier
-ClangUtil::GetQualType(enumerator_clang_type),
-nullptr, enum_llvm_apsint);
+  if (!clang_type)
+return nullptr;
+
+  const clang::EnumType *enutype = llvm::dyn_cast(clang_type);
+
+  if (!enutype)
+return nullptr;
+
+  llvm::APSInt enum_llvm_apsint(enum_value_bit_size, is_signed);
+  enum_llvm_apsint = enum_value;
+  clang::EnumConstantDecl *enumerator_decl = clang::EnumConstantDecl::Create(
+  *getASTContext(), enutype->getDecl(), clang::SourceLocation(),
+  name ? ()->Idents.get(name) : nullptr, // Identifier
+  clang::QualType(enutype, 0), nullptr, enum_llvm_apsint);
+
+  if (!enumerator_decl)
+return nullptr;
 
-if (enumerator_decl) {
-  enutype->getDecl()->addDecl(enumerator_decl);
+  enutype->getDecl()->addDecl(enumerator_decl);
 
 #ifdef LLDB_CONFIGURATION_DEBUG
-  VerifyDecl(enumerator_decl);
+  VerifyDecl(enumerator_decl);
 #endif
 
-  return enumerator_decl;
-}
-  }
-}
-  }
-  return nullptr;
+  return enumerator_decl;
 }
 
 CompilerType
Index: lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
+++ lldb/trunk/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp
@@ -1122,8 +1122,7 @@
   uint32_t byte_size = m_ast.getASTContext()->getTypeSize(
   ClangUtil::GetQualType(underlying_type));
   auto enum_constant_decl = m_ast.AddEnumerationValueToEnumerationType(
-  enum_type.GetOpaqueQualType(), underlying_type, decl, name.c_str(),
-  raw_value, byte_size * 8);
+  enum_type, decl, name.c_str(), raw_value, byte_size * 8);
   if (!enum_constant_decl)
 return false;
 
Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
===
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ 

[Lldb-commits] [PATCH] D54241: Fix bug in printing ValueObjects and in PE/COFF Plugin

2018-11-08 Thread Zachary Turner via Phabricator via lldb-commits
zturner updated this revision to Diff 173194.
zturner added a comment.

Use the layout type instead of the full type, along with a comment explaining 
why this is necessary.


https://reviews.llvm.org/D54241

Files:
  lldb/lit/SymbolFile/NativePDB/Inputs/globals-bss.lldbinit
  lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
  lldb/source/Core/ValueObjectVariable.cpp
  lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp

Index: lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -710,7 +710,10 @@
llvm::COFF::IMAGE_SCN_CNT_INITIALIZED_DATA &&
((const_sect_name == g_data_sect_name) ||
 (const_sect_name == g_DATA_sect_name))) {
-  section_type = eSectionTypeData;
+  if (m_sect_headers[idx].size == 0 && m_sect_headers[idx].offset == 0)
+section_type = eSectionTypeZeroFill;
+  else
+section_type = eSectionTypeData;
 } else if (m_sect_headers[idx].flags &
llvm::COFF::IMAGE_SCN_CNT_UNINITIALIZED_DATA &&
((const_sect_name == g_bss_sect_name) ||
@@ -1053,6 +1056,7 @@
 }
 
 ObjectFile::Strata ObjectFilePECOFF::CalculateStrata() { return eStrataUser; }
+
 //--
 // PluginInterface protocol
 //--
Index: lldb/source/Core/ValueObjectVariable.cpp
===
--- lldb/source/Core/ValueObjectVariable.cpp
+++ lldb/source/Core/ValueObjectVariable.cpp
@@ -66,9 +66,16 @@
 
 CompilerType ValueObjectVariable::GetCompilerTypeImpl() {
   Type *var_type = m_variable_sp->GetType();
-  if (var_type)
-return var_type->GetForwardCompilerType();
-  return CompilerType();
+  if (!var_type)
+return CompilerType();
+
+  // It's important to return the layout type here.  If we have an enum then the
+  // symbol file plugin may have decided to complete it lazily, in which case a
+  // forward type won't be sufficient to display the variable.  On the other
+  // hand, if we have a pointer to a class type, then getting the full type will
+  // resolve the class type, which is too much.  The layout type is both
+  // necessary and sufficient.
+  return var_type->GetLayoutCompilerType();
 }
 
 ConstString ValueObjectVariable::GetTypeName() {
Index: lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
===
--- /dev/null
+++ lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
@@ -0,0 +1,35 @@
+// clang-format off
+// REQUIRES: lld
+
+// Make sure we can read variables from BSS
+// 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: llvm-readobj -s %t.exe | FileCheck --check-prefix=BSS %s
+// RUN: env LLDB_USE_NATIVE_PDB_READER=1 lldb -f %t.exe -s \
+// RUN: %p/Inputs/globals-bss.lldbinit 2>&1 | FileCheck %s
+
+int GlobalVariable = 0;
+
+int main(int argc, char **argv) {
+  return 0;
+}
+
+// BSS:   Section {
+// BSS: Number: 3
+// BSS: Name: .data
+// BSS-NEXT:VirtualSize: 0x4
+// BSS-NEXT:VirtualAddress:
+// BSS-NEXT:RawDataSize: 0
+// BSS-NEXT:PointerToRawData: 0x0
+// BSS-NEXT:PointerToRelocations: 0x0
+// BSS-NEXT:PointerToLineNumbers: 0x0
+// BSS-NEXT:RelocationCount: 0
+// BSS-NEXT:LineNumberCount: 0
+// BSS-NEXT:Characteristics [ (0xC040)
+// BSS-NEXT:  IMAGE_SCN_CNT_INITIALIZED_DATA (0x40)
+// BSS-NEXT:  IMAGE_SCN_MEM_READ (0x4000)
+// BSS-NEXT:  IMAGE_SCN_MEM_WRITE (0x8000)
+// BSS-NEXT:]
+// BSS-NEXT:  }
+
+// CHECK: (int) GlobalVariable = 0
Index: lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
===
--- lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
+++ lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
@@ -89,22 +89,23 @@
 // CHECK: (TrivialC) TC = {}
 // CHECK: (TrivialS) TS = {}
 // CHECK: (TrivialU) TU = {}
-// CHECK: (TrivialE) TE = 
-// CHECK: (A::B::C) ABCInt = (ABCMember = )
-// CHECK: (A::B::C) ABCFloat = (ABCMember = )
-// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = )
+// CHECK: (TrivialE) TE = TE_A
+// CHECK: (A::B::C) ABCInt = (ABCMember = 0)
+// CHECK: (A::B::C) ABCFloat = (ABCMember = 0)
+// CHECK: (A::B::C) ABCVoid = (ABCSpecializationMember = 0x)
 // CHECK: (A::C<0>) AC0 = {}
 // CHECK: (A::C<-1>) ACNeg1 = {}
-// CHECK: (A::C<0>::D) AC0D = (ACDMember = , CPtr = )
-// CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = , CPtr = )
+// CHECK: (A::C<0>::D) AC0D = (ACDMember = 0, CPtr = 

[Lldb-commits] [PATCH] D54216: [NativePDB] Improve support for reconstructing a clang AST from PDB debug info

2018-11-08 Thread Zachary Turner via Phabricator via lldb-commits
zturner added a comment.

In https://reviews.llvm.org/D54216#1291453, @aleksandr.urakov wrote:

> Looks good, thank you!
>
> The only question is performance, haven't you checked how much time takes the 
> preprocessing on huge PDBs? Intuitively it seems that it shouldn't take too 
> much time (n*log(n) where n is the count of LF_NESTTYPE records), but may be 
> you have checked this?


I checked on clang.pdb.  For my local build of LLVM this about 780MB.  It's 
quite slow in debug build (14 seconds for `ParseSectionContribs` and 60 seconds 
for `PreprocessTpiStream`), but in release build the combined total is less 
than 2 seconds for both function calls


https://reviews.llvm.org/D54216



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54221: Add setting to require hardware breakpoints.

2018-11-08 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 173191.
JDevlieghere added a comment.

Update tests to use SB API.


https://reviews.llvm.org/D54221

Files:
  include/lldb/API/SBBreakpoint.h
  include/lldb/API/SBThreadPlan.h
  include/lldb/Breakpoint/Breakpoint.h
  include/lldb/Target/Target.h
  include/lldb/Target/Thread.h
  include/lldb/Target/ThreadPlan.h
  include/lldb/Target/ThreadPlanPython.h
  include/lldb/Target/ThreadPlanShouldStopHere.h
  include/lldb/Target/ThreadPlanStepInRange.h
  include/lldb/Target/ThreadPlanStepInstruction.h
  include/lldb/Target/ThreadPlanStepOut.h
  include/lldb/Target/ThreadPlanStepThrough.h
  include/lldb/Target/ThreadPlanStepUntil.h
  include/lldb/lldb-private-interfaces.h
  
packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/Makefile
  
packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/TestRequireHWBreakpoints.py
  
packages/Python/lldbsuite/test/functionalities/breakpoint/require_hw_breakpoints/main.c
  
packages/Python/lldbsuite/test/functionalities/step_scripted/TestStepScripted.py
  scripts/interface/SBBreakpoint.i
  source/API/SBBreakpoint.cpp
  source/API/SBThread.cpp
  source/API/SBThreadPlan.cpp
  source/Breakpoint/Breakpoint.cpp
  source/Commands/CommandObjectThread.cpp
  
source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
  source/Target/Process.cpp
  source/Target/StopInfo.cpp
  source/Target/Target.cpp
  source/Target/Thread.cpp
  source/Target/ThreadPlan.cpp
  source/Target/ThreadPlanCallOnFunctionExit.cpp
  source/Target/ThreadPlanPython.cpp
  source/Target/ThreadPlanRunToAddress.cpp
  source/Target/ThreadPlanShouldStopHere.cpp
  source/Target/ThreadPlanStepInRange.cpp
  source/Target/ThreadPlanStepInstruction.cpp
  source/Target/ThreadPlanStepOut.cpp
  source/Target/ThreadPlanStepOverRange.cpp
  source/Target/ThreadPlanStepRange.cpp
  source/Target/ThreadPlanStepThrough.cpp
  source/Target/ThreadPlanStepUntil.cpp

Index: source/Target/ThreadPlanStepUntil.cpp
===
--- source/Target/ThreadPlanStepUntil.cpp
+++ source/Target/ThreadPlanStepUntil.cpp
@@ -57,7 +57,10 @@
   m_return_addr = return_frame_sp->GetStackID().GetPC();
   Breakpoint *return_bp =
   target_sp->CreateBreakpoint(m_return_addr, true, false).get();
+
   if (return_bp != nullptr) {
+if (return_bp->IsHardware() && !return_bp->HasResolvedLocations())
+  m_could_not_resolve_hw_bp = true;
 return_bp->SetThreadID(thread_id);
 m_return_bp_id = return_bp->GetID();
 return_bp->SetBreakpointKind("until-return-backstop");
@@ -97,6 +100,7 @@
 }
   }
   m_until_points.clear();
+  m_could_not_resolve_hw_bp = false;
 }
 
 void ThreadPlanStepUntil::GetDescription(Stream *s,
@@ -127,9 +131,16 @@
 }
 
 bool ThreadPlanStepUntil::ValidatePlan(Stream *error) {
-  if (m_return_bp_id == LLDB_INVALID_BREAK_ID)
+  if (m_could_not_resolve_hw_bp) {
+if (error)
+  error->PutCString(
+  "Could not create hardware breakpoint for thread plan.");
+return false;
+  } else if (m_return_bp_id == LLDB_INVALID_BREAK_ID) {
+if (error)
+  error->PutCString("Could not create return breakpoint.");
 return false;
-  else {
+  } else {
 until_collection::iterator pos, end = m_until_points.end();
 for (pos = m_until_points.begin(); pos != end; pos++) {
   if (!LLDB_BREAK_ID_IS_VALID((*pos).second))
Index: source/Target/ThreadPlanStepThrough.cpp
===
--- source/Target/ThreadPlanStepThrough.cpp
+++ source/Target/ThreadPlanStepThrough.cpp
@@ -62,7 +62,10 @@
   ->GetTarget()
   .CreateBreakpoint(m_backstop_addr, true, false)
   .get();
+
   if (return_bp != nullptr) {
+if (return_bp->IsHardware() && !return_bp->HasResolvedLocations())
+  m_could_not_resolve_hw_bp = true;
 return_bp->SetThreadID(m_thread.GetID());
 m_backstop_bkpt_id = return_bp->GetID();
 return_bp->SetBreakpointKind("step-through-backstop");
@@ -139,7 +142,26 @@
 }
 
 bool ThreadPlanStepThrough::ValidatePlan(Stream *error) {
-  return m_sub_plan_sp.get() != nullptr;
+  if (m_could_not_resolve_hw_bp) {
+if (error)
+  error->PutCString(
+  "Could not create hardware breakpoint for thread plan.");
+return false;
+  }
+
+  if (m_backstop_bkpt_id == LLDB_INVALID_BREAK_ID) {
+if (error)
+  error->PutCString("Could not create backstop breakpoint.");
+return false;
+  }
+
+  if (!m_sub_plan_sp.get()) {
+if (error)
+  error->PutCString("Does not have a subplan.");
+return false;
+  }
+
+  return true;
 }
 
 bool ThreadPlanStepThrough::DoPlanExplainsStop(Event *event_ptr) {
@@ -215,6 +237,7 @@
   if (m_backstop_bkpt_id != LLDB_INVALID_BREAK_ID) {
 

[Lldb-commits] [PATCH] D54241: Fix bug in printing ValueObjects and in PE/COFF Plugin

2018-11-08 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Very close, just use the layout type as mentioned in the inline comment.




Comment at: lldb/source/Core/ValueObjectVariable.cpp:70
   if (var_type)
-return var_type->GetForwardCompilerType();
+return var_type->GetFullCompilerType();
   return CompilerType();

Change this to GetLayoutCompilerType(). Why? If you have just a class Foo and 
your variable's type is "Foo *", then you don't need to complete it. The layout 
type gets you the type that is needed in order to display the current variable. 
For enums this will do the right thing. Otherwise if you have 1000 variables 
that are all pointers, you will be completing all of the class types for no 
reason.


https://reviews.llvm.org/D54241



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D54216: [NativePDB] Improve support for reconstructing a clang AST from PDB debug info

2018-11-08 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov accepted this revision.
aleksandr.urakov added a comment.
This revision is now accepted and ready to land.

Looks good, thank you!

The only question is performance, haven't you checked how much time takes the 
preprocessing on huge PDBs? Intuitively it seems that it shouldn't take too 
much time (n*log(n) where n is the count of LF_NESTTYPE records), but may be 
you have checked this?


https://reviews.llvm.org/D54216



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits