[Lldb-commits] [PATCH] D48752: Quiet command regex instructions during batch execution

2018-11-27 Thread Dave Lee via Phabricator via lldb-commits
kastiglione added a comment.

@jingham If you're still willing to review this change to `command regex`, it 
is updated per our previous discussion, thanks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D48752/new/

https://reviews.llvm.org/D48752



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


[Lldb-commits] [PATCH] D43886: [lldb] Add GetCurrentException APIs to SBThread, add frame recognizer for objc_exception_throw for Obj-C runtimes

2018-11-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

The exception breakpoints know that libobjc.B.dylib`objc_exception_throw is 
where you stop for exception breakpoints, and now the ObjCExceptionRecognizer 
knows the same thing.  It always makes me nervous when two different places 
have the same hard-coded string.  Can we add an API to ObjCLanguageRuntime to 
get the FileSpec for the module and a function name for the exception function, 
and then have both CreateExceptionResolver and RegisterObjCExceptionRecognizer 
use that?  Actually it would be better to just add this to the LanguageRuntime, 
because then we could use it for the C++ CreateExceptionResolver and later 
(when one of us gets to it) for RegisterCPlusPlusExceptionRecognizer as well.  
But since C++ can throw in a couple of places, it will need to return a vector 
of name+library pairs.

Other than this niggle, this looks great.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D43886/new/

https://reviews.llvm.org/D43886



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


[Lldb-commits] [lldb] r347725 - [unittest] Fix the FileSystem test on Windows. (Attempt #2)

2018-11-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Nov 27 17:18:10 2018
New Revision: 347725

URL: http://llvm.org/viewvc/llvm-project?rev=347725=rev
Log:
[unittest] Fix the FileSystem test on Windows. (Attempt #2)

This fixes the double escaping and compares FileSpecs instead of
strings.

Modified:
lldb/trunk/unittests/Host/FileSystemTest.cpp

Modified: lldb/trunk/unittests/Host/FileSystemTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/FileSystemTest.cpp?rev=347725=347724=347725=diff
==
--- lldb/trunk/unittests/Host/FileSystemTest.cpp (original)
+++ lldb/trunk/unittests/Host/FileSystemTest.cpp Tue Nov 27 17:18:10 2018
@@ -226,7 +226,7 @@ TEST(FileSystemTest, MakeAbsolute) {
 auto EC = fs.MakeAbsolute(foo);
 EXPECT_FALSE(EC);
 #ifdef _WIN32
-EXPECT_TRUE(foo.equals("foo"));
+EXPECT_TRUE(foo.equals("\\foo"));
 #else
 EXPECT_TRUE(foo.equals("/foo"));
 #endif
@@ -236,7 +236,7 @@ TEST(FileSystemTest, MakeAbsolute) {
 FileSpec file_spec("foo");
 auto EC = fs.MakeAbsolute(file_spec);
 EXPECT_FALSE(EC);
-EXPECT_EQ("/foo", file_spec.GetPath());
+EXPECT_EQ(FileSpec("/foo"), file_spec);
   }
 }
 
@@ -248,7 +248,7 @@ TEST(FileSystemTest, Resolve) {
 SmallString<16> foo(foo_relative);
 fs.Resolve(foo);
 #ifdef _WIN32
-EXPECT_TRUE(foo.equals("foo"));
+EXPECT_TRUE(foo.equals("\\foo"));
 #else
 EXPECT_TRUE(foo.equals("/foo"));
 #endif
@@ -257,7 +257,7 @@ TEST(FileSystemTest, Resolve) {
   {
 FileSpec file_spec("foo");
 fs.Resolve(file_spec);
-EXPECT_EQ("/foo", file_spec.GetPath());
+EXPECT_EQ(FileSpec("/foo"), file_spec);
   }
 
   {
@@ -270,7 +270,7 @@ TEST(FileSystemTest, Resolve) {
   {
 FileSpec file_spec("bogus");
 fs.Resolve(file_spec);
-EXPECT_EQ("bogus", file_spec.GetPath());
+EXPECT_EQ(FileSpec("bogus"), file_spec);
   }
 }
 


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


[Lldb-commits] [lldb] r347717 - [lldbsuite] Each lldb suite test must have a unique class name

2018-11-27 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Tue Nov 27 14:18:02 2018
New Revision: 347717

URL: http://llvm.org/viewvc/llvm-project?rev=347717=rev
Log:
[lldbsuite] Each lldb suite test must have a unique class name

A couple of new tests have been added that use existing class names. This 
causes failures on Windows if the tests run at the same time and on any 
platform it results in the logs being overwritten.

Modified:

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

lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py

Modified: 
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=347717=347716=347717=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/expression_command/radar_43822994/TestScopedEnumType.py
 Tue Nov 27 14:18:02 2018
@@ -7,7 +7,7 @@ from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
 
-class ExprXValuePrintingTestCase(TestBase):
+class ScopedEnumType(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py?rev=347717=347716=347717=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/data-formatter/varscript_formatting/TestDataFormatterVarScriptFormatting.py
 Tue Nov 27 14:18:02 2018
@@ -14,7 +14,7 @@ from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
 
-class PythonSynthDataFormatterTestCase(TestBase):
+class DataFormatterVarScriptFormatting(TestBase):
 
 mydir = TestBase.compute_mydir(__file__)
 


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


[Lldb-commits] [PATCH] D54616: [Reproducers] Improve reproducer API and add unit tests.

2018-11-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347716: [Reproducers] Improve reproducer API and add unit 
tests. (authored by JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54616?vs=175293=175578#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54616/new/

https://reviews.llvm.org/D54616

Files:
  lldb/trunk/include/lldb/API/SBDebugger.h
  lldb/trunk/include/lldb/Core/Debugger.h
  lldb/trunk/include/lldb/Utility/Reproducer.h
  lldb/trunk/scripts/interface/SBDebugger.i
  lldb/trunk/source/API/SBDebugger.cpp
  lldb/trunk/source/Commands/CommandObjectReproducer.cpp
  lldb/trunk/source/Core/Debugger.cpp
  lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/trunk/source/Utility/Reproducer.cpp
  lldb/trunk/tools/driver/Driver.cpp
  lldb/trunk/unittests/Utility/CMakeLists.txt
  lldb/trunk/unittests/Utility/ReproducerTest.cpp

Index: lldb/trunk/unittests/Utility/ReproducerTest.cpp
===
--- lldb/trunk/unittests/Utility/ReproducerTest.cpp
+++ lldb/trunk/unittests/Utility/ReproducerTest.cpp
@@ -0,0 +1,126 @@
+//===-- ReproducerTest.cpp --*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===--===//
+
+#include "gmock/gmock.h"
+#include "gtest/gtest.h"
+
+#include "llvm/Support/Error.h"
+#include "llvm/Testing/Support/Error.h"
+
+#include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/Reproducer.h"
+
+using namespace llvm;
+using namespace lldb_private;
+using namespace lldb_private::repro;
+
+class DummyProvider : public repro::Provider {
+public:
+  static constexpr const char *NAME = "dummy";
+
+  DummyProvider(const FileSpec ) : Provider(directory) {
+m_info.name = "dummy";
+m_info.files.push_back("dummy.yaml");
+  }
+
+  static char ID;
+};
+
+char DummyProvider::ID = 0;
+
+TEST(ReproducerTest, SetCapture) {
+  Reproducer reproducer;
+
+  // Initially both generator and loader are unset.
+  EXPECT_EQ(nullptr, reproducer.GetGenerator());
+  EXPECT_EQ(nullptr, reproducer.GetLoader());
+
+  // Enable capture and check that means we have a generator.
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
+Succeeded());
+  EXPECT_NE(nullptr, reproducer.GetGenerator());
+  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetGenerator()->GetRoot());
+  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetReproducerPath());
+
+  // Ensure that we cannot enable replay.
+  EXPECT_THAT_ERROR(reproducer.SetReplay(FileSpec("/bogus/path")), Failed());
+  EXPECT_EQ(nullptr, reproducer.GetLoader());
+
+  // Ensure we can disable the generator again.
+  EXPECT_THAT_ERROR(reproducer.SetCapture(llvm::None), Succeeded());
+  EXPECT_EQ(nullptr, reproducer.GetGenerator());
+  EXPECT_EQ(nullptr, reproducer.GetLoader());
+}
+
+TEST(ReproducerTest, SetReplay) {
+  Reproducer reproducer;
+
+  // Initially both generator and loader are unset.
+  EXPECT_EQ(nullptr, reproducer.GetGenerator());
+  EXPECT_EQ(nullptr, reproducer.GetLoader());
+
+  // Expected to fail because we can't load the index.
+  EXPECT_THAT_ERROR(reproducer.SetReplay(FileSpec("/bogus/path")), Failed());
+  // However the loader should still be set, which we check here.
+  EXPECT_NE(nullptr, reproducer.GetLoader());
+
+  // Make sure the bogus path is correctly set.
+  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetLoader()->GetRoot());
+  EXPECT_EQ(FileSpec("/bogus/path"), reproducer.GetReproducerPath());
+
+  // Ensure that we cannot enable replay.
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")), Failed());
+  EXPECT_EQ(nullptr, reproducer.GetGenerator());
+}
+
+TEST(GeneratorTest, Create) {
+  Reproducer reproducer;
+
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
+Succeeded());
+  auto  = *reproducer.GetGenerator();
+
+  auto *provider = generator.Create();
+  EXPECT_NE(nullptr, provider);
+  EXPECT_EQ(FileSpec("/bogus/path"), provider->GetRoot());
+  EXPECT_EQ(std::string("dummy"), provider->GetInfo().name);
+  EXPECT_EQ((size_t)1, provider->GetInfo().files.size());
+  EXPECT_EQ(std::string("dummy.yaml"), provider->GetInfo().files.front());
+}
+
+TEST(GeneratorTest, Get) {
+  Reproducer reproducer;
+
+  EXPECT_THAT_ERROR(reproducer.SetCapture(FileSpec("/bogus/path")),
+Succeeded());
+  auto  = *reproducer.GetGenerator();
+
+  auto *provider = generator.Create();
+  EXPECT_NE(nullptr, provider);
+
+  auto *provider_alt = generator.Get();
+  EXPECT_EQ(provider, provider_alt);
+}
+
+TEST(GeneratorTest, GetOrCreate) {
+  Reproducer reproducer;
+
+  

[Lldb-commits] [lldb] r347716 - [Reproducers] Improve reproducer API and add unit tests.

2018-11-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Nov 27 14:11:02 2018
New Revision: 347716

URL: http://llvm.org/viewvc/llvm-project?rev=347716=rev
Log:
[Reproducers] Improve reproducer API and add unit tests.

When I landed the initial reproducer framework I knew there were some
things that needed improvement. Rather than bundling it with a patch
that adds more functionality I split it off into this patch. I also
think the API is stable enough to add unit testing, which is included in
this patch as well.

Other improvements include:

 - Refactor how we initialize the loader and generator.
 - Improve naming consistency: capture and replay seems the least ambiguous.
 - Index providers by name and make sure there's only one of each.
 - Add convenience methods for creating and accessing providers.

Differential revision: https://reviews.llvm.org/D54616

Added:
lldb/trunk/unittests/Utility/ReproducerTest.cpp
Modified:
lldb/trunk/include/lldb/API/SBDebugger.h
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/scripts/interface/SBDebugger.i
lldb/trunk/source/API/SBDebugger.cpp
lldb/trunk/source/Commands/CommandObjectReproducer.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/trunk/source/Utility/Reproducer.cpp
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/unittests/Utility/CMakeLists.txt

Modified: lldb/trunk/include/lldb/API/SBDebugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBDebugger.h?rev=347716=347715=347716=diff
==
--- lldb/trunk/include/lldb/API/SBDebugger.h (original)
+++ lldb/trunk/include/lldb/API/SBDebugger.h Tue Nov 27 14:11:02 2018
@@ -228,7 +228,7 @@ public:
 
   const char *GetReproducerPath() const;
 
-  void SetReproducerPath(const char *reproducer);
+  lldb::SBError ReplayReproducer(const char *path);
 
   lldb::ScriptLanguage GetScriptLanguage() const;
 

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=347716=347715=347716=diff
==
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Tue Nov 27 14:11:02 2018
@@ -263,8 +263,8 @@ public:
 
   llvm::StringRef GetReproducerPath() const;
 
-  void SetReproducerPath(llvm::StringRef p);
-  void SetReproducerPath(const char *) = delete;
+  llvm::Error SetReproducerReplay(llvm::StringRef p);
+  llvm::Error SetReproducerReplay(const char *) = delete;
 
   llvm::Error SetReproducerCapture(bool b);
 

Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=347716=347715=347716=diff
==
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Tue Nov 27 14:11:02 2018
@@ -12,7 +12,7 @@
 
 #include "lldb/Utility/FileSpec.h"
 
-#include "llvm/ADT/StringMap.h"
+#include "llvm/ADT/DenseMap.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/YAMLTraits.h"
 
@@ -38,12 +38,12 @@ struct ProviderInfo {
 /// i.e. in the constructor.
 ///
 /// Different components will implement different providers.
-class Provider {
+class ProviderBase {
 public:
-  virtual ~Provider() = default;
+  virtual ~ProviderBase() = default;
 
-  const ProviderInfo () { return m_info; }
-  const FileSpec () { return m_directory; }
+  const ProviderInfo () const { return m_info; }
+  const FileSpec () const { return m_root; }
 
   /// The Keep method is called when it is decided that we need to keep the
   /// data in order to provide a reproducer.
@@ -53,15 +53,33 @@ public:
   /// keep any information and will not generate a reproducer.
   virtual void Discard(){};
 
+  // Returns the class ID for this type.
+  static const void *ClassID() { return  }
+
+  // Returns the class ID for the dynamic type of this Provider instance.
+  virtual const void *DynamicClassID() const = 0;
+
 protected:
-  Provider(const FileSpec ) : m_directory(directory) {}
+  ProviderBase(const FileSpec ) : m_root(root) {}
 
   /// Every provider keeps track of its own files.
   ProviderInfo m_info;
-
 private:
   /// Every provider knows where to dump its potential files.
-  FileSpec m_directory;
+  FileSpec m_root;
+
+  virtual void anchor();
+  static char ID;
+};
+
+template  class Provider : public ProviderBase {
+public:
+  static const void *ClassID() { return ::ID; }
+
+  const void *DynamicClassID() const override { return ::ID; }
+
+protected:
+  using ProviderBase::ProviderBase; // Inherit constructor.
 };
 
 /// The generator is responsible for the logic needed to generate a
@@ -69,7 +87,7 @@ private:
 /// is necessary for reproducing  a 

[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL347709: [Driver] Use libOption with tablegen. (authored by 
JDevlieghere, committed by ).
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D54692?vs=175526=175566#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54692/new/

https://reviews.llvm.org/D54692

Files:
  lldb/trunk/lit/Driver/Inputs/Print0.in
  lldb/trunk/lit/Driver/Inputs/Print2.in
  lldb/trunk/lit/Driver/Inputs/Print4.in
  lldb/trunk/lit/Driver/Inputs/Print6.in
  lldb/trunk/lit/Driver/TestCommands.test
  lldb/trunk/lit/Driver/TestNoUseColor.test
  lldb/trunk/lldb.xcodeproj/project.pbxproj
  lldb/trunk/tools/driver/CMakeLists.txt
  lldb/trunk/tools/driver/Driver.cpp
  lldb/trunk/tools/driver/Driver.h
  lldb/trunk/tools/driver/Options.td

Index: lldb/trunk/lldb.xcodeproj/project.pbxproj
===
--- lldb/trunk/lldb.xcodeproj/project.pbxproj
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj
@@ -2373,6 +2373,8 @@
 		260A248D15D06C4F009981B0 /* OptionValues.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionValues.h; path = include/lldb/Interpreter/OptionValues.h; sourceTree = ""; };
 		26BC7E8610F1B85900F91463 /* Options.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Options.cpp; path = source/Interpreter/Options.cpp; sourceTree = ""; };
 		26BC7D6D10F1B77400F91463 /* Options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Options.h; path = include/lldb/Interpreter/Options.h; sourceTree = ""; };
+		DD5F951A21ADE5BD00B8265A /* Options.inc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.pascal; name = Options.inc; path = build/Debug/include/Options.inc; sourceTree = ""; };
+		DD5F951B21ADE5F000B8265A /* Options.td */ = {isa = PBXFileReference; lastKnownFileType = text; name = Options.td; path = tools/driver/Options.td; sourceTree = ""; };
 		4C562CC21CC07DDD00C52EAC /* PDBASTParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PDBASTParser.cpp; path = PDB/PDBASTParser.cpp; sourceTree = ""; };
 		4C562CC31CC07DDD00C52EAC /* PDBASTParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDBASTParser.h; path = PDB/PDBASTParser.h; sourceTree = ""; };
 		4CA0C6CA20F929C600CFE6BB /* PDBLocationToDWARFExpression.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PDBLocationToDWARFExpression.cpp; path = PDB/PDBLocationToDWARFExpression.cpp; sourceTree = ""; };
@@ -5916,6 +5918,8 @@
 		26F5C22510F3D956009D5894 /* Driver */ = {
 			isa = PBXGroup;
 			children = (
+DD5F951B21ADE5F000B8265A /* Options.td */,
+DD5F951A21ADE5BD00B8265A /* Options.inc */,
 26F5C27210F3D9E4009D5894 /* lldb-Info.plist */,
 26F5C27410F3D9E4009D5894 /* Driver.h */,
 26F5C27310F3D9E4009D5894 /* Driver.cpp */,
@@ -7173,6 +7177,7 @@
 			isa = PBXNativeTarget;
 			buildConfigurationList = 26F5C26E10F3D9C5009D5894 /* Build configuration list for PBXNativeTarget "lldb-tool" */;
 			buildPhases = (
+DD5F951721ADD0C900B8265A /* Run Tablegen */,
 26F5C26710F3D9A4009D5894 /* Sources */,
 26F5C26810F3D9A4009D5894 /* Frameworks */,
 			);
@@ -7514,9 +7519,29 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			shellPath = "/bin/sh -x";
-			shellScript = "/bin/rm -rf \"$INSTALL_ROOT/System/Library/PrivateFrameworks/LLDB.framework/Resources\" \"$INSTALL_ROOT/System/Library/PrivateFrameworks/LLDB.framework/Swift\"";
+			shellScript = "/bin/rm -rf \"$INSTALL_ROOT/System/Library/PrivateFrameworks/LLDB.framework/Resources\" \"$INSTALL_ROOT/System/Library/PrivateFrameworks/LLDB.framework/Swift\"\n";
 			showEnvVarsInLog = 0;
 		};
+		DD5F951721ADD0C900B8265A /* Run Tablegen */ = {
+			isa = PBXShellScriptBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			inputFileListPaths = (
+			);
+			inputPaths = (
+$SOURCE_DIR/tools/driver/Options.td,
+			);
+			name = "Run Tablegen";
+			outputFileListPaths = (
+			);
+			outputPaths = (
+$BUILT_PRODUCTS_DIR/Options.inc,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+			shellPath = /bin/sh;
+			shellScript = "mkdir -p $BUILT_PRODUCTS_DIR/include\n$LLVM_BUILD_DIR/x86_64/bin/llvm-tblgen -I$LLVM_SOURCE_DIR/include -gen-opt-parser-defs $SRCROOT/tools/driver/Options.td -o $BUILT_PRODUCTS_DIR/include/Options.inc\n";
+		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
@@ -10531,7 +10556,7 @@
 	"$(LLVM_BUILD_DIR)/archives.txt",
 );
 PRODUCT_NAME = lldb;
-USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/include $(SRCROOT)/source $(LLVM_SOURCE_DIR)/include $(LLVM_BUILD_DIR)/$(LLVM_BUILD_DIR_ARCH)/include";
+USER_HEADER_SEARCH_PATHS = 

[Lldb-commits] [lldb] r347709 - [Driver] Use libOption with tablegen.

2018-11-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Nov 27 13:00:32 2018
New Revision: 347709

URL: http://llvm.org/viewvc/llvm-project?rev=347709=rev
Log:
[Driver] Use libOption with tablegen.

This patch modifies the lldb driver to use libOption for option parsing.
It allows us to decouple option parsing from option processing which is
important when arguments affect initialization. This was previously not
possible because the debugger need to be initialized as some option
interpretation (like the scripting language etc) was handled by the
debugger, rather than in the driver.

Differential revision: https://reviews.llvm.org/D54692

Added:
lldb/trunk/lit/Driver/
lldb/trunk/lit/Driver/Inputs/
lldb/trunk/lit/Driver/Inputs/Print0.in
lldb/trunk/lit/Driver/Inputs/Print2.in
lldb/trunk/lit/Driver/Inputs/Print4.in
lldb/trunk/lit/Driver/Inputs/Print6.in
lldb/trunk/lit/Driver/TestCommands.test
lldb/trunk/lit/Driver/TestNoUseColor.test
lldb/trunk/tools/driver/Options.td
Modified:
lldb/trunk/lldb.xcodeproj/project.pbxproj
lldb/trunk/tools/driver/CMakeLists.txt
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Driver.h

Added: lldb/trunk/lit/Driver/Inputs/Print0.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/Print0.in?rev=347709=auto
==
--- lldb/trunk/lit/Driver/Inputs/Print0.in (added)
+++ lldb/trunk/lit/Driver/Inputs/Print0.in Tue Nov 27 13:00:32 2018
@@ -0,0 +1 @@
+expr 0

Added: lldb/trunk/lit/Driver/Inputs/Print2.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/Print2.in?rev=347709=auto
==
--- lldb/trunk/lit/Driver/Inputs/Print2.in (added)
+++ lldb/trunk/lit/Driver/Inputs/Print2.in Tue Nov 27 13:00:32 2018
@@ -0,0 +1 @@
+expr 2

Added: lldb/trunk/lit/Driver/Inputs/Print4.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/Print4.in?rev=347709=auto
==
--- lldb/trunk/lit/Driver/Inputs/Print4.in (added)
+++ lldb/trunk/lit/Driver/Inputs/Print4.in Tue Nov 27 13:00:32 2018
@@ -0,0 +1 @@
+expr 4

Added: lldb/trunk/lit/Driver/Inputs/Print6.in
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/Inputs/Print6.in?rev=347709=auto
==
--- lldb/trunk/lit/Driver/Inputs/Print6.in (added)
+++ lldb/trunk/lit/Driver/Inputs/Print6.in Tue Nov 27 13:00:32 2018
@@ -0,0 +1 @@
+expr 6

Added: lldb/trunk/lit/Driver/TestCommands.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestCommands.test?rev=347709=auto
==
--- lldb/trunk/lit/Driver/TestCommands.test (added)
+++ lldb/trunk/lit/Driver/TestCommands.test Tue Nov 27 13:00:32 2018
@@ -0,0 +1,41 @@
+# RUN: %lldb -x -b \
+# RUN:  -S %S/Inputs/Print0.in \
+# RUN:  -O 'expr 1' \
+# RUN:  -S %S/Inputs/Print2.in \
+# RUN:  -O 'expr 3' \
+# RUN:  -s %S/Inputs/Print4.in \
+# RUN:  -o 'expr 5' \
+# RUN:  -s %S/Inputs/Print6.in \
+# RUN:  -o 'expr 7' \
+# RUN: | FileCheck %s
+#
+# RUN: %lldb -x -b \
+# RUN:  -s %S/Inputs/Print4.in \
+# RUN:  -o 'expr 5' \
+# RUN:  -s %S/Inputs/Print6.in \
+# RUN:  -o 'expr 7' \
+# RUN:  -S %S/Inputs/Print0.in \
+# RUN:  -O 'expr 1' \
+# RUN:  -S %S/Inputs/Print2.in \
+# RUN:  -O 'expr 3' \
+# RUN: | FileCheck %s
+#
+# RUN: %lldb -x -b \
+# RUN:  -s %S/Inputs/Print4.in \
+# RUN:  -S %S/Inputs/Print0.in \
+# RUN:  -o 'expr 5' \
+# RUN:  -O 'expr 1' \
+# RUN:  -s %S/Inputs/Print6.in \
+# RUN:  -S %S/Inputs/Print2.in \
+# RUN:  -o 'expr 7' \
+# RUN:  -O 'expr 3' \
+# RUN: | FileCheck %s
+
+# CHECK: (int) $0 = 0
+# CHECK: (int) $1 = 1
+# CHECK: (int) $2 = 2
+# CHECK: (int) $3 = 3
+# CHECK: (int) $4 = 4
+# CHECK: (int) $5 = 5
+# CHECK: (int) $6 = 6
+# CHECK: (int) $7 = 7

Added: lldb/trunk/lit/Driver/TestNoUseColor.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Driver/TestNoUseColor.test?rev=347709=auto
==
--- lldb/trunk/lit/Driver/TestNoUseColor.test (added)
+++ lldb/trunk/lit/Driver/TestNoUseColor.test Tue Nov 27 13:00:32 2018
@@ -0,0 +1,4 @@
+# RUN: %lldb --no-use-color -s %s | FileCheck %s
+settings show use-color
+# CHECK: use-color (boolean) = false
+q

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=347709=347708=347709=diff
==
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Nov 27 13:00:32 2018
@@ -2373,6 +2373,8 @@
260A248D15D06C4F009981B0 /* OptionValues.h */ = {isa = 
PBXFileReference; fileEncoding = 4; 

[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

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

In D54914#1309700 , @labath wrote:

> I didn't look at the code in detail, as most of it deals with windows stuff, 
> and I don't know much about those anyway. However, the interesting question 
> for me would be how to make this useful for cross-compiling. Right now that 
> sort of works for NativePDB tests because --compiler=clang-cl implies 
> windows, but that won't help if I want to compile say a linux arm64 binary. I 
> think that instead --arch, we should have a `--triple` argument, which 
> specifies the exact target you want to build for. That can default to "host", 
> and we can have special pseudo-triples like "host32" and "host64", if we want 
> to be able to say "I want to build for a 32-bit flavour of the host arch". 
> That could also make gcc detection easier, since you could just search for 
> `$triple-gcc`.


A triple is one way.  I don't know much about gcc, does it support the same 
triple format as clang?  clang-cl certainly doesn't support triples since it 
implies one.  Also, are there any existing use cases for specifying a triple in 
the lit test suite?  I do agree we will need the ability to support triple 
specification, but it seems better to do this as a followup.  I don't think it 
should be too hard as long as we can make some assumptions such as 
"specification of --triple limits the possible supported compilers", etc.

> Another route to take might be to say that this script only supports building 
> for the host, and tests that want to target a specific architecture can just 
> invoke the appropriate compiler directly -- since they know the target arch, 
> they also know the correct compiler option syntax. Plus, these kinds of tests 
> are the ones that are most likely to need fancy compiler command line 
> switches that might be hard to represent generically. In this world, the 
> NativePDB tests would continue to invoke %clang-cl (which would point to the 
> build dir without any fancy logic), and build.py would be used by scripts 
> that just want to build an executable for the host, and don't care much about 
> the details of how this is accomplished (the stop-hook tests are a good 
> example of this).

That's another good possibility.

> (Among the cosmetic things, I'd suggest to make `--source` a positional 
> argument and enable spelling of `--output` as `-o`, just to make things 
> shorter.)

I did both of these in the latest update.  I need to make it possible to 
specify multiple inputs, but I'll do that in a followup as there's no immediate 
need for it in any of the tests I converted.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54914/new/

https://reviews.llvm.org/D54914



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


[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

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

Updated with suggestions.  Currently all NativePDB tests pass with this version 
of the script, and all other tests are unaffected since they don't use the new 
substitution.

Subsequent followups will focus on getting other tests using this, which should 
increase our test coverage across multiple platforms.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54914/new/

https://reviews.llvm.org/D54914

Files:
  lldb/lit/SymbolFile/NativePDB/ast-reconstruction.cpp
  lldb/lit/SymbolFile/NativePDB/bitfields.cpp
  lldb/lit/SymbolFile/NativePDB/disassembly.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-builtins.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-calling-conv.cpp
  lldb/lit/SymbolFile/NativePDB/function-types-classes.cpp
  lldb/lit/SymbolFile/NativePDB/global-classes.cpp
  lldb/lit/SymbolFile/NativePDB/globals-bss.cpp
  lldb/lit/SymbolFile/NativePDB/globals-fundamental.cpp
  lldb/lit/SymbolFile/NativePDB/nested-types.cpp
  lldb/lit/SymbolFile/NativePDB/s_constant.cpp
  lldb/lit/SymbolFile/NativePDB/simple-breakpoints.cpp
  lldb/lit/SymbolFile/NativePDB/source-list.cpp
  lldb/lit/SymbolFile/NativePDB/tag-types.cpp
  lldb/lit/helper/build.py
  lldb/lit/helper/toolchain.py
  llvm/utils/lit/lit/llvm/config.py

Index: llvm/utils/lit/lit/llvm/config.py
===
--- llvm/utils/lit/lit/llvm/config.py
+++ llvm/utils/lit/lit/llvm/config.py
@@ -33,6 +33,8 @@
 ['cmp.exe', 'grep.exe', 'sed.exe'])
 if path is not None:
 self.with_environment('PATH', path, append_path=True)
+# Many tools behave strangely if these environment variables aren't set.
+self.with_system_environment(['SystemDrive', 'SystemRoot', 'TEMP', 'TMP'])
 self.use_lit_shell = True
 
 # Choose between lit's internal shell pipeline runner and a real shell.  If
Index: lldb/lit/helper/toolchain.py
===
--- lldb/lit/helper/toolchain.py
+++ lldb/lit/helper/toolchain.py
@@ -1,4 +1,5 @@
 import os
+import itertools
 import platform
 import subprocess
 import sys
@@ -19,6 +20,15 @@
command=FindTool('lldb-mi'),
extra_args=['--synchronous'],
unresolved='ignore')
+build_script = os.path.dirname(__file__)
+build_script = os.path.join(build_script, 'build.py')
+build_script_args = [build_script, 
+'--compiler=any', # Default to best compiler
+'--arch=64'] # Default to 64-bit, user can override
+if config.lldb_lit_tools_dir:
+build_script_args.append('--tools-dir={0}'.format(config.lldb_lit_tools_dir))
+if config.lldb_tools_dir:
+build_script_args.append('--tools-dir={0}'.format(config.lldb_tools_dir))
 primary_tools = [
 ToolSubst('%lldb',
   command=FindTool('lldb'),
@@ -30,7 +40,10 @@
   command=FindTool(dsname),
   extra_args=dsargs,
   unresolved='ignore'),
-'lldb-test'
+'lldb-test',
+ToolSubst('%build',
+  command=sys.executable,
+  extra_args=build_script_args)
 ]
 
 llvm_config.add_tool_substitutions(primary_tools,
Index: lldb/lit/helper/build.py
===
--- /dev/null
+++ lldb/lit/helper/build.py
@@ -0,0 +1,644 @@
+from __future__ import print_function
+
+import argparse
+import os
+import signal
+import subprocess
+import sys
+
+if sys.platform == 'win32':
+# This module was renamed in Python 3.  Make sure to import it using a
+# consistent name regardless of python version.
+try:
+import winreg
+except:
+import _winreg as winreg
+
+if __name__ != "__main__":
+raise RuntimeError("Do not import this script, run it instead")
+
+
+parser = argparse.ArgumentParser(description='LLDB compilation wrapper')
+parser.add_argument('--arch',
+metavar='arch',
+dest='arch',
+required=True,
+help='Specify the architecture to target.  Valid values=[32,64]')
+
+parser.add_argument('--compiler',
+metavar='compiler',
+dest='compiler',
+required=True,
+help='Path to a compiler executable, or one of the values [any, msvc, clang-cl, gcc, clang]')
+
+parser.add_argument('--tools-dir',
+metavar='directory',
+dest='tools_dir',
+required=False,
+action='append',
+help='If specified, a path to search in addition to PATH when --compiler is not an exact path')
+
+if sys.platform == 'darwin':
+

[Lldb-commits] [PATCH] D54616: [Reproducers] Improve reproducer API and add unit tests.

2018-11-27 Thread Davide Italiano via Phabricator via lldb-commits
davide accepted this revision.
davide added a comment.
This revision is now accepted and ready to land.

LGTM


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54616/new/

https://reviews.llvm.org/D54616



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


[Lldb-commits] [PATCH] D54616: [Reproducers] Improve reproducer API and add unit tests.

2018-11-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I haven't been following the reproducer work in detail, but this seems 
reasonable to me. Thanks for incorporating my drive-by suggestions.




Comment at: include/lldb/Utility/Reproducer.h:104
+  template  T *Create() {
+std::unique_ptr provider(new T(m_root));
+return static_cast(Register(std::move(provider)));

You should still be able to use make_unique here.



Comment at: include/lldb/Utility/Reproducer.h:134
 
-  std::vector> m_providers;
+  /// List of providers indexed by their name for easy access.
+  llvm::DenseMap> m_providers;

Out of date comment.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54616/new/

https://reviews.llvm.org/D54616



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


[Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

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

> Clang called from the builder shows errors on types like char16_t and 
> char32_t. That's why enums-layout.test and typedefs.test are made to use MSVC 
> instead;

For me enums-layout.test crashes, but I see the same behavior in typedefs.test. 
 This is because lld-link does not emit `S_UDT` records (note the original test 
was using %msvc_link, not %lld_link.  That's why it passed before).  I could 
probably add a new magic toolchain called clang-cl-with-msvc-linker but I think 
it's also fine to just keep these using cl.exe.

> The builder now doesn't support /Gy and /order options, so the old scheme is 
> used in function-level-linking.test;

Makes sense.  Just curious, is the order file strictly necessary for this test? 
 `/Gy` is the same as `-ffunction-sections`, so there could be an argument to 
be made for exposing `--function-sections` on the command line of `build.py`.  
On the other hand, there's no harm in falling back to the old mechanism here 
since this test isn't intended to be portable.

> The builder now doesn't support compilation of multiple sources and linking 
> them together, so the old scheme is used for linking in func-symbols.test;

This one is important to fix.

> On Windows 32-bit LLDB can debug only 32-bit applications, and 64-bit LLDB 
> can debug only 64-bit applications. That's why the old scheme is left in 
> dynamic tests udt-layout.test, variables-locations.test and vbases.test. If 
> we will always compile the tests as 32-bit (64-bit), then they will fail on 
> the 64-bit (32-bit) platform. That's why we just assume that the user runs 
> the tests from the same command prompt where the build was run.

Ahh, right.  I wonder if we should have something like `--arch=lldb` that means 
"match the architecture of LLDB".  It's not urgent for this patch, but it could 
be useful as a followup.


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54942/new/

https://reviews.llvm.org/D54942



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


[Lldb-commits] [lldb] r347693 - [CMake] Pass full libedit path to linker

2018-11-27 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Tue Nov 27 11:41:30 2018
New Revision: 347693

URL: http://llvm.org/viewvc/llvm-project?rev=347693=rev
Log:
[CMake] Pass full libedit path to linker

Otherwise, linker fails with "cannot find -ledit" in case of custom libedit 
installation.

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

Modified: lldb/trunk/source/Host/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/CMakeLists.txt?rev=347693=347692=347693=diff
==
--- lldb/trunk/source/Host/CMakeLists.txt (original)
+++ lldb/trunk/source/Host/CMakeLists.txt Tue Nov 27 11:41:30 2018
@@ -155,7 +155,7 @@ if (HAVE_LIBDL)
   list(APPEND EXTRA_LIBS ${CMAKE_DL_LIBS})
 endif()
 if (NOT LLDB_DISABLE_LIBEDIT)
-  list(APPEND EXTRA_LIBS edit)
+  list(APPEND EXTRA_LIBS ${libedit_LIBRARIES})
 endif()
 
 add_lldb_library(lldbHost

Modified: lldb/trunk/source/Utility/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/CMakeLists.txt?rev=347693=347692=347693=diff
==
--- lldb/trunk/source/Utility/CMakeLists.txt (original)
+++ lldb/trunk/source/Utility/CMakeLists.txt Tue Nov 27 11:41:30 2018
@@ -9,7 +9,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "Windows"
 endif ()
 
 if (NOT LLDB_DISABLE_LIBEDIT)
-  list(APPEND LLDB_SYSTEM_LIBS edit)
+  list(APPEND LLDB_SYSTEM_LIBS ${libedit_LIBRARIES})
 endif()
 if (NOT LLDB_DISABLE_CURSES)
   list(APPEND LLDB_SYSTEM_LIBS ${CURSES_LIBRARIES})


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


[Lldb-commits] [PATCH] D54616: [Reproducers] Improve reproducer API and add unit tests.

2018-11-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Does anybody want to have another look or can I land this?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54616/new/

https://reviews.llvm.org/D54616



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

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

- Add EXAMPLES section


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54692/new/

https://reviews.llvm.org/D54692

Files:
  lit/Driver/Inputs/Print0.in
  lit/Driver/Inputs/Print2.in
  lit/Driver/Inputs/Print4.in
  lit/Driver/Inputs/Print6.in
  lit/Driver/TestCommands.test
  lit/Driver/TestNoUseColor.test
  tools/driver/CMakeLists.txt
  tools/driver/Driver.cpp
  tools/driver/Driver.h
  tools/driver/Options.td

Index: tools/driver/Options.td
===
--- /dev/null
+++ tools/driver/Options.td
@@ -0,0 +1,218 @@
+include "llvm/Option/OptParser.td"
+
+class F: Flag<["--", "-"], name>;
+class S: Separate<["--", "-"], name>;
+class R prefixes, string name>
+  : Option;
+
+// Attaching options.
+def grp_attach : OptionGroup<"attaching">, HelpText<"ATTACHING">;
+
+def attach_name: Separate<["--", "-"], "attach-name">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given name.">,
+  Group;
+def: Separate<["-"], "n">,
+  Alias,
+  HelpText<"Alias for --attach-name">,
+  Group;
+
+def wait_for: F<"wait-for">,
+  HelpText<"Tells the debugger to wait for a process with the given pid or name to launch before attaching.">,
+  Group;
+def: Flag<["-"], "w">,
+  Alias,
+  HelpText<"Alias for --wait-for">,
+  Group;
+
+def attach_pid: Separate<["--", "-"], "attach-pid">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given pid.">,
+  Group;
+def: Separate<["-"], "p">,
+  Alias,
+  HelpText<"Alias for --attach-pid">,
+  Group;
+
+
+// Scripting options.
+def grp_scripting : OptionGroup<"scripting">, HelpText<"SCRIPTING">;
+
+def python_path: F<"python-path">,
+  HelpText<"Prints out the path to the lldb.py file for this version of lldb.">,
+  Group;
+def: Flag<["-"], "P">,
+  Alias,
+  HelpText<"Alias for --python-path">,
+  Group;
+
+def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">,
+  Group;
+def: Separate<["-"], "l">,
+  Alias,
+  HelpText<"Alias for --script-language">,
+  Group;
+
+// Repl options.
+def grp_repl : OptionGroup<"repl">, HelpText<"REPL">;
+
+def repl: Separate<["--", "-"], "repl">,
+  HelpText<"Runs lldb in REPL mode with a stub process.">,
+  Group;
+def: Separate<["-"], "r">,
+  Alias,
+  HelpText<"Alias for --repl">,
+  Group;
+
+def repl_language: Separate<["--", "-"], "repl-language">,
+  MetaVarName<"">,
+  HelpText<"Chooses the language for the REPL.">,
+  Group;
+def: Separate<["-"], "R">,
+  Alias,
+  HelpText<"Alias for --repl-language">,
+  Group;
+
+
+// Command options.
+def grp_command : OptionGroup<"command">, HelpText<"COMMANDS">;
+
+def no_lldbinit: F<"no-lldbinit">,
+  HelpText<"Do not automatically parse any '.lldbinit' files.">,
+  Group;
+def: Flag<["-"], "x">,
+  Alias,
+  HelpText<"Alias for --no-lldbinit">,
+  Group;
+
+def batch: F<"batch">,
+  HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">,
+  Group;
+def: Flag<["-"], "b">,
+  Alias,
+  HelpText<"Alias for --batch">,
+  Group;
+
+def source_quietly: F<"source-quietly">,
+  HelpText<"Tells the debugger to execute this one-line lldb command before any file has been loaded.">,
+  Group;
+def: Flag<["-"], "Q">,
+  Alias,
+  HelpText<"Alias for --source-quietly">,
+  Group;
+
+def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">,
+  MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  Group;
+def: Separate<["-"], "k">,
+  Alias,
+  HelpText<"Alias for --one-line-on-crash">,
+  Group;
+
+def source_on_crash: Separate<["--", "-"], "source-on-crash">,
+  MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  Group;
+def: Separate<["-"], "K">,
+  Alias,
+  HelpText<"Alias for --source-on-crash">,
+  Group;
+
+def source: Separate<["--", "-"], "source">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.">,
+  Group;
+def: Separate<["-"], "s">,
+  Alias,
+  HelpText<"Alias for --source">,
+  Group;
+
+def source_before_file: Separate<["--", "-"], "source-before-file">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.">,
+  Group;
+def: Separate<["-"], "S">,
+  Alias,
+  HelpText<"Alias for --source-before-file">,
+  Group;
+
+def one_line: Separate<["--", "-"], "one-line">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to execute this one-line lldb command after any file provided on the command line has been loaded.">,
+  Group;
+def: Separate<["-"], "o">,
+  Alias,
+  HelpText<"Alias for 

[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:355-356
+  if (addr_base == LLDB_INVALID_ADDRESS)
+addr_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
+   DW_AT_GNU_addr_base, 0);
   dwo_cu->SetAddrBase(addr_base);

Do we still want the addr_base to default to zero instead of 
LLDB_INVALID_ADDRESS here?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54751/new/

https://reviews.llvm.org/D54751



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-27 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

I would be happy if we just have an EXAMPLES section much like many of the man 
pages for built in shell commands where we show a few examples.

I would like to see setting up a target a program with arguments that might 
conflict with the argument parser like:

  % lldb --arch x86_64 /path/to/program/a.out -- --arch arvm7

The first arch is for lldb, and any options past the -- are for the inferior 
program

Attaching examples, loading a core file, printing python path, maybe specifying 
some lldb commands with -o and -O to show how those work.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54692/new/

https://reviews.llvm.org/D54692



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


[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

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

In D54914#1309901 , @aprantl wrote:

> I would like to ask a general question that I (indirectly) also asked in 
> D54731 : Why do we want to implement support 
> for building inferiors in LIT-based tests?


I think this is not much different than asking "Why do we want LIT-based 
tests?".  If you can't build an inferior, then you can't really do anything 
with LLDB at all, in which case there's nothing to test.  So without support 
for building inferiors, there is no such thing as lldb lit tests.

> IMHO, if we need to support for dealing with specific compilers, we should 
> implement that once in `Makefile.rules` (which is in a declarative 
> domain-specific-language for describing build logic) and write a 
> `dotest.py`-style test instead. I'm assuming here that we need the support in 
> `Makefile.rules` anyway to support the bulk of the tests. Having this support 
> in two places increases the maintenance effort and cognitive load.

At least for the time being, I think of dotest.py style tests as being 
synonymous with "SB API test".  I think there is a need for a testing framework 
that is more familiar to LLVM developers with a lower barrier to entry as it 
encourages people to write more tests, which is always a good thing.  FWIW, I 
think the results so far have been positive.  I did a search over a 3-month 
period on the repository.  During that time, 37 new lit tests have been added, 
and 32 dotest tests have been added while 9 have been removed.

Your point about having the support in two places increasing the maintenance 
effort is reasonable, but if the build script actually does support everything 
that the Makefile does, then perhaps we could port the existing dotest tests 
over to use the build script.  Make is notoriously finnicky and many people 
don't like it or understand it well and it's very easy to run into portability 
problems when using it.  So if we can eventually do that, that would actually 
*decrease* the cognitive load and maintenance burden.  I'm not proposing that 
at this point and I think the benefits of a system such as the one in this 
patch stand on their own regardless of whether we port dotest builders over to 
use this script, but it's something to think about regardless.

Note that the Makefiles do not currently support clang-cl since it uses a 
totally different command line syntax.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54914/new/

https://reviews.llvm.org/D54914



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere updated this revision to Diff 175505.
JDevlieghere edited the summary of this revision.
JDevlieghere added a comment.

- Add lit test for command options.
- Change usage with prose.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54692/new/

https://reviews.llvm.org/D54692

Files:
  lit/Driver/Inputs/Print0.in
  lit/Driver/Inputs/Print2.in
  lit/Driver/Inputs/Print4.in
  lit/Driver/Inputs/Print6.in
  lit/Driver/TestCommands.test
  lit/Driver/TestNoUseColor.test
  tools/driver/CMakeLists.txt
  tools/driver/Driver.cpp
  tools/driver/Driver.h
  tools/driver/Options.td

Index: tools/driver/Options.td
===
--- /dev/null
+++ tools/driver/Options.td
@@ -0,0 +1,218 @@
+include "llvm/Option/OptParser.td"
+
+class F: Flag<["--", "-"], name>;
+class S: Separate<["--", "-"], name>;
+class R prefixes, string name>
+  : Option;
+
+// Attaching options.
+def grp_attach : OptionGroup<"attaching">, HelpText<"ATTACHING">;
+
+def attach_name: Separate<["--", "-"], "attach-name">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given name.">,
+  Group;
+def: Separate<["-"], "n">,
+  Alias,
+  HelpText<"Alias for --attach-name">,
+  Group;
+
+def wait_for: F<"wait-for">,
+  HelpText<"Tells the debugger to wait for a process with the given pid or name to launch before attaching.">,
+  Group;
+def: Flag<["-"], "w">,
+  Alias,
+  HelpText<"Alias for --wait-for">,
+  Group;
+
+def attach_pid: Separate<["--", "-"], "attach-pid">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to attach to a process with the given pid.">,
+  Group;
+def: Separate<["-"], "p">,
+  Alias,
+  HelpText<"Alias for --attach-pid">,
+  Group;
+
+
+// Scripting options.
+def grp_scripting : OptionGroup<"scripting">, HelpText<"SCRIPTING">;
+
+def python_path: F<"python-path">,
+  HelpText<"Prints out the path to the lldb.py file for this version of lldb.">,
+  Group;
+def: Flag<["-"], "P">,
+  Alias,
+  HelpText<"Alias for --python-path">,
+  Group;
+
+def script_language: Separate<["--", "-"], "script-language">, MetaVarName<"">,
+  HelpText<"Tells the debugger to use the specified scripting language for user-defined scripts.">,
+  Group;
+def: Separate<["-"], "l">,
+  Alias,
+  HelpText<"Alias for --script-language">,
+  Group;
+
+// Repl options.
+def grp_repl : OptionGroup<"repl">, HelpText<"REPL">;
+
+def repl: Separate<["--", "-"], "repl">,
+  HelpText<"Runs lldb in REPL mode with a stub process.">,
+  Group;
+def: Separate<["-"], "r">,
+  Alias,
+  HelpText<"Alias for --repl">,
+  Group;
+
+def repl_language: Separate<["--", "-"], "repl-language">,
+  MetaVarName<"">,
+  HelpText<"Chooses the language for the REPL.">,
+  Group;
+def: Separate<["-"], "R">,
+  Alias,
+  HelpText<"Alias for --repl-language">,
+  Group;
+
+
+// Command options.
+def grp_command : OptionGroup<"command">, HelpText<"COMMANDS">;
+
+def no_lldbinit: F<"no-lldbinit">,
+  HelpText<"Do not automatically parse any '.lldbinit' files.">,
+  Group;
+def: Flag<["-"], "x">,
+  Alias,
+  HelpText<"Alias for --no-lldbinit">,
+  Group;
+
+def batch: F<"batch">,
+  HelpText<"Tells the debugger to run the commands from -s, -S, -o & -O, and then quit.">,
+  Group;
+def: Flag<["-"], "b">,
+  Alias,
+  HelpText<"Alias for --batch">,
+  Group;
+
+def source_quietly: F<"source-quietly">,
+  HelpText<"Tells the debugger to execute this one-line lldb command before any file has been loaded.">,
+  Group;
+def: Flag<["-"], "Q">,
+  Alias,
+  HelpText<"Alias for --source-quietly">,
+  Group;
+
+def one_line_on_crash: Separate<["--", "-"], "one-line-on-crash">,
+  MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  Group;
+def: Separate<["-"], "k">,
+  Alias,
+  HelpText<"Alias for --one-line-on-crash">,
+  Group;
+
+def source_on_crash: Separate<["--", "-"], "source-on-crash">,
+  MetaVarName<"">,
+  HelpText<"When in batch mode, tells the debugger to source this file of lldb commands if the target crashes.">,
+  Group;
+def: Separate<["-"], "K">,
+  Alias,
+  HelpText<"Alias for --source-on-crash">,
+  Group;
+
+def source: Separate<["--", "-"], "source">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, after any file has been loaded.">,
+  Group;
+def: Separate<["-"], "s">,
+  Alias,
+  HelpText<"Alias for --source">,
+  Group;
+
+def source_before_file: Separate<["--", "-"], "source-before-file">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to read in and execute the lldb commands in the given file, before any file has been loaded.">,
+  Group;
+def: Separate<["-"], "S">,
+  Alias,
+  HelpText<"Alias for --source-before-file">,
+  Group;
+
+def one_line: Separate<["--", "-"], "one-line">,
+  MetaVarName<"">,
+  HelpText<"Tells the debugger to execute this one-line lldb command after any file provided on the command line has 

[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

2018-11-27 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

I would like to ask a general question that I (indirectly) also asked in D54731 
: Why do we want to implement support for 
building inferiors in LIT-based tests? IMHO, if we need to support for dealing 
with specific compilers, we should implement that once in `Makefile.rules` 
(which is in a declarative domain-specific-language for describing build logic) 
and write a `dotest.py`-style test instead. I'm assuming here that we need the 
support in `Makefile.rules` anyway to support the bulk of the tests. Having 
this support in two places increases the maintenance effort and cognitive load.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54914/new/

https://reviews.llvm.org/D54914



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


[Lldb-commits] [PATCH] D54731: [lit] Enable the use of custom user-defined lit commands

2018-11-27 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl requested changes to this revision.
aprantl added a comment.
This revision now requires changes to proceed.

> Currently lit supports running shell commands through the use of the RUN:  
> prefix. This patch allows individual test suites to install their own run 
> handlers that can do things other than run shell commands.  RUN commands 
> still work as they always do, just that now if a different kind of command 
> appears it will be appropriately sequenced along with the run command.

I'm not convinced that this is the best direction to evolve the LLDB testsuite 
to. Let me know if I'm missing something; I'm willing to be convinced otherwise 
:-)

It sounds like the problem you want to solve is having a more flexible build 
system for tests, and the ability to run python code as part of a tests. That 
is exactly the feature set that `dotest.py` provides. Tests are written in 
fully flexible Python, and in order to compile inferiors, we can fan out to a 
dedicated build system that is really good at compiling programs, namely `make`.

I don't see how any of your stated goals couldn't be achieved within the 
existing `Makefile.rules`. Establishing a second, parallel way of doing 
something similar would only serve to bifurcate the test infrastructure and 
make maintenance a lot harder in the future. It also makes the system more 
difficult to explain to new developers.

Specifically:

> The commands the user installs can execute arbitrary Python code.

`dotest.py` already does that. Currently, we are using `lit.py` as a test 
scheduler and `dotest.py` as an LLDB-specific test harness. I think that's 
reasonable design.

> As such, they can in theory write directly to stdout or stderr, but a 
> well-behaved command should return its stdout and stderr from the function so 
> that this can be reported to the user in a manner consistent with output from 
> RUN lines.
> 
> The motivating use case for this is being able to provide a richer and more 
> powerful syntax by which to compile test programs in LLDB tests. Currently 
> everything is based off of substitutions and explicitly shell commands, but 
> this is problematic when you get into interesting compilation scenarios.

I disagree with this statement. Building tests is done in an explicit, portable 
build system: `make`. I don't think it is a good idea to *also* add all the 
complexity of the `dotest.py` tests to the lit-based tests. Lit-based tests are 
very useful for certain (specifically non-interactive) use-cases, but if you 
need more build system support, or need to more complex test logic, I'd rather 
use `make`+`dotest.py`.

> For example, one could imagine wanting to write a test that tested the 
> behavior of the debugger with optimized code. Each driver has different sets 
> of flags that control the optimization behavior.

This is mostly a solved problem with our Makefile system.

> Another example is in cross-compilation scenarios. Certain types of PDB tests 
> don't need to run a process, so the tests can be run anywhere, but they need 
> to be linked with special flags to avoid pulling in system libraries.
> 
> We can try to make substitutions for all of these cases, but it will quickly 
> become unwieldy and you will end up with a command line like: RUN: %cxx 
> %debug %opt %norun, and this still isn't as flexible as you'd like.
> 
> With this patch, we could (in theory) do the compilation directly from 
> Python. Instead of a shell command like above, we could write something like:
> 
> COMPILE: source=%p/Inputs/foo.cpp \
>  COMPILE: mode=debug \
>  COMPILE: opt=none \
>  COMPILE: link=no \
>  COMPILE: output=%t.o \
>  COMPILE: clean=yes
>  and let the function figure out how best to do this for each platform. This 
> is similar in spirit to how LLDB's `dotest.py` already works with its 
> platform specific builders, but the mechanism here is general enough that it 
> can be used for anything a test suite wants, not just compiling.

In the dotest tests you generally don't need to write explicit build commands 
at all. All the platform-specific build logic is implemented once in 
Makefile.rules and the individual tests merely specify what source files need 
to be built and whether you want o build a binary or a shared library.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54731/new/

https://reviews.llvm.org/D54731



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


[Lldb-commits] [lldb] r347673 - Catch up with EvaluateAsInt() clang API change.

2018-11-27 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue Nov 27 08:40:21 2018
New Revision: 347673

URL: http://llvm.org/viewvc/llvm-project?rev=347673=rev
Log:
Catch up with EvaluateAsInt() clang API change.

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=347673=347672=347673=diff
==
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Nov 27 08:40:21 2018
@@ -5965,10 +5965,10 @@ GetObjCFieldAtIndex(clang::ASTContext *a
 
 if (is_bitfield && ast) {
   clang::Expr *bitfield_bit_size_expr = ivar_pos->getBitWidth();
-  clang::Expr::EvalResult result;
+  llvm::APSInt bitfield_apsint;
   if (bitfield_bit_size_expr &&
-  bitfield_bit_size_expr->EvaluateAsInt(result, *ast)) {
-llvm::APSInt bitfield_apsint = result.Val.getInt();
+  bitfield_bit_size_expr->EvaluateAsInt(bitfield_apsint,
+*ast)) {
 *bitfield_bit_size_ptr = bitfield_apsint.getLimitedValue();
   }
 }
@@ -6025,11 +6025,10 @@ CompilerType ClangASTContext::GetFieldAt
 
 if (is_bitfield) {
   clang::Expr *bitfield_bit_size_expr = field->getBitWidth();
-  clang::Expr::EvalResult result;
+  llvm::APSInt bitfield_apsint;
   if (bitfield_bit_size_expr &&
-  bitfield_bit_size_expr->EvaluateAsInt(result,
+  bitfield_bit_size_expr->EvaluateAsInt(bitfield_apsint,
 *getASTContext())) {
-llvm::APSInt bitfield_apsint = result.Val.getInt();
 *bitfield_bit_size_ptr = bitfield_apsint.getLimitedValue();
   }
 }


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


[Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

2018-11-27 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova added a comment.

This looks fine, but let's see if Zachary's change lands first and how it looks 
like after it lands :).


Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54942/new/

https://reviews.llvm.org/D54942



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


[Lldb-commits] [PATCH] D53759: [PDB] Support PDB-backed expressions evaluation

2018-11-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: source/Core/RichManglingContext.cpp:134-135
 get(m_cxx_method_parser)->GetBasename();
+if (!m_buffer.data())
+  m_buffer = llvm::StringRef("", 0);
 return;

Why is this necessary? It looks like somebody is misusing the returned 
StringRef by assuming that it always points to at least a single valid byte 
(which is definitely not the case in general, even for StringRefs with a 
non-null `data()`).

It would be better to fix the caller instead.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53759/new/

https://reviews.llvm.org/D53759



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


Re: [Lldb-commits] [lldb] r347615 - [FileSystem] Ignore nanoseconds when comparing oso_mod_time

2018-11-27 Thread Jonas Devlieghere via lldb-commits
You're right, fixed in r347660.

On Tue, Nov 27, 2018 at 6:24 AM Pavel Labath  wrote:

> Was it necessary to modify FileSystem to achieve this. It looks like you
> could have just as easily made the time_point_cast in
> SymbolFileDWARFDebugMap (next to a comment explaining why that was needed).
>
> The extra nanosecond_precision argument looks fairly odd, and diverges
> from how the llvm interfaces for modification times operate.
>
> On 27/11/2018 00:40, Jonas Devlieghere via lldb-commits wrote:
> > Author: jdevlieghere
> > Date: Mon Nov 26 15:40:52 2018
> > New Revision: 347615
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=347615=rev
> > Log:
> > [FileSystem] Ignore nanoseconds when comparing oso_mod_time
> >
> > After a recent change in LLVM the TimePoint encoding become more
> > precise, exceeding the precision of the TimePoint obtained from the
> > DebugMap. This patch adds a flag to the GetModificationTime helper in
> > the FileSystem to return the modification time with less precision.
> >
> > Thanks to Davide for bisecting this failure on the LLDB bots.
> >
> > Modified:
> >  lldb/trunk/include/lldb/Host/FileSystem.h
> >  lldb/trunk/source/Host/common/FileSystem.cpp
> >
> lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
> >
> > Modified: lldb/trunk/include/lldb/Host/FileSystem.h
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=347615=347614=347615=diff
> >
> ==
> > --- lldb/trunk/include/lldb/Host/FileSystem.h (original)
> > +++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Nov 26 15:40:52 2018
> > @@ -56,8 +56,12 @@ public:
> >
> > /// Returns the modification time of the given file.
> > /// @{
> > -  llvm::sys::TimePoint<> GetModificationTime(const FileSpec _spec)
> const;
> > -  llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine )
> const;
> > +  llvm::sys::TimePoint<>
> > +  GetModificationTime(const FileSpec _spec,
> > +  bool nanosecond_precision = true) const;
> > +  llvm::sys::TimePoint<>
> > +  GetModificationTime(const llvm::Twine ,
> > +  bool nanosecond_precision = true) const;
> > /// @}
> >
> > /// Returns the on-disk size of the given file in bytes.
> >
> > Modified: lldb/trunk/source/Host/common/FileSystem.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=347615=347614=347615=diff
> >
> ==
> > --- lldb/trunk/source/Host/common/FileSystem.cpp (original)
> > +++ lldb/trunk/source/Host/common/FileSystem.cpp Mon Nov 26 15:40:52 2018
> > @@ -64,15 +64,22 @@ Optional ::Instan
> >   }
> >
> >   sys::TimePoint<>
> > -FileSystem::GetModificationTime(const FileSpec _spec) const {
> > -  return GetModificationTime(file_spec.GetPath());
> > +FileSystem::GetModificationTime(const FileSpec _spec,
> > +bool nanosecond_precision) const {
> > +  return GetModificationTime(file_spec.GetPath(), nanosecond_precision);
> >   }
> >
> > -sys::TimePoint<> FileSystem::GetModificationTime(const Twine )
> const {
> > +sys::TimePoint<>
> > +FileSystem::GetModificationTime(const Twine ,
> > +bool nanosecond_precision) const {
> > ErrorOr status = m_fs->status(path);
> > if (!status)
> >   return sys::TimePoint<>();
> > -  return status->getLastModificationTime();
> > +  if (nanosecond_precision)
> > +return status->getLastModificationTime();
> > +  else
> > +return std::chrono::time_point_cast(
> > +status->getLastModificationTime());
> >   }
> >
> >   uint64_t FileSystem::GetByteSize(const FileSpec _spec) const {
> >
> > Modified:
> lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=347615=347614=347615=diff
> >
> ==
> > ---
> lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
> (original)
> > +++
> lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Mon
> Nov 26 15:40:52 2018
> > @@ -420,7 +420,8 @@ Module *SymbolFileDWARFDebugMap::GetModu
> > FileSpec oso_file(oso_path);
> > ConstString oso_object;
> > if (FileSystem::Instance().Exists(oso_file)) {
> > -auto oso_mod_time =
> FileSystem::Instance().GetModificationTime(oso_file);
> > +auto oso_mod_time = FileSystem::Instance().GetModificationTime(
> > +oso_file, /*nanosecond_precision=*/false);
> >   if (oso_mod_time != comp_unit_info->oso_mod_time) {
> > obj_file->GetModule()->ReportError(
> > "debug map object file '%s' has changed (actual time is "
> >
> >
> > 

[Lldb-commits] [lldb] r347660 - Move time cast to SymbolFileDWARFDebugMap

2018-11-27 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue Nov 27 07:25:58 2018
New Revision: 347660

URL: http://llvm.org/viewvc/llvm-project?rev=347660=rev
Log:
Move time cast to SymbolFileDWARFDebugMap

When trying to fix the bots we expected that the cast would be needed in
different places. Ultimately it turned out only the
SymbolFileDWARFDebugMap was affected so, as Pavel correctly notes, it
makes more sense to do the cast just there instead of in teh FS.

Modified:
lldb/trunk/include/lldb/Host/FileSystem.h
lldb/trunk/source/Host/common/FileSystem.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=347660=347659=347660=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Tue Nov 27 07:25:58 2018
@@ -56,12 +56,8 @@ public:
 
   /// Returns the modification time of the given file.
   /// @{
-  llvm::sys::TimePoint<>
-  GetModificationTime(const FileSpec _spec,
-  bool nanosecond_precision = true) const;
-  llvm::sys::TimePoint<>
-  GetModificationTime(const llvm::Twine ,
-  bool nanosecond_precision = true) const;
+  llvm::sys::TimePoint<> GetModificationTime(const FileSpec _spec) const;
+  llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine ) const;
   /// @}
 
   /// Returns the on-disk size of the given file in bytes.

Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=347660=347659=347660=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Tue Nov 27 07:25:58 2018
@@ -64,22 +64,15 @@ Optional ::Instan
 }
 
 sys::TimePoint<>
-FileSystem::GetModificationTime(const FileSpec _spec,
-bool nanosecond_precision) const {
-  return GetModificationTime(file_spec.GetPath(), nanosecond_precision);
+FileSystem::GetModificationTime(const FileSpec _spec) const {
+  return GetModificationTime(file_spec.GetPath());
 }
 
-sys::TimePoint<>
-FileSystem::GetModificationTime(const Twine ,
-bool nanosecond_precision) const {
+sys::TimePoint<> FileSystem::GetModificationTime(const Twine ) const {
   ErrorOr status = m_fs->status(path);
   if (!status)
 return sys::TimePoint<>();
-  if (nanosecond_precision)
-return status->getLastModificationTime();
-  else
-return std::chrono::time_point_cast(
-status->getLastModificationTime());
+  return status->getLastModificationTime();
 }
 
 uint64_t FileSystem::GetByteSize(const FileSpec _spec) const {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=347660=347659=347660=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Tue 
Nov 27 07:25:58 2018
@@ -86,8 +86,7 @@ SymbolFileDWARFDebugMap::CompileUnitInfo
   const uint32_t oso_end_idx = comp_unit_info->last_symbol_index + 1;
   for (uint32_t idx = comp_unit_info->first_symbol_index +
   2; // Skip the N_SO and N_OSO
-   idx < oso_end_idx;
-   ++idx) {
+   idx < oso_end_idx; ++idx) {
 Symbol *exe_symbol = exe_symtab->SymbolAtIndex(idx);
 if (exe_symbol) {
   if (exe_symbol->IsDebug() == false)
@@ -420,8 +419,10 @@ Module *SymbolFileDWARFDebugMap::GetModu
   FileSpec oso_file(oso_path);
   ConstString oso_object;
   if (FileSystem::Instance().Exists(oso_file)) {
-auto oso_mod_time = FileSystem::Instance().GetModificationTime(
-oso_file, /*nanosecond_precision=*/false);
+// The modification time returned by the FS can have a higher precision
+// than the one from the CU.
+auto oso_mod_time = std::chrono::time_point_cast(
+FileSystem::Instance().GetModificationTime(oso_file));
 if (oso_mod_time != comp_unit_info->oso_mod_time) {
   obj_file->GetModule()->ReportError(
   "debug map object file '%s' has changed (actual time is "
@@ -802,8 +803,7 @@ uint32_t SymbolFileDWARFDebugMap::Privat
 const ConstString , const CompilerDeclContext *parent_decl_ctx,
 const std::vector
 , // Indexes into the symbol table that match "name"
-uint32_t max_matches,
-VariableList ) {
+uint32_t max_matches, VariableList ) {
   const uint32_t original_size = variables.GetSize();
   

[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

2018-11-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I didn't look at the code in detail, as most of it deals with windows stuff, 
and I don't know much about those anyway. However, the interesting question for 
me would be how to make this useful for cross-compiling. Right now that sort of 
works for NativePDB tests because --compiler=clang-cl implies windows, but that 
won't help if I want to compile say a linux arm64 binary. I think that instead 
--arch, we should have a `--triple` argument, which specifies the exact target 
you want to build for. That can default to "host", and we can have special 
pseudo-triples like "host32" and "host64", if we want to be able to say "I want 
to build for a 32-bit flavour of the host arch". That could also make gcc 
detection easier, since you could just search for `$triple-gcc`.

Another route to take might be to say that this script only supports building 
for the host, and tests that want to target a specific architecture can just 
invoke the appropriate compiler directly -- since they know the target arch, 
they also know the correct compiler option syntax. Plus, these kinds of tests 
are the ones that are most likely to need fancy compiler command line switches 
that might be hard to represent generically. In this world, the NativePDB tests 
would continue to invoke %clang-cl (which would point to the build dir without 
any fancy logic), and build.py would be used by scripts that just want to build 
an executable for the host, and don't care much about the details of how this 
is accomplished (the stop-hook tests are a good example of this).

(Among the cosmetic things, I'd suggest to make `--source` a positional 
argument and enable spelling of `--output` as `-o`, just to make things 
shorter.)


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54914/new/

https://reviews.llvm.org/D54914



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


[Lldb-commits] [PATCH] D54692: [Driver] Use libOption with tablegen.

2018-11-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: tools/driver/Driver.cpp:876-888
+  usage << indent << tool_name
+<< " -a  -f  [-c ] [-s ] [-o "
+   "] [-S ] [-O ] [-k ] [-K ] "
+   "[-Q] [-b] [-e] [-x] [-X] [-l ] [-d] [-z "
+   "] [[--]  [ ...]]\n";
+  usage << indent << tool_name
+<< " -n  -w [-s ] [-o ] [-S "

I am not entirely thrilled by the hard-coding of the option combinations here. 
It sounds like the kind of thing that will invariably get out of sync (I think 
it would be better to just not have it). Instead of trying to exhaustively list 
all possible option combinations (which I generally find too long to make sense 
of), and still getting it wrong (Why is there a `[[--]  
[ ...]]` after `-v` in the second option form?), maybe it would 
be better to just output a short prose here explaining the general principle. 
Maybe something like "LLDB can be started in several modes. Passing an 
executable as a positional arguments prepares lldb to debug the given 
executable. Using one of the attach options causes lldb to immediately attach 
to the given process. Command options can be combined with either mode and 
cause lldb to run the specified commands before starting the interactive shell. 
Using --repl starts lldb in REPL mode. etc."

However, if everyone is happy with the current approach then I won't stand in 
the way..


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54692/new/

https://reviews.llvm.org/D54692



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


Re: [Lldb-commits] [lldb] r347615 - [FileSystem] Ignore nanoseconds when comparing oso_mod_time

2018-11-27 Thread Pavel Labath via lldb-commits
Was it necessary to modify FileSystem to achieve this. It looks like you 
could have just as easily made the time_point_cast in 
SymbolFileDWARFDebugMap (next to a comment explaining why that was needed).


The extra nanosecond_precision argument looks fairly odd, and diverges 
from how the llvm interfaces for modification times operate.


On 27/11/2018 00:40, Jonas Devlieghere via lldb-commits wrote:

Author: jdevlieghere
Date: Mon Nov 26 15:40:52 2018
New Revision: 347615

URL: http://llvm.org/viewvc/llvm-project?rev=347615=rev
Log:
[FileSystem] Ignore nanoseconds when comparing oso_mod_time

After a recent change in LLVM the TimePoint encoding become more
precise, exceeding the precision of the TimePoint obtained from the
DebugMap. This patch adds a flag to the GetModificationTime helper in
the FileSystem to return the modification time with less precision.

Thanks to Davide for bisecting this failure on the LLDB bots.

Modified:
 lldb/trunk/include/lldb/Host/FileSystem.h
 lldb/trunk/source/Host/common/FileSystem.cpp
 lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp

Modified: lldb/trunk/include/lldb/Host/FileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/FileSystem.h?rev=347615=347614=347615=diff
==
--- lldb/trunk/include/lldb/Host/FileSystem.h (original)
+++ lldb/trunk/include/lldb/Host/FileSystem.h Mon Nov 26 15:40:52 2018
@@ -56,8 +56,12 @@ public:
  
/// Returns the modification time of the given file.

/// @{
-  llvm::sys::TimePoint<> GetModificationTime(const FileSpec _spec) const;
-  llvm::sys::TimePoint<> GetModificationTime(const llvm::Twine ) const;
+  llvm::sys::TimePoint<>
+  GetModificationTime(const FileSpec _spec,
+  bool nanosecond_precision = true) const;
+  llvm::sys::TimePoint<>
+  GetModificationTime(const llvm::Twine ,
+  bool nanosecond_precision = true) const;
/// @}
  
/// Returns the on-disk size of the given file in bytes.


Modified: lldb/trunk/source/Host/common/FileSystem.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSystem.cpp?rev=347615=347614=347615=diff
==
--- lldb/trunk/source/Host/common/FileSystem.cpp (original)
+++ lldb/trunk/source/Host/common/FileSystem.cpp Mon Nov 26 15:40:52 2018
@@ -64,15 +64,22 @@ Optional ::Instan
  }
  
  sys::TimePoint<>

-FileSystem::GetModificationTime(const FileSpec _spec) const {
-  return GetModificationTime(file_spec.GetPath());
+FileSystem::GetModificationTime(const FileSpec _spec,
+bool nanosecond_precision) const {
+  return GetModificationTime(file_spec.GetPath(), nanosecond_precision);
  }
  
-sys::TimePoint<> FileSystem::GetModificationTime(const Twine ) const {

+sys::TimePoint<>
+FileSystem::GetModificationTime(const Twine ,
+bool nanosecond_precision) const {
ErrorOr status = m_fs->status(path);
if (!status)
  return sys::TimePoint<>();
-  return status->getLastModificationTime();
+  if (nanosecond_precision)
+return status->getLastModificationTime();
+  else
+return std::chrono::time_point_cast(
+status->getLastModificationTime());
  }
  
  uint64_t FileSystem::GetByteSize(const FileSpec _spec) const {


Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp?rev=347615=347614=347615=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp 
(original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp Mon 
Nov 26 15:40:52 2018
@@ -420,7 +420,8 @@ Module *SymbolFileDWARFDebugMap::GetModu
FileSpec oso_file(oso_path);
ConstString oso_object;
if (FileSystem::Instance().Exists(oso_file)) {
-auto oso_mod_time = 
FileSystem::Instance().GetModificationTime(oso_file);
+auto oso_mod_time = FileSystem::Instance().GetModificationTime(
+oso_file, /*nanosecond_precision=*/false);
  if (oso_mod_time != comp_unit_info->oso_mod_time) {
obj_file->GetModule()->ReportError(
"debug map object file '%s' has changed (actual time is "


___
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


[Lldb-commits] [PATCH] D53759: [PDB] Support PDB-backed expressions evaluation

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

Thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53759/new/

https://reviews.llvm.org/D53759



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


[Lldb-commits] [PATCH] D53759: [PDB] Support PDB-backed expressions evaluation

2018-11-27 Thread Aaron Smith via Phabricator via lldb-commits
asmith accepted this revision.
asmith added a comment.

LGTM


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D53759/new/

https://reviews.llvm.org/D53759



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


[Lldb-commits] [PATCH] D54751: [LLDB] - Fix setting the breakpoints when -gsplit-dwarf and DWARF 5 were used for building the executable.

2018-11-27 Thread George Rimar via Phabricator via lldb-commits
grimar updated this revision to Diff 175456.
grimar added a comment.

- Addressed review comments.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54751/new/

https://reviews.llvm.org/D54751

Files:
  lit/Breakpoint/Inputs/split-dwarf-5-addrbase.dwo.yaml
  lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
  lit/Breakpoint/split-dwarf-5-addrbase.test
  source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp

Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -307,8 +307,11 @@
 
 // m_die_array_mutex must be already held as read/write.
 void DWARFUnit::AddUnitDIE(const DWARFDebugInfoEntry _die) {
-  SetAddrBase(
-  cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_addr_base, 0));
+  dw_addr_t addr_base = cu_die.GetAttributeValueAsUnsigned(
+  m_dwarf, this, DW_AT_addr_base, LLDB_INVALID_ADDRESS);
+  if (addr_base != LLDB_INVALID_ADDRESS)
+SetAddrBase(addr_base);
+
   SetRangesBase(cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
DW_AT_rnglists_base, 0));
 
@@ -342,8 +345,15 @@
 
   m_dwo_symbol_file = std::move(dwo_symbol_file);
 
-  dw_addr_t addr_base =
-  cu_die.GetAttributeValueAsUnsigned(m_dwarf, this, DW_AT_GNU_addr_base, 0);
+  // Here for DWO CU we want to use the address base set in the skeleton unit
+  // (DW_AT_addr_base) if it is available and use the DW_AT_GNU_addr_base
+  // otherwise. We do that because pre-DWARF v5 could use the DW_AT_GNU_*
+  // attributes which were applicable to the DWO units. The corresponding
+  // DW_AT_* attributes standardized in DWARF v5 are also applicable to the main
+  // unit in contrast.
+  if (addr_base == LLDB_INVALID_ADDRESS)
+addr_base = cu_die.GetAttributeValueAsUnsigned(m_dwarf, this,
+   DW_AT_GNU_addr_base, 0);
   dwo_cu->SetAddrBase(addr_base);
 
   dw_addr_t ranges_base = cu_die.GetAttributeValueAsUnsigned(
Index: lit/Breakpoint/split-dwarf-5-addrbase.test
===
--- lit/Breakpoint/split-dwarf-5-addrbase.test
+++ lit/Breakpoint/split-dwarf-5-addrbase.test
@@ -0,0 +1,30 @@
+# RUN: rm -rf %t.dir
+# RUN: mkdir %t.dir
+# RUN: cd %t.dir
+# RUN: yaml2obj %p/Inputs/split-dwarf-5-addrbase.dwo.yaml > %t.dir/test.dwo
+# RUN: yaml2obj %p/Inputs/split-dwarf-5-addrbase.yaml > %t.dir/test
+# RUN: lldb-test breakpoints %t.dir/test %s | FileCheck %s
+
+# This test checks that source code location is shown correctly
+# when -gsplit-dwarf and DWARF 5 are used.
+#
+# split-dwarf-5-addrbase.dwo.yaml and split-dwarf-5-addrbase.yamlare
+# reduced yaml files produces from the dwo file and the corresponding executable.
+#
+# The following code was used initially:
+# void baz() {
+# }
+# 
+# int main() {
+#   baz();
+#   return 0;
+# }
+#
+# Invocation used to produce outputs was:
+# clang test.cc -g -fno-rtti -c -gdwarf-5 -gsplit-dwarf
+# clang test.o -g -fno-rtti -gdwarf-5 -o test -gsplit-dwarf
+# clang version 8.0.0 (trunk 347299)
+
+b baz
+# CHECK-LABEL: b baz
+# CHECK: Address: {{.*}}baz() + 4 at test.cc:2:1
Index: lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
===
--- lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
+++ lit/Breakpoint/Inputs/split-dwarf-5-addrbase.yaml
@@ -0,0 +1,61 @@
+--- !ELF
+FileHeader:  
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_X86_64
+  Entry:   0x00400440
+Sections:
+  - Name:.text
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC, SHF_EXECINSTR ]
+Address: 0x00400440
+AddressAlign:0x0010
+Content: 31ED4989D15E4889E24883E4F0505449C7C0C005400048C7C15005400048C7C730054000E8B7FFF4660F1F4455B820204000483D202040004889E57417B84885C0740D5DBF20204000FFE00F1F445DC3660F1F44BE20204000554881EE202040004889E548C1FE034889F048C1E83F4801C648D1FE7415B84885C0740B5DBF20204000FFE00F1F005DC3660F1F44803D391B007517554889E5E87EFFC605271B015DC30F1F44F3C30F1F4000662E0F1F8400554889E55DEB89660F1F8400554889E55DC3662E0F1F8400554889E54883EC10C745FCE8DCFF31C04883C4105DC30F1F4000415741564189FF415541544C8D25A61855488D2DA618534989F64989D54C29E54883EC0848C1FD03E86FFE4885ED742031DB0F1F84004C89EA4C89F64489FF41FF14DC4883C3014839EB75EA4883C4085B5D415C415D415E415FC390662E0F1F8400F3C3
+  - Name:.debug_str_offsets
+Type:SHT_PROGBITS
+AddressAlign:0x0001
+Content: 0C0005000900
+  - Name:.debug_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+

[Lldb-commits] [PATCH] D54843: [Expr] Check the language before ignoring Objective C keywords

2018-11-27 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov marked 2 inline comments as done.
aleksandr.urakov added inline comments.



Comment at: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp:404
-// non-Apple platforms, but for now it is needed.
-m_compiler->getLangOpts().ObjC = true;
 break;

clayborg wrote:
> A better way would be to try and grab the Objective C runtime from the 
> process. There are some variants of objective C that might run under 
> non-apple targets:
> 
> ```
> ProcessSP process_sp = target->GetProcess();
> if (process_sp) 
>   m_compiler->getLangOpts().ObjC = 
> process_sp->GetLanguageRuntime(eLanguageTypeObjC) != nullptr;
> ```
> 
> Then C and C++ programs on Mac will be able to use "id" and other reserved 
> words in their expressions again.
Thanks for the idea! I've updated the patch.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54843/new/

https://reviews.llvm.org/D54843



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


[Lldb-commits] [PATCH] D54843: [Expr] Check the language before ignoring Objective C keywords

2018-11-27 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov updated this revision to Diff 175443.

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54843/new/

https://reviews.llvm.org/D54843

Files:
  packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py
  packages/Python/lldbsuite/test/expression_command/options/main.cpp
  source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
  source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp


Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -398,10 +398,9 @@
 LLVM_FALLTHROUGH;
   case lldb::eLanguageTypeC_plus_plus_03:
 m_compiler->getLangOpts().CPlusPlus = true;
-// FIXME: the following language option is a temporary workaround,
-// to "ask for C++, get ObjC++".  Apple hopes to remove this requirement on
-// non-Apple platforms, but for now it is needed.
-m_compiler->getLangOpts().ObjC = true;
+if (process_sp)
+  m_compiler->getLangOpts().ObjC =
+  process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC) != nullptr;
 break;
   case lldb::eLanguageTypeObjC_plus_plus:
   case lldb::eLanguageTypeUnknown:
Index: source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -771,8 +771,9 @@
   static const ConstString id_name("id");
   static const ConstString Class_name("Class");
 
-  if (name == id_name || name == Class_name)
-return true;
+  if (m_ast_context->getLangOpts().ObjC)
+if (name == id_name || name == Class_name)
+  return true;
 
   StringRef name_string_ref = name.GetStringRef();
 
Index: packages/Python/lldbsuite/test/expression_command/options/main.cpp
===
--- packages/Python/lldbsuite/test/expression_command/options/main.cpp
+++ packages/Python/lldbsuite/test/expression_command/options/main.cpp
@@ -1,5 +1,6 @@
 extern "C" int foo(void);
 static int static_value = 0;
+static int id = 1234;
 
 int
 bar()
Index: 
packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py
===
--- packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py
+++ packages/Python/lldbsuite/test/expression_command/options/TestExprOptions.py
@@ -63,3 +63,16 @@
 val = frame.EvaluateExpression('foo != nullptr', options)
 self.assertTrue(val.IsValid())
 self.assertFalse(val.GetError().Success())
+
+# Make sure we can retrieve `id` variable if language is set to C++11:
+options.SetLanguage(lldb.eLanguageTypeC_plus_plus_11)
+val = frame.EvaluateExpression('id == 1234', options)
+self.assertTrue(val.IsValid())
+self.assertTrue(val.GetError().Success())
+self.DebugSBValue(val)
+
+# Make sure we can't retrieve `id` variable if language is set to ObjC:
+options.SetLanguage(lldb.eLanguageTypeObjC)
+val = frame.EvaluateExpression('id == 1234', options)
+self.assertTrue(val.IsValid())
+self.assertFalse(val.GetError().Success())


Index: source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
@@ -398,10 +398,9 @@
 LLVM_FALLTHROUGH;
   case lldb::eLanguageTypeC_plus_plus_03:
 m_compiler->getLangOpts().CPlusPlus = true;
-// FIXME: the following language option is a temporary workaround,
-// to "ask for C++, get ObjC++".  Apple hopes to remove this requirement on
-// non-Apple platforms, but for now it is needed.
-m_compiler->getLangOpts().ObjC = true;
+if (process_sp)
+  m_compiler->getLangOpts().ObjC =
+  process_sp->GetLanguageRuntime(lldb::eLanguageTypeObjC) != nullptr;
 break;
   case lldb::eLanguageTypeObjC_plus_plus:
   case lldb::eLanguageTypeUnknown:
Index: source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
===
--- source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -771,8 +771,9 @@
   static const ConstString id_name("id");
   static const ConstString Class_name("Class");
 
-  if (name == id_name || name == Class_name)
-return true;
+  if (m_ast_context->getLangOpts().ObjC)
+if (name == id_name || name == Class_name)
+  return true;
 
   StringRef name_string_ref = name.GetStringRef();
 
Index: 

[Lldb-commits] [PATCH] D54914: Add a generic build script for building test inferiors

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

In D54914#1308919 , @zturner wrote:

> @aleksandr.urakov Would you also mind giving this a try?  I think it will 
> mean that you can re-write the SymbolFile/PDB tests to not be dependent on 
> running from a VS command prompt.  You should be able to pass --arch=32 or 
> --arch=64 no matter which command prompt you are running from, and it should 
> still work.


Sure, thank you for the new build system! I've created a review here: D54942 
. There are some problems left, I've explained 
them in the review description.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54914/new/

https://reviews.llvm.org/D54914



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


[Lldb-commits] [PATCH] D54942: [PDB] Make PDB lit tests use the new builder

2018-11-27 Thread Aleksandr Urakov via Phabricator via lldb-commits
aleksandr.urakov created this revision.
aleksandr.urakov added reviewers: zturner, stella.stamenova.
aleksandr.urakov added a project: LLDB.
Herald added subscribers: lldb-commits, teemperor, abidh.

This patch makes old PDB plugin tests to use the new builder (see D54914 
).

There are some problems left:

- Clang called from the builder shows errors on types like `char16_t` and 
`char32_t`. That's why `enums-layout.test` and `typedefs.test` are made to use 
MSVC instead;
- The builder now doesn't support `/Gy` and `/order` options, so the old scheme 
is used in `function-level-linking.test`;
- The builder now doesn't support compilation of multiple sources and linking 
them together, so the old scheme is used for linking in `func-symbols.test`;
- On Windows 32-bit LLDB can debug only 32-bit applications, and 64-bit LLDB 
can debug only 64-bit applications. That's why the old scheme is left in 
dynamic tests `udt-layout.test`, `variables-locations.test` and `vbases.test`. 
If we will always compile the tests as 32-bit (64-bit), then they will fail on 
the 64-bit (32-bit) platform. That's why we just assume that the user runs the 
tests from the same command prompt where the build was run.

This one depends on D54914 .


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D54942

Files:
  lit/SymbolFile/PDB/ast-restore.test
  lit/SymbolFile/PDB/calling-conventions.test
  lit/SymbolFile/PDB/class-layout.test
  lit/SymbolFile/PDB/compilands.test
  lit/SymbolFile/PDB/enums-layout.test
  lit/SymbolFile/PDB/func-symbols.test
  lit/SymbolFile/PDB/function-nested-block.test
  lit/SymbolFile/PDB/pointers.test
  lit/SymbolFile/PDB/type-quals.test
  lit/SymbolFile/PDB/typedefs.test
  lit/SymbolFile/PDB/variables.test

Index: lit/SymbolFile/PDB/variables.test
===
--- lit/SymbolFile/PDB/variables.test
+++ lit/SymbolFile/PDB/variables.test
@@ -1,6 +1,6 @@
 REQUIRES: system-windows, msvc
-RUN: %clang_cl -m64 /Z7 /c /GS- %S/Inputs/VariablesTest.cpp /o %T/VariablesTest.cpp.obj
-RUN: %msvc_link %T/VariablesTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/VariablesTest.cpp.exe
+RUN: %build --compiler=clang-cl --mode=compile --arch=64 --nodefaultlib --source=%S/Inputs/VariablesTest.cpp --output=%T/VariablesTest.cpp.obj
+RUN: %build --compiler=msvc --mode=link --arch=64 --nodefaultlib --source=%T/VariablesTest.cpp.obj --output=%T/VariablesTest.cpp.exe
 RUN: lldb-test symbols %T/VariablesTest.cpp.exe | FileCheck %s
 
 CHECK: Module [[MOD:.*]]
@@ -55,4 +55,4 @@
 CHECK-NEXT:  Block{[[FID4]]}
 CHECK-DAG: Variable{{.*}}, name = "this"
 CHECK-SAME:scope = parameter
-CHECK-SAME:artificial
\ No newline at end of file
+CHECK-SAME:artificial
Index: lit/SymbolFile/PDB/typedefs.test
===
--- lit/SymbolFile/PDB/typedefs.test
+++ lit/SymbolFile/PDB/typedefs.test
@@ -1,6 +1,5 @@
 REQUIRES: system-windows, msvc
-RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/SimpleTypesTest.cpp /o %T/SimpleTypesTest.cpp.typedefs.obj
-RUN: %msvc_link %T/SimpleTypesTest.cpp.typedefs.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/SimpleTypesTest.cpp.typedefs.exe
+RUN: %build --compiler=msvc --arch=32 --nodefaultlib --source=%S/Inputs/SimpleTypesTest.cpp --output=%T/SimpleTypesTest.cpp.typedefs.exe
 RUN: lldb-test symbols %T/SimpleTypesTest.cpp.typedefs.exe | FileCheck %s
 
 ; Generate 32-bit target
Index: lit/SymbolFile/PDB/type-quals.test
===
--- lit/SymbolFile/PDB/type-quals.test
+++ lit/SymbolFile/PDB/type-quals.test
@@ -1,6 +1,6 @@
 REQUIRES: system-windows, msvc
-RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/TypeQualsTest.cpp /o %T/TypeQualsTest.cpp.obj
-RUN: %msvc_link %T/TypeQualsTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/TypeQualsTest.cpp.exe
+RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --source=%S/Inputs/TypeQualsTest.cpp --output=%T/TypeQualsTest.cpp.obj
+RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --source=%T/TypeQualsTest.cpp.obj --output=%T/TypeQualsTest.cpp.exe
 RUN: lldb-test symbols %T/TypeQualsTest.cpp.exe | FileCheck %s
 
 CHECK: Module [[MOD:.*]]
Index: lit/SymbolFile/PDB/pointers.test
===
--- lit/SymbolFile/PDB/pointers.test
+++ lit/SymbolFile/PDB/pointers.test
@@ -1,6 +1,6 @@
 REQUIRES: system-windows, msvc
-RUN: %clang_cl -m32 /Z7 /c /GS- %S/Inputs/PointerTypeTest.cpp /o %T/PointerTypeTest.cpp.obj
-RUN: %msvc_link %T/PointerTypeTest.cpp.obj /DEBUG /nodefaultlib /ENTRY:main /OUT:%T/PointerTypeTest.cpp.exe
+RUN: %build --compiler=clang-cl --mode=compile --arch=32 --nodefaultlib --source=%S/Inputs/PointerTypeTest.cpp --output=%T/PointerTypeTest.cpp.obj
+RUN: %build --compiler=msvc --mode=link --arch=32 --nodefaultlib --source=%T/PointerTypeTest.cpp.obj