[Lldb-commits] [PATCH] D60667: Allow direct comparison of ConstString against StringRef

2019-04-26 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359281: Allow direct comparison of ConstString against 
StringRef (authored by teemperor, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D60667?vs=196732&id=196806#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D60667

Files:
  lldb/trunk/include/lldb/Utility/ConstString.h
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
  lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp
  
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
  lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
  lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
  lldb/trunk/source/Plugins/Language/ObjC/CF.cpp
  
lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
  lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
  lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
  lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
  lldb/trunk/unittests/Utility/ConstStringTest.cpp

Index: lldb/trunk/unittests/Utility/ConstStringTest.cpp
===
--- lldb/trunk/unittests/Utility/ConstStringTest.cpp
+++ lldb/trunk/unittests/Utility/ConstStringTest.cpp
@@ -89,3 +89,51 @@
   EXPECT_TRUE(null.IsEmpty());
   EXPECT_TRUE(null.IsNull());
 }
+
+TEST(ConstStringTest, CompareConstString) {
+  ConstString foo("foo");
+  ConstString foo2("foo");
+  ConstString bar("bar");
+
+  EXPECT_TRUE(foo == foo2);
+  EXPECT_TRUE(foo2 == foo);
+  EXPECT_TRUE(foo == ConstString("foo"));
+
+  EXPECT_FALSE(foo == bar);
+  EXPECT_FALSE(foo2 == bar);
+  EXPECT_FALSE(foo == ConstString("bar"));
+  EXPECT_FALSE(foo == ConstString("different"));
+  EXPECT_FALSE(foo == ConstString(""));
+  EXPECT_FALSE(foo == ConstString());
+
+  ConstString empty("");
+  EXPECT_FALSE(empty == ConstString("bar"));
+  EXPECT_FALSE(empty == ConstString());
+  EXPECT_TRUE(empty == ConstString(""));
+
+  ConstString null;
+  EXPECT_FALSE(null == ConstString("bar"));
+  EXPECT_TRUE(null == ConstString());
+  EXPECT_FALSE(null == ConstString(""));
+}
+
+TEST(ConstStringTest, CompareStringRef) {
+  ConstString foo("foo");
+
+  EXPECT_TRUE(foo == "foo");
+  EXPECT_TRUE(foo != "");
+  EXPECT_FALSE(foo == static_cast(nullptr));
+  EXPECT_TRUE(foo != "bar");
+
+  ConstString empty("");
+  EXPECT_FALSE(empty == "foo");
+  EXPECT_FALSE(empty != "");
+  EXPECT_FALSE(empty == static_cast(nullptr));
+  EXPECT_TRUE(empty != "bar");
+
+  ConstString null;
+  EXPECT_FALSE(null == "foo");
+  EXPECT_TRUE(null != "");
+  EXPECT_TRUE(null == static_cast(nullptr));
+  EXPECT_TRUE(null != "bar");
+}
Index: lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
===
--- lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
+++ lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
@@ -454,8 +454,7 @@
 ThreadSP SystemRuntimeMacOSX::GetExtendedBacktraceThread(ThreadSP real_thread,
  ConstString type) {
   ThreadSP originating_thread_sp;
-  if (BacktraceRecordingHeadersInitialized() &&
-  type == ConstString("libdispatch")) {
+  if (BacktraceRecordingHeadersInitialized() && type == "libdispatch") {
 Status error;
 
 // real_thread is either an actual, live thread (in which case we need to
@@ -554,7 +553,7 @@
 SystemRuntimeMacOSX::GetExtendedBacktraceForQueueItem(QueueItemSP queue_item_sp,
   ConstString type) {
   ThreadSP extended_thread_sp;
-  if (type != ConstString("libdispatch"))
+  if (type != "libdispatch")
 return extended_thread_sp;
 
   bool stop_id_is_valid = true;
Index: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
===
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -472,7 +472,8 @@
   
   while (descriptor) {
 ConstString class_name(descriptor->GetClassName());
-if (class_name == ConstString("NSException")) return cpp_exception;
+if (class_name == "NSException")
+  return cpp_exception;
 descriptor = descriptor->GetSuperclass();
   }
 
Index: lldb/trunk/source/Plugins/

[Lldb-commits] [lldb] r359281 - Allow direct comparison of ConstString against StringRef

2019-04-26 Thread Raphael Isemann via lldb-commits
Author: teemperor
Date: Fri Apr 26 00:21:36 2019
New Revision: 359281

URL: http://llvm.org/viewvc/llvm-project?rev=359281&view=rev
Log:
Allow direct comparison of ConstString against StringRef

Summary:
When we want to compare a ConstString against a string literal (or any other 
non-ConstString),
we currently have to explicitly turn the other string into a ConstString. This 
makes sense as
comparing ConstStrings against each other is only a fast pointer comparison.

However, currently we (rather incorrectly) use in several places in LLDB 
temporary ConstStrings when
we just want to compare a given ConstString against a hardcoded value, for 
example like this:
```
if (extension != ConstString(".oat") && extension != ConstString(".odex"))
```

Obviously this kind of defeats the point of ConstStrings. In the comparison 
above we would
construct two temporary ConstStrings every time we hit the given code. 
Constructing a
ConstString is relatively expensive: we need to go to the StringPool, take a 
read and possibly
an exclusive write-lock and then look up our temporary string in the string map 
of the pool.
So we do a lot of heavy work for essentially just comparing a <6 characters in 
two strings.

I initially wanted to just fix these issues by turning the temporary 
ConstString in static variables/
members, but that made the code much less readable. Instead I propose to add a 
new overload
for the ConstString comparison operator that takes a StringRef. This comparison 
operator directly
compares the ConstString content against the given StringRef without turning 
the StringRef into
a ConstString.

This means that the example above can look like this now:
```
if (extension != ".oat" && extension != ".odex")
```
It also no longer has to unlock/lock two locks and call multiple functions in 
other TUs for constructing
the temporary ConstString instances. Instead this should end up just being a 
direct string comparison
of the two given strings on most compilers.

This patch also directly updates all uses of temporary and short ConstStrings 
in LLDB to use this new
comparison operator. It also adds a some unit tests for the new and old 
comparison operator.

Reviewers: #lldb, JDevlieghere, espindola, amccarth

Reviewed By: JDevlieghere, amccarth

Subscribers: amccarth, clayborg, JDevlieghere, emaste, arichardson, MaskRay, 
lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/include/lldb/Utility/ConstString.h
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp
lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp

lldb/trunk/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp

lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxx.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
lldb/trunk/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp
lldb/trunk/source/Plugins/Language/ObjC/CF.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp
lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp
lldb/trunk/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp
lldb/trunk/unittests/Utility/ConstStringTest.cpp

Modified: lldb/trunk/include/lldb/Utility/ConstString.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ConstString.h?rev=359281&r1=359280&r2=359281&view=diff
==
--- lldb/trunk/include/lldb/Utility/ConstString.h (original)
+++ lldb/trunk/include/lldb/Utility/ConstString.h Fri Apr 26 00:21:36 2019
@@ -154,6 +154,30 @@ public:
 return m_string == rhs.m_string;
   }
 
+  /// Equal to operator against a non-ConstString value.
+  ///
+  /// Returns true if this string is equal to the string in \a rhs. This
+  /// overload is usually slower than comparing against a ConstString value.
+  /// However, if the rhs string not already a ConstString and it is 
impractical
+  /// to turn it into a non-temporary variable, then this overload is faster.
+  ///
+  /// \param[in] rhs
+  /// Another string object to compare this object to.
+  ///
+  /// \return
+  /// \li \b true if this object is equal to \a rhs.
+  /// \li \b false if this object is not equal to \a rhs.
+  bool operator==(const char *rhs) const {
+// ConstString differentiates between empty strings and nullptr strings, 
but
+// StringRef doesn't. Therefore we have to do this check manually now.
+if (m_string == nullptr && rhs != nullptr)
+  return false;
+if (m_string != nullptr && rhs == nullptr)
+  return false;

[Lldb-commits] [PATCH] D61074: [lldb] [lit] Add register read tests for YMM registers (AVX)

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

In D61074#1479304 , @mgorny wrote:

> Added a 32-bit version of the test, and constexpr.
>
> I propose to keep the dotest tests until I reimplement ZMM as well, and then 
> remove it altogether.


Sounds like a plan. Thanks for doing this.


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

https://reviews.llvm.org/D61074



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


[Lldb-commits] [PATCH] D61172: [ScriptInterpreter] Pass the debugger instead of the command interpreter

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Seems like a good change to me, but Jim should have a look as he requested that.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61172



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


[Lldb-commits] [PATCH] D61090: [SBHostOS} Remove getting the python script interpreter path

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D61090#1479049 , @jingham wrote:

> I really thought there was one at the SB layer, because in terms of design 
> that is what makes sense.  I guess we never really needed it until now, so we 
> didn't add it.  Once there's more than one hard-coded script interpreter, we 
> will need to add some way to select & direct scripts at the various script 
> interpreters so we will need SBScriptInterpreter at the SB layer.  So maybe 
> now is the time to add it in preparation...
>
> Also, the fact that at the lldb_private layer, the ScriptInterpreter is held 
> onto by the CommandInterpreter is clearly wrong.  The CommandInterpreter 
> should have a member that tells it the currently selected ScriptInterpreter, 
> but the list of script interpreters should belong to the Debugger.  We should 
> probably disentangle that at the same time.


Yes, it sounds like we should have a SBScriptInterpreter at some point. Though, 
right now, it's not really clear to me what will it's exact role be, so I would 
tend to agree with Greg that we wait until we have a real use case for it (so 
we don't commit to a design we may want to change later).

> As an aside, IIUC, the current work to support either Python flavor only 
> supports one interpreter at a time because Python doesn't support loading 
> Python 2 & 3 into the same process?

I've heard someone say that, and I can believe that is the official party line 
of the python project, but I haven't investigated how "true" that statement is. 
E.g., I'm pretty sure we could get it to work by using some of the fancier 
flags of dlopen (RTLD_LOCAL, or the new namespace thingies present on linux), 
but that may take more effort than it's worth..


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

https://reviews.llvm.org/D61090



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


[Lldb-commits] [lldb] r359288 - PostfixExpression: move DWARF generator out of NativePDB internals

2019-04-26 Thread Pavel Labath via lldb-commits
Author: labath
Date: Fri Apr 26 01:52:04 2019
New Revision: 359288

URL: http://llvm.org/viewvc/llvm-project?rev=359288&view=rev
Log:
PostfixExpression: move DWARF generator out of NativePDB internals

Summary:
The new dwarf generator is pretty much a verbatim copy of the one in
PDB.

In order to write a pdb-independent test for it, I needed to write a
dummy "symbol resolver", which (together with the fact that I'll need
one more for breakpad-specific resolution logic) prompted me to create a
more simple interface for algorithms which replace or "resolve"
SymbolNodes. The resolving algorithms in NativePDB have been updated to
make use of that too.

I have removed a couple of NativePDB tests which weren't testing
anything pdb-specific and where the tested functionality was covered by
the new format-agnostic tests I have added.

Reviewers: amccarth, clayborg, aleksandr.urakov

Subscribers: aprantl, markmentovai, lldb-commits, jasonmolenda, JDevlieghere

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

Modified:
lldb/trunk/include/lldb/Symbol/PostfixExpression.h

lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
lldb/trunk/source/Symbol/PostfixExpression.cpp
lldb/trunk/unittests/Symbol/PostfixExpressionTest.cpp

Modified: lldb/trunk/include/lldb/Symbol/PostfixExpression.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/PostfixExpression.h?rev=359288&r1=359287&r2=359288&view=diff
==
--- lldb/trunk/include/lldb/Symbol/PostfixExpression.h (original)
+++ lldb/trunk/include/lldb/Symbol/PostfixExpression.h Fri Apr 26 01:52:04 2019
@@ -19,6 +19,9 @@
 #include "llvm/Support/Casting.h"
 
 namespace lldb_private {
+
+class Stream;
+
 namespace postfix {
 
 /// The base class for all nodes in the parsed postfix tree.
@@ -174,6 +177,17 @@ protected:
   }
 };
 
+/// A utility function for "resolving" SymbolNodes. It traverses a tree and
+/// calls the callback function for all SymbolNodes it encountered. The
+/// replacement function should return the node it wished to replace the 
current
+/// SymbolNode with (this can also be the original node), or nullptr in case of
+/// an error. The nodes returned by the callback are inspected and replaced
+/// recursively, *except* for the case when the function returns the exact same
+/// node as the input one. It returns true if all SymbolNodes were replaced
+/// successfully.
+bool ResolveSymbols(Node *&node,
+llvm::function_ref replacer);
+
 template 
 inline T *MakeNode(llvm::BumpPtrAllocator &alloc, Args &&... args) {
   static_assert(std::is_trivially_destructible::value,
@@ -185,6 +199,10 @@ inline T *MakeNode(llvm::BumpPtrAllocato
 /// provided allocator.
 Node *Parse(llvm::StringRef expr, llvm::BumpPtrAllocator &alloc);
 
+/// Serialize the given expression tree as DWARF. The result is written into 
the
+/// given stream. The AST should not contain any SymbolNodes.
+void ToDWARF(Node &node, Stream &stream);
+
 } // namespace postfix
 } // namespace lldb_private
 

Modified: 
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp?rev=359288&r1=359287&r2=359288&view=diff
==
--- 
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
 Fri Apr 26 01:52:04 2019
@@ -10,7 +10,6 @@
 #include "CodeViewRegisterMapping.h"
 
 #include "lldb/Core/StreamBuffer.h"
-#include "lldb/Core/dwarf.h"
 #include "lldb/Symbol/PostfixExpression.h"
 #include "lldb/Utility/LLDBAssert.h"
 #include "lldb/Utility/Stream.h"
@@ -24,83 +23,6 @@ using namespace lldb;
 using namespace lldb_private;
 using namespace lldb_private::postfix;
 
-namespace {
-
-class FPOProgramASTVisitorMergeDependent : public Visitor<> {
-public:
-  void Visit(BinaryOpNode &binary, Node *&) override {
-Dispatch(binary.Left());
-Dispatch(binary.Right());
-  }
-
-  void Visit(UnaryOpNode &unary, Node *&) override {
-Dispatch(unary.Operand());
-  }
-
-  void Visit(RegisterNode &, Node *&) override {}
-  void Visit(IntegerNode &, Node *&) override {}
-  void Visit(SymbolNode &symbol, Node *&ref) override;
-
-  static void
-  Merge(const llvm::DenseMap &dependent_programs,
-Node *&ast) {
-FPOProgramASTVisitorMergeDependent(dependent_programs).Dispatch(ast);
-  }
-
-private:
-  FPOProgramASTVisitorMergeDependent(
-  const llvm::DenseMap &dependent_programs)
-  : m_dependent_programs(dependent_programs) {}
-
-  const llvm::DenseMap &m_dependent_programs;
-};
-
-void FPOProgramASTVisitorMergeDependent::Visit(SymbolNode &symbol, Node *&ref) 
{
-  auto it = m_dependent_programs.find(symbol

[Lldb-commits] [PATCH] D61056: PostfixExpression: move DWARF generator out of NativePDB internals

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB359288: PostfixExpression: move DWARF generator out of 
NativePDB internals (authored by labath, committed by ).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D61056?vs=196665&id=196818#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61056

Files:
  include/lldb/Symbol/PostfixExpression.h
  source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp
  source/Symbol/PostfixExpression.cpp
  unittests/Symbol/PostfixExpressionTest.cpp

Index: unittests/Symbol/PostfixExpressionTest.cpp
===
--- unittests/Symbol/PostfixExpressionTest.cpp
+++ unittests/Symbol/PostfixExpressionTest.cpp
@@ -7,6 +7,9 @@
 //===--===//
 
 #include "lldb/Symbol/PostfixExpression.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/StreamString.h"
 #include "llvm/Support/FormatVariadic.h"
 #include "llvm/Support/raw_ostream.h"
 #include "gtest/gtest.h"
@@ -95,3 +98,55 @@
   EXPECT_EQ("nullptr", ParseAndStringify("1 2"));
   EXPECT_EQ("nullptr", ParseAndStringify(""));
 }
+
+static std::string ParseAndGenerateDWARF(llvm::StringRef expr) {
+  llvm::BumpPtrAllocator alloc;
+  Node *ast = Parse(expr, alloc);
+  if (!ast)
+return "Parse failed.";
+  if (!ResolveSymbols(ast, [&](SymbolNode &symbol) -> Node * {
+uint32_t num;
+if (to_integer(symbol.GetName().drop_front(), num))
+  return MakeNode(alloc, num);
+return nullptr;
+  })) {
+return "Resolution failed.";
+  }
+
+  const size_t addr_size = 4;
+  StreamString dwarf(Stream::eBinary, addr_size, lldb::eByteOrderLittle);
+  ToDWARF(*ast, dwarf);
+
+  // print dwarf expression to comparable textual representation
+  DataExtractor extractor(dwarf.GetData(), dwarf.GetSize(),
+  lldb::eByteOrderLittle, addr_size);
+
+  StreamString result;
+  if (!DWARFExpression::PrintDWARFExpression(result, extractor, addr_size,
+ /*dwarf_ref_size*/ 4,
+ /*location_expression*/ false)) {
+return "DWARF printing failed.";
+  }
+
+  return result.GetString();
+}
+
+TEST(PostfixExpression, ToDWARF) {
+  EXPECT_EQ("DW_OP_constu 0x0", ParseAndGenerateDWARF("0"));
+
+  EXPECT_EQ("DW_OP_breg1 +0", ParseAndGenerateDWARF("R1"));
+
+  EXPECT_EQ("DW_OP_bregx 65 0", ParseAndGenerateDWARF("R65"));
+
+  EXPECT_EQ("DW_OP_constu 0x4, DW_OP_constu 0x5, DW_OP_plus ",
+ParseAndGenerateDWARF("4 5 +"));
+
+  EXPECT_EQ("DW_OP_constu 0x4, DW_OP_constu 0x5, DW_OP_minus ",
+ParseAndGenerateDWARF("4 5 -"));
+
+  EXPECT_EQ("DW_OP_constu 0x4, DW_OP_deref ", ParseAndGenerateDWARF("4 ^"));
+
+  EXPECT_EQ("DW_OP_breg6 +0, DW_OP_constu 0x80, DW_OP_lit1 "
+", DW_OP_minus , DW_OP_not , DW_OP_and ",
+ParseAndGenerateDWARF("R6 128 @"));
+}
Index: source/Symbol/PostfixExpression.cpp
===
--- source/Symbol/PostfixExpression.cpp
+++ source/Symbol/PostfixExpression.cpp
@@ -12,6 +12,8 @@
 //===--===//
 
 #include "lldb/Symbol/PostfixExpression.h"
+#include "lldb/Core/dwarf.h"
+#include "lldb/Utility/Stream.h"
 #include "llvm/ADT/StringExtras.h"
 
 using namespace lldb_private;
@@ -80,3 +82,121 @@
 
   return stack.back();
 }
+
+namespace {
+class SymbolResolver : public Visitor {
+public:
+  SymbolResolver(llvm::function_ref replacer)
+  : m_replacer(replacer) {}
+
+  using Visitor::Dispatch;
+
+private:
+  bool Visit(BinaryOpNode &binary, Node *&) override {
+return Dispatch(binary.Left()) && Dispatch(binary.Right());
+  }
+
+  bool Visit(IntegerNode &integer, Node *&) override { return true; }
+  bool Visit(RegisterNode ®, Node *&) override { return true; }
+
+  bool Visit(SymbolNode &symbol, Node *&ref) override {
+if (Node *replacement = m_replacer(symbol)) {
+  ref = replacement;
+  if (replacement != &symbol)
+return Dispatch(ref);
+  return true;
+}
+return false;
+  }
+
+  bool Visit(UnaryOpNode &unary, Node *&) override {
+return Dispatch(unary.Operand());
+  }
+
+  llvm::function_ref m_replacer;
+};
+
+class DWARFCodegen : public Visitor<> {
+public:
+  DWARFCodegen(Stream &stream) : m_out_stream(stream) {}
+
+  using Visitor<>::Dispatch;
+
+private:
+  void Visit(BinaryOpNode &binary, Node *&);
+
+  void Visit(IntegerNode &integer, Node *&) {
+m_out_stream.PutHex8(DW_OP_constu);
+m_out_stream.PutULEB128(integer.GetValue());
+  }
+
+  void Visit(RegisterNode ®, Node *&);
+
+  void Visit(SymbolNode &symbol, Node *&) {
+llvm_unreachable("Symbols shou

[Lldb-commits] [PATCH] D59537: Instantiate 'std' templates explicitly in the expression evaluator

2019-04-26 Thread Gabor Marton via Phabricator via lldb-commits
martong added inline comments.



Comment at: lldb/source/Symbol/StdModuleHandler.cpp:242
+// Instantiate the template.
+found_decl = ClassTemplateSpecializationDecl::Create(
+m_sema->getASTContext(),

teemperor wrote:
> martong wrote:
> > martong wrote:
> > > Is there any guarantee that the before any subsequent 
> > > clang::ASTImporter::Import call this newly created node is registered as 
> > > imported (via ASTImporter::MapImported)?
> > > 
> > > The reason why I am asking this is because we have to enforce in 
> > > clang::ASTImporter that after every Decl is created then immediately it 
> > > is registered as an imported Decl, see 
> > > `ASTImporter::GetImportedOrCreateDecl`. This we we make sure that no 
> > > subsequent import calls will create the same node again.
> > > The cycles in the AST are handled properly only this way.
> > > 
> > > This is one reason which makes me worried about exposing the import 
> > > mechanism via `ImportInternal`.  Would it be working if 
> > > `GetImportedOrCreateDecl` was virtual and overridden here?
> > > Would it be working if GetImportedOrCreateDecl was virtual and overridden 
> > > here?
> > 
> > Sorry, that would certainly not work, but perhaps a virtual hook inside 
> > that function could work...
> Sorry for the late reply.
> 
> So I was looking into changing the code to your suggestion, but I don't think 
> we can get this working reliably. The problem is that if we intercept the 
> importing in GetImportedOrCreateDecl then we need to intercept not just 
> `std::vector` but also all related imports that the ASTImporter may make 
> before importing `std::vector` itself, e.g. DeclContext, parent classes, 
> return type, template args, etc. Also we constantly would need to update this 
> list in case the standard library or the ASTImporter change internally to 
> make sure we intercept everything.
> 
> Maybe we could instead implement an mechanism in the LLDB code that ensures 
> we do call MapImported and add the decl to the lookup directly after creating 
> a decl? E.g. by implementing something similar to ASTImporter's 
> `GetImportedOrCreateDecl`?
Yes, I think that could work.
So, we could have a new function:
```
void CreateDeclPostamble(Decl *FromD, Decl* ToD) {  // better naming?
  // Keep track of imported Decls.
  Importer.MapImported(FromD, ToD);
  Importer.AddToLookupTable(ToD);
  InitializeImportedDecl(FromD, ToD);
}
```
And we'd call this from `GetImportedOrCreateDecl` and here after `::Create`.


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

https://reviews.llvm.org/D59537



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


[Lldb-commits] [PATCH] D59537: Instantiate 'std' templates explicitly in the expression evaluator

2019-04-26 Thread Gabor Marton via Phabricator via lldb-commits
martong added inline comments.



Comment at: lldb/source/Symbol/StdModuleHandler.cpp:242
+// Instantiate the template.
+found_decl = ClassTemplateSpecializationDecl::Create(
+m_sema->getASTContext(),

martong wrote:
> teemperor wrote:
> > martong wrote:
> > > martong wrote:
> > > > Is there any guarantee that the before any subsequent 
> > > > clang::ASTImporter::Import call this newly created node is registered 
> > > > as imported (via ASTImporter::MapImported)?
> > > > 
> > > > The reason why I am asking this is because we have to enforce in 
> > > > clang::ASTImporter that after every Decl is created then immediately it 
> > > > is registered as an imported Decl, see 
> > > > `ASTImporter::GetImportedOrCreateDecl`. This we we make sure that no 
> > > > subsequent import calls will create the same node again.
> > > > The cycles in the AST are handled properly only this way.
> > > > 
> > > > This is one reason which makes me worried about exposing the import 
> > > > mechanism via `ImportInternal`.  Would it be working if 
> > > > `GetImportedOrCreateDecl` was virtual and overridden here?
> > > > Would it be working if GetImportedOrCreateDecl was virtual and 
> > > > overridden here?
> > > 
> > > Sorry, that would certainly not work, but perhaps a virtual hook inside 
> > > that function could work...
> > Sorry for the late reply.
> > 
> > So I was looking into changing the code to your suggestion, but I don't 
> > think we can get this working reliably. The problem is that if we intercept 
> > the importing in GetImportedOrCreateDecl then we need to intercept not just 
> > `std::vector` but also all related imports that the ASTImporter may make 
> > before importing `std::vector` itself, e.g. DeclContext, parent classes, 
> > return type, template args, etc. Also we constantly would need to update 
> > this list in case the standard library or the ASTImporter change internally 
> > to make sure we intercept everything.
> > 
> > Maybe we could instead implement an mechanism in the LLDB code that ensures 
> > we do call MapImported and add the decl to the lookup directly after 
> > creating a decl? E.g. by implementing something similar to ASTImporter's 
> > `GetImportedOrCreateDecl`?
> Yes, I think that could work.
> So, we could have a new function:
> ```
> void CreateDeclPostamble(Decl *FromD, Decl* ToD) {  // better naming?
>   // Keep track of imported Decls.
>   Importer.MapImported(FromD, ToD);
>   Importer.AddToLookupTable(ToD);
>   InitializeImportedDecl(FromD, ToD);
> }
> ```
> And we'd call this from `GetImportedOrCreateDecl` and here after `::Create`.
Well, the thing is a bit more complex because this is in `ASTNodeImporter`, so 
we need to wire things up to `ASTImporter`. But that seems doable.


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

https://reviews.llvm.org/D59537



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


[Lldb-commits] [PATCH] D61182: DWARFExpression: Fix implementation of DW_OP_pick

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: jasonmolenda, clayborg.
Herald added subscribers: aprantl, mgorny.

The DWARF spec states that the DWARF stack arguments are numbered from
the top. Our implementation of DW_OP_pick was counting them from the
bottom.

This bug probably wasn't noticed because nobody (except my upcoming
postfix-to-DWARF converter) uses DW_OP_pick, but I've cross-checked with
gdb to confirm that counting from the top is the expected behavior.

This patch fixes the implementation to match the spec and gdb behavior
and adds a test.


https://reviews.llvm.org/D61182

Files:
  include/lldb/Utility/Scalar.h
  source/Expression/DWARFExpression.cpp
  source/Utility/Scalar.cpp
  unittests/Expression/CMakeLists.txt
  unittests/Expression/DWARFExpressionTest.cpp

Index: unittests/Expression/DWARFExpressionTest.cpp
===
--- /dev/null
+++ unittests/Expression/DWARFExpressionTest.cpp
@@ -0,0 +1,42 @@
+//===-- DWARFExpressionTest.cpp --*- C++-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Core/dwarf.h"
+#include "lldb/Utility/StreamString.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/Testing/Support/Error.h"
+#include "gtest/gtest.h"
+
+using namespace lldb_private;
+
+static llvm::Expected Evaluate(llvm::ArrayRef expr) {
+  DataExtractor extractor(expr.data(), expr.size(), lldb::eByteOrderLittle,
+  /*addr_size*/ 4);
+
+  Value result;
+  Status status;
+  if (!DWARFExpression::Evaluate(
+  /*exe_ctx*/ nullptr, /*reg_ctx*/ nullptr, /*opcode_ctx*/ nullptr,
+  extractor, /*dwarf_cu*/ nullptr, /*offset*/ 0, expr.size(),
+  lldb::eRegisterKindLLDB, /*initial_value_ptr*/ nullptr,
+  /*object_address_ptr*/ nullptr, result, &status))
+return status.ToError();
+
+  return result.GetScalar();
+}
+
+TEST(DWARFExpression, DW_OP_pick) {
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit1, DW_OP_lit0, DW_OP_pick, 0}),
+   llvm::HasValue(0));
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit1, DW_OP_lit0, DW_OP_pick, 1}),
+   llvm::HasValue(1));
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_lit1, DW_OP_lit0, DW_OP_pick, 2}),
+   llvm::Failed());
+}
Index: unittests/Expression/CMakeLists.txt
===
--- unittests/Expression/CMakeLists.txt
+++ unittests/Expression/CMakeLists.txt
@@ -1,4 +1,5 @@
 add_lldb_unittest(ExpressionTests
+  DWARFExpressionTest.cpp
   ClangParserTest.cpp
 
   LINK_LIBS
@@ -6,4 +7,5 @@
 lldbPluginExpressionParserClang
 lldbUtility
 lldbUtilityHelpers
+LLVMTestingSupport
   )
Index: source/Utility/Scalar.cpp
===
--- source/Utility/Scalar.cpp
+++ source/Utility/Scalar.cpp
@@ -12,6 +12,7 @@
 #include "lldb/Utility/Endian.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StreamString.h"
 #include "lldb/lldb-types.h"
 
 #include "llvm/ADT/SmallString.h"
@@ -2844,3 +2845,9 @@
   }
   return false;
 }
+
+llvm::raw_ostream &lldb_private::operator<<(llvm::raw_ostream &os, const Scalar &scalar) {
+  StreamString s;
+  scalar.GetValue(&s, /*show_type*/ true);
+  return os << s.GetString();
+}
Index: source/Expression/DWARFExpression.cpp
===
--- source/Expression/DWARFExpression.cpp
+++ source/Expression/DWARFExpression.cpp
@@ -1751,7 +1751,7 @@
 case DW_OP_pick: {
   uint8_t pick_idx = opcodes.GetU8(&offset);
   if (pick_idx < stack.size())
-stack.push_back(stack[pick_idx]);
+stack.push_back(stack[stack.size() - 1 - pick_idx]);
   else {
 if (error_ptr)
   error_ptr->SetErrorStringWithFormat(
Index: include/lldb/Utility/Scalar.h
===
--- include/lldb/Utility/Scalar.h
+++ include/lldb/Utility/Scalar.h
@@ -339,6 +339,8 @@
 bool operator>(const Scalar &lhs, const Scalar &rhs);
 bool operator>=(const Scalar &lhs, const Scalar &rhs);
 
+llvm::raw_ostream &operator<<(llvm::raw_ostream &os, const Scalar &scalar);
+
 } // namespace lldb_private
 
 #endif // LLDB_UTILITY_SCALAR_H
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61183: PostfixExpression: Introduce CFANode

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

PS: Although this patch is technically dependency free, for this to work as a 
part of the bigger picture, we'll need to get lldb's dwarf evaluator to 
actually push the CFA value to the dwarf stack (D61018 
) and fix its implementation of DW_OP_pick 
(D61182 ).


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

https://reviews.llvm.org/D61183



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


[Lldb-commits] [PATCH] D61183: PostfixExpression: Introduce CFANode

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: amccarth, clayborg, aleksandr.urakov.
Herald added a subscriber: aprantl.

This node represents the "Canonical Frame Address" of the current frame,
and is used by various DWARF expressions to express adresses of various
objects relative to the frame.

The motivation for this is the ability to translate breakpad register
unwind rules (strings like: ".cfa 8 - ^") back into dwarf.

This patch introduces the new node type, and teaches the dwarf codegen
how to handle it. A slight complication here is that the value of CFA is
provided differently depending on the context where the dwarf expression
is used. In unwind rules, it is made available implicitly via the
initial dwarf stack. It variable location expressions, it needs to be
referred to explicitly via a special opcode.

As currently, the only usage of this is in the unwind rules, I made the
dwarf generator use this convention, but this can be easily made
configurable, if necessary. The implementation does this via keeping
track of the DWARF stack depth an any given point, and then copying the
CFA value from the bottom of the stack via the DW_OP_pick opcode. This
could be made more efficient for simple expressions, but here I chose to
start with the most general implementation possible.


https://reviews.llvm.org/D61183

Files:
  include/lldb/Symbol/PostfixExpression.h
  source/Symbol/PostfixExpression.cpp
  unittests/Symbol/PostfixExpressionTest.cpp

Index: unittests/Symbol/PostfixExpressionTest.cpp
===
--- unittests/Symbol/PostfixExpressionTest.cpp
+++ unittests/Symbol/PostfixExpressionTest.cpp
@@ -44,6 +44,8 @@
  Dispatch(binary.Left()), Dispatch(binary.Right()));
   }
 
+  std::string Visit(CFANode &, Node *&) override { return "CFA"; }
+
   std::string Visit(IntegerNode &integer, Node *&) override {
 return llvm::formatv("int({0})", integer.GetValue());
   }
@@ -105,6 +107,9 @@
   if (!ast)
 return "Parse failed.";
   if (!ResolveSymbols(ast, [&](SymbolNode &symbol) -> Node * {
+if (symbol.GetName() == "CFA")
+  return MakeNode(alloc);
+
 uint32_t num;
 if (to_integer(symbol.GetName().drop_front(), num))
   return MakeNode(alloc, num);
@@ -138,6 +143,17 @@
 
   EXPECT_EQ("DW_OP_bregx 65 0", ParseAndGenerateDWARF("R65"));
 
+  EXPECT_EQ("DW_OP_pick 0x00", ParseAndGenerateDWARF("CFA"));
+
+  EXPECT_EQ("DW_OP_pick 0x00, DW_OP_pick 0x01, DW_OP_plus ",
+ParseAndGenerateDWARF("CFA CFA +"));
+
+  EXPECT_EQ("DW_OP_breg1 +0, DW_OP_pick 0x01, DW_OP_plus ",
+ParseAndGenerateDWARF("R1 CFA +"));
+
+  EXPECT_EQ("DW_OP_constu 0x1, DW_OP_pick 0x01, DW_OP_deref , DW_OP_plus ",
+ParseAndGenerateDWARF("1 CFA ^ +"));
+
   EXPECT_EQ("DW_OP_constu 0x4, DW_OP_constu 0x5, DW_OP_plus ",
 ParseAndGenerateDWARF("4 5 +"));
 
Index: source/Symbol/PostfixExpression.cpp
===
--- source/Symbol/PostfixExpression.cpp
+++ source/Symbol/PostfixExpression.cpp
@@ -96,6 +96,7 @@
 return Dispatch(binary.Left()) && Dispatch(binary.Right());
   }
 
+  bool Visit(CFANode &cfa, Node *&) override { return true; }
   bool Visit(IntegerNode &integer, Node *&) override { return true; }
   bool Visit(RegisterNode ®, Node *&) override { return true; }
 
@@ -125,9 +126,12 @@
 private:
   void Visit(BinaryOpNode &binary, Node *&);
 
+  void Visit(CFANode &cfa, Node *&);
+
   void Visit(IntegerNode &integer, Node *&) {
 m_out_stream.PutHex8(DW_OP_constu);
 m_out_stream.PutULEB128(integer.GetValue());
+++m_stack_depth;
   }
 
   void Visit(RegisterNode ®, Node *&);
@@ -139,6 +143,11 @@
   void Visit(UnaryOpNode &unary, Node *&);
 
   Stream &m_out_stream;
+
+  /// The number keeping track of the virtual evaluation stack depth at the
+  /// given moment. We assume CFA is given via the top of the initial stack,
+  /// hence the initial value is 1.
+  size_t m_stack_depth = 1;
 };
 } // namespace
 
@@ -166,6 +175,16 @@
 m_out_stream.PutHex8(DW_OP_and);
 break;
   }
