[Lldb-commits] [lldb] bd7d9a8 - [lldb] Check if we actually have a Clang type in ObjCLanguage::GetPossibleFormattersMatches

2019-11-12 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-12T09:59:04+01:00
New Revision: bd7d9a85b8b09c945b98d374cc37cb374db012e6

URL: 
https://github.com/llvm/llvm-project/commit/bd7d9a85b8b09c945b98d374cc37cb374db012e6
DIFF: 
https://github.com/llvm/llvm-project/commit/bd7d9a85b8b09c945b98d374cc37cb374db012e6.diff

LOG: [lldb] Check if we actually have a Clang type in 
ObjCLanguage::GetPossibleFormattersMatches

We call IsPossibleDynamicType but we also need to check if this is a Clang type,
otherwise other languages with dynamic types (like Swift) might end up being 
interpreted
as potential Obj-C dynamic types.

Added: 


Modified: 
lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp 
b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
index c5bfb5747c13..0e0f8ae7fb0a 100644
--- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -887,7 +887,7 @@ ObjCLanguage::GetPossibleFormattersMatches(ValueObject 
&valobj,
   bool canBeObjCDynamic =
   compiler_type.IsPossibleDynamicType(nullptr, check_cpp, check_objc);
 
-  if (canBeObjCDynamic) {
+  if (canBeObjCDynamic && ClangUtil::IsClangType(compiler_type)) {
 do {
   lldb::ProcessSP process_sp = valobj.GetProcessSP();
   if (!process_sp)



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


[Lldb-commits] [lldb] 6cc853b - [lldb][NFC] Remove unused CompilerType::IsPossibleCPlusPlusDynamicType

2019-11-12 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-12T10:02:59+01:00
New Revision: 6cc853b416a2b0d0b435d145988c5d3b6faaa712

URL: 
https://github.com/llvm/llvm-project/commit/6cc853b416a2b0d0b435d145988c5d3b6faaa712
DIFF: 
https://github.com/llvm/llvm-project/commit/6cc853b416a2b0d0b435d145988c5d3b6faaa712.diff

LOG: [lldb][NFC] Remove unused CompilerType::IsPossibleCPlusPlusDynamicType

Reviewers: davide, xiaobai

Reviewed By: davide, xiaobai

Subscribers: davide, JDevlieghere, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/include/lldb/Symbol/CompilerType.h

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index bb9881c0bae3..cedd2523a5a8 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -108,11 +108,6 @@ class CompilerType {
 
   bool IsPolymorphicClass() const;
 
-  bool
-  IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const {
-return IsPossibleDynamicType(target_type, true, false);
-  }
-
   bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
  bool check_cplusplus, bool check_objc) const;
 



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


[Lldb-commits] [lldb] 52f3a2f - [lldb][NFC] Move LLVM RTTI implementation from enum to static ID variable

2019-11-12 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-12T10:04:32+01:00
New Revision: 52f3a2faf92c4d8efd0e626d52d5f64b7c5d468f

URL: 
https://github.com/llvm/llvm-project/commit/52f3a2faf92c4d8efd0e626d52d5f64b7c5d468f
DIFF: 
https://github.com/llvm/llvm-project/commit/52f3a2faf92c4d8efd0e626d52d5f64b7c5d468f.diff

LOG: [lldb][NFC] Move LLVM RTTI implementation from enum to static ID variable

Summary:
swift-lldb currently has to patch the ExpressionKind enum to add support for 
Swift expressions. If we implement LLVM's RTTI
with a static ID variable instead of a centralised enum we can drop that patch.

Reviewers: labath, davide

Reviewed By: labath

Subscribers: JDevlieghere, lldb-commits

Tags: #upstreaming_lldb_s_downstream_patches, #lldb

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

Added: 


Modified: 
lldb/include/lldb/Expression/Expression.h
lldb/include/lldb/Expression/FunctionCaller.h
lldb/include/lldb/Expression/LLVMUserExpression.h
lldb/include/lldb/Expression/UserExpression.h
lldb/include/lldb/Expression/UtilityFunction.h
lldb/source/Expression/Expression.cpp
lldb/source/Expression/FunctionCaller.cpp
lldb/source/Expression/LLVMUserExpression.cpp
lldb/source/Expression/UserExpression.cpp
lldb/source/Expression/UtilityFunction.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h

Removed: 




diff  --git a/lldb/include/lldb/Expression/Expression.h 
b/lldb/include/lldb/Expression/Expression.h
index fca5fb9119cb..e0ea7e99f4f9 100644
--- a/lldb/include/lldb/Expression/Expression.h
+++ b/lldb/include/lldb/Expression/Expression.h
@@ -32,22 +32,11 @@ class RecordingMemoryManager;
 /// LLVM IR from the expression.
 class Expression {
 public:
-  /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.)
-  enum ExpressionKind {
-eKindFunctionCaller,
-eKindClangFunctionCaller,
-eKindUserExpression,
-eKindLLVMUserExpression,
-eKindClangUserExpression,
-eKindUtilityFunction,
-eKindClangUtilityFunction,
-  };
-
   enum ResultType { eResultTypeAny, eResultTypeId };
 
-  Expression(Target &target, ExpressionKind kind);
+  Expression(Target &target);
 
-  Expression(ExecutionContextScope &exe_scope, ExpressionKind kind);
+  Expression(ExecutionContextScope &exe_scope);
 
   /// Destructor
   virtual ~Expression() {}
@@ -94,12 +83,9 @@ class Expression {
 
   virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; }
 
-  /// LLVM-style RTTI support.
-  ExpressionKind getKind() const { return m_kind; }
-  
-private:
-  /// LLVM-style RTTI support.
-  const ExpressionKind m_kind;
+  // LLVM RTTI support
+  virtual bool isA(const void *ClassID) const = 0;
+
 protected:
   lldb::TargetWP m_target_wp; /// Expression's always have to have a target...
   lldb::ProcessWP m_jit_process_wp; /// An expression might have a process, but

diff  --git a/lldb/include/lldb/Expression/FunctionCaller.h 
b/lldb/include/lldb/Expression/FunctionCaller.h
index ea9d0205bf86..6f60750febd1 100644
--- a/lldb/include/lldb/Expression/FunctionCaller.h
+++ b/lldb/include/lldb/Expression/FunctionCaller.h
@@ -54,12 +54,13 @@ namespace lldb_private {
 /// Any of the methods that take arg_addr_ptr can be passed nullptr, and the
 /// argument space will be managed for you.
 class FunctionCaller : public Expression {
+  // LLVM RTTI support
+  static char ID;
+
 public:
-  /// LLVM-style RTTI support.
-  static bool classof(const Expression *E) {
-return E->getKind() == eKindFunctionCaller;
-  }
-  
+  bool isA(const void *ClassID) const override { return ClassID == &ID; }
+  static bool classof(const Expression *obj) { return obj->isA(&ID); }
+
   /// Constructor
   ///
   /// \param[in] exe_scope

diff  --git a/lldb/include/lldb/Expression/LLVMUserExpression.h 
b/lldb/include/lldb/Expression/LLVMUserExpression.h
index 5f4c43cdea2e..2679c01a4e00 100644
--- a/lldb/include/lldb/Expression/LLVMUserExpression.h
+++ b/lldb/include/lldb/Expression/LLVMUserExpression.h
@@ -30,11 +30,14 @@ namespace lldb_private {
 /// implementations of LLVMUserExpression - which will be vended through the
 /// appropriate TypeSystem.
 class LLVMUserExpression : public UserExpression {
+  // LLVM RTTI support
+  static char ID;
+
 public:
-  /// LLVM-style RTTI support.
-  static bool classof(const Expression *E) {
-return E->getKind() == eKindLLVMUserExpression;
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || UserExpression::isA(ClassID);
   }
+  static bool classof(const Expression *obj) { ret

[Lldb-commits] [PATCH] D70074: [lldb][NFC] Remove unused CompilerType::IsPossibleCPlusPlusDynamicType

2019-11-12 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6cc853b416a2: [lldb][NFC] Remove unused 
CompilerType::IsPossibleCPlusPlusDynamicType (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70074

Files:
  lldb/include/lldb/Symbol/CompilerType.h


Index: lldb/include/lldb/Symbol/CompilerType.h
===
--- lldb/include/lldb/Symbol/CompilerType.h
+++ lldb/include/lldb/Symbol/CompilerType.h
@@ -108,11 +108,6 @@
 
   bool IsPolymorphicClass() const;
 
-  bool
-  IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const {
-return IsPossibleDynamicType(target_type, true, false);
-  }
-
   bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
  bool check_cplusplus, bool check_objc) const;
 


Index: lldb/include/lldb/Symbol/CompilerType.h
===
--- lldb/include/lldb/Symbol/CompilerType.h
+++ lldb/include/lldb/Symbol/CompilerType.h
@@ -108,11 +108,6 @@
 
   bool IsPolymorphicClass() const;
 
-  bool
-  IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const {
-return IsPossibleDynamicType(target_type, true, false);
-  }
-
   bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
  bool check_cplusplus, bool check_objc) const;
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70070: [lldb][NFC] Move LLVM RTTI implementation from enum to static ID variable

2019-11-12 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG52f3a2faf92c: [lldb][NFC] Move LLVM RTTI implementation from 
enum to static ID variable (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70070

Files:
  lldb/include/lldb/Expression/Expression.h
  lldb/include/lldb/Expression/FunctionCaller.h
  lldb/include/lldb/Expression/LLVMUserExpression.h
  lldb/include/lldb/Expression/UserExpression.h
  lldb/include/lldb/Expression/UtilityFunction.h
  lldb/source/Expression/Expression.cpp
  lldb/source/Expression/FunctionCaller.cpp
  lldb/source/Expression/LLVMUserExpression.cpp
  lldb/source/Expression/UserExpression.cpp
  lldb/source/Expression/UtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h

Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
@@ -33,11 +33,14 @@
 /// simply provide a way to push a function into the target for the debugger
 /// to call later on.
 class ClangUtilityFunction : public UtilityFunction {
+  // LLVM RTTI support
+  static char ID;
+
 public:
-  /// LLVM-style RTTI support.
-  static bool classof(const Expression *E) {
-return E->getKind() == eKindClangUtilityFunction;
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || UtilityFunction::isA(ClassID);
   }
+  static bool classof(const Expression *obj) { return obj->isA(&ID); }
 
   class ClangUtilityFunctionHelper : public ClangExpressionHelper {
   public:
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -31,6 +31,8 @@
 
 using namespace lldb_private;
 
+char ClangUtilityFunction::ID;
+
 /// Constructor
 ///
 /// \param[in] text
@@ -40,7 +42,7 @@
 /// The name of the function, as used in the text.
 ClangUtilityFunction::ClangUtilityFunction(ExecutionContextScope &exe_scope,
const char *text, const char *name)
-: UtilityFunction(exe_scope, text, name, eKindClangUtilityFunction) {
+: UtilityFunction(exe_scope, text, name) {
   m_function_text.assign(ClangExpressionSourceCode::g_expression_prefix);
   if (text && text[0])
 m_function_text.append(text);
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -38,11 +38,14 @@
 /// the objects needed to parse and interpret or JIT an expression.  It uses
 /// the Clang parser to produce LLVM IR from the expression.
 class ClangUserExpression : public LLVMUserExpression {
+  // LLVM RTTI support
+  static char ID;
+
 public:
-  /// LLVM-style RTTI support.
-  static bool classof(const Expression *E) {
-return E->getKind() == eKindClangUserExpression;
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || LLVMUserExpression::isA(ClassID);
   }
+  static bool classof(const Expression *obj) { return obj->isA(&ID); }
 
   enum { kDefaultTimeout = 50u };
 
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
@@ -62,13 +62,15 @@
 
 using namespace lldb_private;
 
+char ClangUserExpression::ID;
+
 ClangUserExpression::ClangUserExpression(
 ExecutionContextScope &exe_scope, llvm::StringRef expr,
 llvm::StringRef prefix, lldb::LanguageType language,
 ResultType desired_type, const EvaluateExpressionOptions &options,
 ValueObject *ctx_obj)
 : LLVMUserExpression(exe_scope, expr, prefix, language, desired_type,
- options, eKindClangUserExpression),
+ options),
   m_type_system_helper(*m_target_wp.lock(), options.GetExecutionPolicy() ==
 eExecutionPolicyTopLevel),
   m_result_delegate(exe_scope.CalculateTarget()), m_ctx_obj(ctx_ob

[Lldb-commits] [lldb] 874b649 - [lldb] Add missing include to ObjCLanguage.cpp to fix build

2019-11-12 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-12T10:21:49+01:00
New Revision: 874b6495b5fd6d7e2dc91d6a756eea67486ea7bb

URL: 
https://github.com/llvm/llvm-project/commit/874b6495b5fd6d7e2dc91d6a756eea67486ea7bb
DIFF: 
https://github.com/llvm/llvm-project/commit/874b6495b5fd6d7e2dc91d6a756eea67486ea7bb.diff

LOG: [lldb] Add missing include to ObjCLanguage.cpp to fix build

Added: 


Modified: 
lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp 
b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
index 0e0f8ae7fb0a..3be548ad4144 100644
--- a/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
+++ b/lldb/source/Plugins/Language/ObjC/ObjCLanguage.cpp
@@ -15,6 +15,7 @@
 #include "lldb/DataFormatters/DataVisualization.h"
 #include "lldb/DataFormatters/FormattersHelpers.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/ClangUtil.h"
 #include "lldb/Symbol/CompilerType.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/ConstString.h"



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


[Lldb-commits] [lldb] ec4c96d - [lldb][NFC] Simplify a return in ThreadPlanStepInRange::DefaultShouldStopHereCallback

2019-11-12 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2019-11-12T10:58:54+01:00
New Revision: ec4c96d68566debcc4588c4189b4ef8a5f78729a

URL: 
https://github.com/llvm/llvm-project/commit/ec4c96d68566debcc4588c4189b4ef8a5f78729a
DIFF: 
https://github.com/llvm/llvm-project/commit/ec4c96d68566debcc4588c4189b4ef8a5f78729a.diff

LOG: [lldb][NFC] Simplify a return in 
ThreadPlanStepInRange::DefaultShouldStopHereCallback

We know should_stop_here is false here, so we might as well return false 
directly.

Added: 


Modified: 
lldb/source/Target/ThreadPlanStepInRange.cpp

Removed: 




diff  --git a/lldb/source/Target/ThreadPlanStepInRange.cpp 
b/lldb/source/Target/ThreadPlanStepInRange.cpp
index 71045cc7a990..2aed516b 100644
--- a/lldb/source/Target/ThreadPlanStepInRange.cpp
+++ b/lldb/source/Target/ThreadPlanStepInRange.cpp
@@ -392,7 +392,7 @@ bool ThreadPlanStepInRange::DefaultShouldStopHereCallback(
   should_stop_here = ThreadPlanShouldStopHere::DefaultShouldStopHereCallback(
   current_plan, flags, operation, status, baton);
   if (!should_stop_here)
-return should_stop_here;
+return false;
 
   if (should_stop_here && current_plan->GetKind() == eKindStepInRange &&
   operation == eFrameCompareYounger) {



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


[Lldb-commits] [lldb] 3130a88 - [lldb][test] Macros in expressions require DWARF 5

2019-11-12 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2019-11-12T13:58:06+03:00
New Revision: 3130a88137ddc6ee277c4e896f235cf93d883dfa

URL: 
https://github.com/llvm/llvm-project/commit/3130a88137ddc6ee277c4e896f235cf93d883dfa
DIFF: 
https://github.com/llvm/llvm-project/commit/3130a88137ddc6ee277c4e896f235cf93d883dfa.diff

LOG: [lldb][test] Macros in expressions require DWARF 5

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/commands/expression/macros/Makefile
lldb/packages/Python/lldbsuite/test/commands/expression/macros/TestMacros.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/macros/Makefile 
b/lldb/packages/Python/lldbsuite/test/commands/expression/macros/Makefile
index 59070728a5fa..a7549f24ea7a 100644
--- a/lldb/packages/Python/lldbsuite/test/commands/expression/macros/Makefile
+++ b/lldb/packages/Python/lldbsuite/test/commands/expression/macros/Makefile
@@ -1,6 +1,6 @@
 CXX_SOURCES := main.cpp
 
-DEBUG_INFO_FLAG = -g3
+DEBUG_INFO_FLAG = -g3 -gdwarf-5
 
 
 include Makefile.rules

diff  --git 
a/lldb/packages/Python/lldbsuite/test/commands/expression/macros/TestMacros.py 
b/lldb/packages/Python/lldbsuite/test/commands/expression/macros/TestMacros.py
index 817f6cb3944a..26e4309605ee 100644
--- 
a/lldb/packages/Python/lldbsuite/test/commands/expression/macros/TestMacros.py
+++ 
b/lldb/packages/Python/lldbsuite/test/commands/expression/macros/TestMacros.py
@@ -21,6 +21,9 @@ class TestMacros(TestBase):
 hostoslist=["windows"],
 compiler="gcc",
 triple='.*-android')
+@expectedFailureAll(
+compiler="gcc", compiler_version=['<', '5.1'],
+bugnumber=".debug_macro was introduced in DWARF 5, GCC supports it 
since version 5.1")
 def test_expr_with_macros(self):
 self.build()
 



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


[Lldb-commits] [PATCH] D70060: [lldb] [Process/NetBSD] Use PT_STOP to stop the process

2019-11-12 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG77cc246412ca: [lldb] [Process/NetBSD] Use PT_STOP to stop 
the process [NFCI] (authored by mgorny).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70060

Files:
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
@@ -47,6 +47,8 @@
 
   Status Signal(int signo) override;
 
+  Status Interrupt() override;
+
   Status Kill() override;
 
   Status GetMemoryRegionInfo(lldb::addr_t load_addr,
Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -381,12 +381,7 @@
 }
 
 Status NativeProcessNetBSD::Halt() {
-  Status error;
-
-  if (kill(GetID(), SIGSTOP) != 0)
-error.SetErrorToErrno();
-
-  return error;
+  return PtraceWrapper(PT_STOP, GetID());
 }
 
 Status NativeProcessNetBSD::Detach() {
@@ -411,6 +406,10 @@
   return error;
 }
 
+Status NativeProcessNetBSD::Interrupt() {
+  return PtraceWrapper(PT_STOP, GetID());
+}
+
 Status NativeProcessNetBSD::Kill() {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
   LLDB_LOG(log, "pid {0}", GetID());


Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
@@ -47,6 +47,8 @@
 
   Status Signal(int signo) override;
 
+  Status Interrupt() override;
+
   Status Kill() override;
 
   Status GetMemoryRegionInfo(lldb::addr_t load_addr,
Index: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
@@ -381,12 +381,7 @@
 }
 
 Status NativeProcessNetBSD::Halt() {
-  Status error;
-
-  if (kill(GetID(), SIGSTOP) != 0)
-error.SetErrorToErrno();
-
-  return error;
+  return PtraceWrapper(PT_STOP, GetID());
 }
 
 Status NativeProcessNetBSD::Detach() {
@@ -411,6 +406,10 @@
   return error;
 }
 
+Status NativeProcessNetBSD::Interrupt() {
+  return PtraceWrapper(PT_STOP, GetID());
+}
+
 Status NativeProcessNetBSD::Kill() {
   Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS));
   LLDB_LOG(log, "pid {0}", GetID());
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70120: [lldb][NFC] Let CompilerType::DumpTypeValue take a option struct instead of a huge list of options

2019-11-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor created this revision.
teemperor added reviewers: labath, davide.
Herald added subscribers: lldb-commits, JDevlieghere.
Herald added a project: LLDB.

This function has 8 parameters which makes its function calls hard to read. It 
also
doesn't help that half the parameters are just integers of some form. What's 
even worse is that
we fiddle around with all these signatures/invocations downstream in swift-lldb 
just because we
add one parameter there.

Let's just pass a struct here so that we can add the default values in a 
sensible way and actually
have some descriptive name beside the values we pass as parameters when we call 
this function.
Also moves the hidden documentation from the one function call to the struct so 
that it becomes
more obvious what's going on here.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D70120

Files:
  lldb/include/lldb/Symbol/ClangASTContext.h
  lldb/include/lldb/Symbol/CompilerType.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/DataFormatters/TypeFormat.cpp
  lldb/source/Symbol/ClangASTContext.cpp
  lldb/source/Symbol/CompilerType.cpp

Index: lldb/source/Symbol/CompilerType.cpp
===
--- lldb/source/Symbol/CompilerType.cpp
+++ lldb/source/Symbol/CompilerType.cpp
@@ -731,17 +731,10 @@
verbose, depth);
 }
 
-bool CompilerType::DumpTypeValue(Stream *s, lldb::Format format,
- const DataExtractor &data,
- lldb::offset_t byte_offset, size_t byte_size,
- uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset,
- ExecutionContextScope *exe_scope) {
+bool CompilerType::DumpTypeValue(DumpTypeValueOpts opts) {
   if (!IsValid())
 return false;
-  return m_type_system->DumpTypeValue(m_type, s, format, data, byte_offset,
-  byte_size, bitfield_bit_size,
-  bitfield_bit_offset, exe_scope);
+  return m_type_system->DumpTypeValue(m_type, opts);
 }
 
 void CompilerType::DumpSummary(ExecutionContext *exe_ctx, Stream *s,
Index: lldb/source/Symbol/ClangASTContext.cpp
===
--- lldb/source/Symbol/ClangASTContext.cpp
+++ lldb/source/Symbol/ClangASTContext.cpp
@@ -9468,11 +9468,8 @@
   return true;
 }
 
-bool ClangASTContext::DumpTypeValue(
-lldb::opaque_compiler_type_t type, Stream *s, lldb::Format format,
-const DataExtractor &data, lldb::offset_t byte_offset, size_t byte_size,
-uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
-ExecutionContextScope *exe_scope) {
+bool ClangASTContext::DumpTypeValue(lldb::opaque_compiler_type_t type,
+CompilerType::DumpTypeValueOpts opts) {
   if (!type)
 return false;
   if (IsAggregateType(type)) {
@@ -9484,8 +9481,7 @@
 
 if (type_class == clang::Type::Elaborated) {
   qual_type = llvm::cast(qual_type)->getNamedType();
-  return DumpTypeValue(qual_type.getAsOpaquePtr(), s, format, data, byte_offset, byte_size,
-   bitfield_bit_size, bitfield_bit_offset, exe_scope);
+  return DumpTypeValue(qual_type.getAsOpaquePtr(), opts);
 }
 
 switch (type_class) {
@@ -9495,32 +9491,24 @@
   ->getDecl()
   ->getUnderlyingType();
   CompilerType typedef_clang_type(this, typedef_qual_type.getAsOpaquePtr());
-  if (format == eFormatDefault)
-format = typedef_clang_type.GetFormat();
+  if (opts.format == eFormatDefault)
+opts.format = typedef_clang_type.GetFormat();
   clang::TypeInfo typedef_type_info =
   getASTContext()->getTypeInfo(typedef_qual_type);
   uint64_t typedef_byte_size = typedef_type_info.Width / 8;
 
-  return typedef_clang_type.DumpTypeValue(
-  s,
-  format,// The format with which to display the element
-  data,  // Data buffer containing all bytes for this type
-  byte_offset,   // Offset into "data" where to grab value from
-  typedef_byte_size, // Size of this type in bytes
-  bitfield_bit_size, // Size in bits of a bitfield value, if zero don't
- // treat as a bitfield
-  bitfield_bit_offset, // Offset in bits of a bitfield value if
-   // bitfield_bit_size != 0
-  exe_scope);
+  opts.data_byte_size = typedef_byte_size;
+  return typedef_clang_type.DumpTypeValue(opts);
 } break;
 
 case clang::Type::Enum:
   // If our format is enum or default, show the enumeration value as its
   // enumeration string value, else just display it as requested.
-  if ((format == eFormatEnum || format == eFormatDefault) &&
+  if ((opts.format == eFormatEnum || opts.format == eFormatDefault) &&
 

[Lldb-commits] [PATCH] D69704: [lldb] Add IsTypeSystemCompatible method to SBModule to allow checking compatibility between language versions

2019-11-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor updated this revision to Diff 228873.
teemperor added a comment.

- Renamed to IsDebugInfoCompatible
- Pass on llvm::Error error message to caller.


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

https://reviews.llvm.org/D69704

Files:
  lldb/include/lldb/API/SBError.h
  lldb/include/lldb/API/SBModule.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/packages/Python/lldbsuite/test/python_api/module_compability/Makefile
  
lldb/packages/Python/lldbsuite/test/python_api/module_compability/TestModuleDebugInfoCompatible.py
  lldb/packages/Python/lldbsuite/test/python_api/module_compability/main.cpp
  lldb/scripts/interface/SBModule.i
  lldb/source/API/SBModule.cpp
  lldb/source/Symbol/TypeSystem.cpp

Index: lldb/source/Symbol/TypeSystem.cpp
===
--- lldb/source/Symbol/TypeSystem.cpp
+++ lldb/source/Symbol/TypeSystem.cpp
@@ -147,6 +147,12 @@
   return false;
 }
 
+Status TypeSystem::IsCompatible() {
+  // Assume a language is compatible. Override this virtual function
+  // in your TypeSystem plug-in if version checking is desired.
+  return Status();
+}
+
 ConstString TypeSystem::DeclGetMangledName(void *opaque_decl) {
   return ConstString();
 }
Index: lldb/source/API/SBModule.cpp
===
--- lldb/source/API/SBModule.cpp
+++ lldb/source/API/SBModule.cpp
@@ -23,6 +23,7 @@
 #include "lldb/Symbol/Symtab.h"
 #include "lldb/Symbol/TypeSystem.h"
 #include "lldb/Symbol/VariableList.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Utility/StreamString.h"
 
@@ -687,6 +688,28 @@
   return LLDB_RECORD_RESULT(sb_addr);
 }
 
+lldb::SBError SBModule::IsDebugInfoCompatible(lldb::LanguageType language) {
+  SBError sb_error;
+  ModuleSP module_sp(GetSP());
+  if (!module_sp) {
+sb_error.SetErrorString("invalid module");
+return sb_error;
+  }
+
+  auto type_system_or_err = module_sp->GetTypeSystemForLanguage(language);
+  if (!type_system_or_err) {
+llvm::handleAllErrors(type_system_or_err.takeError(),
+  [&sb_error](const llvm::ErrorInfoBase &e) {
+sb_error.SetErrorStringWithFormat(
+"%s", e.message().c_str());
+  });
+return sb_error;
+  }
+
+  sb_error.SetError(type_system_or_err->IsCompatible());
+  return sb_error;
+}
+
 namespace lldb_private {
 namespace repro {
 
Index: lldb/scripts/interface/SBModule.i
===
--- lldb/scripts/interface/SBModule.i
+++ lldb/scripts/interface/SBModule.i
@@ -342,6 +342,9 @@
 lldb::SBAddress
 GetObjectFileEntryPointAddress() const;
 
+lldb::SBError
+IsDebugInfoCompatible(lldb::LanguageType language);
+
 %pythoncode %{
 def __len__(self):
 '''Return the number of symbols in a lldb.SBModule object.'''
Index: lldb/packages/Python/lldbsuite/test/python_api/module_compability/main.cpp
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/python_api/module_compability/main.cpp
@@ -0,0 +1 @@
+int main() {}
Index: lldb/packages/Python/lldbsuite/test/python_api/module_compability/TestModuleDebugInfoCompatible.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/python_api/module_compability/TestModuleDebugInfoCompatible.py
@@ -0,0 +1,64 @@
+"""
+Test SBModule's IsDebugInfoCompatible.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+
+class ModuleDebugInfoCheckTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def assert_invalid_module_err(self, error):
+self.assertEquals("invalid module", error.GetCString())
+self.assertFalse(error.Success())
+
+# Py3 asserts due to a bug in SWIG.  A fix for this was upstreamed into
+# SWIG 3.0.8.
+@skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
+@add_test_categories(['pyapi'])
+@no_debug_info_test
+def test_default_module(self):
+exe_module = lldb.SBModule()
+self.assert_invalid_module_err(exe_module.IsDebugInfoCompatible(lldb.eLanguageTypeUnknown))
+self.assert_invalid_module_err(error = exe_module.IsDebugInfoCompatible(lldb.eLanguageTypeC))
+
+def assert_compatible(self, exe_module, lang):
+error = exe_module.IsDebugInfoCompatible(lang)
+self.assertTrue(error.Success())
+
+# Py3 asserts due to a bug in SWIG.  A fix for this was upstreamed into
+# SWIG 3.0.8.
+@skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
+@add_test_categories(['pyapi'])
+@no_debug_info_test
+def test_c_languages(self):
+self.build()
+exe = self.getBuildArtifact("a.out")
+
+

[Lldb-commits] [PATCH] D70120: [lldb][NFC] Let CompilerType::DumpTypeValue take a option struct instead of a huge list of options

2019-11-12 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I can't say I'm a fan of one-shot argument pack structures... For instance, one 
thing that's lost by this particular implementation is the implicit "nonnull" 
annotations on the arguments conferred by the references (the data extractor is 
already "nonnull", the stream isn't but it probably ought to be).

IIRC, we have a nontrivial number of functions which have a need to take a 
"reference" to some bitfield-y thing. For instance, the DumpDataExtractor 
function, which is also mentioned in this patch... Can we come up with some 
clever way to pack the arguments specifying the data to process into a single 
entity? That would replace five of these arguments by one, which should bring 
down the total number of arguments to this function to a reasonable size. And 
it would be usable in other contexts too...


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D70120



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


[Lldb-commits] [lldb] 1dfb1a8 - [lldb] Fix some warnings in the python plugin

2019-11-12 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2019-11-12T14:39:34+01:00
New Revision: 1dfb1a85e7cbc37bf6fff9bb046c6e8be0c26b8e

URL: 
https://github.com/llvm/llvm-project/commit/1dfb1a85e7cbc37bf6fff9bb046c6e8be0c26b8e
DIFF: 
https://github.com/llvm/llvm-project/commit/1dfb1a85e7cbc37bf6fff9bb046c6e8be0c26b8e.diff

LOG: [lldb] Fix some warnings in the python plugin

Added: 


Modified: 
lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h 
b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
index 05f280ae6988..b6d63373b433 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h
@@ -130,7 +130,7 @@ template  T Take(PyObject *obj) {
   assert(!PyErr_Occurred());
   T thing(PyRefType::Owned, obj);
   assert(thing.IsValid());
-  return std::move(thing);
+  return thing;
 }
 
 // Retain a reference you have borrowed, and turn it into
@@ -148,7 +148,7 @@ template  T Retain(PyObject *obj) {
   assert(!PyErr_Occurred());
   T thing(PyRefType::Borrowed, obj);
   assert(thing.IsValid());
-  return std::move(thing);
+  return thing;
 }
 
 // This class can be used like a utility function to convert from

diff  --git 
a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp 
b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 29509f5b98e0..5ed01cf47934 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -1190,6 +1190,7 @@ bool 
ScriptInterpreterPythonImpl::ExecuteOneLineWithReturn(
 return true;
   }
   }
+  llvm_unreachable("Fully covered switch!");
 }
 
 Status ScriptInterpreterPythonImpl::ExecuteMultipleLines(



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


[Lldb-commits] [lldb] 6aa60b0 - [lldb] Fix more -Wdeprecated-copy warnings

2019-11-12 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2019-11-12T14:39:47+01:00
New Revision: 6aa60b0514865751ea9dd208236db60eb69aaf1e

URL: 
https://github.com/llvm/llvm-project/commit/6aa60b0514865751ea9dd208236db60eb69aaf1e
DIFF: 
https://github.com/llvm/llvm-project/commit/6aa60b0514865751ea9dd208236db60eb69aaf1e.diff

LOG: [lldb] Fix more -Wdeprecated-copy warnings

This warning triggers when a class defines a copy constructor but not a
copy-assignment operator (which then gets auto-generated by the
compiler). Fix the warning by deleting the other operator too, as the
default implementation works just fine.

Added: 


Modified: 
lldb/include/lldb/Core/SearchFilter.h
lldb/include/lldb/Host/SocketAddress.h
lldb/include/lldb/Utility/StringExtractorGDBRemote.h
lldb/source/Core/SearchFilter.cpp
lldb/source/Host/common/SocketAddress.cpp
lldb/source/Host/common/TCPSocket.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/SearchFilter.h 
b/lldb/include/lldb/Core/SearchFilter.h
index 6823daf9e3ed..97880f693887 100644
--- a/lldb/include/lldb/Core/SearchFilter.h
+++ b/lldb/include/lldb/Core/SearchFilter.h
@@ -366,8 +366,6 @@ class SearchFilterByModuleList : public SearchFilter {
 
   ~SearchFilterByModuleList() override;
 
-  SearchFilterByModuleList &operator=(const SearchFilterByModuleList &rhs);
-
   bool ModulePasses(const lldb::ModuleSP &module_sp) override;
 
   bool ModulePasses(const FileSpec &spec) override;
@@ -416,13 +414,8 @@ class SearchFilterByModuleListAndCU : public 
SearchFilterByModuleList {
 const FileSpecList &module_list,
 const FileSpecList &cu_list);
 
-  SearchFilterByModuleListAndCU(const SearchFilterByModuleListAndCU &rhs);
-
   ~SearchFilterByModuleListAndCU() override;
 
-  SearchFilterByModuleListAndCU &
-  operator=(const SearchFilterByModuleListAndCU &rhs);
-
   bool AddressPasses(Address &address) override;
 
   bool CompUnitPasses(FileSpec &fileSpec) override;

diff  --git a/lldb/include/lldb/Host/SocketAddress.h 
b/lldb/include/lldb/Host/SocketAddress.h
index 620827ff6eb1..766303a3c1fd 100644
--- a/lldb/include/lldb/Host/SocketAddress.h
+++ b/lldb/include/lldb/Host/SocketAddress.h
@@ -48,8 +48,6 @@ class SocketAddress {
   ~SocketAddress();
 
   // Operators
-  const SocketAddress &operator=(const SocketAddress &rhs);
-
   const SocketAddress &operator=(const struct addrinfo *addr_info);
 
   const SocketAddress &operator=(const struct sockaddr &s);

diff  --git a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h 
b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
index cbf6e0c29e8e..715f3cb2541d 100644
--- a/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
+++ b/lldb/include/lldb/Utility/StringExtractorGDBRemote.h
@@ -31,11 +31,6 @@ class StringExtractorGDBRemote : public StringExtractor {
   StringExtractorGDBRemote(const char *cstr)
   : StringExtractor(cstr), m_validator(nullptr) {}
 
-  StringExtractorGDBRemote(const StringExtractorGDBRemote &rhs)
-  : StringExtractor(rhs), m_validator(rhs.m_validator) {}
-
-  ~StringExtractorGDBRemote() override {}
-
   bool ValidateResponse() const;
 
   void CopyResponseValidator(const StringExtractorGDBRemote &rhs);

diff  --git a/lldb/source/Core/SearchFilter.cpp 
b/lldb/source/Core/SearchFilter.cpp
index e02b4f66b58c..8f80caa3eb4d 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -523,13 +523,6 @@ SearchFilterByModuleList::SearchFilterByModuleList(
 enum FilterTy filter_ty)
 : SearchFilter(target_sp, filter_ty), m_module_spec_list(module_list) {}
 
-SearchFilterByModuleList &SearchFilterByModuleList::
-operator=(const SearchFilterByModuleList &rhs) {
-  m_target_sp = rhs.m_target_sp;
-  m_module_spec_list = rhs.m_module_spec_list;
-  return *this;
-}
-
 SearchFilterByModuleList::~SearchFilterByModuleList() = default;
 
 bool SearchFilterByModuleList::ModulePasses(const ModuleSP &module_sp) {
@@ -669,19 +662,6 @@ 
SearchFilterByModuleListAndCU::SearchFilterByModuleListAndCU(
FilterTy::ByModulesAndCU),
   m_cu_spec_list(cu_list) {}
 
-SearchFilterByModuleListAndCU::SearchFilterByModuleListAndCU(
-const SearchFilterByModuleListAndCU &rhs) = default;
-
-SearchFilterByModuleListAndCU &SearchFilterByModuleListAndCU::
-operator=(const SearchFilterByModuleListAndCU &rhs) {
-  if (&rhs != this) {
-m_target_sp = rhs.m_target_sp;
-m_module_spec_list = rhs.m_module_spec_list;
-m_cu_spec_list = rhs.m_cu_spec_list;
-  }
-  return *this;
-}
-
 SearchFilterByModuleListAndCU::~SearchFilterByModuleListAndCU() = default;
 
 lldb::SearchFilterSP SearchFilterByModuleListAndCU::CreateFromStructuredData(

diff  --git a/lldb/source/Host/common/SocketAddress.cpp 
b/lldb/source/Host/common/SocketAddress.cpp
index 882fd24558f7..960ed18dc768 100644
--- a/lldb/source/Host/common/SocketAddress.c

[Lldb-commits] [lldb] a6c40f5 - Revert "Fix lookup of symbols at the same address with no size vs. size"

2019-11-12 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2019-11-12T19:02:17+05:00
New Revision: a6c40f56aed1556a80867209b6846f7eedc4dc78

URL: 
https://github.com/llvm/llvm-project/commit/a6c40f56aed1556a80867209b6846f7eedc4dc78
DIFF: 
https://github.com/llvm/llvm-project/commit/a6c40f56aed1556a80867209b6846f7eedc4dc78.diff

LOG: Revert "Fix lookup of symbols at the same address with no size vs. size"

This reverts commit 3f594ed1686b44138bee245c708773e526643aaf.

This change has cause LLDB expression evaluation to fail on Arm Linux.

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

Added: 


Modified: 
lldb/source/Symbol/Symtab.cpp

Removed: 
lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s
lldb/test/Shell/SymbolFile/sizeless-symbol.test



diff  --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp
index 8a45cc05e491..9a2b5cddd73b 100644
--- a/lldb/source/Symbol/Symtab.cpp
+++ b/lldb/source/Symbol/Symtab.cpp
@@ -895,14 +895,8 @@ void Symtab::InitAddressIndexes() {
   for (size_t i = 0; i < num_entries; i++) {
 FileRangeToIndexMap::Entry *entry =
 m_file_addr_to_index.GetMutableEntryAtIndex(i);
-if (entry->GetByteSize() > 0)
-  continue;
-addr_t curr_base_addr = entry->GetRangeBase();
-// Symbols with non-zero size will show after zero-sized symbols on the
-// same address. So do not set size of a non-last zero-sized symbol.
-if (i == num_entries - 1 ||
-m_file_addr_to_index.GetMutableEntryAtIndex(i + 1)
-->GetRangeBase() != curr_base_addr) {
+if (entry->GetByteSize() == 0) {
+  addr_t curr_base_addr = entry->GetRangeBase();
   const RangeVector::Entry *containing_section =
   section_ranges.FindEntryThatContains(curr_base_addr);
 

diff  --git a/lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s 
b/lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s
deleted file mode 100644
index ac08dddb0e2c..
--- a/lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s
+++ /dev/null
@@ -1,8 +0,0 @@
-.text
-.byte   0
-sizeless:
-sizeful:
-.byte   0
-.byte   0
-sizeend:
-.size   sizeful, sizeend - sizeful

diff  --git a/lldb/test/Shell/SymbolFile/sizeless-symbol.test 
b/lldb/test/Shell/SymbolFile/sizeless-symbol.test
deleted file mode 100644
index 1459d6ada8de..
--- a/lldb/test/Shell/SymbolFile/sizeless-symbol.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# Some targets do not have the .size directive.
-# RUN: %clang -target x86_64-unknown-unknown-elf %S/Inputs/sizeless-symbol.s 
-c -o %t.o
-# RUN: %lldb %t.o -s %s -o quit | FileCheck %s
-
-image lookup --address 1
-# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful
-image lookup --address 2
-# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful + 1
-image dump symtab
-# CHECK: Index   UserID DSX TypeFile Address/Value Load 
Address   Size   Flags  Name
-# CHECK-NEXT:--- -- --- --- -- 
-- -- -- 
--
-# CHECK-NEXT:[0]  1 Code0x0003 
   0x 0x sizeend
-# CHECK-NEXT:[1]  2 Code0x0001 
   0x0002 0x sizeful
-# CHECK-NEXT:[2]  3 Code0x0001 
   0x 0x sizeless



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


[Lldb-commits] [PATCH] D63540: Fix lookup of symbols at the same address with no size vs. size

2019-11-12 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Revision".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa6c40f56aed1: Revert "Fix lookup of symbols at the same 
address with no size vs. size" (authored by omjavaid).

Changed prior to commit:
  https://reviews.llvm.org/D63540?vs=207304&id=228879#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D63540

Files:
  lldb/source/Symbol/Symtab.cpp
  lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s
  lldb/test/Shell/SymbolFile/sizeless-symbol.test


Index: lldb/test/Shell/SymbolFile/sizeless-symbol.test
===
--- lldb/test/Shell/SymbolFile/sizeless-symbol.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# Some targets do not have the .size directive.
-# RUN: %clang -target x86_64-unknown-unknown-elf %S/Inputs/sizeless-symbol.s 
-c -o %t.o
-# RUN: %lldb %t.o -s %s -o quit | FileCheck %s
-
-image lookup --address 1
-# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful
-image lookup --address 2
-# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful + 1
-image dump symtab
-# CHECK: Index   UserID DSX TypeFile Address/Value Load 
Address   Size   Flags  Name
-# CHECK-NEXT:--- -- --- --- -- 
-- -- -- 
--
-# CHECK-NEXT:[0]  1 Code0x0003 
   0x 0x sizeend
-# CHECK-NEXT:[1]  2 Code0x0001 
   0x0002 0x sizeful
-# CHECK-NEXT:[2]  3 Code0x0001 
   0x 0x sizeless
Index: lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s
===
--- lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s
+++ /dev/null
@@ -1,8 +0,0 @@
-.text
-.byte   0
-sizeless:
-sizeful:
-.byte   0
-.byte   0
-sizeend:
-.size   sizeful, sizeend - sizeful
Index: lldb/source/Symbol/Symtab.cpp
===
--- lldb/source/Symbol/Symtab.cpp
+++ lldb/source/Symbol/Symtab.cpp
@@ -895,14 +895,8 @@
   for (size_t i = 0; i < num_entries; i++) {
 FileRangeToIndexMap::Entry *entry =
 m_file_addr_to_index.GetMutableEntryAtIndex(i);
-if (entry->GetByteSize() > 0)
-  continue;
-addr_t curr_base_addr = entry->GetRangeBase();
-// Symbols with non-zero size will show after zero-sized symbols on the
-// same address. So do not set size of a non-last zero-sized symbol.
-if (i == num_entries - 1 ||
-m_file_addr_to_index.GetMutableEntryAtIndex(i + 1)
-->GetRangeBase() != curr_base_addr) {
+if (entry->GetByteSize() == 0) {
+  addr_t curr_base_addr = entry->GetRangeBase();
   const RangeVector::Entry *containing_section =
   section_ranges.FindEntryThatContains(curr_base_addr);
 


Index: lldb/test/Shell/SymbolFile/sizeless-symbol.test
===
--- lldb/test/Shell/SymbolFile/sizeless-symbol.test
+++ /dev/null
@@ -1,14 +0,0 @@
-# Some targets do not have the .size directive.
-# RUN: %clang -target x86_64-unknown-unknown-elf %S/Inputs/sizeless-symbol.s -c -o %t.o
-# RUN: %lldb %t.o -s %s -o quit | FileCheck %s
-
-image lookup --address 1
-# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful
-image lookup --address 2
-# CHECK: Summary: sizeless-symbol.test.tmp.o`sizeful + 1
-image dump symtab
-# CHECK: Index   UserID DSX TypeFile Address/Value Load Address   Size   Flags  Name
-# CHECK-NEXT:--- -- --- --- -- -- -- -- --
-# CHECK-NEXT:[0]  1 Code0x00030x 0x sizeend
-# CHECK-NEXT:[1]  2 Code0x00010x0002 0x sizeful
-# CHECK-NEXT:[2]  3 Code0x00010x 0x sizeless
Index: lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s
===
--- lldb/test/Shell/SymbolFile/Inputs/sizeless-symbol.s
+++ /dev/null
@@ -1,8 +0,0 @@
-.text
-.byte   0
-sizeless:
-sizeful:
-.byte   0
-.byte   0
-sizeend:
-.size   sizeful, sizeend - sizeful
Index: lldb/source/Symbol/Symtab.cpp
===
--- lldb/source/Symbol/Symtab.cpp
+++ l

[Lldb-commits] [PATCH] D70127: [lldb-vscode] Fix a race in test_extra_launch_commands

2019-11-12 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: clayborg, kusmour, jankratochvil.
Herald added a project: LLDB.

The test used a non-stopping "run" command to launch the process. This
is different from the regular launch with no extra launch commands,
which uses eLaunchFlagStopAtEntry to ensure that the process stops
straight away.

I'm not really sure what's supposed to happen in non-stop-at-entry mode,
or if that's even supported, but what ended up happening was the launch
packet got a reply while the process was running. Then the test case did
a continue_to_next_stop(), which queued a *second* resume request
(along with the internal "resumes" which were being issued as a part of
normal process startup). These two resumes ended up chasing each other's
tails inside lldb in a way which produced hilarious log traces.
Surprisingly, the test ended up passing most of the time, but it did
cause spurious failures when the test seemed to miss a breakpoint.

This changes the test to use stop-at-entry mode in the manual launch
sequence too, which seems to be enough to make the test pass reliably.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70127

Files:
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py


Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
===
--- 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -352,7 +352,7 @@
 'target create "%s"' % (program),
 'br s -f main.c -l %d' % first_line,
 'br s -f main.c -l %d' % second_line,
-'run'
+'process launch --stop-at-entry'
 ]
 
 initCommands = ['target list', 'platform list']


Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -352,7 +352,7 @@
 'target create "%s"' % (program),
 'br s -f main.c -l %d' % first_line,
 'br s -f main.c -l %d' % second_line,
-'run'
+'process launch --stop-at-entry'
 ]
 
 initCommands = ['target list', 'platform list']
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D70127: [lldb-vscode] Fix a race in test_extra_launch_commands

2019-11-12 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil accepted this revision.
jankratochvil added a comment.
This revision is now accepted and ready to land.

I agree - as there is currently:

  self.verify_commands('launchCommands', output, launchCommands)
  # Verify the "stopCommands" here
  self.continue_to_next_stop()

BTW I did not have problem with this testcase, I had problem with 
`TestVSCode_attach` but I never finished that patch: 
https://people.redhat.com/jkratoch/TestVSCode_attach.patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70127



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


[Lldb-commits] [PATCH] D69704: [lldb] Add IsTypeSystemCompatible method to SBModule to allow checking compatibility between language versions

2019-11-12 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.

I think this is fine.

In D69704#1741588 , @jingham wrote:

> If, for instance, we decided to use .pcm files as a serialization form for 
> type info you would need the same sort of check for modules backed by these 
> pcm's - since the clang in lldb and the clang building the pcm would have to 
> match.  BTW I am NOT suggesting that would be a good idea, and this will 
> probably always be a no-op for anything but Swift.


Hm... If I understand modules correctly (and I admit I know very little about 
them), I think this actually illustrates the my reservations about this. 
Assuming we were fetching type info from a pcm file etc., there is no 
relationship between a module (shared library) and a pcm file... I would 
imagine a module can reference multiple pcm files, and each one could be 
theoretically built with a different compiler. That then brings up a question 
of what does it mean for lldb to be "compatible" with the module as a whole...




Comment at: lldb/source/API/SBModule.cpp:700-704
+  if (!type_system_or_err) {
+sb_error.SetErrorStringWithFormat(
+"no type system for language %s",
+Language::GetNameForLanguageType(language));
+llvm::consumeError(type_system_or_err.takeError());

labath wrote:
> Do you want to store the actual error message in `type_system_or_err` into 
> sb_error?
Actually, you can do that by just saying `sb_error.ref() = 
type_system_or_err.takeError()` or something along those lines. :)


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

https://reviews.llvm.org/D69704



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


[Lldb-commits] [lldb] 3b73dcd - Performance: Add a set of visited SymbolFiles to the other FindFiles variant.

2019-11-12 Thread Adrian Prantl via lldb-commits

Author: Adrian Prantl
Date: 2019-11-12T09:38:37-08:00
New Revision: 3b73dcdc9656e156c4380454150b8986c5b9aad1

URL: 
https://github.com/llvm/llvm-project/commit/3b73dcdc9656e156c4380454150b8986c5b9aad1
DIFF: 
https://github.com/llvm/llvm-project/commit/3b73dcdc9656e156c4380454150b8986c5b9aad1.diff

LOG: Performance: Add a set of visited SymbolFiles to the other FindFiles 
variant.

This is basically the same bug as in r260434.

SymbolFileDWARF::FindTypes has exponential worst-case when digging
through dependency DAG of .pcm files because each object file and .pcm
file may depend on an already-visited .pcm file, which may again have
dependencies. Fixed here by carrying a set of already visited
SymbolFiles around.

rdar://problem/56993424

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

Added: 


Modified: 
lldb/include/lldb/Core/Module.h
lldb/include/lldb/Symbol/SymbolFile.h
lldb/source/Core/Module.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
lldb/source/Symbol/SymbolFile.cpp
lldb/tools/lldb-test/lldb-test.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 89b731427e3f..0f1d276337c1 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -429,7 +429,11 @@ class Module : public std::enable_shared_from_this,
   /// This behaves like the other FindTypes method but allows to
   /// specify a DeclContext and a language for the type being searched
   /// for.
+  ///
+  /// \param searched_symbol_files
+  /// Prevents one file from being visited multiple times.
   void FindTypes(llvm::ArrayRef pattern, LanguageSet 
languages,
+ llvm::DenseSet 
&searched_symbol_files,
  TypeMap &types);
 
   lldb::TypeSP FindFirstType(const SymbolContext &sc,

diff  --git a/lldb/include/lldb/Symbol/SymbolFile.h 
b/lldb/include/lldb/Symbol/SymbolFile.h
index 6724b425abf3..3c52766f39d3 100644
--- a/lldb/include/lldb/Symbol/SymbolFile.h
+++ b/lldb/include/lldb/Symbol/SymbolFile.h
@@ -193,9 +193,14 @@ class SymbolFile : public PluginInterface {
 TypeMap &types);
 
   /// Find types specified by a CompilerContextPattern.
-  /// \param languagesOnly return results in these languages.
-  virtual void FindTypes(llvm::ArrayRef pattern,
-   LanguageSet languages, TypeMap &types);
+  /// \param languages
+  /// Only return results in these languages.
+  /// \param searched_symbol_files
+  /// Prevents one file from being visited multiple times.
+  virtual void
+  FindTypes(llvm::ArrayRef pattern, LanguageSet languages,
+llvm::DenseSet &searched_symbol_files,
+TypeMap &types);
 
   virtual void
   GetMangledNamesForFunction(const std::string &scope_qualified_name,

diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index aef3f3e3b4b0..a14bd3d370a1 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -1006,12 +1006,14 @@ void Module::FindTypes(
   }
 }
 
-void Module::FindTypes(llvm::ArrayRef pattern,
-   LanguageSet languages, TypeMap &types) {
+void Module::FindTypes(
+llvm::ArrayRef pattern, LanguageSet languages,
+llvm::DenseSet &searched_symbol_files,
+TypeMap &types) {
   static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
   Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
   if (SymbolFile *symbols = GetSymbolFile())
-symbols->FindTypes(pattern, languages, types);
+symbols->FindTypes(pattern, languages, searched_symbol_files, types);
 }
 
 SymbolFile *Module::GetSymbolFile(bool can_create, Stream *feedback_strm) {

diff  --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp 
b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
index f84cf0c5368d..c77ddd378873 100644
--- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
+++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
@@ -307,8 +307,9 @@ void SymbolFileBreakpad::FindTypes(
 uint32_t max_matches, llvm::DenseSet &searched_symbol_files,
 TypeMap &types) {}
 
-void SymbolFileBreakpad::FindTypes(llvm::ArrayRef pattern,
-   LanguageSet languages, TypeMap &types) {}
+void SymbolFileBreakpad::FindTypes(
+llvm::ArrayRef pattern, LanguageSet languages,
+llvm::DenseSet &searched_sym

[Lldb-commits] [PATCH] D70022: [lldb] [Process/NetBSD] Improve threading support

2019-11-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 228907.
mgorny added a comment.
Herald added a reviewer: jfb.

Included updated on test suite status. I've only un-XFAIL-ed tests that are 
definitely (well, most likely) fixed. I didn't change the status of tests that 
are flaky (e.g. concurrent tests that pass only because accidentally concurrent 
enough). I'll look into adding more tests later.


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

https://reviews.llvm.org/D70022

Files:
  
lldb/packages/Python/lldbsuite/test/commands/watchpoints/hello_watchlocation/TestWatchLocation.py
  
lldb/packages/Python/lldbsuite/test/commands/watchpoints/watchpoint_set_command/TestWatchLocationWithWatchSet.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointOneDelayBreakpointThreads.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithSignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpointBreakpointSignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointSignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayedCrashWithBreakpointWatchpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointThreads.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/exit_during_break/TestExitDuringBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/exit_during_step/TestExitDuringStep.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/num_threads/TestNumThreads.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_exit/TestThreadExit.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py
  
lldb/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py
  
lldb/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h

Index: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
===
--- lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
+++ lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
@@ -48,11 +48,16 @@
 private:
   // Interface for friend classes
 
+  Status Resume();
+  Status SingleStep();
+  Status Suspend();
+
   void SetStoppedBySignal(uint32_t signo, const siginfo_t *info = nullptr);
   void SetStoppedByBreakpoint();
   void SetStoppedByTrace();
   void SetStoppedByExec();
   void SetStoppedByWatchpoint(uint32_t wp_index);
+  void SetStoppedWithNoReason();
   void SetStopped();
   void SetRunning();
   void SetStepping();
Index: lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
@@ -17,6 +17,11 @@
 #include "lldb/Utility/RegisterValue.h"
 #include "lldb/Utility/State.h"
 
+// clang-format off
+#include 
+#include 
+// clang-format on
+
 #include 
 
 using namespace lldb;
@@ -30,6 +35,38 @@
 NativeRegisterContextNetBSD::CreateHostNativeRegisterContextNetBSD(process.GetArchitecture(), *this)
 ), m_stop_description() {}
 
+Status NativeThreadNetBSD::Resume() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_RESUME, m_process.GetID(),
+  nullptr, GetID());
+  if (!ret.Success())
+return ret;
+  ret = NativeProcessNetBSD::PtraceWrapper(PT_CLEARSTEP, m_process.GetID(),
+   nullptr, GetID());
+  if (ret.Success())
+SetRunning();
+  return ret;
+}
+
+Status NativeThreadNetBSD::SingleStep() {
+  Status ret = NativeProcessNetBSD::PtraceWrapper(PT_RESUME, m_process.GetID(),
+  nullptr, Ge

[Lldb-commits] [PATCH] D70106: Performance: Add a set of visited SymbolFiles to other the FindFiles variant.

2019-11-12 Thread Adrian Prantl via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3b73dcdc9656: Performance: Add a set of visited SymbolFiles 
to the other FindFiles variant. (authored by aprantl).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70106

Files:
  lldb/include/lldb/Core/Module.h
  lldb/include/lldb/Symbol/SymbolFile.h
  lldb/source/Core/Module.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp
  lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
  lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
  lldb/source/Symbol/SymbolFile.cpp
  lldb/tools/lldb-test/lldb-test.cpp

Index: lldb/tools/lldb-test/lldb-test.cpp
===
--- lldb/tools/lldb-test/lldb-test.cpp
+++ lldb/tools/lldb-test/lldb-test.cpp
@@ -529,7 +529,7 @@
 Symfile.FindTypes(ConstString(Name), ContextPtr, UINT32_MAX, SearchedFiles,
   Map);
   else
-Module.FindTypes(parseCompilerContext(), languages, Map);
+Module.FindTypes(parseCompilerContext(), languages, SearchedFiles, Map);
 
   outs() << formatv("Found {0} types:\n", Map.GetSize());
   StreamString Stream;
Index: lldb/source/Symbol/SymbolFile.cpp
===
--- lldb/source/Symbol/SymbolFile.cpp
+++ lldb/source/Symbol/SymbolFile.cpp
@@ -134,7 +134,9 @@
 TypeMap &types) {}
 
 void SymbolFile::FindTypes(llvm::ArrayRef pattern,
-   LanguageSet languages, TypeMap &types) {}
+   LanguageSet languages,
+   llvm::DenseSet &searched_symbol_files,
+   TypeMap &types) {}
 
 void SymbolFile::AssertModuleLock() {
   // The code below is too expensive to leave enabled in release builds. It's
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -134,6 +134,7 @@
 
   void FindTypes(llvm::ArrayRef pattern,
  lldb_private::LanguageSet languages,
+ llvm::DenseSet &searched_symbol_files,
  lldb_private::TypeMap &types) override;
 
   void FindTypesByRegex(const lldb_private::RegularExpression ®ex,
Index: lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ lldb/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -1562,9 +1562,10 @@
   }
 }
 
-void SymbolFilePDB::FindTypes(llvm::ArrayRef pattern,
-  LanguageSet languages,
-  lldb_private::TypeMap &types) {}
+void SymbolFilePDB::FindTypes(
+llvm::ArrayRef pattern, LanguageSet languages,
+llvm::DenseSet &searched_symbol_files,
+lldb_private::TypeMap &types) {}
 
 void SymbolFilePDB::GetTypesForPDBSymbol(const llvm::pdb::PDBSymbol &pdb_symbol,
  uint32_t type_mask,
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h
@@ -131,6 +131,7 @@
  TypeMap &types) override;
 
   void FindTypes(llvm::ArrayRef pattern, LanguageSet languages,
+ llvm::DenseSet &searched_symbol_files,
  TypeMap &types) override;
 
   llvm::Expected
Index: lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -1259,8 +1259,9 @@
   FindTypesByName(name.GetStringRef(), max_matches, types);
 }
 
-void SymbolFileNativePDB::FindTypes(llvm::ArrayRef pattern,
-LanguageSet languages, TypeMap &types) {}
+void SymbolFileNativePDB::FindTypes(
+llvm::ArrayRef pattern, LanguageSet languages,
+llvm::DenseSet &searched_symbol_files, TypeMap &types) {}
 
 void SymbolFileNativePDB::FindTypesByName(llvm::StringRef name,
   uint32_t max_matches,
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
==

[Lldb-commits] [PATCH] D70134: dotest: Add a way for the run_to_* helpers to register dylibs

2019-11-12 Thread Frederic Riss via Phabricator via lldb-commits
friss created this revision.
friss added a reviewer: jingham.
Herald added a project: LLDB.

To run the testsuite remotely the executable needs to be uploaded to
the target system. The Target takes care of this by default.

When the test uses additional shared libraries, those won't be handled
by default and need to be registered with the target using
test.registerSharedLibrariesWithTarget(target, dylib).

Calling this API requires a target, so it doesn't mesh well with the
run_to_* helpers that we've been advertising as the right way to write
tests.

This patch adds an extra_images argument to all the helpers and does
the registration automatically when running a remote
testsuite. TestWeakSymbols.py was converted to use this new scheme.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70134

Files:
  
lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymbols.py
  lldb/packages/Python/lldbsuite/test/lldbutil.py

Index: lldb/packages/Python/lldbsuite/test/lldbutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbutil.py
@@ -760,13 +760,18 @@
 test.assertTrue(target, "Target: %s is not valid."%(exe_name))
 return target
 
-def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None, only_one_thread = True):
+def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
+ only_one_thread = True, extra_images = None):
 
 # Launch the process, and do not stop at the entry point.
 if not launch_info:
 launch_info = lldb.SBLaunchInfo(None)
 launch_info.SetWorkingDirectory(test.get_process_working_directory())
 
+if extra_images and lldb.remote_platform:
+environ = test.registerSharedLibrariesWithTarget(target, extra_images)
+launch_info.SetEnvironmentEntries(environ, True)
+
 error = lldb.SBError()
 process = target.Launch(launch_info, error)
 
@@ -791,7 +796,8 @@
 exe_name = "a.out",
 bkpt_module = None,
 in_cwd = True,
-only_one_thread = True):
+only_one_thread = True,
+extra_images = None):
 """Start up a target, using exe_name as the executable, and run it to
a breakpoint set by name on bkpt_name restricted to bkpt_module.
 
@@ -827,13 +833,15 @@
 
 test.assertTrue(breakpoint.GetNumLocations() > 0,
 "No locations found for name breakpoint: '%s'."%(bkpt_name))
-return run_to_breakpoint_do_run(test, target, breakpoint, launch_info, only_one_thread)
+return run_to_breakpoint_do_run(test, target, breakpoint, launch_info,
+only_one_thread, extra_images)
 
 def run_to_source_breakpoint(test, bkpt_pattern, source_spec,
  launch_info = None, exe_name = "a.out",
  bkpt_module = None,
  in_cwd = True,
- only_one_thread = True):
+ only_one_thread = True,
+ extra_images = None):
 """Start up a target, using exe_name as the executable, and run it to
a breakpoint set by source regex bkpt_pattern.
 
@@ -847,13 +855,15 @@
 test.assertTrue(breakpoint.GetNumLocations() > 0,
 'No locations found for source breakpoint: "%s", file: "%s", dir: "%s"'
 %(bkpt_pattern, source_spec.GetFilename(), source_spec.GetDirectory()))
-return run_to_breakpoint_do_run(test, target, breakpoint, launch_info, only_one_thread)
+return run_to_breakpoint_do_run(test, target, breakpoint, launch_info,
+only_one_thread, extra_images)
 
 def run_to_line_breakpoint(test, source_spec, line_number, column = 0,
launch_info = None, exe_name = "a.out",
bkpt_module = None,
in_cwd = True,
-   only_one_thread = True):
+   only_one_thread = True,
+   extra_images = None):
 """Start up a target, using exe_name as the executable, and run it to
a breakpoint set by (source_spec, line_number(, column)).
 
@@ -868,7 +878,8 @@
 'No locations found for line breakpoint: "%s:%d(:%d)", dir: "%s"'
 %(source_spec.GetFilename(), line_number, column,
   source_spec.GetDirectory()))
-return run_to_breakpoint_do_run(test, target, breakpoint, launch_info, only_one_thread)
+return run_to_breakpoint_do_run(test, target, breakpoint, launch_info,
+only_one_thread, extra_images)
 
 
 def continue_to_breakpoint(process, bkpt):
Index: lldb/packages/Python/lldbsuite/test/commands/expression/weak_symbols/TestWeakSymb

[Lldb-commits] [PATCH] D69704: [lldb] Add IsTypeSystemCompatible method to SBModule to allow checking compatibility between language versions

2019-11-12 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik added inline comments.



Comment at: 
lldb/packages/Python/lldbsuite/test/python_api/module_compability/TestModuleDebugInfoCompatible.py:61
+self.assert_compatible(exe_module, lldb.eLanguageTypeC_plus_plus_11)
+self.assert_compatible(exe_module, lldb.eLanguageTypeC_plus_plus_14)
+

I note that we don't have one for C++17 but I think that is because we just 
don't have the enumerator although I think we could.


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

https://reviews.llvm.org/D69704



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


[Lldb-commits] [PATCH] D70100: [DWARF] Handle call sites with indirect call targets

2019-11-12 Thread Vedant Kumar via Phabricator via lldb-commits
vsk updated this revision to Diff 228920.
vsk marked 3 inline comments as done.
vsk added a comment.

- Add doxygen comments describing {Direct,Indirect}CallEdge & address the rest 
of Adrian's comments.


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

https://reviews.llvm.org/D70100

Files:
  lldb/include/lldb/Symbol/Function.h
  lldb/include/lldb/Symbol/SymbolFile.h
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Symbol/Function.cpp
  lldb/source/Target/StackFrameList.cpp

Index: lldb/source/Target/StackFrameList.cpp
===
--- lldb/source/Target/StackFrameList.cpp
+++ lldb/source/Target/StackFrameList.cpp
@@ -243,7 +243,8 @@
 /// \p return_pc) to \p end. On success this path is stored into \p path, and 
 /// on failure \p path is unchanged.
 static void FindInterveningFrames(Function &begin, Function &end,
-  Target &target, addr_t return_pc,
+  ExecutionContext &exe_ctx, Target &target,
+  addr_t return_pc,
   std::vector &path,
   ModuleList &images, Log *log) {
   LLDB_LOG(log, "Finding frames between {0} and {1}, retn-pc={2:x}",
@@ -251,9 +252,9 @@
 
   // Find a non-tail calling edge with the correct return PC.
   if (log)
-for (const CallEdge &edge : begin.GetCallEdges())
+for (const auto &edge : begin.GetCallEdges())
   LLDB_LOG(log, "FindInterveningFrames: found call with retn-PC = {0:x}",
-   edge.GetReturnPCAddress(begin, target));
+   edge->GetReturnPCAddress(begin, target));
   CallEdge *first_edge = begin.GetCallEdgeForReturnAddress(return_pc, target);
   if (!first_edge) {
 LLDB_LOG(log, "No call edge outgoing from {0} with retn-PC == {1:x}",
@@ -262,7 +263,7 @@
   }
 
   // The first callee may not be resolved, or there may be nothing to fill in.
-  Function *first_callee = first_edge->GetCallee(images);
+  Function *first_callee = first_edge->GetCallee(images, exe_ctx);
   if (!first_callee) {
 LLDB_LOG(log, "Could not resolve callee");
 return;
@@ -283,8 +284,10 @@
 bool ambiguous = false;
 Function *end;
 ModuleList &images;
+ExecutionContext &context;
 
-DFS(Function *end, ModuleList &images) : end(end), images(images) {}
+DFS(Function *end, ModuleList &images, ExecutionContext &context)
+: end(end), images(images), context(context) {}
 
 void search(Function &first_callee, std::vector &path) {
   dfs(first_callee);
@@ -313,8 +316,8 @@
 
   // Search the calls made from this callee.
   active_path.push_back(&callee);
-  for (CallEdge &edge : callee.GetTailCallingEdges()) {
-Function *next_callee = edge.GetCallee(images);
+  for (const auto &edge : callee.GetTailCallingEdges()) {
+Function *next_callee = edge->GetCallee(images, context);
 if (!next_callee)
   continue;
 
@@ -326,7 +329,7 @@
 }
   };
 
-  DFS(&end, images).search(*first_callee, path);
+  DFS(&end, images, exe_ctx).search(*first_callee, path);
 }
 
 /// Given that \p next_frame will be appended to the frame list, synthesize
@@ -379,8 +382,10 @@
   addr_t return_pc = next_reg_ctx_sp->GetPC();
   Target &target = *target_sp.get();
   ModuleList &images = next_frame.CalculateTarget()->GetImages();
-  FindInterveningFrames(*next_func, *prev_func, target, return_pc, path, images,
-log);
+  ExecutionContext exe_ctx(target_sp, /*get_process=*/true);
+  exe_ctx.SetFramePtr(&next_frame);
+  FindInterveningFrames(*next_func, *prev_func, exe_ctx, target, return_pc,
+path, images, log);
 
   // Push synthetic tail call frames.
   for (Function *callee : llvm::reverse(path)) {
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -17,6 +17,7 @@
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Target/Language.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Utility/Log.h"
 #include "llvm/Support/Casting.h"
 
@@ -127,23 +128,21 @@
   return FunctionInfo::MemorySize() + m_mangled.MemorySize();
 }
 
-//
-CallEdge::CallEdge(const char *symbol_name, lldb::addr_t return_pc,
-   CallSiteParameterArray parameters)
-: return_pc(return_pc), parameters(std::move(parameters)), resolved(false) {
-  lazy_callee.symbol_name = symbol_name;
-}
+/// @name Call site related structures
+/

[Lldb-commits] [PATCH] D70100: [DWARF] Handle call sites with indirect call targets

2019-11-12 Thread Vedant Kumar via Phabricator via lldb-commits
vsk updated this revision to Diff 228921.
vsk added a comment.

- Remove a few more redundant Optional initializations.


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

https://reviews.llvm.org/D70100

Files:
  lldb/include/lldb/Symbol/Function.h
  lldb/include/lldb/Symbol/SymbolFile.h
  
lldb/packages/Python/lldbsuite/test/functionalities/param_entry_vals/basic_entry_values_x86_64/main.cpp
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
  lldb/source/Symbol/Function.cpp
  lldb/source/Target/StackFrameList.cpp

Index: lldb/source/Target/StackFrameList.cpp
===
--- lldb/source/Target/StackFrameList.cpp
+++ lldb/source/Target/StackFrameList.cpp
@@ -243,7 +243,8 @@
 /// \p return_pc) to \p end. On success this path is stored into \p path, and 
 /// on failure \p path is unchanged.
 static void FindInterveningFrames(Function &begin, Function &end,
-  Target &target, addr_t return_pc,
+  ExecutionContext &exe_ctx, Target &target,
+  addr_t return_pc,
   std::vector &path,
   ModuleList &images, Log *log) {
   LLDB_LOG(log, "Finding frames between {0} and {1}, retn-pc={2:x}",
@@ -251,9 +252,9 @@
 
   // Find a non-tail calling edge with the correct return PC.
   if (log)
-for (const CallEdge &edge : begin.GetCallEdges())
+for (const auto &edge : begin.GetCallEdges())
   LLDB_LOG(log, "FindInterveningFrames: found call with retn-PC = {0:x}",
-   edge.GetReturnPCAddress(begin, target));
+   edge->GetReturnPCAddress(begin, target));
   CallEdge *first_edge = begin.GetCallEdgeForReturnAddress(return_pc, target);
   if (!first_edge) {
 LLDB_LOG(log, "No call edge outgoing from {0} with retn-PC == {1:x}",
@@ -262,7 +263,7 @@
   }
 
   // The first callee may not be resolved, or there may be nothing to fill in.
-  Function *first_callee = first_edge->GetCallee(images);
+  Function *first_callee = first_edge->GetCallee(images, exe_ctx);
   if (!first_callee) {
 LLDB_LOG(log, "Could not resolve callee");
 return;
@@ -283,8 +284,10 @@
 bool ambiguous = false;
 Function *end;
 ModuleList &images;
+ExecutionContext &context;
 
-DFS(Function *end, ModuleList &images) : end(end), images(images) {}
+DFS(Function *end, ModuleList &images, ExecutionContext &context)
+: end(end), images(images), context(context) {}
 
 void search(Function &first_callee, std::vector &path) {
   dfs(first_callee);
@@ -313,8 +316,8 @@
 
   // Search the calls made from this callee.
   active_path.push_back(&callee);
-  for (CallEdge &edge : callee.GetTailCallingEdges()) {
-Function *next_callee = edge.GetCallee(images);
+  for (const auto &edge : callee.GetTailCallingEdges()) {
+Function *next_callee = edge->GetCallee(images, context);
 if (!next_callee)
   continue;
 
@@ -326,7 +329,7 @@
 }
   };
 
-  DFS(&end, images).search(*first_callee, path);
+  DFS(&end, images, exe_ctx).search(*first_callee, path);
 }
 
 /// Given that \p next_frame will be appended to the frame list, synthesize
@@ -379,8 +382,10 @@
   addr_t return_pc = next_reg_ctx_sp->GetPC();
   Target &target = *target_sp.get();
   ModuleList &images = next_frame.CalculateTarget()->GetImages();
-  FindInterveningFrames(*next_func, *prev_func, target, return_pc, path, images,
-log);
+  ExecutionContext exe_ctx(target_sp, /*get_process=*/true);
+  exe_ctx.SetFramePtr(&next_frame);
+  FindInterveningFrames(*next_func, *prev_func, exe_ctx, target, return_pc,
+path, images, log);
 
   // Push synthetic tail call frames.
   for (Function *callee : llvm::reverse(path)) {
Index: lldb/source/Symbol/Function.cpp
===
--- lldb/source/Symbol/Function.cpp
+++ lldb/source/Symbol/Function.cpp
@@ -17,6 +17,7 @@
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Target/Language.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Utility/Log.h"
 #include "llvm/Support/Casting.h"
 
@@ -127,23 +128,21 @@
   return FunctionInfo::MemorySize() + m_mangled.MemorySize();
 }
 
-//
-CallEdge::CallEdge(const char *symbol_name, lldb::addr_t return_pc,
-   CallSiteParameterArray parameters)
-: return_pc(return_pc), parameters(std::move(parameters)), resolved(false) {
-  lazy_callee.symbol_name = symbol_name;
-}
+/// @name Call site related structures
+/// @{
 
-llvm::ArrayRef CallEdge::GetCallSiteParameters() const {
-  return paramete

[Lldb-commits] [PATCH] D69704: [lldb] Add IsDebugInfoCompatible method to SBModule to allow checking compatibility between language versions

2019-11-12 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D69704#1742494 , @labath wrote:

> I think this is fine.
>
> In D69704#1741588 , @jingham wrote:
>
> > If, for instance, we decided to use .pcm files as a serialization form for 
> > type info you would need the same sort of check for modules backed by these 
> > pcm's - since the clang in lldb and the clang building the pcm would have 
> > to match.  BTW I am NOT suggesting that would be a good idea, and this will 
> > probably always be a no-op for anything but Swift.
>
>
> Hm... If I understand modules correctly (and I admit I know very little about 
> them), I think this actually illustrates the my reservations about this. 
> Assuming we were fetching type info from a pcm file etc., there is no 
> relationship between a module (shared library) and a pcm file... I would 
> imagine a module can reference multiple pcm files, and each one could be 
> theoretically built with a different compiler. That then brings up a question 
> of what does it mean for lldb to be "compatible" with the module as a whole...


It doesn't seem like these are mutually exclusive.  If we were being exhaustive 
about this we would have two levels of test, (1) is all the debug information 
in the module uningestible and (2)  are there some CU's in the module that have 
debug information that lldb can't ingest.  If we had (2) then a language could 
decide "am I able to construct types from the debug info for a module that has 
some broken parts?"  Deciding that depends on how the debug info is laid out.  
If the answer is yes, then (1) would return "false if all CU's return false 
from (2)." if no, (1) would return "false if any CU's return false from (2)".

Also, IRL if we introduce some incompatibility in the toolchain from compiler 
version -> lldb version, the vastly more common situation would be for all of a 
module to be built in an incompatible way.  So having this larger scale check 
still seems to me useful.  That lldb or some GUI using it can put up a dialog 
saying "This module is not compatible with lldb".  If the whole module is not 
compatible it would be awkward to complain about it CU by CU.

Then historically, in the case of swift the part that causes problems is a 
whole-module resource and if that is not compatible with lldb,  lldb can't 
construct a valid TypeSystem for that module.  So we didn't need to implement 
(2), we just did (1).  But that shouldn't stop anybody from implementing (2) 
should the need arise.


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

https://reviews.llvm.org/D69704



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


[Lldb-commits] [PATCH] D69913: Re-enable std::function formatter with fixes to improve non-cached lookup performance

2019-11-12 Thread Shafik Yaghmour via Phabricator via lldb-commits
shafik updated this revision to Diff 228923.
shafik added a comment.

Applying clang-format


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

https://reviews.llvm.org/D69913

Files:
  lldb/include/lldb/Symbol/CompileUnit.h
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
  
lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
  
lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Symbol/CompileUnit.cpp

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -12,6 +12,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/Language.h"
+#include "lldb/Utility/Timer.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -81,6 +82,31 @@
   return;
 }
 
+lldb::FunctionSP CompileUnit::FindFunction(
+llvm::function_ref matching_lambda) {
+  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+  Timer scoped_timer(func_cat, "CompileUnit::FindFunction");
+
+  lldb::ModuleSP module = CalculateSymbolContextModule();
+
+  if (!module)
+return {};
+
+  SymbolFile *symbol_file = module->GetSymbolFile();
+
+  if (!symbol_file)
+return {};
+
+  // m_functions_by_uid is filled in lazily but we need all the entries.
+  symbol_file->ParseFunctions(*this);
+
+  for (auto &p : m_functions_by_uid) {
+if (matching_lambda(p.second))
+  return p.second;
+  }
+  return {};
+}
+
 // Dump the current contents of this object. No functions that cause on demand
 // parsing of functions, globals, statics are called, so this is a good
 // function to call to get an idea of the current contents of the CompileUnit
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -830,6 +830,8 @@
 }
 
 size_t SymbolFileDWARF::ParseFunctions(CompileUnit &comp_unit) {
+  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+  Timer scoped_timer(func_cat, "SymbolFileDWARF::ParseFunctions");
   std::lock_guard guard(GetModuleMutex());
   DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
   if (!dwarf_cu)
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/UniqueCStringMap.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/RegisterContext.h"
@@ -28,6 +29,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/ThreadPlanRunToAddress.h"
 #include "lldb/Target/ThreadPlanStepInRange.h"
+#include "lldb/Utility/Timer.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -58,9 +60,53 @@
   return false;
 }
 
+bool contains_lambda_identifier(llvm::StringRef &str_ref) {
+  return str_ref.contains("$_") || str_ref.contains("'lambda'");
+};
+
+CPPLanguageRuntime::LibCppStdFunctionCallableInfo
+line_entry_helper(Target &target, const SymbolContext &sc, Symbol *symbol,
+  llvm::StringRef first_template_param_sref,
+  bool has___invoke) {
+
+  CPPLanguageRuntime::LibCppStdFunctionCallableInfo optional_info;
+
+  AddressRange range;
+  sc.GetAddressRange(eSymbolContextEverything, 0, false, range);
+
+  Address address = range.GetBaseAddress();
+
+  Address addr;
+  if (target.ResolveLoadAddress(address.GetCallableLoadAddress(&target),
+addr)) {
+LineEntry line_entry;
+addr.CalculateSymbolContextLineEntry(line_entry);
+
+if (contains_lambda_identifier(first_template_param_sref) || has___invoke) {
+  // Case 1 and 2
+  optional_info.callable_case = lldb_private::CPPLanguageRuntime::
+  LibCppStdFunctionCallableCase::Lambda;
+} else {
+  // Case 3
+  optional_info.callable_case = lldb_private::CPPLanguageRuntime::
+  LibCppStdFunctionCallableCase::CallableObject;
+}
+
+optional_info.callable_symbol = *symbol;
+optional_info.callable_line_entry = line_entry;
+optional_info.callable_address = addr;
+  }
+
+  return optional_info;
+}
+
 CPPLanguageRuntime::LibCppStdFunctionCallableInfo
 CPPLang

[Lldb-commits] [lldb] 9691549 - [ObjectFileMachO] Fix the build for __arm64__.

2019-11-12 Thread Davide Italiano via lldb-commits

Author: Davide Italiano
Date: 2019-11-12T11:10:36-08:00
New Revision: 96915495f9fcbd47bf3f893200e3f5a8e30d0d9e

URL: 
https://github.com/llvm/llvm-project/commit/96915495f9fcbd47bf3f893200e3f5a8e30d0d9e
DIFF: 
https://github.com/llvm/llvm-project/commit/96915495f9fcbd47bf3f893200e3f5a8e30d0d9e.diff

LOG: [ObjectFileMachO] Fix the build for __arm64__.

Catch up with an API change.

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index d82a1addd334..aff1d1e87bb6 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -2538,8 +2538,7 @@ size_t ObjectFileMachO::ParseSymtab() {
 
 // Next we need to determine the correct path for the dyld shared cache.
 
-ArchSpec header_arch;
-GetArchitecture(header_arch);
+ArchSpec header_arch = GetArchitecture();
 char dsc_path[PATH_MAX];
 char dsc_path_development[PATH_MAX];
 



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


[Lldb-commits] [PATCH] D70134: dotest: Add a way for the run_to_* helpers to register dylibs

2019-11-12 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.

This is fine.

I wondered a bit about whether it would be generally useful to add the 'dylibs 
that have to be copied' to the SBLaunchInfo?  It has some other platform'y like 
things.  I'm not strongly promoting the idea, just thought I'd float it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70134



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


[Lldb-commits] [PATCH] D70127: [lldb-vscode] Fix a race in test_extra_launch_commands

2019-11-12 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

It looks like all the continue routines in lldbvscode_testcase.py use 
self.vscode.wait_for_stopped() after setting the target going.  Would that fix 
the problem here?  Without knowing anything about the protocol VSCode is using, 
I can't say that's right.  But if launch is asynchronous, as it looks like it 
is, it seems reasonable to test whether wait_for_stopped() also works for 
launch.  Be weird if it didn't...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70127



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


[Lldb-commits] [lldb] 91e94a7 - [LLDB][Formatters] Re-enable std::function formatter with fixes to improve non-cached lookup performance

2019-11-12 Thread via lldb-commits

Author: shafik
Date: 2019-11-12T11:30:18-08:00
New Revision: 91e94a7015f14f78809e875c43acbd341d081479

URL: 
https://github.com/llvm/llvm-project/commit/91e94a7015f14f78809e875c43acbd341d081479
DIFF: 
https://github.com/llvm/llvm-project/commit/91e94a7015f14f78809e875c43acbd341d081479.diff

LOG: [LLDB][Formatters] Re-enable std::function formatter with fixes to improve 
non-cached lookup performance

Performance issues lead to the libc++ std::function formatter to be disabled. 
We addressed some of those performance issues by adding caching see D67111
This PR fixes the first lookup performance by not using 
FindSymbolsMatchingRegExAndType(...) and instead finding the compilation unit 
the std::function wrapped callable should be in and then searching for the 
callable directly in the CU.

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

Added: 


Modified: 
lldb/include/lldb/Symbol/CompileUnit.h

lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py

lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py

lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Symbol/CompileUnit.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompileUnit.h 
b/lldb/include/lldb/Symbol/CompileUnit.h
index d132c367b999..4a6306fcf4a7 100644
--- a/lldb/include/lldb/Symbol/CompileUnit.h
+++ b/lldb/include/lldb/Symbol/CompileUnit.h
@@ -163,6 +163,18 @@ class CompileUnit : public 
std::enable_shared_from_this,
   void ForeachFunction(
   llvm::function_ref lambda) const;
 
+  /// Find a function in the compile unit based on the predicate 
matching_lambda
+  ///
+  /// \param[in] matching_lambda
+  /// A predicate that will be used within FindFunction to evaluate each
+  /// FunctionSP in m_functions_by_uid. When the predicate returns true
+  /// FindFunction will return the corresponding FunctionSP.
+  ///
+  /// \return
+  ///   The first FunctionSP that the matching_lambda prediate returns true 
for.
+  lldb::FunctionSP FindFunction(
+  llvm::function_ref matching_lambda);
+
   /// Dump the compile unit contents to the stream \a s.
   ///
   /// \param[in] s

diff  --git 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
index a0cf19b3bed6..ea03084cbe60 100644
--- 
a/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
+++ 
b/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
@@ -17,24 +17,22 @@ class LibCxxFunctionTestCase(TestBase):
 
 # Run frame var for a variable twice. Verify we do not hit the cache
 # the first time but do the second time.
-def run_frame_var_check_cache_use(self, variable, result_to_match):
+def run_frame_var_check_cache_use(self, variable, result_to_match, 
skip_find_function=False):
 self.runCmd("log timers reset")
 self.expect("frame variable " + variable,
 substrs=[variable + " =  " + result_to_match])
-self.expect("log timers dump",
-   
substrs=["lldb_private::Module::FindSymbolsMatchingRegExAndType"])
+if not skip_find_function:
+  self.expect("log timers dump",
+   substrs=["lldb_private::CompileUnit::FindFunction"])
 
 self.runCmd("log timers reset")
 self.expect("frame variable " + variable,
 substrs=[variable + " =  " + result_to_match])
 self.expect("log timers dump",
matching=False,
-   
substrs=["lldb_private::Module::FindSymbolsMatchingRegExAndType"])
+   substrs=["lldb_private::CompileUnit::FindFunction"])
 
 
-# Temporarily skipping for everywhere b/c we are disabling the 
std::function formatter
-# due to performance issues but plan on turning it back on once they are 
addressed.
-@skipIf
 @add_test_categories(["libc++"])
 def test(self):
 """Test that std::function as defined by libc++ is correctly printed 
by LLDB"""
@@ -61,8 +59,10 @@ def test(self):
 lldbutil.continue_to_breakpoint(self.process(), bkpt)
 
 self.run_frame_var_check_cache_use("f2", "Lambda in File main.cpp at 
Line 43")
-self.run_frame_var_check_cache_use("f3", "Lambda in File main.cpp at 
Line 47")
-self.run_frame

[Lldb-commits] [PATCH] D69704: [lldb] Add IsDebugInfoCompatible method to SBModule to allow checking compatibility between language versions

2019-11-12 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor requested review of this revision.
teemperor marked an inline comment as done.
teemperor added a comment.

Marking this as changes needed that I don't land this without applying Pavel's 
comment.




Comment at: lldb/source/API/SBModule.cpp:700-704
+  if (!type_system_or_err) {
+sb_error.SetErrorStringWithFormat(
+"no type system for language %s",
+Language::GetNameForLanguageType(language));
+llvm::consumeError(type_system_or_err.takeError());

labath wrote:
> labath wrote:
> > Do you want to store the actual error message in `type_system_or_err` into 
> > sb_error?
> Actually, you can do that by just saying `sb_error.ref() = 
> type_system_or_err.takeError()` or something along those lines. :)
Oh, TIL!


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

https://reviews.llvm.org/D69704



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


[Lldb-commits] [PATCH] D69913: Re-enable std::function formatter with fixes to improve non-cached lookup performance

2019-11-12 Thread Shafik Yaghmour via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG91e94a7015f1: [LLDB][Formatters] Re-enable std::function 
formatter with fixes to improve non… (authored by shafik).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69913

Files:
  lldb/include/lldb/Symbol/CompileUnit.h
  
lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/function/TestLibCxxFunction.py
  
lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/TestStdFunctionStepIntoCallable.py
  
lldb/packages/Python/lldbsuite/test/lang/cpp/std-function-step-into-callable/main.cpp
  lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
  lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Symbol/CompileUnit.cpp

Index: lldb/source/Symbol/CompileUnit.cpp
===
--- lldb/source/Symbol/CompileUnit.cpp
+++ lldb/source/Symbol/CompileUnit.cpp
@@ -12,6 +12,7 @@
 #include "lldb/Symbol/SymbolFile.h"
 #include "lldb/Symbol/VariableList.h"
 #include "lldb/Target/Language.h"
+#include "lldb/Utility/Timer.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -81,6 +82,31 @@
   return;
 }
 
+lldb::FunctionSP CompileUnit::FindFunction(
+llvm::function_ref matching_lambda) {
+  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+  Timer scoped_timer(func_cat, "CompileUnit::FindFunction");
+
+  lldb::ModuleSP module = CalculateSymbolContextModule();
+
+  if (!module)
+return {};
+
+  SymbolFile *symbol_file = module->GetSymbolFile();
+
+  if (!symbol_file)
+return {};
+
+  // m_functions_by_uid is filled in lazily but we need all the entries.
+  symbol_file->ParseFunctions(*this);
+
+  for (auto &p : m_functions_by_uid) {
+if (matching_lambda(p.second))
+  return p.second;
+  }
+  return {};
+}
+
 // Dump the current contents of this object. No functions that cause on demand
 // parsing of functions, globals, statics are called, so this is a good
 // function to call to get an idea of the current contents of the CompileUnit
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -830,6 +830,8 @@
 }
 
 size_t SymbolFileDWARF::ParseFunctions(CompileUnit &comp_unit) {
+  static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
+  Timer scoped_timer(func_cat, "SymbolFileDWARF::ParseFunctions");
   std::lock_guard guard(GetModuleMutex());
   DWARFUnit *dwarf_cu = GetDWARFCompileUnit(&comp_unit);
   if (!dwarf_cu)
Index: lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
===
--- lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
+++ lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp
@@ -21,6 +21,7 @@
 #include "lldb/Core/PluginManager.h"
 #include "lldb/Core/UniqueCStringMap.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/RegisterContext.h"
@@ -28,6 +29,7 @@
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/ThreadPlanRunToAddress.h"
 #include "lldb/Target/ThreadPlanStepInRange.h"
+#include "lldb/Utility/Timer.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -58,9 +60,53 @@
   return false;
 }
 
+bool contains_lambda_identifier(llvm::StringRef &str_ref) {
+  return str_ref.contains("$_") || str_ref.contains("'lambda'");
+};
+
+CPPLanguageRuntime::LibCppStdFunctionCallableInfo
+line_entry_helper(Target &target, const SymbolContext &sc, Symbol *symbol,
+  llvm::StringRef first_template_param_sref,
+  bool has___invoke) {
+
+  CPPLanguageRuntime::LibCppStdFunctionCallableInfo optional_info;
+
+  AddressRange range;
+  sc.GetAddressRange(eSymbolContextEverything, 0, false, range);
+
+  Address address = range.GetBaseAddress();
+
+  Address addr;
+  if (target.ResolveLoadAddress(address.GetCallableLoadAddress(&target),
+addr)) {
+LineEntry line_entry;
+addr.CalculateSymbolContextLineEntry(line_entry);
+
+if (contains_lambda_identifier(first_template_param_sref) || has___invoke) {
+  // Case 1 and 2
+  optional_info.callable_case = lldb_private::CPPLanguageRuntime::
+  LibCppStdFunctionCallableCase::Lambda;
+} else {
+  // Case 3
+  optional_info.callable_case = lldb_private::CPPLanguageRuntime::
+  LibCppStdFunctionCallableCase::CallableObject;
+}
+
+optional_info.callable_symbol = *symbol;
+op

[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-12 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
rupprecht added reviewers: JDevlieghere, labath.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This adds several 5C/5D escape codes that allow moving forward/backward words 
similar to bash command line navigation.

On my terminal, `ctrl+v ctrl+` prints `^[[1;5D`. However, it seems 
inputrc also maps other escape variants of this to forward/backward word, so 
I've included those too. Similar for 5C = ctrl+right arrow.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D70137

Files:
  lldb/source/Host/common/Editline.cpp


Index: lldb/source/Host/common/Editline.cpp
===
--- lldb/source/Host/common/Editline.cpp
+++ lldb/source/Host/common/Editline.cpp
@@ -1105,6 +1105,15 @@
   el_set(m_editline, EL_BIND, "\t", "lldb-complete",
  NULL); // Bind TAB to auto complete
 
+  // Allow ctrl-left-arrow and ctrl-right-arrow for navigation, behave like
+  // bash in emacs mode.
+  el_set(m_editline, EL_BIND, ESCAPE "[1;5C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[1;5D", "ed-prev-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[5C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[5D", "ed-prev-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE ESCAPE "[C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE ESCAPE "[D", "ed-prev-word", NULL);
+
   // Allow user-specific customization prior to registering bindings we
   // absolutely require
   el_source(m_editline, nullptr);


Index: lldb/source/Host/common/Editline.cpp
===
--- lldb/source/Host/common/Editline.cpp
+++ lldb/source/Host/common/Editline.cpp
@@ -1105,6 +1105,15 @@
   el_set(m_editline, EL_BIND, "\t", "lldb-complete",
  NULL); // Bind TAB to auto complete
 
+  // Allow ctrl-left-arrow and ctrl-right-arrow for navigation, behave like
+  // bash in emacs mode.
+  el_set(m_editline, EL_BIND, ESCAPE "[1;5C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[1;5D", "ed-prev-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[5C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[5D", "ed-prev-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE ESCAPE "[C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE ESCAPE "[D", "ed-prev-word", NULL);
+
   // Allow user-specific customization prior to registering bindings we
   // absolutely require
   el_source(m_editline, nullptr);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D69873: [lldb-vscode] support the completion request

2019-11-12 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 228937.
wallace added a comment.

set a return list limit of 50


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69873

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/Makefile
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/TestVSCode_completions.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/completions/main.cpp
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/variables/TestVSCode_variables.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/tools/lldb-vscode/lldb-vscode.cpp

Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -821,6 +821,152 @@
   g_vsc.SendJSON(llvm::json::Value(std::move(response)));
 }
 
+// "CompletionsRequest": {
+//   "allOf": [ { "$ref": "#/definitions/Request" }, {
+// "type": "object",
+// "description": "Returns a list of possible completions for a given caret position and text.\nThe CompletionsRequest may only be called if the 'supportsCompletionsRequest' capability exists and is true.",
+// "properties": {
+//   "command": {
+// "type": "string",
+// "enum": [ "completions" ]
+//   },
+//   "arguments": {
+// "$ref": "#/definitions/CompletionsArguments"
+//   }
+// },
+// "required": [ "command", "arguments"  ]
+//   }]
+// },
+// "CompletionsArguments": {
+//   "type": "object",
+//   "description": "Arguments for 'completions' request.",
+//   "properties": {
+// "frameId": {
+//   "type": "integer",
+//   "description": "Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope."
+// },
+// "text": {
+//   "type": "string",
+//   "description": "One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion."
+// },
+// "column": {
+//   "type": "integer",
+//   "description": "The character position for which to determine the completion proposals."
+// },
+// "line": {
+//   "type": "integer",
+//   "description": "An optional line for which to determine the completion proposals. If missing the first line of the text is assumed."
+// }
+//   },
+//   "required": [ "text", "column" ]
+// },
+// "CompletionsResponse": {
+//   "allOf": [ { "$ref": "#/definitions/Response" }, {
+// "type": "object",
+// "description": "Response to 'completions' request.",
+// "properties": {
+//   "body": {
+// "type": "object",
+// "properties": {
+//   "targets": {
+// "type": "array",
+// "items": {
+//   "$ref": "#/definitions/CompletionItem"
+// },
+// "description": "The possible completions for ."
+//   }
+// },
+// "required": [ "targets" ]
+//   }
+// },
+// "required": [ "body" ]
+//   }]
+// },
+// "CompletionItem": {
+//   "type": "object",
+//   "description": "CompletionItems are the suggestions returned from the CompletionsRequest.",
+//   "properties": {
+// "label": {
+//   "type": "string",
+//   "description": "The label of this completion item. By default this is also the text that is inserted when selecting this completion."
+// },
+// "text": {
+//   "type": "string",
+//   "description": "If text is not falsy then it is inserted instead of the label."
+// },
+// "sortText": {
+//   "type": "string",
+//   "description": "A string that should be used when comparing this item with other items. When `falsy` the label is used."
+// },
+// "type": {
+//   "$ref": "#/definitions/CompletionItemType",
+//   "description": "The item's type. Typically the client uses this information to render the item in the UI with an icon."
+// },
+// "start": {
+//   "type": "integer",
+//   "description": "This value determines the location (in the CompletionsRequest's 'text' attribute) where the completion text is added.\nIf missing the text is added at the location specified by the CompletionsRequest's 'column' attribute."
+// },
+// "length": {
+//   "type": "integer",
+//   "description": "This value determines how many characters are overwritten by the completion text.\nIf missing the value 0 is assumed which results in the completion text being inserted."
+// }
+//   },
+//   "required": [ "label" ]
+// },
+// "CompletionItemType": {
+//   "type": "string",
+//   "description": "Some predefined types for the CompletionItem. Please note that not all clients have specific icons f

[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-12 Thread pre-merge checks [bot] via Phabricator via lldb-commits
merge_guards_bot added a comment.

Build result: pass - 59972 tests passed, 0 failed and 763 were skipped.
Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70137



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


[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

This is very nice, thanks!

Any chance we could test this with a pexpect test?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70137



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


[Lldb-commits] [lldb] fbb228c - [LLDB] Always remove debugserver from LLVM_DISTRIBUTION_COMPONENTS

2019-11-12 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-12T12:58:26-08:00
New Revision: fbb228c7d222b991bed20d674e3b43143848fb95

URL: 
https://github.com/llvm/llvm-project/commit/fbb228c7d222b991bed20d674e3b43143848fb95
DIFF: 
https://github.com/llvm/llvm-project/commit/fbb228c7d222b991bed20d674e3b43143848fb95.diff

LOG: [LLDB] Always remove debugserver from LLVM_DISTRIBUTION_COMPONENTS

Centralize the logic to remove debugserver from
LLVM_DISTRIBUTION_COMPONENTS when LLDB_USE_SYSTEM_DEBUGSERVER is
enabled. Now this happens regardless of whether the tests are enabled.

Added: 


Modified: 
lldb/cmake/modules/LLDBConfig.cmake
lldb/test/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index e9ed2229d6bf..2a709f81981f 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -54,6 +54,15 @@ option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH 
settings in binaries
 option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing 
(Darwin only)." OFF)
 option(LLDB_SKIP_STRIP "Whether to skip stripping of binaries when installing 
lldb." OFF)
 
+if (LLDB_USE_SYSTEM_DEBUGSERVER)
+  # The custom target for the system debugserver has no install target, so we
+  # need to remove it from the LLVM_DISTRIBUTION_COMPONENTS list.
+  if (LLVM_DISTRIBUTION_COMPONENTS)
+list(REMOVE_ITEM LLVM_DISTRIBUTION_COMPONENTS debugserver)
+set(LLVM_DISTRIBUTION_COMPONENTS ${LLVM_DISTRIBUTION_COMPONENTS} CACHE 
STRING "" FORCE)
+  endif()
+endif()
+
 if(LLDB_BUILD_FRAMEWORK)
   if(NOT APPLE)
 message(FATAL_ERROR "LLDB.framework can only be generated when targeting 
Apple platforms")

diff  --git a/lldb/test/API/CMakeLists.txt b/lldb/test/API/CMakeLists.txt
index 9aec808073ec..45f622725412 100644
--- a/lldb/test/API/CMakeLists.txt
+++ b/lldb/test/API/CMakeLists.txt
@@ -122,12 +122,6 @@ if(CMAKE_HOST_APPLE)
   COMMAND ${CMAKE_COMMAND} -E copy_if_
diff erent
   ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
   COMMENT "Copying the system debugserver to LLDB's binaries directory for 
testing.")
-# The custom target for the system debugserver has no install target, so we
-# need to remove it from the LLVM_DISTRIBUTION_COMPONENTS list.
-if (LLVM_DISTRIBUTION_COMPONENTS)
-  list(REMOVE_ITEM LLVM_DISTRIBUTION_COMPONENTS debugserver)
-  set(LLVM_DISTRIBUTION_COMPONENTS ${LLVM_DISTRIBUTION_COMPONENTS} 
PARENT_SCOPE)
-endif()
 message(STATUS "LLDB tests use out-of-tree debugserver: 
${system_debugserver_path}")
 list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
 add_lldb_test_dependency(debugserver)



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


[Lldb-commits] [PATCH] D70050: [lldb] [test] Add a test for watchpoint set error handling on NetBSD

2019-11-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny abandoned this revision.
mgorny added a comment.

Combined into D70023 .


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

https://reviews.llvm.org/D70050



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


[Lldb-commits] [PATCH] D70023: [lldb] [Process/NetBSD] Copy watchpoints to newly-created threads

2019-11-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny planned changes to this revision.
mgorny marked an inline comment as done.
mgorny added inline comments.
Herald added a subscriber: dexonsmith.



Comment at: lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp:281
+NativeThreadNetBSD& t = AddThread(pst.pe_lwp);
+t.CopyWatchpointsFrom(
+static_cast(*GetCurrentThread()));

Note to self: need to add error handling here.



Comment at: lldb/test/Shell/Watchpoint/netbsd-nouserdbregs.test:5
+# REQUIRES: native && system-netbsd && (target-x86 || target-x86_64) && 
!dbregs-set
+# RUN: %clang %p/Inputs/thread-dbreg.c -pthread -g -o %t.out
+# RUN: %lldb -b -o 'settings set interpreter.stop-command-source-on-error 
false' -s %s %t.out 2>&1 | FileCheck %s

Note to self: try `%clang_host` as suggested in D70050.


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

https://reviews.llvm.org/D70023



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


[Lldb-commits] [PATCH] D70025: [lldb] [Process/NetBSD] Fix handling concurrent watchpoint events

2019-11-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 228955.
mgorny added a comment.
Herald added a reviewer: jfb.

Included fixed tests.


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

https://reviews.llvm.org/D70025

Files:
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointDelayBreakpointOneSignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentNWatchNBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointThreads.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneBreakpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoWatchpointsOneDelayBreakpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/step_out/TestThreadStepOut.py
  
lldb/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
  lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
  lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h

Index: lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
===
--- lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
+++ lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
@@ -58,6 +58,8 @@
 
   bool ClearHardwareWatchpoint(uint32_t wp_index) override;
 
+  Status ClearWatchpointHit(uint32_t wp_index) override;
+
   Status ClearAllHardwareWatchpoints() override;
 
   Status SetHardwareWatchpointWithIndex(lldb::addr_t addr, size_t size,
Index: lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
===
--- lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
+++ lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
@@ -853,10 +853,10 @@
   if (!is_vacant)
 return Status("Watchpoint index not vacant");
 
-  RegisterValue reg_value;
   const RegisterInfo *const reg_info_dr7 =
   GetRegisterInfoAtIndex(lldb_dr7_x86_64);
-  error = ReadRegister(reg_info_dr7, reg_value);
+  RegisterValue dr7_value;
+  error = ReadRegister(reg_info_dr7, dr7_value);
   if (error.Fail())
 return error;
 
@@ -874,16 +874,28 @@
 
   uint64_t bit_mask = (0x3 << (2 * wp_index)) | (0xF << (16 + 4 * wp_index));
 
-  uint64_t control_bits = reg_value.GetAsUInt64() & ~bit_mask;
+  uint64_t control_bits = dr7_value.GetAsUInt64() & ~bit_mask;
 
   control_bits |= enable_bit | rw_bits | size_bits;
 
   const RegisterInfo *const reg_info_drN =
   GetRegisterInfoAtIndex(lldb_dr0_x86_64 + wp_index);
-  error = WriteRegister(reg_info_drN, RegisterValue(addr));
+  RegisterValue drN_value;
+  error = ReadRegister(reg_info_drN, drN_value);
   if (error.Fail())
 return error;
 
+  // clear dr6 if address or bits changed (i.e. we're not reenabling the same
+  // watchpoint)
+  if (drN_value.GetAsUInt64() != addr ||
+  (dr7_value.GetAsUInt64() & bit_mask) != (rw_bits | size_bits)) {
+ClearWatchpointHit(wp_index);
+
+error = WriteRegister(reg_info_drN, RegisterValue(addr));
+if (error.Fail())
+  return error;
+  }
+
   error = WriteRegister(reg_info_dr7, RegisterValue(control_bits));
   if (error.Fail())
 return error;
@@ -897,32 +909,36 @@
   if (wp_index >= NumSupportedHardwareWatchpoints())
 return false;
 
+  // for watchpoints 0, 1, 2, or 3, respectively, clear bits 0-1, 2-3, 4-5
+  // or 6-7 of the debug control register (DR7)
+  const RegisterInfo *const reg_info_dr7 =
+  GetRegisterInfoAtIndex(lldb_dr7_x86_64);
   RegisterValue reg_value;
+  Status error = ReadRegister(reg_info_dr7, reg_value);
+  if (error.Fail())
+return false;
+  uint64_t bit_mask = 0x3 << (2 * wp_index);
+  uint64_t control_bits = reg_value.GetAsUInt64() & ~bit_mask;
+
+  return WriteRegister(reg_info_dr7, RegisterValue(control_bits)).Success();
+}
 
-  // for watchpoints 0, 1, 2, or 3, respectively, clear bits 0, 1, 2, or 3 of
+Status NativeRegisterContextNetBSD_x86_64::ClearWatchpointHit(uint32_t wp_index) {
+  if (wp_index >= NumSupportedHardwareWatchpoints())
+return Status("Watchpoint index out of range");
+
+  // for watchpoints 0, 1, 2, or 3, respectively, check bits 0, 1, 2, or 3 of
   // the debug status register (DR6)
   const RegisterInfo *const reg_info_dr6 =
   GetRegisterInfoAtIndex(lldb_dr6_x86_64);
+  RegisterValue reg_value;
   Status error = ReadRegister(reg_info_dr6, reg_value);
   if (error.Fail())
-return false;
+return error;
+
   uint64

[Lldb-commits] [PATCH] D70023: [lldb] [Process/NetBSD] Copy watchpoints to newly-created threads

2019-11-12 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 228954.
mgorny marked an inline comment as done.
mgorny edited the summary of this revision.
mgorny added a comment.
Herald added a reviewer: jfb.
Herald added a subscriber: jfb.

Included fixed tests + new test from D70050 .


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

https://reviews.llvm.org/D70023

Files:
  
lldb/packages/Python/lldbsuite/test/commands/watchpoints/multiple_threads/TestWatchpointMultipleThreads.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentBreakpointsDelayedBreakpointOneWatchpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelaySignalWatch.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentDelayWatchBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentSignalWatch.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneDelaySignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneSignal.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentTwoBreakpointsOneWatchpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchBreak.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchBreakDelay.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchpointDelayWatchpointOneBreakpoint.py
  
lldb/packages/Python/lldbsuite/test/functionalities/thread/concurrent_events/TestConcurrentWatchpointWithDelayWatchpointThreads.py
  lldb/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h
  lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp
  lldb/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.h
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp
  lldb/source/Plugins/Process/NetBSD/NativeThreadNetBSD.h
  lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
  lldb/test/Shell/Watchpoint/netbsd-nouserdbregs.test
  lldb/test/Shell/lit.cfg.py

Index: lldb/test/Shell/lit.cfg.py
===
--- lldb/test/Shell/lit.cfg.py
+++ lldb/test/Shell/lit.cfg.py
@@ -5,6 +5,7 @@
 import re
 import shutil
 import site
+import subprocess
 import sys
 
 import lit.formats
@@ -103,3 +104,17 @@
 
 if find_executable('xz') != None:
 config.available_features.add('xz')
+
+# NetBSD permits setting dbregs either if one is root
+# or if user_set_dbregs is enabled
+can_set_dbregs = True
+if platform.system() == 'NetBSD' and os.geteuid() != 0:
+try:
+output = subprocess.check_output(["/sbin/sysctl", "-n",
+  "security.models.extensions.user_set_dbregs"]).decode().strip()
+if output != "1":
+can_set_dbregs = False
+except subprocess.CalledProcessError:
+can_set_dbregs = False
+if can_set_dbregs:
+config.available_features.add('dbregs-set')
Index: lldb/test/Shell/Watchpoint/netbsd-nouserdbregs.test
===
--- /dev/null
+++ lldb/test/Shell/Watchpoint/netbsd-nouserdbregs.test
@@ -0,0 +1,22 @@
+# Check that 'watchpoint set' errors out gracefully when we can't set dbregs
+# and that new threads are monitored correctly even though we can't copy dbregs.
+
+# REQUIRES: native && system-netbsd && (target-x86 || target-x86_64) && !dbregs-set
+# RUN: %clang %p/Inputs/thread-dbreg.c -pthread -g -o %t.out
+# RUN: %lldb -b -o 'settings set interpreter.stop-command-source-on-error false' -s %s %t.out 2>&1 | FileCheck %s
+
+settings show interpreter.stop-command-source-on-error
+# CHECK: interpreter.stop-command-source-on-error (boolean) = false
+
+b main
+# CHECK: Breakpoint {{[0-9]+}}: where = {{.*}}`main
+b thread_func
+# CHECK: Breakpoint {{[0-9]+}}: where = {{.*}}`thread_func
+run
+# CHECK: stop reason = breakpoint
+watchpoint set variable g_watchme
+# CHECK: error: Watchpoint creation failed
+cont
+# CHECK: stop reason = breakpoint
+cont
+# CHECK: Process {{[0-9]+}} exited with status = 0
Index: lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
===
--- /dev/null
+++ lldb/test/Shell/Watchpoint/Inputs/thread-dbreg.c
@@ -0,0 +1,23 @@
+#include 
+
+int g_watchme = 0;
+
+void *thread_func(void *arg) {
+  /* watchpoint trigger from subthread */
+  g_watchme = 2;
+  return 0;
+}
+
+int main() {
+  pthread_t thread;
+  if (pthread_create(&thread, 0, thread_func, 0))
+return 1;
+
+  /* watchpoint trigger from main thread */
+  g_watchme = 1;
+
+  if (pthread_join(thread, 0))
+return 2;
+
+  return 0;
+}
Index: 

[Lldb-commits] [lldb] a247bd1 - [LLDB] Fix/silence CMake developer warning for LLDB framework.

2019-11-12 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-12T14:17:19-08:00
New Revision: a247bd1f274e49ea83b2ad39c6ff062753e9e779

URL: 
https://github.com/llvm/llvm-project/commit/a247bd1f274e49ea83b2ad39c6ff062753e9e779
DIFF: 
https://github.com/llvm/llvm-project/commit/a247bd1f274e49ea83b2ad39c6ff062753e9e779.diff

LOG: [LLDB] Fix/silence CMake developer warning for LLDB framework.

This fixes the following warning for developers:

  Target 'liblldb' was changed to a FRAMEWORK sometime after install().  This
  may result in the wrong install DESTINATION.  Set the FRAMEWORK property
  earlier.

The solution is to pass the FRAMEWORK flag to add_lldb_library and set
the target property before install(). For now liblldb is the only
customer.

Added: 


Modified: 
lldb/cmake/modules/AddLLDB.cmake
lldb/source/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/cmake/modules/AddLLDB.cmake 
b/lldb/cmake/modules/AddLLDB.cmake
index 6f05be384908..e094092498aa 100644
--- a/lldb/cmake/modules/AddLLDB.cmake
+++ b/lldb/cmake/modules/AddLLDB.cmake
@@ -35,7 +35,7 @@ function(add_lldb_library name)
   # only supported parameters to this macro are the optional
   # MODULE;SHARED;STATIC library type and source files
   cmake_parse_arguments(PARAM
-"MODULE;SHARED;STATIC;OBJECT;PLUGIN"
+"MODULE;SHARED;STATIC;OBJECT;PLUGIN;FRAMEWORK"
 "INSTALL_PREFIX;ENTITLEMENTS"
 "EXTRA_CXXFLAGS;DEPENDS;LINK_LIBS;LINK_COMPONENTS;CLANG_LIBS"
 ${ARGN})
@@ -99,6 +99,14 @@ function(add_lldb_library name)
 endif()
   endif()
 
+  # A target cannot be changed to a FRAMEWORK after calling install() because
+  # this may result in the wrong install DESTINATION. The FRAMEWORK property
+  # must be set earlier.
+  if(PARAM_FRAMEWORK)
+message(WARNING "{name} is now a FRAMEWORK")
+set_target_properties(liblldb PROPERTIES FRAMEWORK ON)
+  endif()
+
   if(PARAM_SHARED)
 set(install_dest lib${LLVM_LIBDIR_SUFFIX})
 if(PARAM_INSTALL_PREFIX)

diff  --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index f06ed1fcdd07..488dae3cae34 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -13,7 +13,7 @@ if(LLDB_BUILD_FRAMEWORK)
   set(option_install_prefix INSTALL_PREFIX ${LLDB_FRAMEWORK_INSTALL_DIR})
 endif()
 
-add_lldb_library(liblldb SHARED
+add_lldb_library(liblldb SHARED FRAMEWORK
   SBAddress.cpp
   SBAttachInfo.cpp
   SBBlock.cpp



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


[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-12 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht updated this revision to Diff 228972.
rupprecht added a comment.

- Add a pexpect test


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70137

Files:
  lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
  lldb/source/Host/common/Editline.cpp


Index: lldb/source/Host/common/Editline.cpp
===
--- lldb/source/Host/common/Editline.cpp
+++ lldb/source/Host/common/Editline.cpp
@@ -1105,6 +1105,15 @@
   el_set(m_editline, EL_BIND, "\t", "lldb-complete",
  NULL); // Bind TAB to auto complete
 
+  // Allow ctrl-left-arrow and ctrl-right-arrow for navigation, behave like
+  // bash in emacs mode.
+  el_set(m_editline, EL_BIND, ESCAPE "[1;5C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[1;5D", "ed-prev-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[5C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[5D", "ed-prev-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE ESCAPE "[C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE ESCAPE "[D", "ed-prev-word", NULL);
+
   // Allow user-specific customization prior to registering bindings we
   // absolutely require
   el_source(m_editline, nullptr);
Index: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
@@ -0,0 +1,49 @@
+"""
+Test that the lldb editline handling is configured correctly.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+
+class EditlineTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_left_right_arrow(self):
+"""Test that ctrl+left/right arrow navigates words correctly.
+
+Note: just sending escape characters to pexpect and checking the buffer
+doesn't work well, so we run real commands. We want to type
+"help command" while exercising word-navigation, so type it as below,
+where [] indicates cursor position.
+
+1. Send "el ommand" -> "el command[]"
+2. Ctrl+left once   -> "el []command"
+3. Send "c" -> "el c[]ommand"
+4. Ctrl+left twice  -> "[]el command"
+5. Send "h" -> "h[]el command"
+6. Ctrl+right   -> "hel[] command"
+7. Send "p" -> "help command"
+"""
+self.launch()
+
+# Run help for different commands for escape variants to make sure each
+# one matches uniquely (the buffer isn't cleared in between matches).
+cases = [
+("print", "\x1b[1;5D", "\x1b[1;5C"),
+("step", "\x1b[5D", "\x1b[5C"),
+("exit", "\x1b\x1b[D", "\x1b\x1b[C"),
+]
+for (cmd, l_escape, r_escape) in cases:
+self.child.send("el {cmd_tail}{L}{cmd_head}{L}{L}h{R}p\n".format(
+cmd_head=cmd[0], cmd_tail=cmd[1:], L=l_escape, R=r_escape))
+self.child.expect_exact("Syntax: %s" % cmd)
+
+self.quit()


Index: lldb/source/Host/common/Editline.cpp
===
--- lldb/source/Host/common/Editline.cpp
+++ lldb/source/Host/common/Editline.cpp
@@ -1105,6 +1105,15 @@
   el_set(m_editline, EL_BIND, "\t", "lldb-complete",
  NULL); // Bind TAB to auto complete
 
+  // Allow ctrl-left-arrow and ctrl-right-arrow for navigation, behave like
+  // bash in emacs mode.
+  el_set(m_editline, EL_BIND, ESCAPE "[1;5C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[1;5D", "ed-prev-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[5C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE "[5D", "ed-prev-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE ESCAPE "[C", "em-next-word", NULL);
+  el_set(m_editline, EL_BIND, ESCAPE ESCAPE "[D", "ed-prev-word", NULL);
+
   // Allow user-specific customization prior to registering bindings we
   // absolutely require
   el_source(m_editline, nullptr);
Index: lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
===
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/terminal/TestEditline.py
@@ -0,0 +1,49 @@
+"""
+Test that the lldb editline handling is configured correctly.
+"""
+
+from __future__ import print_function
+
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+
+class EditlineTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def test_left_right_arrow(self):
+"""Test that ctrl+left/

[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-12 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht added a comment.

In D70137#1742766 , @JDevlieghere 
wrote:

> This is very nice, thanks!
>
> Any chance we could test this with a pexpect test?


Absolutely. It was waaay more complicated than I expected due to funny escaping 
somewhere between pexpect and lldb, but testing an actual command seems to 
work. Hopefully I've captured that in the test doc comment.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70137



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


[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-12 Thread pre-merge checks [bot] via Phabricator via lldb-commits
merge_guards_bot added a comment.

Build result: pass - 59972 tests passed, 0 failed and 763 were skipped.
Log files: console-log.txt 
,
 CMakeCache.txt 



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70137



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


[Lldb-commits] [lldb] 34ca6e1 - [LLDB] Remove debug message in AddLLDB.cmake

2019-11-12 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-12T15:33:03-08:00
New Revision: 34ca6e1fbef54465d623ffc8d55e824054913509

URL: 
https://github.com/llvm/llvm-project/commit/34ca6e1fbef54465d623ffc8d55e824054913509
DIFF: 
https://github.com/llvm/llvm-project/commit/34ca6e1fbef54465d623ffc8d55e824054913509.diff

LOG: [LLDB] Remove debug message in AddLLDB.cmake

Added: 


Modified: 
lldb/cmake/modules/AddLLDB.cmake

Removed: 




diff  --git a/lldb/cmake/modules/AddLLDB.cmake 
b/lldb/cmake/modules/AddLLDB.cmake
index e094092498aa..ecf0b66a41a3 100644
--- a/lldb/cmake/modules/AddLLDB.cmake
+++ b/lldb/cmake/modules/AddLLDB.cmake
@@ -103,7 +103,6 @@ function(add_lldb_library name)
   # this may result in the wrong install DESTINATION. The FRAMEWORK property
   # must be set earlier.
   if(PARAM_FRAMEWORK)
-message(WARNING "{name} is now a FRAMEWORK")
 set_target_properties(liblldb PROPERTIES FRAMEWORK ON)
   endif()
 



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


[Lldb-commits] [lldb] 056c319 - [LLDB] Only set FRAMEWORK when we're actually building a framework.

2019-11-12 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-12T15:42:07-08:00
New Revision: 056c3197694881379cb75a3cb1bd6a511d044714

URL: 
https://github.com/llvm/llvm-project/commit/056c3197694881379cb75a3cb1bd6a511d044714
DIFF: 
https://github.com/llvm/llvm-project/commit/056c3197694881379cb75a3cb1bd6a511d044714.diff

LOG: [LLDB] Only set FRAMEWORK when we're actually building a framework.

Added: 


Modified: 
lldb/source/API/CMakeLists.txt

Removed: 




diff  --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index 488dae3cae34..934bbf2ec1b0 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -11,9 +11,10 @@ endif()
 
 if(LLDB_BUILD_FRAMEWORK)
   set(option_install_prefix INSTALL_PREFIX ${LLDB_FRAMEWORK_INSTALL_DIR})
+  set(option_framework FRAMEWORK)
 endif()
 
-add_lldb_library(liblldb SHARED FRAMEWORK
+add_lldb_library(liblldb SHARED ${option_framework}
   SBAddress.cpp
   SBAttachInfo.cpp
   SBBlock.cpp



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


[Lldb-commits] [PATCH] D70137: [lldb][Editline] Support ctrl+left/right arrow word navigation.

2019-11-12 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

In D70137#1743032 , @rupprecht wrote:

> In D70137#1742766 , @JDevlieghere 
> wrote:
>
> > This is very nice, thanks!
> >
> > Any chance we could test this with a pexpect test?
>
>
> Absolutely. It was waaay more complicated than I expected due to funny 
> escaping somewhere between pexpect and lldb, but testing an actual command 
> seems to work. Hopefully I've captured that in the test doc comment.


Ha, I can imagine... Thanks for taking the time to make it work!

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70137



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


[Lldb-commits] [PATCH] D70127: [lldb-vscode] Fix a race in test_extra_launch_commands

2019-11-12 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

--stop-at-entry only really works for Darwin since its posix_spawn has a flag 
that will stop it at the entry point before anything executes. On linux, does 
this flag do anything?




Comment at: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/launch/TestVSCode_launch.py:355
 'br s -f main.c -l %d' % second_line,
-'run'
+'process launch --stop-at-entry'
 ]

This can probably still be racy on linux since I believe --stop-at-entry will 
launch the process and stop it as soon as possible (unlike a real posix_spawn 
flag on Darwin...). I wonder if we did a python call like:
```
script lldb.target.Launch(...)
```
As I believe the python interpreter is synchronous by default?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70127



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


[Lldb-commits] [PATCH] D70134: dotest: Add a way for the run_to_* helpers to register dylibs

2019-11-12 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D70134#1742647 , @jingham wrote:

> This is fine.
>
> I wondered a bit about whether it would be generally useful to add the 
> 'dylibs that have to be copied' to the SBLaunchInfo?  It has some other 
> platform'y like things.  I'm not strongly promoting the idea, just thought 
> I'd float it.


You can currently do this by setting the platform file spec for a SBModule. If 
that is set, then the target will upload the module to that path. The main 
executable always goes to the remote working directory if its platform file 
spec isn't set, but any module can set this manually. The register shared 
libraries code sets the platform path.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70134



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


[Lldb-commits] [PATCH] D70134: dotest: Add a way for the run_to_* helpers to register dylibs

2019-11-12 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

In D70134#1743075 , @clayborg wrote:

> In D70134#1742647 , @jingham wrote:
>
> > This is fine.
> >
> > I wondered a bit about whether it would be generally useful to add the 
> > 'dylibs that have to be copied' to the SBLaunchInfo?  It has some other 
> > platform'y like things.  I'm not strongly promoting the idea, just thought 
> > I'd float it.
>
>
> You can currently do this by setting the platform file spec for a SBModule. 
> If that is set, then the target will upload the module to that path. The main 
> executable always goes to the remote working directory if its platform file 
> spec isn't set, but any module can set this manually. The register shared 
> libraries code sets the platform path.


I don't think that this would help in Fred's case, since he needs to pass 
something that will work to the API that CREATES the target, so he doesn't 
really have an SBModule for the library yet.  OTOH, since there's another way 
to do this that works more generally, then that make adding it to the 
SBLaunchInfo seem redundant...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D70134



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


[Lldb-commits] [lldb] 9b95835 - [LLDB] Add core definition for armv8l and armv7l

2019-11-12 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2019-11-13T05:40:09+05:00
New Revision: 9b958356983afffaf56788f37bdab9213369fa45

URL: 
https://github.com/llvm/llvm-project/commit/9b958356983afffaf56788f37bdab9213369fa45
DIFF: 
https://github.com/llvm/llvm-project/commit/9b958356983afffaf56788f37bdab9213369fa45.diff

LOG: [LLDB] Add core definition for armv8l and armv7l

This patch adds core definitions in lldb ArchSpecs for armv8l and armv7l cores.

This was needed because on Linux running on 32-bit Arm v8 we are returned
armv8l in case we are running 32-bit sysroot on 64bit kernel. In case of 32-bit
kernel and 32-bit sysroot running on arm v8 hardware we are returned armv7l.
This is quite common when we run 32 bit arm using docker container.

Signed-off-by: Muhammad Omair Javaid 

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

Added: 


Modified: 
lldb/include/lldb/Utility/ArchSpec.h
lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
lldb/source/Utility/ArchSpec.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index bd8c421c3bfc..ae7958376832 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -101,6 +101,7 @@ class ArchSpec {
 eCore_arm_armv6,
 eCore_arm_armv6m,
 eCore_arm_armv7,
+eCore_arm_armv7l,
 eCore_arm_armv7f,
 eCore_arm_armv7s,
 eCore_arm_armv7k,
@@ -122,6 +123,7 @@ class ArchSpec {
 eCore_thumbv7em,
 eCore_arm_arm64,
 eCore_arm_armv8,
+eCore_arm_armv8l,
 eCore_arm_arm64_32,
 eCore_arm_aarch64,
 

diff  --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py 
b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index 4ad400564340..3515bc812ac5 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -25,7 +25,7 @@ def check_first_register_readable(test_case):
 
 if arch in ['x86_64', 'i386']:
 test_case.expect("register read eax", substrs=['eax = 0x'])
-elif arch in ['arm', 'armv7', 'armv7k']:
+elif arch in ['arm', 'armv7', 'armv7k', 'armv8l', 'armv7l']:
 test_case.expect("register read r0", substrs=['r0 = 0x'])
 elif arch in ['aarch64', 'arm64', 'arm64e', 'arm64_32']:
 test_case.expect("register read x0", substrs=['x0 = 0x'])

diff  --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules 
b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 2ad4a486c743..53729548cc4b 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -239,7 +239,7 @@ else
override ARCH :=
override ARCHFLAG :=
endif
-   ifeq "$(ARCH)" "arm"
+   ifeq "$(findstring arm,$(ARCH))" "arm"
override ARCH :=
override ARCHFLAG :=
endif

diff  --git a/lldb/source/Utility/ArchSpec.cpp 
b/lldb/source/Utility/ArchSpec.cpp
index a8781251ef8a..62d9d246255a 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -61,6 +61,8 @@ static const CoreDefinition g_core_definitions[] = {
  "armv6m"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7,
  "armv7"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7l,
+ "armv7l"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7f,
  "armv7f"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7s,
@@ -101,6 +103,8 @@ static const CoreDefinition g_core_definitions[] = {
  ArchSpec::eCore_arm_arm64, "arm64"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
  ArchSpec::eCore_arm_armv8, "armv8"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm,
+  ArchSpec::eCore_arm_armv8l, "armv8l"},
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::aarch64_32,
   ArchSpec::eCore_arm_arm64_32, "arm64_32"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
@@ -1188,6 +1192,8 @@ static bool cores_match(const ArchSpec::Core core1, const 
ArchSpec::Core core2,
   case ArchSpec::eCore_arm_armv7f:
   case ArchSpec::eCore_arm_armv7k:
   case ArchSpec::eCore_arm_armv7s:
+  case ArchSpec::eCore_arm_armv7l:
+  case ArchSpec::eCore_arm_armv8l:
 if (!enforce_exact_match) {
   if (core2 == ArchSpec::eCore_arm_generic)
 return true;



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


[Lldb-commits] [PATCH] D69904: [arm] Add core definition for armv8l and armv7l

2019-11-12 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid marked an inline comment as done.
omjavaid added a comment.

I have updated the patch as suggested and will move out the triple fix and 
whitespace issue in separate patches. Committing remaining changes shortly.


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

https://reviews.llvm.org/D69904



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


[Lldb-commits] [PATCH] D69904: [arm] Add core definition for armv8l and armv7l

2019-11-12 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9b958356983a: [LLDB] Add core definition for armv8l and 
armv7l (authored by omjavaid).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D69904?vs=228083&id=228984#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D69904

Files:
  lldb/include/lldb/Utility/ArchSpec.h
  lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules
  lldb/source/Utility/ArchSpec.cpp


Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -61,6 +61,8 @@
  "armv6m"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7,
  "armv7"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7l,
+ "armv7l"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7f,
  "armv7f"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7s,
@@ -101,6 +103,8 @@
  ArchSpec::eCore_arm_arm64, "arm64"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
  ArchSpec::eCore_arm_armv8, "armv8"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm,
+  ArchSpec::eCore_arm_armv8l, "armv8l"},
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::aarch64_32,
   ArchSpec::eCore_arm_arm64_32, "arm64_32"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
@@ -1188,6 +1192,8 @@
   case ArchSpec::eCore_arm_armv7f:
   case ArchSpec::eCore_arm_armv7k:
   case ArchSpec::eCore_arm_armv7s:
+  case ArchSpec::eCore_arm_armv7l:
+  case ArchSpec::eCore_arm_armv8l:
 if (!enforce_exact_match) {
   if (core2 == ArchSpec::eCore_arm_generic)
 return true;
Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -239,7 +239,7 @@
override ARCH :=
override ARCHFLAG :=
endif
-   ifeq "$(ARCH)" "arm"
+   ifeq "$(findstring arm,$(ARCH))" "arm"
override ARCH :=
override ARCHFLAG :=
endif
Index: lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
===
--- lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -25,7 +25,7 @@
 
 if arch in ['x86_64', 'i386']:
 test_case.expect("register read eax", substrs=['eax = 0x'])
-elif arch in ['arm', 'armv7', 'armv7k']:
+elif arch in ['arm', 'armv7', 'armv7k', 'armv8l', 'armv7l']:
 test_case.expect("register read r0", substrs=['r0 = 0x'])
 elif arch in ['aarch64', 'arm64', 'arm64e', 'arm64_32']:
 test_case.expect("register read x0", substrs=['x0 = 0x'])
Index: lldb/include/lldb/Utility/ArchSpec.h
===
--- lldb/include/lldb/Utility/ArchSpec.h
+++ lldb/include/lldb/Utility/ArchSpec.h
@@ -101,6 +101,7 @@
 eCore_arm_armv6,
 eCore_arm_armv6m,
 eCore_arm_armv7,
+eCore_arm_armv7l,
 eCore_arm_armv7f,
 eCore_arm_armv7s,
 eCore_arm_armv7k,
@@ -122,6 +123,7 @@
 eCore_thumbv7em,
 eCore_arm_arm64,
 eCore_arm_armv8,
+eCore_arm_armv8l,
 eCore_arm_arm64_32,
 eCore_arm_aarch64,
 


Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -61,6 +61,8 @@
  "armv6m"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7,
  "armv7"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7l,
+ "armv7l"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7f,
  "armv7f"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7s,
@@ -101,6 +103,8 @@
  ArchSpec::eCore_arm_arm64, "arm64"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
  ArchSpec::eCore_arm_armv8, "armv8"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm,
+  ArchSpec::eCore_arm_armv8l, "armv8l"},
 {eByteOrderLittle, 4, 4, 4, llvm::Triple::aarch64_32,
   ArchSpec::eCore_arm_arm64_32, "arm64_32"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
@@ -1188,6 +1192,8 @@
   case ArchSpec::eCore_arm_armv7f:
   case ArchSpec::eCore_arm_armv7k:
   case ArchSpec::eCore_arm_armv7s:
+  case ArchSpec::eCore_arm_armv7l:
+  case ArchSpec::eCore_arm_armv8l:
 if (!enforce_e

[Lldb-commits] [PATCH] D70154: [LLDB] Fix whitespace/tabs mismatch in lldbsuite Makefile.rules

2019-11-12 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid created this revision.
omjavaid added a reviewer: labath.

This patch fixes whitespace/tabs mismatch in 
lldb/packages/Python/lldbsuite/test/make/Makefile.rules


https://reviews.llvm.org/D70154

Files:
  lldb/packages/Python/lldbsuite/test/make/Makefile.rules


Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules
===
--- lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -181,8 +181,8 @@
 
 ifeq "$(OS)" "Darwin"
 ifeq "$(SDKROOT)" ""
-# We haven't otherwise set the SDKROOT, so set it now to macosx
-SDKROOT := $(shell xcrun --sdk macosx --show-sdk-path)
+   # We haven't otherwise set the SDKROOT, so set it now to macosx
+   SDKROOT := $(shell xcrun --sdk macosx --show-sdk-path)
 endif
 endif
 
@@ -360,46 +360,46 @@
 
 # Function that returns the counterpart C++ compiler, given $(CC) as arg.
 cxx_compiler_notdir = $(if $(findstring icc,$(1)), \
-$(subst icc,icpc,$(1)), \
-$(if $(findstring llvm-gcc,$(1)), \
- $(subst llvm-gcc,llvm-g++,$(1)), \
- $(if $(findstring gcc,$(1)), \
-  $(subst gcc,g++,$(1)), \
-  $(subst cc,c++,$(1)
+   $(subst icc,icpc,$(1)), \
+   $(if $(findstring llvm-gcc,$(1)), \
+   $(subst llvm-gcc,llvm-g++,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+   $(subst gcc,g++,$(1)), \
+   $(subst cc,c++,$(1)
 cxx_compiler = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_compiler_notdir,$(notdir $(1,$(call cxx_compiler_notdir,$(1)))
 
 # Function that returns the C++ linker, given $(CC) as arg.
 cxx_linker_notdir = $(if $(findstring icc,$(1)), \
-  $(subst icc,icpc,$(1)), \
-  $(if $(findstring llvm-gcc,$(1)), \
-   $(subst llvm-gcc,llvm-g++,$(1)), \
-   $(if $(findstring gcc,$(1)), \
-$(subst gcc,g++,$(1)), \
-$(subst cc,c++,$(1)
+   $(subst icc,icpc,$(1)), \
+   $(if $(findstring llvm-gcc,$(1)), \
+   $(subst llvm-gcc,llvm-g++,$(1)), \
+   $(if $(findstring gcc,$(1)), \
+   $(subst gcc,g++,$(1)), \
+   $(subst cc,c++,$(1)
 cxx_linker = $(if $(findstring /,$(1)),$(join $(dir $(1)), $(call 
cxx_linker_notdir,$(notdir $(1,$(call cxx_linker_notdir,$(1)))
 
 ifneq "$(OS)" "Darwin"
-CLANG_OR_GCC := $(strip $(if $(findstring clang,$(CC)), \
- $(findstring clang,$(CC)), \
- $(if $(findstring gcc,$(CC)), \
-  $(findstring gcc,$(CC)), \
-  cc)))
-
-CC_LASTWORD := $(strip $(lastword $(subst -, ,$(CC
-
-replace_with = $(strip $(if $(findstring $(3),$(CC_LASTWORD)), \
-   $(subst $(3),$(1),$(2)), \
-   $(subst $(3),$(1),$(subst -$(CC_LASTWORD),,$(2)
-
-ifeq "$(notdir $(CC))" "$(CC)"
-replace_cc_with = $(call replace_with,$(1),$(CC),$(CLANG_OR_GCC))
-else
-replace_cc_with = $(join $(dir $(CC)),$(call 
replace_with,$(1),$(notdir $(CC)),$(CLANG_OR_GCC)))
-endif
+   CLANG_OR_GCC := $(strip $(if $(findstring clang,$(CC)), \
+   $(findstring clang,$(CC)), \
+   $(if $(findstring gcc,$(CC)), \
+   $(findstring gcc,$(CC)), \
+   cc)))
+
+   CC_LASTWORD := $(strip $(lastword $(subst -, ,$(CC
+
+   replace_with = $(strip $(if $(findstring $(3),$(CC_LASTWORD)), \
+   $(subst $(3),$(1),$(2)), \
+   $(subst $(3),$(1),$(subst -$(CC_LASTWORD),,$(2)
+
+   ifeq "$(notdir $(CC))" "$(CC)"
+   replace_cc_with = $(call 
replace_with,$(1),$(CC),$(CLANG_OR_GCC))
+   else
+   replace_cc_with = $(join $(dir $(CC)),$(call 
replace_with,$(1),$(notdir $(CC)),$(CLANG_OR_GCC)))
+   endif
 
-OBJCOPY ?= $(call replace_cc_with,objcopy)
-ARCHIVER ?= $(call replace_cc_with,ar)
-override AR = $(ARCHIVER)
+   OBJCOPY ?= $(call replace_cc_with,objcopy)
+   ARCHIVER ?= $(call replace_cc_with,ar)
+   override AR = $(ARCHIVER)
 endif
 
 ifdef PIE


Index: lldb/packages/Python/lldbsuite/test/make/Makefile.rules

[Lldb-commits] [PATCH] D70155: [LLDB] Avoid triple corruption while merging core info from platform and target triples

2019-11-12 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid created this revision.
omjavaid added reviewers: labath, jasonmolenda, clayborg.
Herald added a subscriber: kristof.beyls.

This patch fixes a bug where when target triple created from elf information is 
arm-*-linux-eabihf and platform triple is armv8l-*-linux-gnueabihf. Merging 
both triple results in armv8l--unknown-unknown.

This happens because we order a triple update while calling CoreUpdated and 
CoreUpdated creates a new triple with no vendor or environment information.

Making sure we do not update triple and just update to more specific core fixes 
the issue.


https://reviews.llvm.org/D70155

Files:
  lldb/source/Utility/ArchSpec.cpp


Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -868,7 +868,7 @@
   IsCompatibleMatch(other) && GetCore() == ArchSpec::eCore_arm_generic &&
   other.GetCore() != ArchSpec::eCore_arm_generic) {
 m_core = other.GetCore();
-CoreUpdated(true);
+CoreUpdated(false);
   }
   if (GetFlags() == 0) {
 SetFlags(other.GetFlags());


Index: lldb/source/Utility/ArchSpec.cpp
===
--- lldb/source/Utility/ArchSpec.cpp
+++ lldb/source/Utility/ArchSpec.cpp
@@ -868,7 +868,7 @@
   IsCompatibleMatch(other) && GetCore() == ArchSpec::eCore_arm_generic &&
   other.GetCore() != ArchSpec::eCore_arm_generic) {
 m_core = other.GetCore();
-CoreUpdated(true);
+CoreUpdated(false);
   }
   if (GetFlags() == 0) {
 SetFlags(other.GetFlags());
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 7ba2864 - [Reproducer] Discard reproducer directory if not generated.

2019-11-12 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2019-11-12T20:16:33-08:00
New Revision: 7ba28644a1eeb554e818644556f98abfc0795b02

URL: 
https://github.com/llvm/llvm-project/commit/7ba28644a1eeb554e818644556f98abfc0795b02
DIFF: 
https://github.com/llvm/llvm-project/commit/7ba28644a1eeb554e818644556f98abfc0795b02.diff

LOG: [Reproducer] Discard reproducer directory if not generated.

If lldb was run in capture mode, but no reproducer was generated, make
sure we clean up the reproducer directory.

Added: 
lldb/test/Shell/Reproducer/Inputs/Discard.in
lldb/test/Shell/Reproducer/TestDiscard.test

Modified: 
lldb/include/lldb/Utility/Reproducer.h
lldb/source/Utility/Reproducer.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Reproducer.h 
b/lldb/include/lldb/Utility/Reproducer.h
index 3db98a781d4c..ddb1f45a7219 100644
--- a/lldb/include/lldb/Utility/Reproducer.h
+++ b/lldb/include/lldb/Utility/Reproducer.h
@@ -288,7 +288,7 @@ class Generator final {
   FileSpec m_root;
 
   /// Flag to ensure that we never call both keep and discard.
-  bool m_done;
+  bool m_done = false;
 };
 
 class Loader final {

diff  --git a/lldb/source/Utility/Reproducer.cpp 
b/lldb/source/Utility/Reproducer.cpp
index 4777d7576a32..e0806f5f5981 100644
--- a/lldb/source/Utility/Reproducer.cpp
+++ b/lldb/source/Utility/Reproducer.cpp
@@ -143,12 +143,14 @@ static FileSpec MakeAbsolute(FileSpec file_spec) {
   return FileSpec(path, file_spec.GetPathStyle());
 }
 
-Generator::Generator(FileSpec root)
-: m_root(MakeAbsolute(std::move(root))), m_done(false) {
+Generator::Generator(FileSpec root) : m_root(MakeAbsolute(std::move(root))) {
   GetOrCreate();
 }
 
-Generator::~Generator() {}
+Generator::~Generator() {
+  if (!m_done)
+Discard();
+}
 
 ProviderBase *Generator::Register(std::unique_ptr provider) {
   std::lock_guard lock(m_providers_mutex);

diff  --git a/lldb/test/Shell/Reproducer/Inputs/Discard.in 
b/lldb/test/Shell/Reproducer/Inputs/Discard.in
new file mode 100644
index ..a2c4e48d1f46
--- /dev/null
+++ b/lldb/test/Shell/Reproducer/Inputs/Discard.in
@@ -0,0 +1,5 @@
+breakpoint set -f simple.c -l 12
+run
+bt
+cont
+reproducer status

diff  --git a/lldb/test/Shell/Reproducer/TestDiscard.test 
b/lldb/test/Shell/Reproducer/TestDiscard.test
new file mode 100644
index ..db9614aabb84
--- /dev/null
+++ b/lldb/test/Shell/Reproducer/TestDiscard.test
@@ -0,0 +1,13 @@
+# UNSUPPORTED: system-windows
+# This ensures that the reproducer properly cleans up after itself.
+
+# Build the inferior.
+# RUN: mkdir -p %t
+# RUN: rm -rf %t.repro
+# RUN: %clang_host %S/Inputs/simple.c -g -o %t/reproducer.out
+
+# Capture but don't generate the reproducer.
+# RUN: %lldb -x -b -s %S/Inputs/Discard.in --capture --capture-path %t.repro 
%t/reproducer.out
+
+# Make sure the directory doesn't exist.
+# RUN: mkdir %t.repro



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