+  --m_stack_depth; // Two pops, one push.
+}
+
+void DWARFCodegen::Visit(CFANode &, Node *&) {
+  // We never go below the initial stack, so we can pick the initial CFA value
+  // from the bottom of the stack at any moment.
+  assert(m_stack_depth >= 1);
+  m_out_stream.PutHex8(DW_OP_pick);
+  m_out_stream.PutHex8(m_stack_depth - 1);
+  ++m_stack_depth;
 }
 
 void DWARFCodegen::Visit(RegisterNode ®, Node *&) {
@@ -179,6 +198,7 @@
 m_out_stream.PutHex8(DW_OP_breg0 + reg_num);
 
   m_out_stream.PutSLEB128(0);
+  ++m_stack_depth;
 }
 
 void DWARFCodegen::Visit(UnaryOpNode &unary, Node *&) {
@@ -189,6 +209,7 @@
 m_out_stream.PutHex8(DW_OP_deref);
 break;
   }
+  // Stack depth unchanged.
 }
 
 bool postfix::ResolveSymbols(
Index: include/lldb/Symbol/PostfixExpression.h
==

[Lldb-commits] [PATCH] D59015: [lldb-mi] Include full path in the -data-disassemble response

2019-04-26 Thread Anton Kolesov via Phabricator via lldb-commits
anton.kolesov added inline comments.



Comment at: lldb/tools/lldb-mi/MICmdCmdData.cpp:419
+  // Get a full path to the file.
+  std::unique_ptr pPathBuffer(new char[PATH_MAX]);
+  lineEntry.GetFileSpec().GetPath(pPathBuffer.get(), PATH_MAX);

clayborg wrote:
> anton.kolesov wrote:
> > clayborg wrote:
> > > Confused as to why we are calling malloc and free here for pPathBuffer? 
> > > Why not just:
> > > ```
> > > char pPathBuffer[PATH_MAX];
> > > ```
> > I don't have a strong opinion on this, so to maintain consistency in the 
> > code I'm trying to use what other code in lldb-mi uses in similar 
> > situations - which is either unique_ptr or static local variable, but I 
> > presume it was decided that second approach is not good. FWIW, If I were to 
> > write code without regard of what is being done in the same project, then I 
> > would never ever had a variable named "miValueConst5".
> I would just use a local variable on the stack as I suggested. static 
> variables are not correct and should never be used in cases like this, so if 
> you see other errors, might be a good idea to submit a patch and improve 
> lldb-mi. I am all for consistency where it makes sense, but I am also for 
> fixing issues when we see them. 
But what is wrong with the approach of using std::unique_ptr local 
variable?


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59015



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


[Lldb-commits] [lldb] r359304 - [lldb] [lit] Add register read tests for YMM registers (AVX)

2019-04-26 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Fri Apr 26 06:21:58 2019
New Revision: 359304

URL: http://llvm.org/viewvc/llvm-project?rev=359304&view=rev
Log:
[lldb] [lit] Add register read tests for YMM registers (AVX)

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

Added:
lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp
lldb/trunk/lit/Register/x86-64-ymm-read.test
lldb/trunk/lit/Register/x86-ymm-read.test
Modified:
lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp

Added: lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp?rev=359304&view=auto
==
--- lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp (added)
+++ lldb/trunk/lit/Register/Inputs/x86-ymm-read.cpp Fri Apr 26 06:21:58 2019
@@ -0,0 +1,81 @@
+#include 
+
+struct alignas(32) ymm_t {
+  uint64_t a, b, c, d;
+};
+
+int main() {
+  constexpr ymm_t ymm0 = { 0x020406080A0C0E01, 0x030507090B0D0F00,
+   0x838587898B8D8F80, 0x828486888A8C8E81 };
+  constexpr ymm_t ymm1 = { 0x121416181A1C1E11, 0x131517191B1D1F10,
+   0x939597999B9D9F90, 0x929496989A9C9E91 };
+  constexpr ymm_t ymm2 = { 0x222426282A2C2E21, 0x232527292B2D2F20,
+   0xA3A5A7A9ABADAFA0, 0xA2A4A6A8AAACAEA1 };
+  constexpr ymm_t ymm3 = { 0x323436383A3C3E31, 0x333537393B3D3F30,
+   0xB3B5B7B9BBBDBFB0, 0xB2B4B6B8BABCBEB1 };
+  constexpr ymm_t ymm4 = { 0x424446484A4C4E41, 0x434547494B4D4F40,
+   0xC3C5C7C9CBCDCFC0, 0xC2C4C6C8CACCCEC1 };
+  constexpr ymm_t ymm5 = { 0x525456585A5C5E51, 0x535557595B5D5F50,
+   0xD3D5D7D9DBDDDFD0, 0xD2D4D6D8DADCDED1 };
+  constexpr ymm_t ymm6 = { 0x626466686A6C6E61, 0x636567696B6D6F60,
+   0xE3E5E7E9EBEDEFE0, 0xE2E4E6E8EAECEEE1 };
+  constexpr ymm_t ymm7 = { 0x727476787A7C7E71, 0x737577797B7D7F70,
+   0xF3F5F7F9FBFDFFF0, 0xF2F4F6F8FAFCFEF1 };
+#if defined(__x86_64__) || defined(_M_X64)
+  constexpr ymm_t ymm8 = { 0x838587898B8D8F80, 0x828486888A8C8E81,
+   0x020406080A0C0E01, 0x030507090B0D0F00 };
+  constexpr ymm_t ymm9 = { 0x939597999B9D9F90, 0x929496989A9C9E91,
+   0x121416181A1C1E11, 0x131517191B1D1F10 };
+  constexpr ymm_t ymm10 = { 0xA3A5A7A9ABADAFA0, 0xA2A4A6A8AAACAEA1,
+0x222426282A2C2E21, 0x232527292B2D2F20 };
+  constexpr ymm_t ymm11 = { 0xB3B5B7B9BBBDBFB0, 0xB2B4B6B8BABCBEB1,
+0x323436383A3C3E31, 0x333537393B3D3F30 };
+  constexpr ymm_t ymm12 = { 0xC3C5C7C9CBCDCFC0, 0xC2C4C6C8CACCCEC1,
+0x424446484A4C4E41, 0x434547494B4D4F40 };
+  constexpr ymm_t ymm13 = { 0xD3D5D7D9DBDDDFD0, 0xD2D4D6D8DADCDED1,
+0x525456585A5C5E51, 0x535557595B5D5F50 };
+  constexpr ymm_t ymm14 = { 0xE3E5E7E9EBEDEFE0, 0xE2E4E6E8EAECEEE1,
+0x626466686A6C6E61, 0x636567696B6D6F60 };
+  constexpr ymm_t ymm15 = { 0xF3F5F7F9FBFDFFF0, 0xF2F4F6F8FAFCFEF1,
+0x727476787A7C7E71, 0x737577797B7D7F70 };
+#endif
+
+  asm volatile(
+"vmovaps  %0, %%ymm0\n\t"
+"vmovaps  %1, %%ymm1\n\t"
+"vmovaps  %2, %%ymm2\n\t"
+"vmovaps  %3, %%ymm3\n\t"
+"vmovaps  %4, %%ymm4\n\t"
+"vmovaps  %5, %%ymm5\n\t"
+"vmovaps  %6, %%ymm6\n\t"
+"vmovaps  %7, %%ymm7\n\t"
+#if defined(__x86_64__) || defined(_M_X64)
+"vmovaps  %8, %%ymm8\n\t"
+"vmovaps  %9, %%ymm9\n\t"
+"vmovaps  %10, %%ymm10\n\t"
+"vmovaps  %11, %%ymm11\n\t"
+"vmovaps  %12, %%ymm12\n\t"
+"vmovaps  %13, %%ymm13\n\t"
+"vmovaps  %14, %%ymm14\n\t"
+"vmovaps  %15, %%ymm15\n\t"
+#endif
+"\n\t"
+"int3"
+:
+: "m"(ymm0), "m"(ymm1), "m"(ymm2), "m"(ymm3), "m"(ymm4), "m"(ymm5),
+  "m"(ymm6), "m"(ymm7)
+#if defined(__x86_64__) || defined(_M_X64)
+  ,
+  "m"(ymm8), "m"(ymm9), "m"(ymm10), "m"(ymm11),
+  "m"(ymm12), "m"(ymm13), "m"(ymm14), "m"(ymm15)
+#endif
+: "%ymm0", "%ymm1", "%ymm2", "%ymm3", "%ymm4", "%ymm5", "%ymm6", "%ymm7"
+#if defined(__x86_64__) || defined(_M_X64)
+  ,
+  "%ymm8", "%ymm9", "%ymm10", "%ymm11", "%ymm12", "%ymm13", "%ymm14",
+  "%ymm15"
+#endif
+  );
+
+  return 0;
+}

Added: lldb/trunk/lit/Register/x86-64-ymm-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-64-ymm-read.test?rev=359304&view=auto
==
--- lldb/trunk/lit/Register/x86-64-ymm-read.test (added)
+++ lldb/trunk/lit/Register/x86-64-ymm-read.test Fri Apr 26 06:21:58 2019
@@ -0,0 +1,39 @@
+# XFAIL: system-windows
+# REQUIRES: native && target-x86_64 && native-cpu-avx
+# RUN: %clangxx %p/Inputs/x86-ymm-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: xmm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x0

[Lldb-commits] [lldb] r359303 - [lldb] [lit] Add feature flags for native CPU features

2019-04-26 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Fri Apr 26 06:21:46 2019
New Revision: 359303

URL: http://llvm.org/viewvc/llvm-project?rev=359303&view=rev
Log:
[lldb] [lit] Add feature flags for native CPU features

Add a new lit-cpuid tool that detects CPU features used by some of
the tests, and use it to populate available_features in lit.  For now,
this means that the test for MM/XMM register read will be run only
when the host CPU support SSE instruction set.  However, this is going
to make it possible to introduce additional tests relying on AVX.

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

Added:
lldb/trunk/utils/lit-cpuid/
lldb/trunk/utils/lit-cpuid/CMakeLists.txt
lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp
Modified:
lldb/trunk/CMakeLists.txt
lldb/trunk/lit/CMakeLists.txt
lldb/trunk/lit/Register/x86-mm-xmm-read.test
lldb/trunk/lit/lit.cfg.py

Modified: lldb/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=359303&r1=359302&r2=359303&view=diff
==
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Fri Apr 26 06:21:46 2019
@@ -138,6 +138,7 @@ if(LLDB_INCLUDE_TESTS)
   add_subdirectory(test)
   add_subdirectory(unittests)
   add_subdirectory(lit)
+  add_subdirectory(utils/lit-cpuid)
   add_subdirectory(utils/lldb-dotest)
 endif()
 

Modified: lldb/trunk/lit/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/CMakeLists.txt?rev=359303&r1=359302&r2=359303&view=diff
==
--- lldb/trunk/lit/CMakeLists.txt (original)
+++ lldb/trunk/lit/CMakeLists.txt Fri Apr 26 06:21:46 2019
@@ -20,6 +20,7 @@ string(REPLACE ${CMAKE_CFG_INTDIR} ${LLV
 list(APPEND LLDB_TEST_DEPS
   LLDBUnitTests
   dsymutil
+  lit-cpuid
   llc
   lldb
   lldb-test

Modified: lldb/trunk/lit/Register/x86-mm-xmm-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-mm-xmm-read.test?rev=359303&r1=359302&r2=359303&view=diff
==
--- lldb/trunk/lit/Register/x86-mm-xmm-read.test (original)
+++ lldb/trunk/lit/Register/x86-mm-xmm-read.test Fri Apr 26 06:21:46 2019
@@ -1,6 +1,6 @@
 # XFAIL: system-darwin
 # XFAIL: system-windows
-# REQUIRES: native && (target-x86 || target-x86_64)
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
 # RUN: %clangxx %p/Inputs/x86-mm-xmm-read.cpp -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
 process launch

Modified: lldb/trunk/lit/lit.cfg.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg.py?rev=359303&r1=359302&r2=359303&view=diff
==
--- lldb/trunk/lit/lit.cfg.py (original)
+++ lldb/trunk/lit/lit.cfg.py Fri Apr 26 06:21:46 2019
@@ -73,3 +73,17 @@ for i in ['module-cache-clang', 'module-
 if os.path.isdir(cachedir):
 print("Deleting module cache at %s."%cachedir)
 shutil.rmtree(cachedir)
+
+# If running tests natively, check for CPU features needed for some tests.
+
+if 'native' in config.available_features:
+cpuid_exe = lit.util.which('lit-cpuid', config.lldb_tools_dir)
+if cpuid_exe is None:
+lit_config.warning("lit-cpuid not found, tests requiring CPU 
extensions will be skipped")
+else:
+out, err, exitcode = lit.util.executeCommand([cpuid_exe])
+if exitcode == 0:
+for x in out.split():
+config.available_features.add('native-cpu-%s' % x)
+else:
+lit_config.warning("lit-cpuid failed: %s" % err)

Added: lldb/trunk/utils/lit-cpuid/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lit-cpuid/CMakeLists.txt?rev=359303&view=auto
==
--- lldb/trunk/utils/lit-cpuid/CMakeLists.txt (added)
+++ lldb/trunk/utils/lit-cpuid/CMakeLists.txt Fri Apr 26 06:21:46 2019
@@ -0,0 +1,5 @@
+add_llvm_utility(lit-cpuid
+  lit-cpuid.cpp
+  )
+
+target_link_libraries(lit-cpuid PRIVATE LLVMSupport)

Added: lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp?rev=359303&view=auto
==
--- lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp (added)
+++ lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp Fri Apr 26 06:21:46 2019
@@ -0,0 +1,33 @@
+//===- lit-cpuid.cpp - Get CPU feature flags for lit exported features 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// lit-cpuid obtains the feature list for the currently runnin

[Lldb-commits] [PATCH] D61073: [lldb] [lit] Add feature flags for native CPU features

2019-04-26 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359303: [lldb] [lit] Add feature flags for native CPU 
features (authored by mgorny, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61073?vs=196675&id=196839#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61073

Files:
  lldb/trunk/CMakeLists.txt
  lldb/trunk/lit/CMakeLists.txt
  lldb/trunk/lit/Register/x86-mm-xmm-read.test
  lldb/trunk/lit/lit.cfg.py
  lldb/trunk/utils/lit-cpuid/CMakeLists.txt
  lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp

Index: lldb/trunk/utils/lit-cpuid/CMakeLists.txt
===
--- lldb/trunk/utils/lit-cpuid/CMakeLists.txt
+++ lldb/trunk/utils/lit-cpuid/CMakeLists.txt
@@ -0,0 +1,5 @@
+add_llvm_utility(lit-cpuid
+  lit-cpuid.cpp
+  )
+
+target_link_libraries(lit-cpuid PRIVATE LLVMSupport)
Index: lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp
===
--- lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp
+++ lldb/trunk/utils/lit-cpuid/lit-cpuid.cpp
@@ -0,0 +1,33 @@
+//===- lit-cpuid.cpp - Get CPU feature flags for lit exported features ===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// lit-cpuid obtains the feature list for the currently running CPU, and outputs
+// those flags that are interesting for LLDB lit tests.
+//
+//===--===//
+
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/Host.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+int main(int argc, char **argv) {
+#if defined(__i386__) || defined(_M_IX86) || \
+defined(__x86_64__) || defined(_M_X64)
+  StringMap features;
+
+  if (!sys::getHostCPUFeatures(features))
+return 1;
+
+  if (features["sse"])
+outs() << "sse\n";
+#endif
+
+  return 0;
+}
Index: lldb/trunk/lit/Register/x86-mm-xmm-read.test
===
--- lldb/trunk/lit/Register/x86-mm-xmm-read.test
+++ lldb/trunk/lit/Register/x86-mm-xmm-read.test
@@ -1,6 +1,6 @@
 # XFAIL: system-darwin
 # XFAIL: system-windows
-# REQUIRES: native && (target-x86 || target-x86_64)
+# REQUIRES: native && (target-x86 || target-x86_64) && native-cpu-sse
 # RUN: %clangxx %p/Inputs/x86-mm-xmm-read.cpp -o %t
 # RUN: %lldb -b -s %s %t | FileCheck %s
 process launch
Index: lldb/trunk/lit/CMakeLists.txt
===
--- lldb/trunk/lit/CMakeLists.txt
+++ lldb/trunk/lit/CMakeLists.txt
@@ -20,6 +20,7 @@
 list(APPEND LLDB_TEST_DEPS
   LLDBUnitTests
   dsymutil
+  lit-cpuid
   llc
   lldb
   lldb-test
Index: lldb/trunk/lit/lit.cfg.py
===
--- lldb/trunk/lit/lit.cfg.py
+++ lldb/trunk/lit/lit.cfg.py
@@ -73,3 +73,17 @@
 if os.path.isdir(cachedir):
 print("Deleting module cache at %s."%cachedir)
 shutil.rmtree(cachedir)
+
+# If running tests natively, check for CPU features needed for some tests.
+
+if 'native' in config.available_features:
+cpuid_exe = lit.util.which('lit-cpuid', config.lldb_tools_dir)
+if cpuid_exe is None:
+lit_config.warning("lit-cpuid not found, tests requiring CPU extensions will be skipped")
+else:
+out, err, exitcode = lit.util.executeCommand([cpuid_exe])
+if exitcode == 0:
+for x in out.split():
+config.available_features.add('native-cpu-%s' % x)
+else:
+lit_config.warning("lit-cpuid failed: %s" % err)
Index: lldb/trunk/CMakeLists.txt
===
--- lldb/trunk/CMakeLists.txt
+++ lldb/trunk/CMakeLists.txt
@@ -138,6 +138,7 @@
   add_subdirectory(test)
   add_subdirectory(unittests)
   add_subdirectory(lit)
+  add_subdirectory(utils/lit-cpuid)
   add_subdirectory(utils/lldb-dotest)
 endif()
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61074: [lldb] [lit] Add register read tests for YMM registers (AVX)

2019-04-26 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB359304: [lldb] [lit] Add register read tests for YMM 
registers (AVX) (authored by mgorny, committed by ).
Herald added a subscriber: teemperor.
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D61074?vs=196714&id=196840#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61074

Files:
  lit/Register/Inputs/x86-ymm-read.cpp
  lit/Register/x86-64-ymm-read.test
  lit/Register/x86-ymm-read.test
  utils/lit-cpuid/lit-cpuid.cpp

Index: lit/Register/x86-64-ymm-read.test
===
--- lit/Register/x86-64-ymm-read.test
+++ lit/Register/x86-64-ymm-read.test
@@ -0,0 +1,39 @@
+# XFAIL: system-windows
+# REQUIRES: native && target-x86_64 && native-cpu-avx
+# RUN: %clangxx %p/Inputs/x86-ymm-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: xmm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}
+# CHECK-DAG: xmm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}
+# CHECK-DAG: xmm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}
+# CHECK-DAG: xmm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}
+# CHECK-DAG: xmm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43}
+# CHECK-DAG: xmm5 = {0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53}
+# CHECK-DAG: xmm6 = {0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63}
+# CHECK-DAG: xmm7 = {0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73}
+# CHECK-DAG: xmm8 = {0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 0x8a 0x88 0x86 0x84 0x82}
+# CHECK-DAG: xmm9 = {0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 0x9a 0x98 0x96 0x94 0x92}
+# CHECK-DAG: xmm10 = {0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 0xaa 0xa8 0xa6 0xa4 0xa2}
+# CHECK-DAG: xmm11 = {0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 0xba 0xb8 0xb6 0xb4 0xb2}
+# CHECK-DAG: xmm12 = {0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 0xca 0xc8 0xc6 0xc4 0xc2}
+# CHECK-DAG: xmm13 = {0xd0 0xdf 0xdd 0xdb 0xd9 0xd7 0xd5 0xd3 0xd1 0xde 0xdc 0xda 0xd8 0xd6 0xd4 0xd2}
+# CHECK-DAG: xmm14 = {0xe0 0xef 0xed 0xeb 0xe9 0xe7 0xe5 0xe3 0xe1 0xee 0xec 0xea 0xe8 0xe6 0xe4 0xe2}
+# CHECK-DAG: xmm15 = {0xf0 0xff 0xfd 0xfb 0xf9 0xf7 0xf5 0xf3 0xf1 0xfe 0xfc 0xfa 0xf8 0xf6 0xf4 0xf2}
+# CHECK-DAG: ymm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03 0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 0x8a 0x88 0x86 0x84 0x82}
+# CHECK-DAG: ymm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13 0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 0x9a 0x98 0x96 0x94 0x92}
+# CHECK-DAG: ymm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23 0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 0xaa 0xa8 0xa6 0xa4 0xa2}
+# CHECK-DAG: ymm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33 0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 0xba 0xb8 0xb6 0xb4 0xb2}
+# CHECK-DAG: ymm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43 0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 0xca 0xc8 0xc6 0xc4 0xc2}
+# CHECK-DAG: ymm5 = {0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53 0xd0 0xdf 0xdd 0xdb 0xd9 0xd7 0xd5 0xd3 0xd1 0xde 0xdc 0xda 0xd8 0xd6 0xd4 0xd2}
+# CHECK-DAG: ymm6 = {0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63 0xe0 0xef 0xed 0xeb 0xe9 0xe7 0xe5 0xe3 0xe1 0xee 0xec 0xea 0xe8 0xe6 0xe4 0xe2}
+# CHECK-DAG: ymm7 = {0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73 0xf0 0xff 0xfd 0xfb 0xf9 0xf7 0xf5 0xf3 0xf1 0xfe 0xfc 0xfa 0xf8 0xf6 0xf4 0xf2}
+# CHECK-DAG: ymm8 = {0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 0x8a 0x88 0x86 0x84 0x82 0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}
+# CHECK-DAG: ymm9 = {0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 0x9a 0x98 0x96 0x94 0x92 0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}
+# CHECK-DAG: ymm10 = {0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 0xaa 0xa8 0xa6 0xa4 0xa2 0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}
+# CHECK-DAG: ymm11 = {0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 0xba 0xb8 0xb6 0xb4 0xb2 0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}
+# CHECK-DAG: ymm12 = {0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 0xca 0xc8 0xc6 0xc4 0xc2 0x4

[Lldb-commits] [PATCH] D61191: Editline: Fix an msan error

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: christos, krytarowski, davide.

Despite the documentation for the el_get(EL_GETTC) function claiming the
vararg part is (const char *name, void *value), in reality the function
expects the vararg list to be terminated by a null pointer, which can be
clearly seen by examining the source code. Although this is mostly
bening because the extra values are not used it any way, it still lights
up as an error when running the tests under msan.

Work around this quirk by adding an explicit nullptr to the end of the
argument list.


https://reviews.llvm.org/D61191

Files:
  source/Host/common/Editline.cpp


Index: source/Host/common/Editline.cpp
===
--- source/Host/common/Editline.cpp
+++ source/Host/common/Editline.cpp
@@ -1215,9 +1215,11 @@
   if (m_editline != nullptr) {
 el_resize(m_editline);
 int columns;
-// Despite the man page claiming non-zero indicates success, it's actually
-// zero
-if (el_get(m_editline, EL_GETTC, "co", &columns) == 0) {
+// Mac man page claims non-zero indicates success, but it's actually
+// zero. Additionally, all manpages document the varargs part of this
+// function as (const char *name, void *value), but in reality the source
+// code expects the vararg list to be terminated by a null pointer.
+if (el_get(m_editline, EL_GETTC, "co", &columns, nullptr) == 0) {
   m_terminal_width = columns;
   if (m_current_line_rows != -1) {
 const LineInfoW *info = el_wline(m_editline);


Index: source/Host/common/Editline.cpp
===
--- source/Host/common/Editline.cpp
+++ source/Host/common/Editline.cpp
@@ -1215,9 +1215,11 @@
   if (m_editline != nullptr) {
 el_resize(m_editline);
 int columns;
-// Despite the man page claiming non-zero indicates success, it's actually
-// zero
-if (el_get(m_editline, EL_GETTC, "co", &columns) == 0) {
+// Mac man page claims non-zero indicates success, but it's actually
+// zero. Additionally, all manpages document the varargs part of this
+// function as (const char *name, void *value), but in reality the source
+// code expects the vararg list to be terminated by a null pointer.
+if (el_get(m_editline, EL_GETTC, "co", &columns, nullptr) == 0) {
   m_terminal_width = columns;
   if (m_current_line_rows != -1) {
 const LineInfoW *info = el_wline(m_editline);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61191: Editline: Fix an msan error

2019-04-26 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

You can see the relevant part of the source code here 
https://github.com/cdesjardins/libedit/blob/master/src/eln.c#L310 (not the 
canonical source, but at least it's easy to link to).

@christos, any chance of getting this fixed (either the docs, or the source 
code)?


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

https://reviews.llvm.org/D61191



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


[Lldb-commits] [PATCH] D61191: Editline: Fix an msan error

2019-04-26 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 but this should really be fixed upstream (in libedit)


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

https://reviews.llvm.org/D61191



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


[Lldb-commits] [lldb] r359319 - Replace local utility class OnExit with llvm::scope_exit (NFC)

2019-04-26 Thread Tatyana Krasnukha via lldb-commits
Author: tkrasnukha
Date: Fri Apr 26 09:41:04 2019
New Revision: 359319

URL: http://llvm.org/viewvc/llvm-project?rev=359319&view=rev
Log:
Replace local utility class OnExit with llvm::scope_exit (NFC)

Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp

Modified: 
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp?rev=359319&r1=359318&r2=359319&view=diff
==
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
(original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp 
Fri Apr 26 09:41:04 2019
@@ -56,6 +56,8 @@
 #include "clang/AST/DeclCXX.h"
 #include "clang/AST/DeclObjC.h"
 
+#include "llvm/ADT/ScopeExit.h"
+
 using namespace lldb_private;
 
 ClangUserExpression::ClangUserExpression(
@@ -328,21 +330,6 @@ static void ApplyObjcCastHack(std::strin
 #undef OBJC_CAST_HACK_FROM
 }
 
-namespace {
-// Utility guard that calls a callback when going out of scope.
-class OnExit {
-public:
-  typedef std::function Callback;
-
-  OnExit(Callback const &callback) : m_callback(callback) {}
-
-  ~OnExit() { m_callback(); }
-
-private:
-  Callback m_callback;
-};
-} // namespace
-
 bool ClangUserExpression::SetupPersistentState(DiagnosticManager 
&diagnostic_manager,
  ExecutionContext &exe_ctx) {
   if (Target *target = exe_ctx.GetTargetPtr()) {
@@ -560,7 +547,7 @@ bool ClangUserExpression::Parse(Diagnost
 
   ResetDeclMap(exe_ctx, m_result_delegate, keep_result_in_memory);
 
-  OnExit on_exit([this]() { ResetDeclMap(); });
+  auto on_exit = llvm::make_scope_exit([this]() { ResetDeclMap(); });
 
   if (!DeclMap()->WillParse(exe_ctx, m_materializer_up.get())) {
 diagnostic_manager.PutString(
@@ -748,7 +735,7 @@ bool ClangUserExpression::Complete(Execu
 
   ResetDeclMap(exe_ctx, m_result_delegate, /*keep result in memory*/ true);
 
-  OnExit on_exit([this]() { ResetDeclMap(); });
+  auto on_exit = llvm::make_scope_exit([this]() { ResetDeclMap(); });
 
   if (!DeclMap()->WillParse(exe_ctx, m_materializer_up.get())) {
 diagnostic_manager.PutString(


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


[Lldb-commits] [PATCH] D56229: [PECOFF] Implementation of ObjectFilePECOFF:: GetUUID()

2019-04-26 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 196874.

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

https://reviews.llvm.org/D56229

Files:
  lit/Modules/PECOFF/export-dllfunc.yaml
  lit/Modules/PECOFF/uuid.yaml
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
  source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h

Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
===
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -286,6 +286,8 @@
   llvm::Optional m_deps_filespec;
   typedef llvm::object::OwningBinary OWNBINType;
   llvm::Optional m_owningbin;
+
+  lldb_private::UUID m_uuid;
 };
 
 #endif // liblldb_ObjectFilePECOFF_h_
Index: source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
===
--- source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -40,6 +40,54 @@
 using namespace lldb;
 using namespace lldb_private;
 
+struct CVInfoPdb70 {
+  // 16-byte GUID
+  struct _Guid {
+llvm::support::ulittle32_t Data1;
+llvm::support::ulittle16_t Data2;
+llvm::support::ulittle16_t Data3;
+uint8_t Data4[8];
+  } Guid;
+
+  llvm::support::ulittle32_t Age;
+};
+
+static UUID GetCoffUUID(llvm::object::COFFObjectFile *coff_obj) {
+  if (!coff_obj)
+return UUID();
+
+  const llvm::codeview::DebugInfo *pdb_info = nullptr;
+  llvm::StringRef pdb_file;
+
+  // This part is similar with what has done in minidump parser.
+  if (!coff_obj->getDebugPDBInfo(pdb_info, pdb_file) && pdb_info) {
+if (pdb_info->PDB70.CVSignature == llvm::OMF::Signature::PDB70) {
+  using llvm::support::endian::read16be;
+  using llvm::support::endian::read32be;
+
+  const uint8_t *sig = pdb_info->PDB70.Signature;
+  struct CVInfoPdb70 info;
+  info.Guid.Data1 = read32be(sig);
+  sig += 4;
+  info.Guid.Data2 = read16be(sig);
+  sig += 2;
+  info.Guid.Data3 = read16be(sig);
+  sig += 2;
+  memcpy(info.Guid.Data4, sig, 8);
+
+  // Return 20-byte UUID if the Age is not zero
+  if (pdb_info->PDB70.Age) {
+info.Age = read32be(&pdb_info->PDB70.Age);
+return UUID::fromOptionalData((uint8_t *)&info, sizeof(info));
+  }
+  // Otherwise return 16-byte GUID
+  return UUID::fromOptionalData((uint8_t *)&info.Guid, sizeof(info.Guid));
+}
+  }
+
+  return UUID();
+}
+
 void ObjectFilePECOFF::Initialize() {
   PluginManager::RegisterPlugin(
   GetPluginNameStatic(), GetPluginDescriptionStatic(), CreateInstance,
@@ -113,36 +161,44 @@
 lldb::offset_t data_offset, lldb::offset_t file_offset,
 lldb::offset_t length, lldb_private::ModuleSpecList &specs) {
   const size_t initial_count = specs.GetSize();
+  if (!data_sp || !ObjectFilePECOFF::MagicBytesMatch(data_sp))
+return initial_count;
 
-  if (ObjectFilePECOFF::MagicBytesMatch(data_sp)) {
-DataExtractor data;
-data.SetData(data_sp, data_offset, length);
-data.SetByteOrder(eByteOrderLittle);
+  auto binary = llvm::object::createBinary(file.GetPath());
+  if (!binary)
+return initial_count;
 
-dos_header_t dos_header;
-coff_header_t coff_header;
+  if (!binary->getBinary()->isCOFF() &&
+  !binary->getBinary()->isCOFFImportFile())
+return initial_count;
 
-if (ParseDOSHeader(data, dos_header)) {
-  lldb::offset_t offset = dos_header.e_lfanew;
-  uint32_t pe_signature = data.GetU32(&offset);
-  if (pe_signature != IMAGE_NT_SIGNATURE)
-return false;
-  if (ParseCOFFHeader(data, &offset, coff_header)) {
-ArchSpec spec;
-if (coff_header.machine == MachineAmd64) {
-  spec.SetTriple("x86_64-pc-windows");
-  specs.Append(ModuleSpec(file, spec));
-} else if (coff_header.machine == MachineX86) {
-  spec.SetTriple("i386-pc-windows");
-  specs.Append(ModuleSpec(file, spec));
-  spec.SetTriple("i686-pc-windows");
-  specs.Append(ModuleSpec(file, spec));
-} else if (coff_header.machine == MachineArmNt) {
-  spec.SetTriple("arm-pc-windows");
-  specs.Append(ModuleSpec(file, spec));
-}
-  }
-}
+  auto COFFObj =
+  llvm::dyn_cast(binary->getBinary());
+  assert(COFFObj);
+
+  ModuleSpec module_spec(file);
+  ArchSpec &spec = module_spec.GetArchitecture();
+  lldb_private::UUID &uuid = module_spec.GetUUID();
+  if (!uuid.IsValid())
+uuid = GetCoffUUID(COFFObj);
+
+  switch (COFFObj->getMachine()) {
+  case MachineAmd64:
+spec.SetTriple("x86_64-pc-windows");
+specs.Append(module_spec);
+break;
+  case MachineX86:
+spec.SetTriple("i386-pc-windows");
+specs.Append(module_spec);
+spec.SetTriple("i686-pc-windows");
+specs.Append(module_spec);
+break;
+  case MachineArmNt:
+spec.SetTriple("arm-pc-windows");
+specs.Append(module_spec);

Re: [Lldb-commits] [PATCH] D61191: Editline: Fix an msan error

2019-04-26 Thread Christos Zoulas via lldb-commits
On Apr 26,  3:11pm, revi...@reviews.llvm.org (Pavel Labath via Phabricator) 
wrote:
-- Subject: [PATCH] D61191: Editline: Fix an msan error

| 
| --b1_b299efcc557883c5ff30a5eebc16e12b
| Content-Type: text/plain; charset=us-ascii
| Content-Transfer-Encoding: quoted-printable
| 
| labath created this revision.
| labath added reviewers: christos, krytarowski, davide.
| 
| Despite the documentation for the el_get(EL_GETTC) function claiming the
| vararg part is (const char *name, void *value), in reality the function
| expects the vararg list to be terminated by a null pointer, which can be
| clearly seen by examining the source code. Although this is mostly
| bening because the extra values are not used it any way, it still lights
| up as an error when running the tests under msan.
| 
| Work around this quirk by adding an explicit nullptr to the end of the
| argument list.
| 
| 
| https://reviews.llvm.org/D61191

fixed, thanks!

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


[Lldb-commits] [PATCH] D61172: [ScriptInterpreter] Pass the debugger instead of the command interpreter

2019-04-26 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Looks good to me too.  The fact that you were mostly eliminating redirections 
from CommandInterpreter -> Debugger is good evidence this was wrongly 
structured initially.

I'm a little curious that we do:

  m_debugger.GetCommandInterpreter().GetPythonCommandsFromIOHandler

to read "break command add -s python" command text.  Seems like the script 
interpreter IO handler should do this otherwise the Command Interpreter has to 
know the right way to do input for every script interpreter.  But I think 
that's a change for another patch.

This one seems pure goodness.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61172



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


Re: [Lldb-commits] [PATCH] D61090: [SBHostOS} Remove getting the python script interpreter path

2019-04-26 Thread Jim Ingham via lldb-commits


> On Apr 26, 2019, at 1:29 AM, Pavel Labath via Phabricator 
>  wrote:
> 
> labath added a comment.
> 
> In D61090#1479049 , @jingham wrote:
> 
>> I really thought there was one at the SB layer, because in terms of design 
>> that is what makes sense.  I guess we never really needed it until now, so 
>> we didn't add it.  Once there's more than one hard-coded script interpreter, 
>> we will need to add some way to select & direct scripts at the various 
>> script interpreters so we will need SBScriptInterpreter at the SB layer.  So 
>> maybe now is the time to add it in preparation...
>> 
>> Also, the fact that at the lldb_private layer, the ScriptInterpreter is held 
>> onto by the CommandInterpreter is clearly wrong.  The CommandInterpreter 
>> should have a member that tells it the currently selected ScriptInterpreter, 
>> but the list of script interpreters should belong to the Debugger.  We 
>> should probably disentangle that at the same time.
> 
> 
> Yes, it sounds like we should have a SBScriptInterpreter at some point. 
> Though, right now, it's not really clear to me what will it's exact role be, 
> so I would tend to agree with Greg that we wait until we have a real use case 
> for it (so we don't commit to a design we may want to change later).

At this point we could get away with adding is 
"SBDebugger::GetSelectedScriptInterpreter()" and 
"SBScriptInterpreter::GetLLDBScriptModulePath" - that would be sufficient to 
move the responsibility for finding this path to the correct place.  Those 
don't seem controversial to me.  I agree sketching in selecting interpreters 
and invoking scripts on the would not be a good choice till we have something 
more concrete to play with.  

> 
>> As an aside, IIUC, the current work to support either Python flavor only 
>> supports one interpreter at a time because Python doesn't support loading 
>> Python 2 & 3 into the same process?
> 
> I've heard someone say that, and I can believe that is the official party 
> line of the python project, but I haven't investigated how "true" that 
> statement is. E.g., I'm pretty sure we could get it to work by using some of 
> the fancier flags of dlopen (RTLD_LOCAL, or the new namespace thingies 
> present on linux), but that may take more effort than it's worth..
> 

Interesting.  If/when we get to supporting fairly different scripting 
languages, it will be important to be able to load them all to support "I got 
cool formatter in scripting language X from person A and another in language Y 
from person B and I need to use them in the same debugging session".  But for 
now it seems more likely you're either going to convert all your Python scripts 
from 2 -> 3 or leave them in 2, so this doesn't seem crucial for Python 
support.  The only use-case where this is slightly motivated is apps like Xcode 
that create many debug sessions in the same lldb binary.  This would force them 
to make a choice of 2 vrs. 3 for all sessions.

Jim


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

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


[Lldb-commits] [lldb] r359330 - [ScriptInterpreter] Pass the debugger instead of the command interpreter

2019-04-26 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Apr 26 10:58:19 2019
New Revision: 359330

URL: http://llvm.org/viewvc/llvm-project?rev=359330&view=rev
Log:
[ScriptInterpreter] Pass the debugger instead of the command interpreter

As discussed in D61090, there's no good reason for the script
interpreter to depend on the command interpreter. When looking at the
code, it becomes clear that we mostly use the command interpreter as a
way to access the debugger. Hence, it makes more sense to just pass that
to the script interpreter directly.

This is part 1 out of 2. I have another patch in the pipeline that
changes the ownership of the script interpreter to the debugger as well,
but I didn't get around to finish that today.

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

Modified:
lldb/trunk/include/lldb/Core/PluginManager.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/lldb-private-interfaces.h
lldb/trunk/source/Core/PluginManager.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h

Modified: lldb/trunk/include/lldb/Core/PluginManager.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/PluginManager.h?rev=359330&r1=359329&r2=359330&view=diff
==
--- lldb/trunk/include/lldb/Core/PluginManager.h (original)
+++ lldb/trunk/include/lldb/Core/PluginManager.h Fri Apr 26 10:58:19 2019
@@ -263,7 +263,7 @@ public:
 
   static lldb::ScriptInterpreterSP
   GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
-  CommandInterpreter &interpreter);
+  Debugger &debugger);
 
   // StructuredDataPlugin
 

Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=359330&r1=359329&r2=359330&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Fri Apr 26 10:58:19 
2019
@@ -52,8 +52,7 @@ public:
 eScriptReturnTypeOpaqueObject
   } ScriptReturnType;
 
-  ScriptInterpreter(CommandInterpreter &interpreter,
-lldb::ScriptLanguage script_lang);
+  ScriptInterpreter(Debugger &debugger, lldb::ScriptLanguage script_lang);
 
   ~ScriptInterpreter() override;
 
@@ -247,7 +246,7 @@ public:
lldb::BreakpointSP &bkpt_sp) {
 return StructuredData::GenericSP();
   }
-  
+
   virtual bool
   ScriptedBreakpointResolverSearchCallback(StructuredData::GenericSP 
implementor_sp,
SymbolContext *sym_ctx)
@@ -460,8 +459,6 @@ public:
 
   int GetMasterFileDescriptor();
 
-  CommandInterpreter &GetCommandInterpreter();
-
   static std::string LanguageToString(lldb::ScriptLanguage language);
 
   static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string);
@@ -471,7 +468,7 @@ public:
   lldb::ScriptLanguage GetLanguage() { return m_script_lang; }
 
 protected:
-  CommandInterpreter &m_interpreter;
+  Debugger &m_debugger;
   lldb::ScriptLanguage m_script_lang;
 };
 

Modified: lldb/trunk/include/lldb/lldb-private-interfaces.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-private-interfaces.h?rev=359330&r1=359329&r2=359330&view=diff
==
--- lldb/trunk/include/lldb/lldb-private-interfaces.h (original)
+++ lldb/trunk/include/lldb/lldb-private-interfaces.h Fri Apr 26 10:58:19 2019
@@ -66,7 +66,7 @@ typedef lldb::ProcessSP (*ProcessCreateI
 lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
 const FileSpec *crash_file_path);
 typedef lldb::ScriptInterpreterSP (*ScriptInterpreterCreateInstance)(
-CommandInterpreter &interpreter);
+Debugger &debugger);
 typedef SymbolFile *(*SymbolFileCreateInstance)(ObjectFile *obj_file);
 typedef SymbolVendor *(*SymbolVendorCreateInstance)(
 const lldb::ModuleSP &module_sp,

Modified: lldb/trunk/source/Core/PluginManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/PluginManager.cpp?rev=359330&r1=359329&r2=359330&view=diff
==
--- lldb/trunk/source/Core/PluginManager.cpp (original)
+++ lldb/trunk/source/Core/PluginManager.cpp Fri Apr 26 10:58:1

[Lldb-commits] [PATCH] D61172: [ScriptInterpreter] Pass the debugger instead of the command interpreter

2019-04-26 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

Oops, forgot to do the action part of this...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61172



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


[Lldb-commits] [PATCH] D61172: [ScriptInterpreter] Pass the debugger instead of the command interpreter

2019-04-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL359330: [ScriptInterpreter] Pass the debugger instead of the 
command interpreter (authored by JDevlieghere, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61172?vs=196796&id=196885#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61172

Files:
  lldb/trunk/include/lldb/Core/PluginManager.h
  lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
  lldb/trunk/include/lldb/lldb-private-interfaces.h
  lldb/trunk/source/Core/PluginManager.cpp
  lldb/trunk/source/Interpreter/CommandInterpreter.cpp
  lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.h
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
  
lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h

Index: lldb/trunk/source/Core/PluginManager.cpp
===
--- lldb/trunk/source/Core/PluginManager.cpp
+++ lldb/trunk/source/Core/PluginManager.cpp
@@ -1516,8 +1516,9 @@
   return nullptr;
 }
 
-lldb::ScriptInterpreterSP PluginManager::GetScriptInterpreterForLanguage(
-lldb::ScriptLanguage script_lang, CommandInterpreter &interpreter) {
+lldb::ScriptInterpreterSP
+PluginManager::GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
+   Debugger &debugger) {
   std::lock_guard guard(GetScriptInterpreterMutex());
   ScriptInterpreterInstances &instances = GetScriptInterpreterInstances();
 
@@ -1528,12 +1529,12 @@
   none_instance = pos->create_callback;
 
 if (script_lang == pos->language)
-  return pos->create_callback(interpreter);
+  return pos->create_callback(debugger);
   }
 
   // If we didn't find one, return the ScriptInterpreter for the null language.
   assert(none_instance != nullptr);
-  return none_instance(interpreter);
+  return none_instance(debugger);
 }
 
 #pragma mark -
Index: lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
===
--- lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
+++ lldb/trunk/source/Interpreter/ScriptInterpreter.cpp
@@ -21,16 +21,12 @@
 using namespace lldb;
 using namespace lldb_private;
 
-ScriptInterpreter::ScriptInterpreter(CommandInterpreter &interpreter,
+ScriptInterpreter::ScriptInterpreter(Debugger &debugger,
  lldb::ScriptLanguage script_lang)
-: m_interpreter(interpreter), m_script_lang(script_lang) {}
+: m_debugger(debugger), m_script_lang(script_lang) {}
 
 ScriptInterpreter::~ScriptInterpreter() {}
 
-CommandInterpreter &ScriptInterpreter::GetCommandInterpreter() {
-  return m_interpreter;
-}
-
 void ScriptInterpreter::CollectDataForBreakpointCommandCallback(
 std::vector &bp_options_vec,
 CommandReturnObject &result) {
Index: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
===
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp
@@ -2507,7 +2507,7 @@
   return nullptr;
 lldb::ScriptLanguage script_lang = GetDebugger().GetScriptLanguage();
 m_script_interpreter_sp =
-PluginManager::GetScriptInterpreterForLanguage(script_lang, *this);
+PluginManager::GetScriptInterpreterForLanguage(script_lang, m_debugger);
   }
   return m_script_interpreter_sp.get();
 }
Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
===
--- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
+++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h
@@ -29,7 +29,7 @@
 public:
   friend class IOHandlerPythonInterpreter;
 
-  ScriptInterpreterPythonImpl(CommandInterpreter &interpreter);
+  ScriptInterpreterPythonImpl(Debugger &debugger);
 
   ~ScriptInterpreterPythonImpl() override;
 
@@ -273,8 +273,7 @@
   void IOHandlerInputComplete(IOHandler &io_handler,
   std::string &data) override;
 
-  static lldb::ScriptInterpreterSP
-  CreateInstance(CommandInterpreter &interpreter);
+  static lldb::ScriptInterpreterSP CreateInstance(Debugger &debugger);
 
   // PluginInterface protocol
   lldb_private::ConstString GetPluginName() override;
Index: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
===
--- lldb/trunk/source/Plugins/Sc

[Lldb-commits] [lldb] r359346 - [CommandInterpreter] Remove scripting language argument. (NFC)

2019-04-26 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Apr 26 13:03:22 2019
New Revision: 359346

URL: http://llvm.org/viewvc/llvm-project?rev=359346&view=rev
Log:
[CommandInterpreter] Remove scripting language argument. (NFC)

The script language argument was passed from the debugger to the command
interpreter, only to call SetScriptLanguage on the debugger again. It
wasn't even used to initialize the script interpreter, because that
would query the debugger again. This patch removes the needless back and
forth.

Modified:
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=359346&r1=359345&r2=359346&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Fri Apr 26 
13:03:22 2019
@@ -188,8 +188,7 @@ public:
 eCommandTypesAllThem = 0x  // all commands
   };
 
-  CommandInterpreter(Debugger &debugger, lldb::ScriptLanguage script_language,
- bool synchronous_execution);
+  CommandInterpreter(Debugger &debugger, bool synchronous_execution);
 
   ~CommandInterpreter() override;
 
@@ -372,8 +371,6 @@ public:
 
   void Clear();
 
-  void SetScriptLanguage(lldb::ScriptLanguage lang);
-
   bool HasCommands() const;
 
   bool HasAliases() const;

Modified: lldb/trunk/source/Core/Debugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Debugger.cpp?rev=359346&r1=359345&r2=359346&view=diff
==
--- lldb/trunk/source/Core/Debugger.cpp (original)
+++ lldb/trunk/source/Core/Debugger.cpp Fri Apr 26 13:03:22 2019
@@ -765,8 +765,8 @@ Debugger::Debugger(lldb::LogOutputCallba
   m_terminal_state(), m_target_list(*this), m_platform_list(),
   m_listener_sp(Listener::MakeListener("lldb.Debugger")),
   m_source_manager_up(), m_source_file_cache(),
-  m_command_interpreter_up(llvm::make_unique(
-  *this, eScriptLanguageDefault, false)),
+  m_command_interpreter_up(
+  llvm::make_unique(*this, false)),
   m_input_reader_stack(), m_instance_name(), m_loaded_plugins(),
   m_event_handler_thread(), m_io_handler_thread(),
   m_sync_broadcaster(nullptr, "lldb.debugger.sync"),

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=359346&r1=359345&r2=359346&view=diff
==
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Apr 26 13:03:22 
2019
@@ -122,7 +122,6 @@ ConstString &CommandInterpreter::GetStat
 }
 
 CommandInterpreter::CommandInterpreter(Debugger &debugger,
-   ScriptLanguage script_language,
bool synchronous_execution)
 : Broadcaster(debugger.GetBroadcasterManager(),
   CommandInterpreter::GetStaticBroadcasterClass().AsCString()),
@@ -135,7 +134,6 @@ CommandInterpreter::CommandInterpreter(D
   m_batch_command_mode(false), m_truncation_warning(eNoTruncation),
   m_command_source_depth(0), m_num_errors(0), m_quit_requested(false),
   m_stopped_for_crash(false) {
-  debugger.SetScriptLanguage(script_language);
   SetEventName(eBroadcastBitThreadShouldExit, "thread-should-exit");
   SetEventName(eBroadcastBitResetPrompt, "reset-prompt");
   SetEventName(eBroadcastBitQuitCommandReceived, "quit");


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


[Lldb-commits] [lldb] r359347 - TestZMMRegister: use an integer division as intended

2019-04-26 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Apr 26 13:23:55 2019
New Revision: 359347

URL: http://llvm.org/viewvc/llvm-project?rev=359347&view=rev
Log:
TestZMMRegister: use an integer division as intended

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py?rev=359347&r1=359346&r2=359347&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
 Fri Apr 26 13:23:55 2019
@@ -62,7 +62,7 @@ class TestYMMRegister(TestBase):
 else:
 register_range = 8
 for i in range(register_range):
-j = i - ((i / 8) * 8)
+j = i - ((i // 8) * 8)
 self.runCmd("thread step-inst")
 
 register_byte = (byte_pattern1 | j)
@@ -104,7 +104,7 @@ class TestYMMRegister(TestBase):
 else:
 register_range = 8
 for i in range(register_range):
-j = i - ((i / 8) * 8)
+j = i - ((i // 8) * 8)
 self.runCmd("thread step-inst")
 self.runCmd("thread step-inst")
 


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


[Lldb-commits] [PATCH] D61210: [lldb] [lit] Introduce tests for reading x86 general purpose registers

2019-04-26 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, krytarowski.

Introduce tests for reading the eight x86 general purpose registers,
i.e. RAX/RBX/RCX/RDX/RBP/RSP/RSI/RDI and their shorter counterparts.
The test comes in separate 32-bit and 64-bit variant, targeting
appropriate processors.

While technically the 32-bit test could run on amd64, it would be
redundant to the 64-bit version, so just run one of them on each arch.


https://reviews.llvm.org/D61210

Files:
  lldb/lit/Register/Inputs/x86-64-gp-read.cpp
  lldb/lit/Register/Inputs/x86-gp-read.cpp
  lldb/lit/Register/x86-64-gp-read.test
  lldb/lit/Register/x86-gp-read.test

Index: lldb/lit/Register/x86-gp-read.test
===
--- /dev/null
+++ lldb/lit/Register/x86-gp-read.test
@@ -0,0 +1,31 @@
+# XFAIL: system-windows
+# REQUIRES: native && target-x86
+# RUN: %clangxx %p/Inputs/x86-gp-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: eax = 0x05060708
+# CHECK-DAG: ebx = 0x15161718
+# CHECK-DAG: ecx = 0x25262728
+# CHECK-DAG: edx = 0x35363738
+# CHECK-DAG: edi = 0x75767778
+# CHECK-DAG: esi = 0x65666768
+# CHECK-DAG: ebp = 0x55565758
+# CHECK-DAG: esp = 0x45464748
+# CHECK-DAG: ax = 0x0708
+# CHECK-DAG: bx = 0x1718
+# CHECK-DAG: cx = 0x2728
+# CHECK-DAG: dx = 0x3738
+# CHECK-DAG: di = 0x7778
+# CHECK-DAG: si = 0x6768
+# CHECK-DAG: bp = 0x5758
+# CHECK-DAG: sp = 0x4748
+# CHECK-DAG: ah = 0x07
+# CHECK-DAG: bh = 0x17
+# CHECK-DAG: ch = 0x27
+# CHECK-DAG: dh = 0x37
+# CHECK-DAG: al = 0x08
+# CHECK-DAG: bl = 0x18
+# CHECK-DAG: cl = 0x28
+# CHECK-DAG: dl = 0x38
Index: lldb/lit/Register/x86-64-gp-read.test
===
--- /dev/null
+++ lldb/lit/Register/x86-64-gp-read.test
@@ -0,0 +1,39 @@
+# XFAIL: system-windows
+# REQUIRES: native && target-x86_64
+# RUN: %clangxx %p/Inputs/x86-64-gp-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: rax = 0x0102030405060708
+# CHECK-DAG: rbx = 0x1112131415161718
+# CHECK-DAG: rcx = 0x2122232425262728
+# CHECK-DAG: rdx = 0x3132333435363738
+# CHECK-DAG: rdi = 0x7172737475767778
+# CHECK-DAG: rsi = 0x6162636465666768
+# CHECK-DAG: rbp = 0x5152535455565758
+# CHECK-DAG: rsp = 0x4142434445464748
+# CHECK-DAG: eax = 0x05060708
+# CHECK-DAG: ebx = 0x15161718
+# CHECK-DAG: ecx = 0x25262728
+# CHECK-DAG: edx = 0x35363738
+# CHECK-DAG: edi = 0x75767778
+# CHECK-DAG: esi = 0x65666768
+# CHECK-DAG: ebp = 0x55565758
+# CHECK-DAG: esp = 0x45464748
+# CHECK-DAG: ax = 0x0708
+# CHECK-DAG: bx = 0x1718
+# CHECK-DAG: cx = 0x2728
+# CHECK-DAG: dx = 0x3738
+# CHECK-DAG: di = 0x7778
+# CHECK-DAG: si = 0x6768
+# CHECK-DAG: bp = 0x5758
+# CHECK-DAG: sp = 0x4748
+# CHECK-DAG: ah = 0x07
+# CHECK-DAG: bh = 0x17
+# CHECK-DAG: ch = 0x27
+# CHECK-DAG: dh = 0x37
+# CHECK-DAG: al = 0x08
+# CHECK-DAG: bl = 0x18
+# CHECK-DAG: cl = 0x28
+# CHECK-DAG: dl = 0x38
Index: lldb/lit/Register/Inputs/x86-gp-read.cpp
===
--- /dev/null
+++ lldb/lit/Register/Inputs/x86-gp-read.cpp
@@ -0,0 +1,31 @@
+#include 
+
+int main() {
+  constexpr uint32_t eax = 0x05060708;
+  constexpr uint32_t ebx = 0x15161718;
+  constexpr uint32_t ecx = 0x25262728;
+  constexpr uint32_t edx = 0x35363738;
+  constexpr uint32_t esp = 0x45464748;
+  constexpr uint32_t ebp = 0x55565758;
+  constexpr uint32_t esi = 0x65666768;
+  constexpr uint32_t edi = 0x75767778;
+
+  asm volatile(
+"movl%0, %%eax\n\t"
+"movl%1, %%ebx\n\t"
+"movl%2, %%ecx\n\t"
+"movl%3, %%edx\n\t"
+"movl%4, %%esp\n\t"
+"movl%5, %%ebp\n\t"
+"movl%6, %%esi\n\t"
+"movl%7, %%edi\n\t"
+"\n\t"
+"int3"
+:
+: "i"(eax), "i"(ebx), "i"(ecx), "i"(edx), "i"(esp), "i"(ebp), "i"(esi),
+  "i"(edi)
+: "%eax", "%ebx", "%ecx", "%edx", "%esp", "%ebp", "%esi", "%edi"
+  );
+
+  return 0;
+}
Index: lldb/lit/Register/Inputs/x86-64-gp-read.cpp
===
--- /dev/null
+++ lldb/lit/Register/Inputs/x86-64-gp-read.cpp
@@ -0,0 +1,31 @@
+#include 
+
+int main() {
+  constexpr uint64_t rax = 0x0102030405060708;
+  constexpr uint64_t rbx = 0x1112131415161718;
+  constexpr uint64_t rcx = 0x2122232425262728;
+  constexpr uint64_t rdx = 0x3132333435363738;
+  constexpr uint64_t rsp = 0x4142434445464748;
+  constexpr uint64_t rbp = 0x5152535455565758;
+  constexpr uint64_t rsi = 0x6162636465666768;
+  constexpr uint64_t rdi = 0x7172737475767778;
+
+  asm volatile(
+"movq%0, %%rax\n\t"
+"movq%1, %%rbx\n\t"
+"movq%2, %%rcx\n\t"
+"movq%3, %%rdx\n\t"
+"movq%4, %%rsp\n\t"
+"movq%5, %%rbp\n\t"
+"movq%6, %%rsi\n\t"
+"movq%7, %%rdi\n\t"
+"\n\t"
+"int3"
+:
+: "i"(rax), "i"(rbx), "i"(rcx), "i"(rdx), "i"(rsp), "i"(rbp), "i"(rsi),
+  "i"(rdi)
+ 

[Lldb-commits] [PATCH] D61211: [ScriptInterpreter] Move ownership into debugger (NFC)

2019-04-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added a reviewer: jingham.
Herald added a project: LLDB.

This is part two of the change started in r359330. This patch moves the 
ownership of the script interpreter from the command interpreter into the 
debugger. I would've preferred to remove the lazy initialization,  however the 
fact that the scripting language is set after the debugger is created makes 
that tricky. So for now this does exactly the same thing as when it was under 
the command interpreter. The result is that this patch is fully NFC.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61211

Files:
  lldb/include/lldb/Core/Debugger.h
  lldb/include/lldb/Interpreter/CommandInterpreter.h
  lldb/include/lldb/Interpreter/CommandObject.h
  lldb/source/API/SBBreakpoint.cpp
  lldb/source/API/SBBreakpointLocation.cpp
  lldb/source/API/SBBreakpointName.cpp
  lldb/source/API/SBTypeCategory.cpp
  lldb/source/Breakpoint/BreakpointOptions.cpp
  lldb/source/Breakpoint/BreakpointResolverScripted.cpp
  lldb/source/Commands/CommandObjectBreakpointCommand.cpp
  lldb/source/Commands/CommandObjectCommands.cpp
  lldb/source/Commands/CommandObjectFrame.cpp
  lldb/source/Commands/CommandObjectThread.cpp
  lldb/source/Commands/CommandObjectType.cpp
  lldb/source/Commands/CommandObjectWatchpointCommand.cpp
  lldb/source/Core/Debugger.cpp
  lldb/source/Core/FormatEntity.cpp
  lldb/source/Core/Module.cpp
  lldb/source/DataFormatters/TypeSummary.cpp
  lldb/source/DataFormatters/TypeSynthetic.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Interpreter/CommandObject.cpp
  lldb/source/Interpreter/CommandObjectScript.cpp
  lldb/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Target/Target.cpp
  lldb/source/Target/ThreadPlanPython.cpp

Index: lldb/source/Target/ThreadPlanPython.cpp
===
--- lldb/source/Target/ThreadPlanPython.cpp
+++ lldb/source/Target/ThreadPlanPython.cpp
@@ -60,7 +60,6 @@
 ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
-   .GetCommandInterpreter()
.GetScriptInterpreter();
 if (script_interp) {
   m_implementation_sp = script_interp->CreateScriptedThreadPlan(
@@ -80,7 +79,6 @@
 ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
-   .GetCommandInterpreter()
.GetScriptInterpreter();
 if (script_interp) {
   bool script_error;
@@ -104,7 +102,6 @@
 ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
-   .GetCommandInterpreter()
.GetScriptInterpreter();
 if (script_interp) {
   bool script_error;
@@ -128,7 +125,6 @@
 ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
-   .GetCommandInterpreter()
.GetScriptInterpreter();
 if (script_interp) {
   bool script_error;
@@ -167,7 +163,6 @@
 ScriptInterpreter *script_interp = m_thread.GetProcess()
->GetTarget()
.GetDebugger()
-   .GetCommandInterpreter()
.GetScriptInterpreter();
 if (script_interp) {
   bool script_error;
Index: lldb/source/Target/Target.cpp
===
--- lldb/source/Target/Target.cpp
+++ lldb/source/Target/Target.cpp
@@ -615,13 +615,10 @@
   StructuredDataImpl *extra_args_impl = new StructuredDataImpl();
   if (extra_args_sp)
 extra_args_impl->SetObjectSP(extra_args_sp);
-  
-  BreakpointResolverSP resolver_sp(new 
-   BreakpointResolverScripted(nullptr, class_name,
-   depth,
-   extra_args_impl,
-   *GetDebugger().GetCommandInterpreter()
-   .GetScriptInterpreter()));
+
+  BreakpointResolverSP resolver_sp(new BreakpointResolverScripted(
+  nullptr, class_name, depth, extra_a

[Lldb-commits] [PATCH] D61183: PostfixExpression: Introduce CFANode

2019-04-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

FYI: for all DWARF expressions found in EH frame stuff, they expect the CFA 
address to be pushed onto the stack prior to executing the expression. Do we 
just want to follow suit with the these expressions and avoid the extra needed 
node?


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

https://reviews.llvm.org/D61183



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


[Lldb-commits] [PATCH] D59015: [lldb-mi] Include full path in the -data-disassemble response

2019-04-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added inline comments.



Comment at: lldb/tools/lldb-mi/MICmdCmdData.cpp:419
+  // Get a full path to the file.
+  std::unique_ptr pPathBuffer(new char[PATH_MAX]);
+  lineEntry.GetFileSpec().GetPath(pPathBuffer.get(), PATH_MAX);

anton.kolesov wrote:
> clayborg wrote:
> > anton.kolesov wrote:
> > > clayborg wrote:
> > > > Confused as to why we are calling malloc and free here for pPathBuffer? 
> > > > Why not just:
> > > > ```
> > > > char pPathBuffer[PATH_MAX];
> > > > ```
> > > I don't have a strong opinion on this, so to maintain consistency in the 
> > > code I'm trying to use what other code in lldb-mi uses in similar 
> > > situations - which is either unique_ptr or static local variable, but I 
> > > presume it was decided that second approach is not good. FWIW, If I were 
> > > to write code without regard of what is being done in the same project, 
> > > then I would never ever had a variable named "miValueConst5".
> > I would just use a local variable on the stack as I suggested. static 
> > variables are not correct and should never be used in cases like this, so 
> > if you see other errors, might be a good idea to submit a patch and improve 
> > lldb-mi. I am all for consistency where it makes sense, but I am also for 
> > fixing issues when we see them. 
> But what is wrong with the approach of using std::unique_ptr local 
> variable?
That forces a call to malloc(...) and free(...). No need to involve allocations 
on the heap for such simple things


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D59015



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


[Lldb-commits] [lldb] r359349 - Pass explicit C++ version to test

2019-04-26 Thread Frederic Riss via lldb-commits
Author: friss
Date: Fri Apr 26 14:16:15 2019
New Revision: 359349

URL: http://llvm.org/viewvc/llvm-project?rev=359349&view=rev
Log:
Pass explicit C++ version to test

stop-hook-threads.cpp uses C++11 features, so ask for C++11 explicitely.
This isn't broken on mainstream because clang defaults to a newer C++
version now, but it breaks if testing against an older compiler.

Modified:
lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test

Modified: lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test?rev=359349&r1=359348&r2=359349&view=diff
==
--- lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test (original)
+++ lldb/trunk/lit/ExecControl/StopHook/stop-hook-threads.test Fri Apr 26 
14:16:15 2019
@@ -1,4 +1,4 @@
-# RUN: %clangxx %p/Inputs/stop-hook-threads.cpp -g -o %t
+# RUN: %clangxx -std=c++11 %p/Inputs/stop-hook-threads.cpp -g -o %t
 # RUN: %lldb -b -s %p/Inputs/stop-hook-threads-1.lldbinit -s %s -f %t \
 # RUN: | FileCheck --check-prefix=CHECK --check-prefix=CHECK-NO-FILTER %s
 # RUN: %lldb -b -s %p/Inputs/stop-hook-threads-2.lldbinit -s %s -f %t \


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


[Lldb-commits] [PATCH] D61212: [lldb] [lit] Add tests for reading ZMM registers (AVX512)

2019-04-26 Thread Michał Górny via Phabricator via lldb-commits
mgorny created this revision.
mgorny added reviewers: labath, krytarowski.
Herald added a subscriber: delcypher.

Disclaimer: I don't have access to any hardware capable of AVX512, so I haven't 
tested it.


https://reviews.llvm.org/D61212

Files:
  lldb/lit/Register/Inputs/x86-zmm-read.cpp
  lldb/lit/Register/x86-64-zmm-read.test
  lldb/lit/Register/x86-zmm-read.test
  lldb/utils/lit-cpuid/lit-cpuid.cpp

Index: lldb/utils/lit-cpuid/lit-cpuid.cpp
===
--- lldb/utils/lit-cpuid/lit-cpuid.cpp
+++ lldb/utils/lit-cpuid/lit-cpuid.cpp
@@ -29,6 +29,8 @@
 outs() << "sse\n";
   if (features["avx"])
 outs() << "avx\n";
+  if (features["avx512f"])
+outs() << "avx512f\n";
 #endif
 
   return 0;
Index: lldb/lit/Register/x86-zmm-read.test
===
--- /dev/null
+++ lldb/lit/Register/x86-zmm-read.test
@@ -0,0 +1,31 @@
+# XFAIL: system-windows
+# REQUIRES: native && target-x86 && native-cpu-avx512f
+# RUN: %clangxx %p/Inputs/x86-zmm-read.cpp -o %t
+# RUN: %lldb -b -s %s %t | FileCheck %s
+process launch
+
+register read --all
+# CHECK-DAG: xmm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03}
+# CHECK-DAG: xmm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13}
+# CHECK-DAG: xmm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23}
+# CHECK-DAG: xmm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33}
+# CHECK-DAG: xmm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43}
+# CHECK-DAG: xmm5 = {0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53}
+# CHECK-DAG: xmm6 = {0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63}
+# CHECK-DAG: xmm7 = {0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73}
+# CHECK-DAG: ymm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03 0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 0x8a 0x88 0x86 0x84 0x82}
+# CHECK-DAG: ymm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13 0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 0x9a 0x98 0x96 0x94 0x92}
+# CHECK-DAG: ymm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23 0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 0xaa 0xa8 0xa6 0xa4 0xa2}
+# CHECK-DAG: ymm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33 0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 0xba 0xb8 0xb6 0xb4 0xb2}
+# CHECK-DAG: ymm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43 0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 0xca 0xc8 0xc6 0xc4 0xc2}
+# CHECK-DAG: ymm5 = {0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53 0xd0 0xdf 0xdd 0xdb 0xd9 0xd7 0xd5 0xd3 0xd1 0xde 0xdc 0xda 0xd8 0xd6 0xd4 0xd2}
+# CHECK-DAG: ymm6 = {0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63 0xe0 0xef 0xed 0xeb 0xe9 0xe7 0xe5 0xe3 0xe1 0xee 0xec 0xea 0xe8 0xe6 0xe4 0xe2}
+# CHECK-DAG: ymm7 = {0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73 0xf0 0xff 0xfd 0xfb 0xf9 0xf7 0xf5 0xf3 0xf1 0xfe 0xfc 0xfa 0xf8 0xf6 0xf4 0xf2}
+# CHECK-DAG: zmm0 = {0x01 0x0e 0x0c 0x0a 0x08 0x06 0x04 0x02 0x00 0x0f 0x0d 0x0b 0x09 0x07 0x05 0x03 0x80 0x8f 0x8d 0x8b 0x89 0x87 0x85 0x83 0x81 0x8e 0x8c 0x8a 0x88 0x86 0x84 0x82 0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43 0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 0xca 0xc8 0xc6 0xc4 0xc2}
+# CHECK-DAG: zmm1 = {0x11 0x1e 0x1c 0x1a 0x18 0x16 0x14 0x12 0x10 0x1f 0x1d 0x1b 0x19 0x17 0x15 0x13 0x90 0x9f 0x9d 0x9b 0x99 0x97 0x95 0x93 0x91 0x9e 0x9c 0x9a 0x98 0x96 0x94 0x92 0x51 0x5e 0x5c 0x5a 0x58 0x56 0x54 0x52 0x50 0x5f 0x5d 0x5b 0x59 0x57 0x55 0x53 0xd0 0xdf 0xdd 0xdb 0xd9 0xd7 0xd5 0xd3 0xd1 0xde 0xdc 0xda 0xd8 0xd6 0xd4 0xd2}
+# CHECK-DAG: zmm2 = {0x21 0x2e 0x2c 0x2a 0x28 0x26 0x24 0x22 0x20 0x2f 0x2d 0x2b 0x29 0x27 0x25 0x23 0xa0 0xaf 0xad 0xab 0xa9 0xa7 0xa5 0xa3 0xa1 0xae 0xac 0xaa 0xa8 0xa6 0xa4 0xa2 0x61 0x6e 0x6c 0x6a 0x68 0x66 0x64 0x62 0x60 0x6f 0x6d 0x6b 0x69 0x67 0x65 0x63 0xe0 0xef 0xed 0xeb 0xe9 0xe7 0xe5 0xe3 0xe1 0xee 0xec 0xea 0xe8 0xe6 0xe4 0xe2}
+# CHECK-DAG: zmm3 = {0x31 0x3e 0x3c 0x3a 0x38 0x36 0x34 0x32 0x30 0x3f 0x3d 0x3b 0x39 0x37 0x35 0x33 0xb0 0xbf 0xbd 0xbb 0xb9 0xb7 0xb5 0xb3 0xb1 0xbe 0xbc 0xba 0xb8 0xb6 0xb4 0xb2 0x71 0x7e 0x7c 0x7a 0x78 0x76 0x74 0x72 0x70 0x7f 0x7d 0x7b 0x79 0x77 0x75 0x73 0xf0 0xff 0xfd 0xfb 0xf9 0xf7 0xf5 0xf3 0xf1 0xfe 0xfc 0xfa 0xf8 0xf6 0xf4 0xf2}
+# CHECK-DAG: zmm4 = {0x41 0x4e 0x4c 0x4a 0x48 0x46 0x44 0x42 0x40 0x4f 0x4d 0x4b 0x49 0x47 0x45 0x43 0xc0 0xcf 0xcd 0xcb 0xc9 0xc7 0xc5 0xc3 0xc1 0xce 0xcc 0xca 0xc8 0xc6 0xc4 0xc

[Lldb-commits] [PATCH] D61211: [ScriptInterpreter] Move ownership into debugger (NFC)

2019-04-26 Thread Jim Ingham via Phabricator via lldb-commits
jingham accepted this revision.
jingham added a comment.
This revision is now accepted and ready to land.

That looks nicer!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61211



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


[Lldb-commits] [lldb] r359354 - [ScriptInterpreter] Move ownership into debugger (NFC)

2019-04-26 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Apr 26 15:43:16 2019
New Revision: 359354

URL: http://llvm.org/viewvc/llvm-project?rev=359354&view=rev
Log:
[ScriptInterpreter] Move ownership into debugger (NFC)

This is part two of the change started in r359330. This patch moves the
ownership of the script interpreter from the command interpreter into
the debugger. I would've preferred to remove the lazy initialization,
however the fact that the scripting language is set after the debugger
is created makes that tricky. So for now this does exactly the same
thing as when it was under the command interpreter. The result is that
this patch is fully NFC.

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

Modified:
lldb/trunk/include/lldb/Core/Debugger.h
lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
lldb/trunk/include/lldb/Interpreter/CommandObject.h
lldb/trunk/source/API/SBBreakpoint.cpp
lldb/trunk/source/API/SBBreakpointLocation.cpp
lldb/trunk/source/API/SBBreakpointName.cpp
lldb/trunk/source/API/SBTypeCategory.cpp
lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
lldb/trunk/source/Breakpoint/BreakpointResolverScripted.cpp
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectFrame.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp
lldb/trunk/source/Core/Debugger.cpp
lldb/trunk/source/Core/FormatEntity.cpp
lldb/trunk/source/Core/Module.cpp
lldb/trunk/source/DataFormatters/TypeSummary.cpp
lldb/trunk/source/DataFormatters/TypeSynthetic.cpp
lldb/trunk/source/Interpreter/CommandInterpreter.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp
lldb/trunk/source/Interpreter/CommandObjectScript.cpp
lldb/trunk/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
lldb/trunk/source/Target/Target.cpp
lldb/trunk/source/Target/ThreadPlanPython.cpp

Modified: lldb/trunk/include/lldb/Core/Debugger.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Debugger.h?rev=359354&r1=359353&r2=359354&view=diff
==
--- lldb/trunk/include/lldb/Core/Debugger.h (original)
+++ lldb/trunk/include/lldb/Core/Debugger.h Fri Apr 26 15:43:16 2019
@@ -154,6 +154,8 @@ public:
 return *m_command_interpreter_up;
   }
 
+  ScriptInterpreter *GetScriptInterpreter(bool can_create = true);
+
   lldb::ListenerSP GetListener() { return m_listener_sp; }
 
   // This returns the Debugger's scratch source manager.  It won't be able to
@@ -395,6 +397,9 @@ protected:
   // source file cache.
   std::unique_ptr m_command_interpreter_up;
 
+  lldb::ScriptInterpreterSP m_script_interpreter_sp;
+  std::recursive_mutex m_script_interpreter_mutex;
+
   IOHandlerStack m_input_reader_stack;
   llvm::StringMap> m_log_streams;
   std::shared_ptr m_log_callback_stream_sp;

Modified: lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h?rev=359354&r1=359353&r2=359354&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandInterpreter.h Fri Apr 26 
15:43:16 2019
@@ -386,10 +386,6 @@ public:
 
   int GetOptionArgumentPosition(const char *in_string);
 
-  ScriptInterpreter *GetScriptInterpreter(bool can_create = true);
-
-  void SetScriptInterpreter();
-
   void SkipLLDBInitFiles(bool skip_lldbinit_files) {
 m_skip_lldbinit_files = skip_lldbinit_files;
   }
@@ -573,8 +569,6 @@ private:
   CommandHistory m_command_history;
   std::string m_repeat_command; // Stores the command that will be executed for
 // an empty command string.
-  lldb::ScriptInterpreterSP m_script_interpreter_sp;
-  std::recursive_mutex m_script_interpreter_mutex;
   lldb::IOHandlerSP m_command_io_handler_sp;
   char m_comment_char;
   bool m_batch_command_mode;

Modified: lldb/trunk/include/lldb/Interpreter/CommandObject.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/CommandObject.h?rev=359354&r1=359353&r2=359354&view=diff
==
--- lldb/trunk/include/lldb/Interpreter/CommandObject.h (original)
+++ lldb/trunk/include/lldb/Interpreter/CommandObject.h Fri Apr 26 15:43:16 2019
@@ -121,6 +121,7 @@ public:
   GetArgumentDescriptionA

[Lldb-commits] [PATCH] D61211: [ScriptInterpreter] Move ownership into debugger (NFC)

2019-04-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB359354: [ScriptInterpreter] Move ownership into debugger 
(NFC) (authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61211?vs=196913&id=196922#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61211

Files:
  include/lldb/Core/Debugger.h
  include/lldb/Interpreter/CommandInterpreter.h
  include/lldb/Interpreter/CommandObject.h
  source/API/SBBreakpoint.cpp
  source/API/SBBreakpointLocation.cpp
  source/API/SBBreakpointName.cpp
  source/API/SBTypeCategory.cpp
  source/Breakpoint/BreakpointOptions.cpp
  source/Breakpoint/BreakpointResolverScripted.cpp
  source/Commands/CommandObjectBreakpointCommand.cpp
  source/Commands/CommandObjectCommands.cpp
  source/Commands/CommandObjectFrame.cpp
  source/Commands/CommandObjectThread.cpp
  source/Commands/CommandObjectType.cpp
  source/Commands/CommandObjectWatchpointCommand.cpp
  source/Core/Debugger.cpp
  source/Core/FormatEntity.cpp
  source/Core/Module.cpp
  source/DataFormatters/TypeSummary.cpp
  source/DataFormatters/TypeSynthetic.cpp
  source/Interpreter/CommandInterpreter.cpp
  source/Interpreter/CommandObject.cpp
  source/Interpreter/CommandObjectScript.cpp
  source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp
  source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  source/Target/Target.cpp
  source/Target/ThreadPlanPython.cpp

Index: source/Interpreter/CommandInterpreter.cpp
===
--- source/Interpreter/CommandInterpreter.cpp
+++ source/Interpreter/CommandInterpreter.cpp
@@ -130,7 +130,7 @@
   IOHandlerDelegate(IOHandlerDelegate::Completion::LLDBCommand),
   m_debugger(debugger), m_synchronous_execution(synchronous_execution),
   m_skip_lldbinit_files(false), m_skip_app_init_files(false),
-  m_script_interpreter_sp(), m_command_io_handler_sp(), m_comment_char('#'),
+  m_command_io_handler_sp(), m_comment_char('#'),
   m_batch_command_mode(false), m_truncation_warning(eNoTruncation),
   m_command_source_depth(0), m_num_errors(0), m_quit_requested(false),
   m_stopped_for_crash(false) {
@@ -433,9 +433,6 @@
 
 void CommandInterpreter::Clear() {
   m_command_io_handler_sp.reset();
-
-  if (m_script_interpreter_sp)
-m_script_interpreter_sp->Clear();
 }
 
 const char *CommandInterpreter::ProcessEmbeddedScriptCommands(const char *arg) {
@@ -2498,18 +2495,6 @@
   debugger.SetAsyncExecution(old_async_execution);
 }
 
-ScriptInterpreter *CommandInterpreter::GetScriptInterpreter(bool can_create) {
-  std::lock_guard locker(m_script_interpreter_mutex);
-  if (!m_script_interpreter_sp) {
-if (!can_create)
-  return nullptr;
-lldb::ScriptLanguage script_lang = GetDebugger().GetScriptLanguage();
-m_script_interpreter_sp =
-PluginManager::GetScriptInterpreterForLanguage(script_lang, m_debugger);
-  }
-  return m_script_interpreter_sp.get();
-}
-
 bool CommandInterpreter::GetSynchronous() { return m_synchronous_execution; }
 
 void CommandInterpreter::SetSynchronous(bool value) {
@@ -2884,7 +2869,8 @@
 }
   }
 
-  ScriptInterpreter *script_interpreter = GetScriptInterpreter(false);
+  ScriptInterpreter *script_interpreter =
+  m_debugger.GetScriptInterpreter(false);
   if (script_interpreter) {
 if (script_interpreter->Interrupt())
   return true;
Index: source/Interpreter/CommandObjectScript.cpp
===
--- source/Interpreter/CommandObjectScript.cpp
+++ source/Interpreter/CommandObjectScript.cpp
@@ -50,7 +50,7 @@
 return false;
   }
 
-  ScriptInterpreter *script_interpreter = m_interpreter.GetScriptInterpreter();
+  ScriptInterpreter *script_interpreter = GetDebugger().GetScriptInterpreter();
 
   if (script_interpreter == nullptr) {
 result.AppendError("no script interpreter");
Index: source/Interpreter/CommandObject.cpp
===
--- source/Interpreter/CommandObject.cpp
+++ source/Interpreter/CommandObject.cpp
@@ -49,6 +49,8 @@
 
 CommandObject::~CommandObject() {}
 
+Debugger &CommandObject::GetDebugger() { return m_interpreter.GetDebugger(); }
+
 llvm::StringRef CommandObject::GetHelp() { return m_cmd_help_short; }
 
 llvm::StringRef CommandObject::GetHelpLong() { return m_cmd_help_long; }
Index: source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -377,7 +377,7 @@
 bool ProcessGDBRemote::ParsePythonTargetDefinition(
 const FileSpec &target_definition_fspec) {
   ScriptInterpr

[Lldb-commits] [lldb] r359355 - [Driver] Remove unused functions (NFC)

2019-04-26 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Apr 26 15:54:39 2019
New Revision: 359355

URL: http://llvm.org/viewvc/llvm-project?rev=359355&view=rev
Log:
[Driver] Remove unused functions (NFC)

Remove unused from the driver class. I noticed a bunch of small thing
while doing this that didn't warrant separate commits, so I've lumped
them together into this patch.

Modified:
lldb/trunk/tools/driver/Driver.cpp
lldb/trunk/tools/driver/Driver.h

Modified: lldb/trunk/tools/driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/driver/Driver.cpp?rev=359355&r1=359354&r2=359355&view=diff
==
--- lldb/trunk/tools/driver/Driver.cpp (original)
+++ lldb/trunk/tools/driver/Driver.cpp Fri Apr 26 15:54:39 2019
@@ -163,22 +163,6 @@ void Driver::OptionData::AddInitialComma
 command_set->push_back(InitialCmdEntry(command, is_file, false));
 }
 
-const char *Driver::GetFilename() const {
-  if (m_option_data.m_args.empty())
-return nullptr;
-  return m_option_data.m_args.front().c_str();
-}
-
-const char *Driver::GetCrashLogFilename() const {
-  if (m_option_data.m_crash_log.empty())
-return nullptr;
-  return m_option_data.m_crash_log.c_str();
-}
-
-lldb::ScriptLanguage Driver::GetScriptLanguage() const {
-  return m_option_data.m_script_lang;
-}
-
 void Driver::WriteCommandsForSourcing(CommandPlacement placement,
   SBStream &strm) {
   std::vector *command_set;
@@ -236,8 +220,6 @@ void Driver::WriteCommandsForSourcing(Co
   }
 }
 
-bool Driver::GetDebugMode() const { return m_option_data.m_debug_mode; }
-
 // Check the arguments that were passed to this program to make sure they are
 // valid and to get their argument values (if any).  Return a boolean value
 // indicating whether or not to start up the full debugger (i.e. the Command
@@ -321,7 +303,7 @@ SBError Driver::ProcessArgs(const opt::I
 
   if (auto *arg = args.getLastArg(OPT_script_language)) {
 auto arg_value = arg->getValue();
-m_option_data.m_script_lang = m_debugger.GetScriptingLanguage(arg_value);
+m_debugger.SetScriptLanguage(m_debugger.GetScriptingLanguage(arg_value));
   }
 
   if (args.hasArg(OPT_no_use_colors)) {
@@ -474,7 +456,7 @@ static inline int OpenPipe(int fds[2], s
 #ifdef _WIN32
   return _pipe(fds, size, O_BINARY);
 #else
-  (void) size;
+  (void)size;
   return pipe(fds);
 #endif
 }
@@ -494,10 +476,10 @@ static ::FILE *PrepareCommandsForSourcin
   if (size_t(nrwr) != commands_size) {
 WithColor::error()
 << format(
-"write(%i, %p, %" PRIu64
-") failed (errno = %i) when trying to open LLDB commands pipe",
-fds[WRITE], static_cast(commands_data),
-static_cast(commands_size), errno)
+   "write(%i, %p, %" PRIu64
+   ") failed (errno = %i) when trying to open LLDB commands pipe",
+   fds[WRITE], static_cast(commands_data),
+   static_cast(commands_size), errno)
 << '\n';
 llvm::sys::Process::SafelyCloseFileDescriptor(fds[READ]);
 llvm::sys::Process::SafelyCloseFileDescriptor(fds[WRITE]);
@@ -549,8 +531,8 @@ int Driver::MainLoop() {
 
   m_debugger.SetErrorFileHandle(stderr, false);
   m_debugger.SetOutputFileHandle(stdout, false);
-  m_debugger.SetInputFileHandle(stdin,
-false); // Don't take ownership of STDIN yet...
+  // Don't take ownership of STDIN yet...
+  m_debugger.SetInputFileHandle(stdin, false);
 
   m_debugger.SetUseExternalEditor(m_option_data.m_use_external_editor);
 
@@ -567,7 +549,7 @@ int Driver::MainLoop() {
   // .lldbinit file in the user's home directory.
   SBCommandReturnObject result;
   sb_interpreter.SourceInitFileInHomeDirectory(result);
-  if (GetDebugMode()) {
+  if (m_option_data.m_debug_mode) {
 result.PutError(m_debugger.GetErrorFileHandle());
 result.PutOutput(m_debugger.GetOutputFileHandle());
   }
@@ -589,7 +571,8 @@ int Driver::MainLoop() {
 const size_t num_args = m_option_data.m_args.size();
 if (num_args > 0) {
   char arch_name[64];
-  if (lldb::SBDebugger::GetDefaultArchitecture(arch_name, 
sizeof(arch_name)))
+  if (lldb::SBDebugger::GetDefaultArchitecture(arch_name,
+   sizeof(arch_name)))
 commands_stream.Printf("target create --arch=%s %s", arch_name,
EscapeString(m_option_data.m_args[0]).c_str());
   else
@@ -613,8 +596,9 @@ int Driver::MainLoop() {
   commands_stream.Printf("target create --core %s\n",
  EscapeString(m_option_data.m_core_file).c_str());
 } else if (!m_option_data.m_process_name.empty()) {
-  commands_stream.Printf("process attach --name %s",
- 
EscapeString(m_option_data.m_process_name).c_str());
+  commands_stream.Printf(
+  "process attach --name %s",
+  Escape

[Lldb-commits] [PATCH] D61216: [Docs] Make it possible to generate the python reference without building all of LLDB

2019-04-26 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: labath, ted.
JDevlieghere added a project: LLDB.
Herald added a subscriber: mgorny.

As discussed on the mailing list, we should be able to generate the Python 
reference without building all of LLDB. To make that possible I create a dummy 
python package, which is then parsed by epydoc. The latter will complain that 
it couldn't import lldb, but that doesn't matter as far as generation of the 
docs is concerned.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61216

Files:
  lldb/CMakeLists.txt
  lldb/docs/CMakeLists.txt


Index: lldb/docs/CMakeLists.txt
===
--- lldb/docs/CMakeLists.txt
+++ lldb/docs/CMakeLists.txt
@@ -13,31 +13,46 @@
 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 COMMENT "Generating LLDB C++ API reference with Doxygen" VERBATIM
   )
-endif(DOXYGEN_FOUND)
+endif()
 
-find_package(PythonInterp REQUIRED)
 find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py)
 if(EPYDOC_EXECUTABLE)
+  message(STATUS "Found epydoc - ${EPYDOC_EXECUTABLE}")
+
   find_program(DOT_EXECUTABLE dot)
-if(DOT_EXECUTABLE)
-  set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath 
${DOT_EXECUTABLE})
-endif()
-set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
-file(MAKE_DIRECTORY "${DOC_DIR}")
-#set(ENV{PYTHONPATH} 
${CMAKE_CURRENT_BINARY_DIR}/../../../lib/python2.7/site-packages)
-add_custom_target(lldb-python-doc
-  ${EPYDOC_EXECUTABLE}
-  --html
-  lldb
-  -o ${CMAKE_CURRENT_BINARY_DIR}/python_reference
-  --name "LLDB python API"
-  --url "http://lldb.llvm.org";
-  ${EPYDOC_OPTIONS}
-  DEPENDS swig_wrapper liblldb
-  WORKING_DIRECTORY 
${CMAKE_CURRENT_BINARY_DIR}/../../../lib${LLVM_LIBDIR_SUFFIX}/python2.7/site-packages
-  COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
-)
-endif(EPYDOC_EXECUTABLE)
+  if(DOT_EXECUTABLE)
+set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath 
${DOT_EXECUTABLE})
+message(STATUS "Found dot - ${DOT_EXECUTABLE}")
+  endif()
+
+  # Pretend to make a python package so that we can generate the reference.
+  # Because we don't build liblldb, epydoc will complain that the import of
+  # _lldb.so failed, but that doesn't prevent it from generating the docs.
+  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb)
+  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
+  add_custom_target(lldb-python-doc-package
+COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_scripts_dir}/lldb.py" 
"${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
+DEPENDS swig_wrapper
+COMMENT "Copying lldb.py to pretend package.")
+
+  set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
+  file(MAKE_DIRECTORY "${DOC_DIR}")
+  add_custom_target(lldb-python-doc
+${EPYDOC_EXECUTABLE}
+--html
+lldb
+-o ${CMAKE_CURRENT_BINARY_DIR}/python_reference
+--name "LLDB python API"
+--url "http://lldb.llvm.org";
+${EPYDOC_OPTIONS}
+DEPENDS swig_wrapper
+DEPENDS lldb-python-doc-package
+WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
+  )
+else()
+  message(STATUS "Could NOT find epydoc")
+endif()
 
 if (LLVM_ENABLE_SPHINX)
   include(AddSphinxTarget)
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -30,12 +30,12 @@
   add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
 endif()
 
-add_subdirectory(docs)
 if (NOT LLDB_DISABLE_PYTHON)
   add_subdirectory(scripts)
 endif ()
 add_subdirectory(source)
 add_subdirectory(tools)
+add_subdirectory(docs)
 
 option(LLDB_INCLUDE_TESTS "Generate build targets for the LLDB unit tests." 
${LLVM_INCLUDE_TESTS})
 option(LLDB_TEST_USE_CUSTOM_C_COMPILER "Use the C compiler provided via 
LLDB_TEST_C_COMPILER for building test inferiors (instead of the just-built 
compiler). Defaults to OFF." OFF)


Index: lldb/docs/CMakeLists.txt
===
--- lldb/docs/CMakeLists.txt
+++ lldb/docs/CMakeLists.txt
@@ -13,31 +13,46 @@
 WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
 COMMENT "Generating LLDB C++ API reference with Doxygen" VERBATIM
   )
-endif(DOXYGEN_FOUND)
+endif()
 
-find_package(PythonInterp REQUIRED)
 find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py)
 if(EPYDOC_EXECUTABLE)
+  message(STATUS "Found epydoc - ${EPYDOC_EXECUTABLE}")
+
   find_program(DOT_EXECUTABLE dot)
-if(DOT_EXECUTABLE)
-  set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE})
-endif()
-set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
-file(MAKE_DIRECTORY "${DOC_DIR}")
-#set(ENV{PYTHONPATH} ${CMAKE_CURRENT_BINARY_DIR}/../../../lib/python2.7/site-packages)
-add_custom_target(lldb-python-doc
-  ${EPYDOC_EXECUTABLE}
-  --html
-  lldb
-  -o ${CMAKE_CURR

[Lldb-commits] [PATCH] D61218: Fix a stack-smasher in PlatformMacOSX::GetSDKDirectory()

2019-04-26 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added reviewers: jingham, jasonmolenda.
Herald added a project: LLDB.

GetSDKVersion expects the number of version fields not their byte size and will 
happily overwrite later contents of the stack.

I just found this by accident while stepping through the function and noticing 
that the backtrace disappears halfway through the function.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61218

Files:
  lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp


Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -164,7 +164,7 @@
   std::string default_xcode_sdk;
   FileSpec fspec;
   uint32_t versions[2];
-  if (objfile->GetSDKVersion(versions, sizeof(versions))) {
+  if (objfile->GetSDKVersion(versions, 2)) {
 fspec = HostInfo::GetShlibDir();
 if (fspec) {
   std::string path;


Index: lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
+++ lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp
@@ -164,7 +164,7 @@
   std::string default_xcode_sdk;
   FileSpec fspec;
   uint32_t versions[2];
-  if (objfile->GetSDKVersion(versions, sizeof(versions))) {
+  if (objfile->GetSDKVersion(versions, 2)) {
 fspec = HostInfo::GetShlibDir();
 if (fspec) {
   std::string path;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61218: Fix a stack-smasher in PlatformMacOSX::GetSDKDirectory()

2019-04-26 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda accepted this revision.
jasonmolenda added a comment.
This revision is now accepted and ready to land.

LGTM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61218



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


[Lldb-commits] [lldb] r359372 - [FormatEntity] Remove unused format type (NFC)

2019-04-26 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Apr 26 22:36:57 2019
New Revision: 359372

URL: http://llvm.org/viewvc/llvm-project?rev=359372&view=rev
Log:
[FormatEntity] Remove unused format type (NFC)

The FormatType enum and corresponding field are unused. This patch
removes the type, field and simplifies the macros that initialize them.

Modified:
lldb/trunk/include/lldb/Core/FormatEntity.h
lldb/trunk/source/Core/FormatEntity.cpp

Modified: lldb/trunk/include/lldb/Core/FormatEntity.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/FormatEntity.h?rev=359372&r1=359371&r2=359372&view=diff
==
--- lldb/trunk/include/lldb/Core/FormatEntity.h (original)
+++ lldb/trunk/include/lldb/Core/FormatEntity.h Fri Apr 26 22:36:57 2019
@@ -110,14 +110,10 @@ public:
   CurrentPCArrow
 };
 
-enum FormatType { None, UInt32, UInt64, CString };
-
 struct Definition {
   const char *name;
   const char *string; // Insert this exact string into the output
   Entry::Type type;
-  FormatType format_type; // uint32_t, uint64_t, cstr, or anything that can
-  // be formatted by printf or lldb::Format
   uint64_t data;
   uint32_t num_children;
   Definition *children; // An array of "num_children" Definition entries,

Modified: lldb/trunk/source/Core/FormatEntity.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/FormatEntity.cpp?rev=359372&r1=359371&r2=359372&view=diff
==
--- lldb/trunk/source/Core/FormatEntity.cpp (original)
+++ lldb/trunk/source/Core/FormatEntity.cpp Fri Apr 26 22:36:57 2019
@@ -79,108 +79,98 @@ using namespace lldb_private;
 
 enum FileKind { FileError = 0, Basename, Dirname, Fullpath };
 
-#define ENTRY(n, t, f) 
\
+#define ENTRY(n, t)
\
+  { n, nullptr, FormatEntity::Entry::Type::t, 0, 0, nullptr, false }
+#define ENTRY_VALUE(n, t, v)   
\
+  { n, nullptr, FormatEntity::Entry::Type::t, v, 0, nullptr, false }
+#define ENTRY_CHILDREN(n, t, c)
\
   {
\
-n, nullptr, FormatEntity::Entry::Type::t,  
\
-FormatEntity::Entry::FormatType::f, 0, 0, nullptr, false   
\
-  }
-#define ENTRY_VALUE(n, t, f, v)
\
-  {
\
-n, nullptr, FormatEntity::Entry::Type::t,  
\
-FormatEntity::Entry::FormatType::f, v, 0, nullptr, false   
\
-  }
-#define ENTRY_CHILDREN(n, t, f, c) 
\
-  {
\
-n, nullptr, FormatEntity::Entry::Type::t,  
\
-FormatEntity::Entry::FormatType::f, 0, 
\
+n, nullptr, FormatEntity::Entry::Type::t, 0,   
\
 static_cast(llvm::array_lengthof(c)), c, false   
\
   }
-#define ENTRY_CHILDREN_KEEP_SEP(n, t, f, c)
\
+#define ENTRY_CHILDREN_KEEP_SEP(n, t, c)   
\
   {
\
-n, nullptr, FormatEntity::Entry::Type::t,  
\
-FormatEntity::Entry::FormatType::f, 0, 
\
+n, nullptr, FormatEntity::Entry::Type::t, 0,   
\
 static_cast(llvm::array_lengthof(c)), c, true
\
   }
 #define ENTRY_STRING(n, s) 
\
-  {
\
-n, s, FormatEntity::Entry::Type::InsertString, 
\
-FormatEntity::Entry::FormatType::None, 0, 0, nullptr, false
\
-  }
+  { n, s, FormatEntity::Entry::Type::InsertString, 0, 0, nullptr, false }
 static FormatEntity::Entry::Definition g_string_entry[] = {
-ENTRY("*", ParentString, None)};
+ENTRY("*", ParentString)};
 
 static FormatEntity::Entry::Definition g_addr_entries[] = {
-ENTRY("load", AddressLoad, UInt64), ENTRY("file", AddressFile, UInt64),
-ENTRY("load", AddressLoadOrFile, UInt64),
+ENTRY("load", AddressLoad),
+ENTRY("file", AddressFile),
+ENTRY("load", AddressLoadOrFile),
 };
 
 static FormatEntity::Entry::Definition g_file_child_entries[] = {
-ENTRY_VALUE("basename", ParentNumber, CString, FileKind::Basename),
-ENTRY_VALUE(

[Lldb-commits] [lldb] r359373 - [CommandObject] Use GetDebugger() helper method (NFC)

2019-04-26 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Fri Apr 26 23:19:42 2019
New Revision: 359373

URL: http://llvm.org/viewvc/llvm-project?rev=359373&view=rev
Log:
[CommandObject] Use GetDebugger() helper method (NFC)

In r359354 a GetDebugger() method was added to the CommandObject class,
so that we didn't have to go through the command interpreter to obtain
the script interpreter. This patch simplifies other call sites where
m_interpreter.GetDebugger() was used, and replaces them with a shorter
call to the new method.

Modified:
lldb/trunk/source/Commands/CommandObjectApropos.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/trunk/source/Commands/CommandObjectCommands.cpp
lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
lldb/trunk/source/Commands/CommandObjectExpression.cpp
lldb/trunk/source/Commands/CommandObjectGUI.cpp
lldb/trunk/source/Commands/CommandObjectLog.cpp
lldb/trunk/source/Commands/CommandObjectPlatform.cpp
lldb/trunk/source/Commands/CommandObjectPlugin.cpp
lldb/trunk/source/Commands/CommandObjectProcess.cpp
lldb/trunk/source/Commands/CommandObjectSettings.cpp
lldb/trunk/source/Commands/CommandObjectSource.cpp
lldb/trunk/source/Commands/CommandObjectTarget.cpp
lldb/trunk/source/Commands/CommandObjectThread.cpp
lldb/trunk/source/Commands/CommandObjectType.cpp
lldb/trunk/source/Commands/CommandObjectWatchpoint.cpp
lldb/trunk/source/Commands/CommandObjectWatchpointCommand.cpp

Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=359373&r1=359372&r2=359373&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Fri Apr 26 23:19:42 2019
@@ -80,7 +80,7 @@ bool CommandObjectApropos::DoExecute(Arg
 
   std::vector properties;
   const size_t num_properties =
-  m_interpreter.GetDebugger().Apropos(search_word, properties);
+  GetDebugger().Apropos(search_word, properties);
   if (num_properties) {
 const bool dump_qualified_name = true;
 result.AppendMessageWithFormatv(

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=359373&r1=359372&r2=359373&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Fri Apr 26 23:19:42 
2019
@@ -897,7 +897,7 @@ protected:
   const bool show_locations = false;
   bp_sp->GetDescription(&output_stream, lldb::eDescriptionLevelInitial,
  show_locations);
-  if (target == m_interpreter.GetDebugger().GetDummyTarget())
+  if (target == GetDebugger().GetDummyTarget())
 output_stream.Printf("Breakpoint set in dummy target, will get copied "
  "into future targets.\n");
   else {

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=359373&r1=359372&r2=359373&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Fri Apr 26 
23:19:42 2019
@@ -630,7 +630,7 @@ public:
 
 protected:
   bool DoExecute(Args &command, CommandReturnObject &result) override {
-Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+Target *target = GetDebugger().GetSelectedTarget().get();
 
 if (target == nullptr) {
   result.AppendError("There is not a current executable; there are no "

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=359373&r1=359372&r2=359373&view=diff
==
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Fri Apr 26 23:19:42 
2019
@@ -985,11 +985,8 @@ protected:
   llvm::StringRef bytes_strref(lines[i]);
   Status error = AppendRegexSubstitution(bytes_strref, check_only);
   if (error.Fail()) {
-if (!m_interpreter.GetDebugger()
- .GetCommandInterpreter()
- .GetBatchCommandMode()) {
-  StreamSP out_stream =
-  m_interpreter.GetDebugger().GetAsyncOutputStream();
+if (!GetDebugger().GetCommandInterpr

[Lldb-commits] [PATCH] D61212: [lldb] [lit] Add tests for reading ZMM registers (AVX512)

2019-04-26 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 196948.
mgorny added a comment.
Herald added a subscriber: srhines.

Included dotest test removal for completeness. I'm going to commit it 
separately though.


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

https://reviews.llvm.org/D61212

Files:
  lldb/lit/Register/Inputs/x86-zmm-read.cpp
  lldb/lit/Register/x86-64-zmm-read.test
  lldb/lit/Register/x86-zmm-read.test
  
lldb/packages/Python/lldbsuite/test/functionalities/register/intel_avx/Makefile
  
lldb/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestYMMRegister.py
  
lldb/packages/Python/lldbsuite/test/functionalities/register/intel_avx/TestZMMRegister.py
  lldb/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
  lldb/utils/lit-cpuid/lit-cpuid.cpp

Index: lldb/utils/lit-cpuid/lit-cpuid.cpp
===
--- lldb/utils/lit-cpuid/lit-cpuid.cpp
+++ lldb/utils/lit-cpuid/lit-cpuid.cpp
@@ -29,6 +29,8 @@
 outs() << "sse\n";
   if (features["avx"])
 outs() << "avx\n";
+  if (features["avx512f"])
+outs() << "avx512f\n";
 #endif
 
   return 0;
Index: lldb/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
===
--- lldb/packages/Python/lldbsuite/test/functionalities/register/intel_avx/main.c
+++ /dev/null
@@ -1,142 +0,0 @@
-//===-- main.c *- C -*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-void func() {
-  unsigned int ymmvalues[16];
-  for (int i = 0 ; i < 16 ; i++)
-  {
-unsigned char val = (0x80 | i);
-ymmvalues[i] = (val << 24) | (val << 16) | (val << 8) | val;
-  }
-
-  unsigned int ymmallones = 0x;
-#if defined(__AVX__)
-  __asm__("int3;"
-  "vbroadcastss %1, %%ymm0;"
-  "vbroadcastss %0, %%ymm0;"
-  "vbroadcastss %2, %%ymm1;"
-  "vbroadcastss %0, %%ymm1;"
-  "vbroadcastss %3, %%ymm2;"
-  "vbroadcastss %0, %%ymm2;"
-  "vbroadcastss %4, %%ymm3;"
-  "vbroadcastss %0, %%ymm3;"
-  "vbroadcastss %5, %%ymm4;"
-  "vbroadcastss %0, %%ymm4;"
-  "vbroadcastss %6, %%ymm5;"
-  "vbroadcastss %0, %%ymm5;"
-  "vbroadcastss %7, %%ymm6;"
-  "vbroadcastss %0, %%ymm6;"
-  "vbroadcastss %8, %%ymm7;"
-  "vbroadcastss %0, %%ymm7;"
-#if defined(__x86_64__)
-  "vbroadcastss %1, %%ymm8;"
-  "vbroadcastss %0, %%ymm8;"
-  "vbroadcastss %2, %%ymm9;"
-  "vbroadcastss %0, %%ymm9;"
-  "vbroadcastss %3, %%ymm10;"
-  "vbroadcastss %0, %%ymm10;"
-  "vbroadcastss %4, %%ymm11;"
-  "vbroadcastss %0, %%ymm11;"
-  "vbroadcastss %5, %%ymm12;"
-  "vbroadcastss %0, %%ymm12;"
-  "vbroadcastss %6, %%ymm13;"
-  "vbroadcastss %0, %%ymm13;"
-  "vbroadcastss %7, %%ymm14;"
-  "vbroadcastss %0, %%ymm14;"
-  "vbroadcastss %8, %%ymm15;"
-  "vbroadcastss %0, %%ymm15;"
-#endif
-  ::"m"(ymmallones),
-  "m"(ymmvalues[0]), "m"(ymmvalues[1]), "m"(ymmvalues[2]), "m"(ymmvalues[3]),
-  "m"(ymmvalues[4]), "m"(ymmvalues[5]), "m"(ymmvalues[6]), "m"(ymmvalues[7])
-  );
-#endif
-
-#if defined(__AVX512F__)
-  unsigned int zmmvalues[32];
-  for (int i = 0 ; i < 32 ; i++)
-  {
-unsigned char val = (0x80 | i);
-zmmvalues[i] = (val << 24) | (val << 16) | (val << 8) | val;
-  }
-
-  __asm__("int3;"
-  "vbroadcastss %1, %%zmm0;"
-  "vbroadcastss %0, %%zmm0;"
-  "vbroadcastss %2, %%zmm1;"
-  "vbroadcastss %0, %%zmm1;"
-  "vbroadcastss %3, %%zmm2;"
-  "vbroadcastss %0, %%zmm2;"
-  "vbroadcastss %4, %%zmm3;"
-  "vbroadcastss %0, %%zmm3;"
-  "vbroadcastss %5, %%zmm4;"
-  "vbroadcastss %0, %%zmm4;"
-  "vbroadcastss %6, %%zmm5;"
-  "vbroadcastss %0, %%zmm5;"
-  "vbroadcastss %7, %%zmm6;"
-  "vbroadcastss %0, %%zmm6;"
-  "vbroadcastss %8, %%zmm7;"
-  "vbroadcastss %0, %%zmm7;"
-#if defined(__x86_64__)
-  "vbroadcastss %1, %%zmm8;"
-  "vbroadcastss %0, %%zmm8;"
-  "vbroadcastss %2, %%zmm9;"
-  "vbroadcastss %0, %%zmm9;"
-  "vbroadcastss %3, %%zmm10;"
-  "vbroadcastss %0, %%zmm10;"
-  "vbroadcastss %4, %%zmm11;"
-  "vbroadcastss %0, %%zmm11;"
-  "vbroadcastss %5, %%zmm12;"
-  "vbroadcastss %0, %%zmm12;"
-  "vbroadcastss %6, %%zmm13;"
-  "vbroadcastss %0, %%zmm13;"
-  "vbroadcastss %7, %%zmm14;"
-  "vbroadcastss %0, %%zmm14;"
-  "vbroad