[Lldb-commits] [PATCH] D74816: [lldb/Core] Remove more duplicate code in PluginManager (NFCI)

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG80b2e3cc5312: [lldb/Core] Remove more duplicate code in 
PluginManager (NFCI) (authored by JDevlieghere).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74816

Files:
  lldb/source/Core/PluginManager.cpp

Index: lldb/source/Core/PluginManager.cpp
===
--- lldb/source/Core/PluginManager.cpp
+++ lldb/source/Core/PluginManager.cpp
@@ -16,38 +16,24 @@
 #include "lldb/Utility/FileSpec.h"
 #include "lldb/Utility/Status.h"
 #include "lldb/Utility/StringList.h"
-
-#if defined(_WIN32)
-#include "lldb/Host/windows/PosixApi.h"
-#endif
-
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/DynamicLibrary.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/raw_ostream.h"
-
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
 #include 
-
-#include 
-
-namespace lldb_private {
-class CommandInterpreter;
-}
+#if defined(_WIN32)
+#include "lldb/Host/windows/PosixApi.h"
+#endif
 
 using namespace lldb;
 using namespace lldb_private;
 
-enum PluginAction {
-  ePluginRegisterInstance,
-  ePluginUnregisterInstance,
-  ePluginGetInstanceAtIndex
-};
-
 typedef bool (*PluginInitCallback)();
 typedef void (*PluginTermCallback)();
 
@@ -92,7 +78,6 @@
 static FileSystem::EnumerateDirectoryResult
 LoadPluginCallback(void *baton, llvm::sys::fs::file_type ft,
llvm::StringRef path) {
-  //PluginManager *plugin_manager = (PluginManager *)baton;
   Status error;
 
   namespace fs = llvm::sys::fs;
@@ -156,7 +141,6 @@
 }
 
 void PluginManager::Initialize() {
-#if 1
   const bool find_directories = true;
   const bool find_files = true;
   const bool find_other = true;
@@ -178,7 +162,6 @@
 LoadPluginCallback, nullptr);
 }
   }
-#endif
 }
 
 void PluginManager::Terminate() {
@@ -198,6 +181,8 @@
 }
 
 template  struct PluginInstance {
+  typedef Callback CallbackType;
+
   PluginInstance() = default;
   PluginInstance(ConstString name, std::string description,
  Callback create_callback = nullptr,
@@ -212,16 +197,97 @@
   DebuggerInitializeCallback debugger_init_callback;
 };
 
-#pragma mark ABI
+template  class PluginInstances {
+public:
+  template 
+  bool RegisterPlugin(ConstString name, const char *description,
+  typename Instance::CallbackType callback,
+  Args &&... args) {
+if (!callback)
+  return false;
 
-typedef PluginInstance ABIInstance;
+assert((bool)name);
+Instance instance =
+Instance(name, description, callback, std::forward(args)...);
+std::lock_guard guard(m_mutex);
+m_instances.push_back(instance);
+return false;
+  }
 
-typedef std::vector ABIInstances;
+  bool UnregisterPlugin(typename Instance::CallbackType callback) {
+if (!callback)
+  return false;
+std::lock_guard guard(m_mutex);
+auto pos = m_instances.begin();
+auto end = m_instances.end();
+for (; pos != end; ++pos) {
+  if (pos->create_callback == callback) {
+m_instances.erase(pos);
+return true;
+  }
+}
+return false;
+  }
 
-static std::recursive_mutex &GetABIInstancesMutex() {
-  static std::recursive_mutex g_instances_mutex;
-  return g_instances_mutex;
-}
+  typename Instance::CallbackType GetCallbackAtIndex(uint32_t idx) {
+std::lock_guard guard(m_mutex);
+if (Instance *instance = GetInstanceAtIndex(idx))
+  return instance->create_callback;
+return nullptr;
+  }
+
+  const char *GetDescriptionAtIndex(uint32_t idx) {
+std::lock_guard guard(m_mutex);
+if (Instance *instance = GetInstanceAtIndex(idx))
+  return instance->description.c_str();
+return nullptr;
+  }
+
+  const char *GetNameAtIndex(uint32_t idx) {
+std::lock_guard guard(m_mutex);
+if (Instance *instance = GetInstanceAtIndex(idx))
+  return instance->name.GetCString();
+return nullptr;
+  }
+
+  typename Instance::CallbackType GetCallbackForName(ConstString name) {
+if (!name)
+  return nullptr;
+std::lock_guard guard(m_mutex);
+for (auto &instance : m_instances) {
+  if (name == instance.name)
+return instance.create_callback;
+}
+return nullptr;
+  }
+
+  void PerformDebuggerCallback(Debugger &debugger) {
+std::lock_guard guard(m_mutex);
+for (auto &instance : m_instances) {
+  if (instance.debugger_init_callback)
+instance.debugger_init_callback(debugger);
+}
+  }
+
+  std::recursive_mutex &GetMutex() { return m_mutex; }
+  const std::vector &GetInstances() const { return m_instances; }
+  std::vector &GetInstances() { return m_instances; }
+
+private:
+  Instance *GetInstanceAtIndex(uint32_t idx) {
+// Caller locks.
+if (idx < m_instances.size())
+  return &m_instances[idx];
+retur

[Lldb-commits] [lldb] 2bab173 - [lldb] Make TestFormatters.py not rely on working constructor calls

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T10:21:36+01:00
New Revision: 2bab1738f39606324f7bd4c71de1354288c63285

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

LOG: [lldb] Make TestFormatters.py not rely on working constructor calls

All calls to operator new in this test fail for me with:
```
expression --show-types -- *(new foo(47))`
Error output:
error: Execution was interrupted, reason: internal c++ exception 
breakpoint(-6)..
The process has been returned to the state before expression evaluation.
```

As calling operator new isn't the idea of this test, this patch moves that
logic to the binary with some new_* utility functions and explicitly tests
this logic in the constructor test (where we can isolate the failures and
skip them on Linux).

Added: 


Modified: 
lldb/test/API/commands/expression/formatters/TestFormatters.py
lldb/test/API/commands/expression/formatters/main.cpp
lldb/test/API/lang/cpp/constructors/TestCppConstructors.py

Removed: 




diff  --git a/lldb/test/API/commands/expression/formatters/TestFormatters.py 
b/lldb/test/API/commands/expression/formatters/TestFormatters.py
index 98872dffca35..1fbc1ef82986 100644
--- a/lldb/test/API/commands/expression/formatters/TestFormatters.py
+++ b/lldb/test/API/commands/expression/formatters/TestFormatters.py
@@ -57,7 +57,7 @@ def cleanup():
 self.runCmd("frame variable foo1.b --show-types")
 self.runCmd("frame variable foo1.b.b_ref --show-types")
 
-self.filecheck("expression --show-types -- *(new foo(47))", __file__,
+self.filecheck("expression --show-types -- *(new_foo(47))", __file__,
 '-check-prefix=EXPR-TYPES-NEW-FOO')
 # EXPR-TYPES-NEW-FOO: (foo) ${{.*}} = {
 # EXPR-TYPES-NEW-FOO-NEXT:   (int) a = 47
@@ -90,13 +90,13 @@ def cleanup():
 
 self.runCmd("type summary add -F formatters.foo_SummaryProvider foo")
 
-self.expect("expression new int(12)",
+self.expect("expression new_int(12)",
 substrs=['(int *) $', ' = 0x'])
 
 self.runCmd(
 "type summary add -s \"${var%pointer} -> ${*var%decimal}\" \"int 
*\"")
 
-self.expect("expression new int(12)",
+self.expect("expression new_int(12)",
 substrs=['(int *) $', '= 0x', ' -> 12'])
 
 self.expect("expression foo1.a_ptr",
@@ -112,7 +112,7 @@ def cleanup():
 # EXPR-FOO1-SAME: h = 27
 # EXPR-FOO1-SAME: k = 29
 
-self.filecheck("expression --ptr-depth=1 -- new foo(47)", __file__,
+self.filecheck("expression --ptr-depth=1 -- new_foo(47)", __file__,
 '-check-prefix=EXPR-PTR-DEPTH1')
 # EXPR-PTR-DEPTH1: (foo *) $
 # EXPR-PTR-DEPTH1-SAME: a = 47

diff  --git a/lldb/test/API/commands/expression/formatters/main.cpp 
b/lldb/test/API/commands/expression/formatters/main.cpp
index 4ca2504ff8cb..7360c479f10a 100644
--- a/lldb/test/API/commands/expression/formatters/main.cpp
+++ b/lldb/test/API/commands/expression/formatters/main.cpp
@@ -1,6 +1,10 @@
 #include 
 #include 
 
+int *new_int(int val) {
+  return new int(val);
+}
+
 struct baz
 {
 int h;
@@ -24,16 +28,22 @@ struct foo
bar b;

foo(int x) : a(x),
-   a_ptr(new int(x+1)),
+   a_ptr(new_int(x+1)),
b(2*x) {}

};
+
+foo *new_foo(int x) {
+  return new foo(x);
+}
+

 int main(int argc, char** argv)
 {
foo foo1(12);
foo foo2(121);
-   
+   foo * newd_foo = new_foo(1);
+   delete newd_foo;
foo2.a = ; // Stop here
*(foo2.b.i_ptr) = ;
 foo2.b.b.h = ;

diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 422854e38de1..75784f310dde 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -24,3 +24,9 @@ def test_constructors(self):
 self.expect("expr ClassWithDeletedCtor(1).value", error=True, 
substrs=["Couldn't lookup symbols:"])
 self.expect("expr ClassWithDeletedDefaultCtor().value", error=True, 
substrs=["Couldn't lookup symbols:"])
 
+@skipIfLinux # Fails on some Linux systems with SIGABRT.
+def test_constructors_new(self):
+self.build()
+lldbutil.run_to_source_breakpoint(self,"// break here", 
lldb.SBFileSpec("main.cpp"))
+
+self.expect_expr("(new ClassWithOneCtor(1)).value; 1", 
result_type="int", result_value="1")



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

[Lldb-commits] [lldb] b4608ef - [lldb][NFC] Add a missing test case to TestCppConstructors.py

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T10:24:59+01:00
New Revision: b4608efc0b7d0317030ba13daf4833751c5cba64

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

LOG: [lldb][NFC] Add a missing test case to TestCppConstructors.py

Added: 


Modified: 
lldb/test/API/lang/cpp/constructors/TestCppConstructors.py

Removed: 




diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 75784f310dde..b59b1ab9bfaf 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -11,6 +11,7 @@ def test_constructors(self):
 self.build()
 lldbutil.run_to_source_breakpoint(self,"// break here", 
lldb.SBFileSpec("main.cpp"))
 self.expect_expr("ClassWithImplicitCtor().foo()", result_type="int", 
result_value="1")
+self.expect_expr("ClassWithOneCtor(2).value", result_type="int", 
result_value="2")
 self.expect_expr("ClassWithMultipleCtor(3).value", result_type="int", 
result_value="3")
 self.expect_expr("ClassWithMultipleCtor(3, 1).value", 
result_type="int", result_value="4")
 



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


[Lldb-commits] [lldb] 785df61 - [lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T10:30:11+01:00
New Revision: 785df616807fde4f13738f2fafd978de8202fb12

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

LOG: [lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline 
namespaces.

Summary:
Currently when printing data types we include implicit scopes such as inline 
namespaces or anonymous namespaces.
This leads to command output like this (for `std::set` with X being in an 
anonymous namespace):

```
(lldb) print my_set
(std::__1::set<(anonymous namespace)::X, std::__1::less<(anonymous 
namespace)::X>, std::__1::allocator<(anonymous namespace)::X> >) $0 = size=0 {}
```

This patch removes all the implicit scopes when printing type names in 
TypeSystemClang::GetDisplayTypeName
so that our output now looks like this:

```
(lldb) print my_set
(std::set, std::allocator >) $0 = size=0 {}
```

As previously GetDisplayTypeName and GetTypeName had the same output we 
actually often used the
two as if they are the same method (they were in fact using the same 
implementation), so this patch also
fixes the places where we actually want the display type name and not the 
actual type name.

Note that this doesn't touch the `GetTypeName` class that for example the data 
formatters use, so this patch
is only changes the way we display types to the user. The full type name can 
also still be found when passing
'-R' to see the raw output of a variable in case someone is somehow interested 
in that.

Partly fixes rdar://problem/59292534

Reviewers: shafik, jingham

Reviewed By: shafik

Subscribers: christof, JDevlieghere, lldb-commits

Tags: #lldb

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

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbtest.py
lldb/source/DataFormatters/FormatManager.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h

lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py

lldb/test/API/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/main.cpp

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/set/main.cpp

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index 784d6ecd2ddf..0d1372497ef5 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -2406,7 +2406,7 @@ def expect_expr(
 "Unexpected failure with msg: " + 
eval_result.GetError().GetCString())
 
 if result_type:
-self.assertEqual(result_type, eval_result.GetTypeName())
+self.assertEqual(result_type, eval_result.GetDisplayTypeName())
 
 if result_value:
 self.assertEqual(result_value, eval_result.GetValue())

diff  --git a/lldb/source/DataFormatters/FormatManager.cpp 
b/lldb/source/DataFormatters/FormatManager.cpp
index 23ad6c67f887..cce893477d3b 100644
--- a/lldb/source/DataFormatters/FormatManager.cpp
+++ b/lldb/source/DataFormatters/FormatManager.cpp
@@ -193,7 +193,7 @@ void FormatManager::GetPossibleMatches(
 entries.push_back(
 {type_name, reason, did_strip_ptr, did_strip_ref, did_str

[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-19 Thread Nick Desaulniers via Phabricator via lldb-commits
nickdesaulniers added a comment.

As a heads up, Linaro's ToolChain Working Group's Linux kernel CI lit up on 
this change. I see it's been reverted (thank you). Please cc me on the updated 
patch and I can help test it against the Linux kernel.

Edit: Link: 
https://ci.linaro.org/job/tcwg_kernel-bisect-llvm-master-arm-mainline-allyesconfig/25/artifact/artifacts/build-a82d3e8a6e67473c94a5ce6345372748e9b61718/03-build_linux/console.log


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-19 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro updated this revision to Diff 245345.
djtodoro added a comment.

- Address the issue with ARM `describeLoadedValue()` (thanks to @vsk, I've 
reduced the test 
`llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir`)


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

https://reviews.llvm.org/D73534

Files:
  clang/include/clang/Basic/CodeGenOptions.def
  clang/include/clang/Driver/CC1Options.td
  clang/lib/CodeGen/BackendUtil.cpp
  clang/lib/CodeGen/CGDebugInfo.cpp
  clang/lib/Frontend/CompilerInvocation.cpp
  clang/test/CodeGen/debug-info-extern-call.c
  clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
  lldb/packages/Python/lldbsuite/test/decorators.py
  
lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
  llvm/include/llvm/CodeGen/CommandFlags.inc
  llvm/include/llvm/Target/TargetMachine.h
  llvm/include/llvm/Target/TargetOptions.h
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/LiveDebugValues.cpp
  llvm/lib/CodeGen/MIRParser/MIRParser.cpp
  llvm/lib/CodeGen/MachineFunction.cpp
  llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
  llvm/lib/CodeGen/TargetOptionsImpl.cpp
  llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
  llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
  llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
  llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
  llvm/lib/Target/ARM/ARMISelLowering.cpp
  llvm/lib/Target/ARM/ARMTargetMachine.cpp
  llvm/lib/Target/X86/X86ISelLowering.cpp
  llvm/lib/Target/X86/X86TargetMachine.cpp
  llvm/test/CodeGen/AArch64/arm64-anyregcc.ll
  llvm/test/CodeGen/AArch64/arm64-patchpoint.ll
  llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll
  llvm/test/CodeGen/ARM/smml.ll
  llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
  llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
  llvm/test/CodeGen/X86/call-site-info-output.ll
  llvm/test/CodeGen/X86/hoist-invariant-load.ll
  llvm/test/CodeGen/X86/speculative-load-hardening-indirect.ll
  llvm/test/CodeGen/X86/statepoint-allocas.ll
  llvm/test/CodeGen/X86/tail-dup-repeat.ll
  llvm/test/CodeGen/X86/xray-custom-log.ll
  llvm/test/CodeGen/X86/xray-typed-event-log.ll
  llvm/test/DebugInfo/AArch64/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/call-site-info-output.ll
  llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
  llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir
  llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
  llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
  llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
  llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
  llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
  llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
  llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
  llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
  llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
  llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
  llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
  llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
  llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
  llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
  llvm/test/DebugInfo/X86/dbg-value-range.ll
  llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
  llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
  llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
  llvm/test/DebugInfo/X86/loclists-dwp.ll
  llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll
  llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
  llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
  llvm/test/tools/llvm-dwarfdump/X86/valid-call-site-GNU-extensions.ll
  llvm/test/tools/llvm-locstats/locstats.ll

Index: llvm/test/tools/llvm-locs

[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-19 Thread David Stenberg via Phabricator via lldb-commits
dstenb added a comment.

In D73534#1881353 , @nickdesaulniers 
wrote:

> As a heads up, Linaro's ToolChain Working Group's Linux kernel CI lit up on 
> this change. I see it's been reverted (thank you). Please cc me on the 
> updated patch and I can help test it against the Linux kernel.
>
> Edit: Link: 
> https://ci.linaro.org/job/tcwg_kernel-bisect-llvm-master-arm-mainline-allyesconfig/25/artifact/artifacts/build-a82d3e8a6e67473c94a5ce6345372748e9b61718/03-build_linux/console.log


Its hard to tell from the backtrace, but looking at the code, I think this 
might be a bug that sneaked in when I did D70431 
. Sorry if that is the case!

`ARMBaseInstrInfo::isAddImmediate()` does a `getReg()` without any `isReg()` 
guard:

  Optional ARMBaseInstrInfo::isAddImmediate(const MachineInstr &MI, 



 
Register Reg) const {   



 
  [...]
// TODO: Handle cases where Reg is a super- or sub-register of the  



 
// destination register.
if (Reg != MI.getOperand(0).getReg())
  return None;


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-19 Thread Djordje Todorovic via Phabricator via lldb-commits
djtodoro added a comment.

In D73534#1882118 , @dstenb wrote:

> In D73534#1881353 , @nickdesaulniers 
> wrote:
>
> > As a heads up, Linaro's ToolChain Working Group's Linux kernel CI lit up on 
> > this change. I see it's been reverted (thank you). Please cc me on the 
> > updated patch and I can help test it against the Linux kernel.
> >
> > Edit: Link: 
> > https://ci.linaro.org/job/tcwg_kernel-bisect-llvm-master-arm-mainline-allyesconfig/25/artifact/artifacts/build-a82d3e8a6e67473c94a5ce6345372748e9b61718/03-build_linux/console.log
>
>
> Its hard to tell from the backtrace, but looking at the code, I think this 
> might be a bug that sneaked in when I did D70431 
> . Sorry if that is the case!
>
> `ARMBaseInstrInfo::isAddImmediate()` does a `getReg()` without any `isReg()` 
> guard:
>
>   Optional ARMBaseInstrInfo::isAddImmediate(const MachineInstr 
> &MI,  
>   
>   
> 
> Register Reg) const { 
>   
>   
>   
>  
>   [...]
> // TODO: Handle cases where Reg is a super- or sub-register of the
>   
>   
>   
>  
> // destination register.
> if (Reg != MI.getOperand(0).getReg())
>   return None;
>


@dstenb No problem, we have already addressed the issue. Thanks to @vsk and 
@nickdesaulniers! I'll update the patch.


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-02-19 Thread David Stenberg via Phabricator via lldb-commits
dstenb added a comment.

In D73534#1882127 , @djtodoro wrote:

> @dstenb No problem, we have already addressed the issue. Thanks to @vsk and 
> @nickdesaulniers! I'll update the patch.


Great, thanks!


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

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D74478: [lldb] Let TypeSystemClang::GetDisplayTypeName remove anonymous and inline namespaces.

2020-02-19 Thread Raphael Isemann via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG785df616807f: [lldb] Let TypeSystemClang::GetDisplayTypeName 
remove anonymous and inline… (authored by teemperor).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74478

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/DataFormatters/FormatManager.cpp
  lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  
lldb/test/API/commands/expression/import-std-module/basic/TestImportStdModule.py
  
lldb/test/API/commands/expression/import-std-module/conflicts/TestStdModuleWithConflicts.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/forward_list/TestDataFormatterLibcxxForwardList.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/iterator/TestDataFormatterLibccIterator.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/multimap/TestDataFormatterLibccMultiMap.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/TestDataFormatterLibcxxMultiSet.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/multiset/main.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/queue/TestDataFormatterLibcxxQueue.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/set/TestDataFormatterLibcxxSet.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/set/main.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
  lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp

Index: lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
===
--- lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
+++ lldb/test/Shell/SymbolFile/NativePDB/ast-types.cpp
@@ -102,9 +102,9 @@
 // CHECK: (A::C<-1>::D) ACNeg1D = (ACDMember = 0, CPtr = 0x{{0+}})
 // CHECK: (A::D) AD = {}
 // CHECK: (A::D::E) ADE = (ADDMember = 0)
-// CHECK: ((anonymous namespace)::Anonymous) AnonInt = (AnonymousMember = 0)
-// CHECK: ((anonymous namespace)::Anonymous>) AnonABCVoid = (AnonymousMember = 0)
-// CHECK: ((anonymous namespace)::Anonymous>::D) AnonABCVoidD = (AnonymousDMember = 0)
+// CHECK: (Anonymous) AnonInt = (AnonymousMember = 0)
+// CHECK: (Anonymous>) AnonABCVoid = (AnonymousMember = 0)
+// CHECK: (Anonymous>::D) AnonABCVoidD = (AnonymousDMember = 0)
 // CHECK: Dumping clang ast for 1 modules.
 // CHECK: TranslationUnitDecl {{.*}}
 // CHECK: |-CXXRecordDecl {{.*}} class TrivialC definition
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/variant/TestDataFormatterLibcxxVariant.py
@@ -51,7 +51,7 @@
'}'])
 
 self.expect("frame variable v_v1",
-substrs=['v_v1 =  Active Type = std::__1::variant  {',
+substrs=['v_v1 =  Active Type = std::variant  {',
  'Value =  Active Type = int  {',
'Value = 12',
  '}',
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/unordered/TestDataFormatterUnordered.py
@@ -16,8 +16,7 @@
 
 def setUp(self):
 TestBase.setUp(self)
-ns = 'ndk' if lldbplatformutil.target_is_android() else ''
-self.namespace = 'std::__' + ns + '1'
+self.namespace = 'std'
 
 @add_test_categories(["libc++"])
 def test_with_run_command(self):
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/tuple/TestDataFormatterLibcxxTuple.py
===
--- lldb/test/API/fu

[Lldb-commits] [PATCH] D74759: Treat RangeDataVector as an augmented BST

2020-02-19 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

If we get away with this approach them I'm completely fine with it. But I would 
feel better if we first have some more unit tests for RangeDataVector first.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74759



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


[Lldb-commits] [lldb] 3ed0ce4 - [lldb] Put Host/common headers in a module

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T10:47:46+01:00
New Revision: 3ed0ce458c3a51b866625ec70e50b0f8556e0d20

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

LOG: [lldb] Put Host/common headers in a module

This directory escaped the modularization effort it seems. Just adding
this to the Host module along with the other common headers, which should
make this code less likely to break under modules and speed up compilation.

Added: 


Modified: 
lldb/include/lldb/module.modulemap

Removed: 




diff  --git a/lldb/include/lldb/module.modulemap 
b/lldb/include/lldb/module.modulemap
index e040df8f913b..e668abe1c6ae 100644
--- a/lldb/include/lldb/module.modulemap
+++ b/lldb/include/lldb/module.modulemap
@@ -55,6 +55,11 @@ module lldb_Host {
   module Time { header "Host/Time.h" export * }
   module XML { header "Host/XML.h" export * }
 
+  module common {
+umbrella "Host/common"
+module * { export * }
+  }
+
   export *
 }
 



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


[Lldb-commits] [lldb] a3093bf - [lldb] Let TestCppConstructors pass without fix-it intervention

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T11:02:10+01:00
New Revision: a3093bfb3e7c4972e7ff7af1cc38452ec9984e13

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

LOG: [lldb] Let TestCppConstructors pass without fix-it intervention

This should use -> instead of '.', but the fix-it functionality of
the expression evaluator saved us here. Let's use the proper syntax
in the first place as we don't want to test fix-its here.

Added: 


Modified: 
lldb/test/API/lang/cpp/constructors/TestCppConstructors.py

Removed: 




diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index b59b1ab9bfaf..77e17b93bbc9 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -30,4 +30,4 @@ def test_constructors_new(self):
 self.build()
 lldbutil.run_to_source_breakpoint(self,"// break here", 
lldb.SBFileSpec("main.cpp"))
 
-self.expect_expr("(new ClassWithOneCtor(1)).value; 1", 
result_type="int", result_value="1")
+self.expect_expr("(new ClassWithOneCtor(1))->value; 1", 
result_type="int", result_value="1")



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


[Lldb-commits] [lldb] faff707 - Reland "[DebugInfo] Enable the debug entry values feature by default"

2020-02-19 Thread Djordje Todorovic via lldb-commits

Author: Djordje Todorovic
Date: 2020-02-19T11:12:26+01:00
New Revision: faff707db82d7db12fcd9f7826b8741261230e63

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

LOG: Reland "[DebugInfo] Enable the debug entry values feature by default"

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

Added: 
llvm/test/DebugInfo/MIR/ARM/dbgcallsite-noreg-is-imm-check.mir
llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll

Modified: 
clang/include/clang/Basic/CodeGenOptions.def
clang/include/clang/Driver/CC1Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/CodeGen/CGDebugInfo.cpp
clang/lib/Frontend/CompilerInvocation.cpp
clang/test/CodeGen/debug-info-extern-call.c
clang/test/CodeGenCXX/dbg-info-all-calls-described.cpp
lldb/packages/Python/lldbsuite/test/decorators.py

lldb/test/API/functionalities/param_entry_vals/basic_entry_values_x86_64/Makefile
llvm/include/llvm/CodeGen/CommandFlags.inc
llvm/include/llvm/Target/TargetMachine.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/LiveDebugValues.cpp
llvm/lib/CodeGen/MIRParser/MIRParser.cpp
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp
llvm/lib/CodeGen/TargetOptionsImpl.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64InstrInfo.cpp
llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
llvm/lib/Target/ARM/ARMISelLowering.cpp
llvm/lib/Target/ARM/ARMTargetMachine.cpp
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86TargetMachine.cpp
llvm/test/CodeGen/AArch64/arm64-anyregcc.ll
llvm/test/CodeGen/AArch64/arm64-patchpoint.ll
llvm/test/CodeGen/AArch64/arm64-tls-dynamics.ll
llvm/test/CodeGen/ARM/smml.ll
llvm/test/CodeGen/MIR/Hexagon/bundled-call-site-info.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error1.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error2.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error3.mir
llvm/test/CodeGen/MIR/X86/call-site-info-error4.mir
llvm/test/CodeGen/X86/call-site-info-output.ll
llvm/test/CodeGen/X86/hoist-invariant-load.ll
llvm/test/CodeGen/X86/speculative-load-hardening-indirect.ll
llvm/test/CodeGen/X86/statepoint-allocas.ll
llvm/test/CodeGen/X86/tail-dup-repeat.ll
llvm/test/CodeGen/X86/xray-custom-log.ll
llvm/test/CodeGen/X86/xray-typed-event-log.ll
llvm/test/DebugInfo/AArch64/call-site-info-output.ll
llvm/test/DebugInfo/ARM/call-site-info-output.ll
llvm/test/DebugInfo/ARM/entry-value-multi-byte-expr.ll
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpret-movzxi.mir
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/AArch64/dbgcall-site-orr-moves.mir
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/ARM/dbgcall-site-propagated-value.mir
llvm/test/DebugInfo/MIR/ARM/if-coverter-call-site-info.mir
llvm/test/DebugInfo/MIR/Hexagon/dbgcall-site-instr-before-bundled-call.mir
llvm/test/DebugInfo/MIR/Hexagon/live-debug-values-bundled-entry-values.mir
llvm/test/DebugInfo/MIR/SystemZ/call-site-lzer.mir
llvm/test/DebugInfo/MIR/X86/DW_OP_entry_value.mir
llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg-multiple-defs.mir
llvm/test/DebugInfo/MIR/X86/dbg-call-site-spilled-arg.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-copy-super-sub.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-interpretation.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-lea-interpretation.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-partial-describe.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reference.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-reg-shuffle.mir
llvm/test/DebugInfo/MIR/X86/dbgcall-site-two-fwd-reg-defs.mir
llvm/test/DebugInfo/MIR/X86/dbginfo-entryvals.mir
llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
llvm/test/DebugInfo/MIR/X86/entry-value-of-modified-param.mir
llvm/test/DebugInfo/MIR/X86/entry-values-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/kill-entry-value-after-diamond-bbs.mir
llvm/test/DebugInfo/MIR/X86/multiple-param-dbg-value-entry.mir
llvm/test/DebugInfo/MIR/X86/propagate-entry-value-cross-bbs.mir
llvm/test/DebugInfo/MIR/X86/unreachable-block-call-site.mir
llvm/test/DebugInfo/Sparc/entry-value-complex-reg-expr.ll
llvm/test/DebugInfo/X86/dbg-value-range.ll
llvm/test/DebugInfo/X86/dbg-value-regmask-clobber.ll
llvm/test/DebugInfo/X86/dbgcall-site-64-bit-imms.ll
llvm/test/DebugInfo/X86/dbgcall-site-zero-valued-imms.ll
llvm/test/DebugInfo/X86

[Lldb-commits] [lldb] b0060c3 - [lldb] Make comparing RegisterInfo::[alt_]name's pointer value less footy-shooty

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T13:19:41+01:00
New Revision: b0060c3a7868ef026d95d0cf8a076791ef74f474

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

LOG: [lldb] Make comparing RegisterInfo::[alt_]name's pointer value less 
footy-shooty

Comparing those two `const char *` values relies on the assumption that both
strings were created by a ConstString. Let's check that assumption with an
assert as otherwise this code silently does nothing and that's not great.

Added: 


Modified: 
lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
lldb/source/Target/ABI.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp 
b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
index 3675724deb36..443638aa39f6 100644
--- a/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
+++ b/lldb/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp
@@ -742,6 +742,8 @@ const lldb_private::RegisterInfo 
*DynamicRegisterInfo::GetRegisterInfo(
   for (auto ®_info : m_regs) {
 // We can use pointer comparison since we used a ConstString to set the
 // "name" member in AddRegister()
+assert(ConstString(reg_info.name).GetCString() == reg_info.name &&
+   "reg_info.name not from a ConstString?");
 if (reg_info.name == reg_name.GetCString()) {
   return ®_info;
 }

diff  --git a/lldb/source/Target/ABI.cpp b/lldb/source/Target/ABI.cpp
index 47a46f401e61..cb7eca280a39 100644
--- a/lldb/source/Target/ABI.cpp
+++ b/lldb/source/Target/ABI.cpp
@@ -49,13 +49,20 @@ bool RegInfoBasedABI::GetRegisterInfoByName(ConstString 
name, RegisterInfo &info
 const char *unique_name_cstr = name.GetCString();
 uint32_t i;
 for (i = 0; i < count; ++i) {
-  if (register_info_array[i].name == unique_name_cstr) {
+  const char *reg_name = register_info_array[i].name;
+  assert(ConstString(reg_name).GetCString() == reg_name &&
+ "register_info_array[i].name not from a ConstString?");
+  if (reg_name == unique_name_cstr) {
 info = register_info_array[i];
 return true;
   }
 }
 for (i = 0; i < count; ++i) {
-  if (register_info_array[i].alt_name == unique_name_cstr) {
+  const char *reg_alt_name = register_info_array[i].alt_name;
+  assert((reg_alt_name == nullptr ||
+  ConstString(reg_alt_name).GetCString() == reg_alt_name) &&
+ "register_info_array[i].alt_name not from a ConstString?");
+  if (reg_alt_name == unique_name_cstr) {
 info = register_info_array[i];
 return true;
   }



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


[Lldb-commits] [lldb] 4a9011d - [lldb] Skip failing parts of TestCppConstructors that use 'new' on Windows

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T13:21:51+01:00
New Revision: 4a9011dcdade7cd562e0488d387ccbbaf2eee6c8

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

LOG: [lldb] Skip failing parts of TestCppConstructors that use 'new' on Windows

Added: 


Modified: 
lldb/test/API/lang/cpp/constructors/TestCppConstructors.py

Removed: 




diff  --git a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py 
b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
index 77e17b93bbc9..e330093a8467 100644
--- a/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
+++ b/lldb/test/API/lang/cpp/constructors/TestCppConstructors.py
@@ -25,6 +25,7 @@ def test_constructors(self):
 self.expect("expr ClassWithDeletedCtor(1).value", error=True, 
substrs=["Couldn't lookup symbols:"])
 self.expect("expr ClassWithDeletedDefaultCtor().value", error=True, 
substrs=["Couldn't lookup symbols:"])
 
+@skipIfWindows # Can't find operator new.
 @skipIfLinux # Fails on some Linux systems with SIGABRT.
 def test_constructors_new(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] D74816: [lldb/Core] Remove more duplicate code in PluginManager (NFCI)

2020-02-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Very nice.

I'm not really sure why we need that mutex in the first place. All the plugin 
registration happens when we're still single-threaded. I'd be tempted to just 
delete it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74816



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


[Lldb-commits] [PATCH] D74759: Treat RangeDataVector as an augmented BST

2020-02-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D74759#1880559 , @jarin wrote:

> In D74759#1880499 , @labath wrote:
>
> > I like this idea a lot, in principle. It is much simpler than a full blown 
> > interval tree, and it should give us similar performance characteristics.
> >
> > Have you done a proper complexity analysis here? I doubt the `O(log n)` 
> > claim is true in general. It would have to be at least `O(m + log n)` (m - 
> > number of elements found), but it's not clear to me whether even this is 
> > true in general. (However, I believe this can achieve ~~log(n) for 
> > non-degenerate cases.)
>
>
> Thanks for the feedback! We were aiming for something simple and efficient 
> enough. Our preliminary results show that the lookup pretty much disappears 
> even from the profiles it was dominating before.
>
> The implementation is pretty much taken from the "Augmented tree" section of 
> https://en.wikipedia.org/wiki/Interval_tree where we just use the tree 
> induced by the pivots of the binary search as the binary search tree that we 
> augment. I believe the complexity is O(m log n), even though the wikipedia 
> article makes a O(m + log n) claim. This should be still much better than the 
> current O(n) and the memory cost seems to be quite palatable (extra word per 
> symbol).


Ok, I see. Thanks for that reference. The wikipedia description is somewhat 
short, but I am beginning to understand how this could work. Maybe you could 
include a pointer to the wikipedia page and/or the book it references next to 
the algorithm.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74759



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


[Lldb-commits] [lldb] 10df88d - [lldb] Remove some unnecessary includes from test sources

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T14:12:45+01:00
New Revision: 10df88de21772ff40818bec7eef6b099ba4279fb

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

LOG: [lldb] Remove some unnecessary includes from test sources

Added: 


Modified: 
lldb/test/API/commands/frame/var/main.c
lldb/test/API/commands/target/basic/a.c
lldb/test/API/lang/c/anonymous/main.c
lldb/test/API/lang/c/conflicting-symbol/One/One.c
lldb/test/API/lang/c/conflicting-symbol/Two/Two.c
lldb/test/API/lang/c/conflicting-symbol/main.c
lldb/test/API/lang/c/forward/foo.c
lldb/test/API/lang/c/forward/main.c
lldb/test/API/lang/c/global_variables/main.c
lldb/test/API/lang/c/step-target/main.c
lldb/test/API/lang/c/stepping/main.c
lldb/test/API/lang/c/strings/main.c
lldb/test/API/lang/cpp/auto/TestCPPAuto.py
lldb/test/API/lang/cpp/auto/main.cpp
lldb/test/API/lang/cpp/static_members/main.cpp

Removed: 




diff  --git a/lldb/test/API/commands/frame/var/main.c 
b/lldb/test/API/commands/frame/var/main.c
index da23af2ac550..531a20a94d93 100644
--- a/lldb/test/API/commands/frame/var/main.c
+++ b/lldb/test/API/commands/frame/var/main.c
@@ -1,11 +1,8 @@
-#include 
-
 int g_var = 200;
 
 int
 main(int argc, char **argv)
 {
   int test_var = 10;
-  printf ("Set a breakpoint here: %d %d.\n", test_var, g_var);
-  return 0;
+  return test_var + g_var; // Set a breakpoint here
 }

diff  --git a/lldb/test/API/commands/target/basic/a.c 
b/lldb/test/API/commands/target/basic/a.c
index ec4824ad4ad7..b451d4ed703c 100644
--- a/lldb/test/API/commands/target/basic/a.c
+++ b/lldb/test/API/commands/target/basic/a.c
@@ -5,7 +5,6 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===--===//
-#include 
 
 int main(int argc, const char* argv[])
 {

diff  --git a/lldb/test/API/lang/c/anonymous/main.c 
b/lldb/test/API/lang/c/anonymous/main.c
index 58ac85b7d431..990d79b23b5d 100644
--- a/lldb/test/API/lang/c/anonymous/main.c
+++ b/lldb/test/API/lang/c/anonymous/main.c
@@ -1,5 +1,3 @@
-#include 
-
 struct anonymous_nest {
   struct {
 struct {
@@ -74,9 +72,9 @@ int main()
   type_z *pz = 0;
   type_z z = {{2}};
 
-  printf("%d\n", processor_nest(&n));
-  printf("%d\n", processor_child(&c));
-  printf("%d\n", processor_grandchild(&g)); // Set breakpoint 2 here.
+  processor_nest(&n);
+  processor_child(&c);
+  processor_grandchild(&g); // Set breakpoint 2 here.
 
   return 0;
 }

diff  --git a/lldb/test/API/lang/c/conflicting-symbol/One/One.c 
b/lldb/test/API/lang/c/conflicting-symbol/One/One.c
index 6bd729f65700..568d130e32d9 100644
--- a/lldb/test/API/lang/c/conflicting-symbol/One/One.c
+++ b/lldb/test/API/lang/c/conflicting-symbol/One/One.c
@@ -1,6 +1,5 @@
 #include "One.h"
-#include 
 
 void one() {
-  printf("One\n"); // break here
+  int i = 0; // break here
 }

diff  --git a/lldb/test/API/lang/c/conflicting-symbol/Two/Two.c 
b/lldb/test/API/lang/c/conflicting-symbol/Two/Two.c
index 8d8d668b8c31..e0d75540861c 100644
--- a/lldb/test/API/lang/c/conflicting-symbol/Two/Two.c
+++ b/lldb/test/API/lang/c/conflicting-symbol/Two/Two.c
@@ -1,6 +1,5 @@
 #include "Two.h"
-#include 
 
 void two() {
-  printf("Two\n"); // break here
+  int i = 0; // break here
 }

diff  --git a/lldb/test/API/lang/c/conflicting-symbol/main.c 
b/lldb/test/API/lang/c/conflicting-symbol/main.c
index 4dcd443c0492..0c22ae8494ff 100644
--- a/lldb/test/API/lang/c/conflicting-symbol/main.c
+++ b/lldb/test/API/lang/c/conflicting-symbol/main.c
@@ -1,11 +1,8 @@
 #include "One/One.h"
 #include "Two/Two.h"
 
-#include 
-
 int main() {
   one();
   two();
-  printf("main\n"); // break here
-  return(0); 
+  return 0; // break here
 }

diff  --git a/lldb/test/API/lang/c/forward/foo.c 
b/lldb/test/API/lang/c/forward/foo.c
index 2e050e8d..4c66d1eba48b 100644
--- a/lldb/test/API/lang/c/forward/foo.c
+++ b/lldb/test/API/lang/c/forward/foo.c
@@ -1,8 +1,7 @@
-#include 
 #include "foo.h"
 
 int 
 foo (struct bar *bar_ptr)
 {
-return printf ("bar_ptr = %p\n", bar_ptr);
+return 1;
 }

diff  --git a/lldb/test/API/lang/c/forward/main.c 
b/lldb/test/API/lang/c/forward/main.c
index 6f9787c30a36..5a13f1d1ea2b 100644
--- a/lldb/test/API/lang/c/forward/main.c
+++ b/lldb/test/API/lang/c/forward/main.c
@@ -1,4 +1,3 @@
-#include 
 #include "foo.h"
 
 struct bar

diff  --git a/lldb/test/API/lang/c/global_variables/main.c 
b/lldb/test/API/lang/c/global_variables/main.c
index ea54eb927c0c..caa715db3d57 100644
--- a/lldb/test/API/lang/c/global_variables/main.c
+++ b/lldb/test/API/lang/c/global_variables/main.c
@@ -5,7 +5,6 @@
 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 
//===

[Lldb-commits] [PATCH] D74727: Allow customized relative PYTHONHOME

2020-02-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D74727#1881962 , @JDevlieghere 
wrote:

> In D74727#1881055 , @hhb wrote:
>
> > > Can we maybe rename it to something like that?
> >
> > LLDB_RELOCATABLE_PYTHON is misleading. I'd be happy to rename it. But that 
> > may break people who already set this flag.
> >
> > Is there a standard procedure to do this? Maybe add the new one and remove 
> > the old one a year later? Or maybe fail when the old is set. So that at 
> > least people know how to fix?
>
>
> We've made breaking changes like that in the past. This might even be a good 
> thing when we're changing behavior.


Yeah, I wouldn't worry about that. When we were doing some dependency 
refactorings two months ago, we left in some compat code. However, this was 
only because some buildbots depended on the old options, and the code was 
removed as soon as those were updated.

But you don't need to worry about that -- I don't see any bot using this option.

>>> Or maybe even just a single LLDB_PYTHON_HOME variable, with the empty value 
>>> meaning we use the default python mechanism (PYTHONHOME env var, or the 
>>> baked-in python default)?
>> 
>> To do that, we have to make LLDB_PYTHON_HOME default to PYTHON_HOME for 
>> Windows. And if windows users want to make it "relocatable", they should set 
>> LLDB_PYTHON_HOME back to empty. That's also somehow weird...

Yes, I can see how that could be confusing. Then let's stick with two options, 
but rename `LLDB_RELOCATABLE_PYTHON` to indicate that is really about 
hardcoding the PYTHONHOME path?

>>> The other thing which bugs me is that the relative python path chosen here 
>>> will likely only be correct once lldb is installed. Will it be possible to 
>>> run lldb (and its test suite) configured in this way directly from the 
>>> build tree? I don't know if there's anything we can or should do about 
>>> that, but this situation seems less than ideal...
>> 
>> If someone uses relative python, that mean they should be responsible to put 
>> Python at the right place. No matter it is build tree or install tree. Or in 
>> other words, the install tree won't work by default either. People still 
>> need to put a symlink to python at the right place.

Yeah, that makes kind of sense. I think I can go with that...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74727



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


[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-19 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid accepted this revision.
omjavaid added a comment.
This revision is now accepted and ready to land.

I have tested this not sure why it actually failed on the buildbot. The test 
seems to pass independently. Lets see if the new version fixes the issue.


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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [lldb] 8131cb6 - [lldb/DWARF] Add support for location lists in package files

2020-02-19 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2020-02-19T14:33:58+01:00
New Revision: 8131cb6e18931e4cb642a1dfaa7c219c38656442

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

LOG: [lldb/DWARF] Add support for location lists in package files

The only thing needed was to account for the offset from the
debug_cu_index section when searching for the location list.

This patch also fixes a bug in the Module::ParseAllDebugSymbols
function, which meant that we would only parse the variables of the
first compile unit in the module. This function is only used from
lldb-test, so this does not fix any real issue, besides preventing me
from writing a test for this patch.

Added: 


Modified: 
lldb/source/Core/Module.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
lldb/test/Shell/SymbolFile/DWARF/dwp.s

Removed: 




diff  --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index e61b875c3399..e917980791c2 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -364,11 +364,11 @@ void Module::ParseAllDebugSymbols() {
   if (num_comp_units == 0)
 return;
 
-  SymbolContext sc;
-  sc.module_sp = shared_from_this();
   SymbolFile *symbols = GetSymbolFile();
 
   for (size_t cu_idx = 0; cu_idx < num_comp_units; cu_idx++) {
+SymbolContext sc;
+sc.module_sp = shared_from_this();
 sc.comp_unit = symbols->GetCompileUnitAtIndex(cu_idx).get();
 if (!sc.comp_unit)
   continue;

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
index 6ff3601ab049..0198a10645c2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -474,10 +474,17 @@ DWARFUnit::GetLocationTable(const DataExtractor &data) 
const {
   return std::make_unique(llvm_data);
 }
 
-const DWARFDataExtractor &DWARFUnit::GetLocationData() const {
+DWARFDataExtractor DWARFUnit::GetLocationData() const {
   DWARFContext &Ctx = GetSymbolFileDWARF().GetDWARFContext();
-  return GetVersion() >= 5 ? Ctx.getOrLoadLocListsData()
-   : Ctx.getOrLoadLocData();
+  const DWARFDataExtractor &data =
+  GetVersion() >= 5 ? Ctx.getOrLoadLocListsData() : Ctx.getOrLoadLocData();
+  if (const llvm::DWARFUnitIndex::Entry *entry = m_header.GetIndexEntry()) {
+if (const auto *contribution = entry->getOffset(llvm::DW_SECT_LOC))
+  return DWARFDataExtractor(data, contribution->Offset,
+contribution->Length);
+return DWARFDataExtractor();
+  }
+  return data;
 }
 
 void DWARFUnit::SetRangesBase(dw_addr_t ranges_base) {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
index f15086d9504d..938a49453e37 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -255,7 +255,7 @@ class DWARFUnit : public lldb_private::UserID {
   std::unique_ptr
   GetLocationTable(const lldb_private::DataExtractor &data) const;
 
-  const lldb_private::DWARFDataExtractor &GetLocationData() const;
+  lldb_private::DWARFDataExtractor GetLocationData() const;
 
 protected:
   DWARFUnit(SymbolFileDWARF &dwarf, lldb::user_id_t uid,

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/dwp.s 
b/lldb/test/Shell/SymbolFile/DWARF/dwp.s
index 23fcde872947..730609412c36 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/dwp.s
+++ b/lldb/test/Shell/SymbolFile/DWARF/dwp.s
@@ -2,23 +2,49 @@
 
 # RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t --defsym MAIN=0
 # RUN: llvm-mc --filetype=obj --triple x86_64-pc-linux %s -o %t.dwp --defsym 
DWP=0
-# RUN: %lldb %t -o "target variable A" -b | FileCheck %s
+# RUN: %lldb %t -o "target variable A" -o "image lookup -v -n F1" -b | 
FileCheck %s
 # RUN: lldb-test symbols %t | FileCheck %s --check-prefix=SYMBOLS
 
+# CHECK-LABEL: target variable A
 # CHECK: (INT0) A = 0
 # CHECK: (INT1) A = 1
 # CHECK: (INT2) A = 2
 # CHECK: (INT3) A = 3
 
+# CHECK-LABEL: image lookup -v -n F1
+# CHECK: CompileUnit: id = {0x0001}, file = "1.c", language = "unknown"
+# CHECK: Function: {{.*}}, name = "F1", range = 
[0x0001-0x0002)
+# CHECK: Variable: {{.*}}, name = "x", type = "int", location = DW_OP_reg1 RDX
+
 # SYMBOLS:  Compile units:
 # SYMBOLS-NEXT: CompileUnit{0x}, language = "unknown", file = '0.c'
 # SYMBOLS-NEXT:   Variable{{.*}}, name = "A", {{.*}}, location = 
DW_OP_GNU_addr_index 0x0
+# SYMBOLS-NEXT:   Function{{.*}}, demangled = F0
+# SYMBOLS-NEXT:   Block{{.*}}, ranges = [0x-0x0001)
+# SYMBOLS-NEXT: Variable{{.*}}, name = "x", {{.*}}, location = 
+# SYMBOLS-NEXT:   DW_LL

[Lldb-commits] [PATCH] D74727: Allow customized relative PYTHONHOME

2020-02-19 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp:298
+llvm::sys::path::append(path, lldb_python_home);
+llvm::sys::path::remove_dots(path, /* remove_dot_dots = */ true);
+absolute_python_home = path.c_str();

hhb wrote:
> hhb wrote:
> > labath wrote:
> > > Is the `remove_dot_dots` really necessary? It can produce unexpected 
> > > results when `..`s back up over symlinks...
> > I was just trying to make the string shorter. It is not necessary. Removed.
> > 
> > But just curious what is the unexpected result? Say if I have a symlink 
> > "/src/python" -> "/usr/local/lib/python3.7", a "/src/python/../" should be 
> > resolved to /src, with or without remove_dot_dots?
> > 
> > Well I guess things get more interesting when liblldb is a symlink... That 
> > doesn't affect my use case though.
> Kind of understood after searching around. For me remove_dot_dots is the 
> expected behavior. But yea let's remove it to reduce some confusion...
Yeah, a lot of people think that is the expected behavior, and then get 
surprised when something different happens. Unfortunately, the surprise does 
not happen frequently enough to for people to become aware of that...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74727



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


[Lldb-commits] [lldb] 3d7b591 - [lldb][NFC] Pointer to reference conversion for CompilerDeclContext params in ClangExpressionDeclMap.

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T14:45:23+01:00
New Revision: 3d7b591dca83595ebcca04f94260f1f4901b8956

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

LOG: [lldb][NFC] Pointer to reference conversion for CompilerDeclContext params 
in ClangExpressionDeclMap.

Follow up for f9568a95493aea3ea813bd37cb8c084ec4294e38.

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h

Removed: 




diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index f4c6cb2a79a8..5b776fb4a100 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -593,11 +593,11 @@ addr_t 
ClangExpressionDeclMap::GetSymbolAddress(ConstString name,
 
 lldb::VariableSP ClangExpressionDeclMap::FindGlobalVariable(
 Target &target, ModuleSP &module, ConstString name,
-CompilerDeclContext *namespace_decl) {
+const CompilerDeclContext &namespace_decl) {
   VariableList vars;
 
   if (module && namespace_decl)
-module->FindGlobalVariables(name, *namespace_decl, -1, vars);
+module->FindGlobalVariables(name, namespace_decl, -1, vars);
   else
 target.GetImages().FindGlobalVariables(name, -1, vars);
 
@@ -1073,7 +1073,7 @@ void ClangExpressionDeclMap::LookupInModulesDeclVendor(
 
 bool ClangExpressionDeclMap::LookupLocalVariable(
 NameSearchContext &context, ConstString name, unsigned current_id,
-SymbolContext &sym_ctx, CompilerDeclContext &namespace_decl) {
+SymbolContext &sym_ctx, const CompilerDeclContext &namespace_decl) {
   if (sym_ctx.block == nullptr)
 return false;
 
@@ -1213,11 +1213,9 @@ SymbolContextList 
ClangExpressionDeclMap::SearchFunctionsInSymbolContexts(
   return sc_func_list;
 }
 
-void ClangExpressionDeclMap::LookupFunction(NameSearchContext &context,
-lldb::ModuleSP module_sp,
-ConstString name,
-CompilerDeclContext 
&namespace_decl,
-unsigned current_id) {
+void ClangExpressionDeclMap::LookupFunction(
+NameSearchContext &context, lldb::ModuleSP module_sp, ConstString name,
+const CompilerDeclContext &namespace_decl, unsigned current_id) {
   if (!m_parser_vars)
 return;
 
@@ -1339,7 +1337,7 @@ void 
ClangExpressionDeclMap::LookupFunction(NameSearchContext &context,
 
 void ClangExpressionDeclMap::FindExternalVisibleDecls(
 NameSearchContext &context, lldb::ModuleSP module_sp,
-CompilerDeclContext &namespace_decl, unsigned int current_id) {
+const CompilerDeclContext &namespace_decl, unsigned int current_id) {
   assert(m_ast_context);
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS));
@@ -1424,7 +1422,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
   if (target) {
 ValueObjectSP valobj;
 VariableSP var;
-var = FindGlobalVariable(*target, module_sp, name, &namespace_decl);
+var = FindGlobalVariable(*target, module_sp, name, namespace_decl);
 
 if (var) {
   valobj = ValueObjectVariable::Create(target, var);

diff  --git 
a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index e8dd62a70a5b..72f8807fe775 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -281,7 +281,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
   /// for logging purposes.
   void FindExternalVisibleDecls(NameSearchContext &context,
 lldb::ModuleSP module,
-CompilerDeclContext &namespace_decl,
+const CompilerDeclContext &namespace_decl,
 unsigned int current_id);
 
 protected:
@@ -468,7 +468,7 @@ class ClangExpressionDeclMap : public ClangASTSource {
   ///True iff a local variable was found.
   bool LookupLocalVariable(NameSearchContext &context, ConstString name,
unsigned current_id, SymbolContext &sym_ctx,
-   CompilerDeclContext &namespace_decl);
+   const CompilerDeclContext &namespace_decl);
 
   /// Searches for functions in the given SymbolContextList.
   ///
@@ -505,7 +505,8 @@ class ClangExpressionDeclMap : public ClangASTSource {
   /// The ID for the current FindExternalVisibleDecls inv

[Lldb-commits] [lldb] 1b2deb9 - [lldb] Remove Windows X-fail for TestCPPAuto and TestStepTarget

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T15:05:36+01:00
New Revision: 1b2deb9ae00f6fa1e47ec7059d777fb36a1df1d1

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

LOG: [lldb] Remove Windows X-fail for TestCPPAuto and TestStepTarget

TestCPPAuto was only failing on windows due to the std::string
copying (which was not related at all to 'auto' functionality).

TestStepTarget is now also passing but that seems more that we
now have by accident the right behavior in Windows. I'll remove
the x-fail just to make the bot green again.

Added: 


Modified: 
lldb/test/API/lang/c/step-target/TestStepTarget.py
lldb/test/API/lang/cpp/auto/TestCPPAuto.py

Removed: 




diff  --git a/lldb/test/API/lang/c/step-target/TestStepTarget.py 
b/lldb/test/API/lang/c/step-target/TestStepTarget.py
index 7665b2f73b6a..0b97f400be46 100644
--- a/lldb/test/API/lang/c/step-target/TestStepTarget.py
+++ b/lldb/test/API/lang/c/step-target/TestStepTarget.py
@@ -73,7 +73,6 @@ def test_with_end_line_bad_name(self):
 self.assertEqual(frame.line_entry.line, self.end_line,
 "Stepped to the block end.")
 
-@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr32343")
 def test_with_end_line_deeper(self):
 """Test stepping over vrs. hitting breakpoints & subsequent stepping 
in various forms."""
 

diff  --git a/lldb/test/API/lang/cpp/auto/TestCPPAuto.py 
b/lldb/test/API/lang/cpp/auto/TestCPPAuto.py
index c8a33e6cf658..b0e7ff73e98d 100644
--- a/lldb/test/API/lang/cpp/auto/TestCPPAuto.py
+++ b/lldb/test/API/lang/cpp/auto/TestCPPAuto.py
@@ -14,7 +14,6 @@ class CPPAutoTestCase(TestBase):
 @expectedFailureAll(
 compiler="gcc",
 bugnumber="GCC generates incomplete debug info")
-@expectedFailureAll(oslist=['windows'], bugnumber="llvm.org/pr26339")
 @expectedFailureNetBSD
 def test_with_run_command(self):
 """Test that auto types work in the expression parser"""



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


[Lldb-commits] [lldb] 53eece0 - [lldb][NFC] Modernize test setup code in several lang/cpp tests

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T15:07:26+01:00
New Revision: 53eece04bd15d9235b104e545d01184347e5f703

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

LOG: [lldb][NFC] Modernize test setup code in several lang/cpp tests

All these tests can just call lldbutil.run_to_source_breakpoint
instead of reimplementing it.

Added: 


Modified: 
lldb/test/API/lang/cpp/auto/TestCPPAuto.py
lldb/test/API/lang/cpp/bool/TestCPPBool.py

lldb/test/API/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py
lldb/test/API/lang/cpp/call-function/TestCallCPPFunction.py
lldb/test/API/lang/cpp/chained-calls/TestCppChainedCalls.py
lldb/test/API/lang/cpp/char8_t/TestCxxChar8_t.py
lldb/test/API/lang/cpp/char8_t/main.cpp
lldb/test/API/lang/cpp/overloaded-functions/TestOverloadedFunctions.py
lldb/test/API/lang/cpp/static_methods/TestCPPStaticMethods.py
lldb/test/API/lang/cpp/stl/TestSTL.py
lldb/test/API/lang/cpp/stl/TestStdCXXDisassembly.py
lldb/test/API/lang/cpp/unicode-literals/TestUnicodeLiterals.py
lldb/test/API/lang/cpp/unique-types/TestUniqueTypes.py
lldb/test/API/lang/cpp/unsigned_types/TestUnsignedTypes.py
lldb/test/API/lang/cpp/wchar_t/TestCxxWCharT.py
lldb/test/API/lang/cpp/wchar_t/main.cpp

Removed: 




diff  --git a/lldb/test/API/lang/cpp/auto/TestCPPAuto.py 
b/lldb/test/API/lang/cpp/auto/TestCPPAuto.py
index b0e7ff73e98d..0094db1c0681 100644
--- a/lldb/test/API/lang/cpp/auto/TestCPPAuto.py
+++ b/lldb/test/API/lang/cpp/auto/TestCPPAuto.py
@@ -18,13 +18,7 @@ class CPPAutoTestCase(TestBase):
 def test_with_run_command(self):
 """Test that auto types work in the expression parser"""
 self.build()
-self.runCmd("file " + self.getBuildArtifact("a.out"), 
CURRENT_EXECUTABLE_SET)
-
-line = line_number('main.cpp', '// break here')
-lldbutil.run_break_set_by_file_and_line(
-self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
-
-self.runCmd("process launch", RUN_SUCCEEDED)
+lldbutil.run_to_source_breakpoint(self, "// break here", 
lldb.SBFileSpec("main.cpp"))
 
 self.expect_expr('auto f = 123456; f', result_type='int', 
result_value='123456')
 self.expect(

diff  --git a/lldb/test/API/lang/cpp/bool/TestCPPBool.py 
b/lldb/test/API/lang/cpp/bool/TestCPPBool.py
index 0a4a3343f00c..bff3e86f54cf 100644
--- a/lldb/test/API/lang/cpp/bool/TestCPPBool.py
+++ b/lldb/test/API/lang/cpp/bool/TestCPPBool.py
@@ -13,13 +13,7 @@ class CPPBoolTestCase(TestBase):
 def test_with_run_command(self):
 """Test that bool types work in the expression parser"""
 self.build()
-self.runCmd("file " + self.getBuildArtifact("a.out"), 
CURRENT_EXECUTABLE_SET)
-
-line = line_number('main.cpp', '// breakpoint 1')
-lldbutil.run_break_set_by_file_and_line(
-self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
-
-self.runCmd("process launch", RUN_SUCCEEDED)
+lldbutil.run_to_source_breakpoint(self, "// breakpoint 1", 
lldb.SBFileSpec("main.cpp"))
 
 self.expect_expr("bool second_bool = my_bool; second_bool", 
result_type="bool", result_value="false")
 self.expect_expr("my_bool = true", result_type="bool", 
result_value="true")

diff  --git 
a/lldb/test/API/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py
 
b/lldb/test/API/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py
index 1e46f73cb298..41bb8673c3a0 100644
--- 
a/lldb/test/API/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py
+++ 
b/lldb/test/API/lang/cpp/breakpoint_in_member_func_w_non_primitive_params/TestBreakpointInMemberFuncWNonPrimitiveParams.py
@@ -19,8 +19,7 @@ class TestBreakpointInMemberFuncWNonPrimitiveParams(TestBase):
 @add_test_categories(["gmodules"])
 def test_breakpint_in_member_func_w_non_primitie_params(self):
 self.build()
-
-(self.target, self.process, _, bkpt) = 
lldbutil.run_to_source_breakpoint(self, '// break here',
+lldbutil.run_to_source_breakpoint(self, '// break here',
 lldb.SBFileSpec("main.cpp", False))
 
 self.runCmd("b a.cpp:11");

diff  --git a/lldb/test/API/lang/cpp/call-function/TestCallCPPFunction.py 
b/lldb/test/API/lang/cpp/call-function/TestCallCPPFunction.py
index 3327eed1b292..6924ad2f255f 100644
--- a/lldb/test/API/lang/cpp/call-function/TestCallCPPFunction.py
+++ b/lldb/test/API/lang/cpp/call-function/TestCallCPPFunction.py
@@ -19,12 +19,7 @@ def setUp(self):
 def test_with_run_command(self):
   

[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-19 Thread Levon Ter-Grigoryan via Phabricator via lldb-commits
PatriosTheGreat added a comment.

Hi Muhammad,
Thank you for review.
Could you or Pavel commit this to master, since I don't have commit access?


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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [PATCH] D74836: [lldb/test] Move `platform process list` tests to its own directory (NFC)

2020-02-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib created this revision.
mib added a reviewer: teemperor.
mib added a project: LLDB.
Herald added a subscriber: lldb-commits.
mib edited the summary of this revision.

Since the `platform process` commamnd has more tests now, this commits
separates each of the `platform process` subcommand's test in its own directory.

Signed-off-by: Med Ismail Bennani 


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74836

Files:
  lldb/test/API/commands/platform/process/Makefile
  lldb/test/API/commands/platform/process/TestProcessList.py
  lldb/test/API/commands/platform/process/list/Makefile
  lldb/test/API/commands/platform/process/list/TestProcessList.py
  lldb/test/API/commands/platform/process/list/main.cpp
  lldb/test/API/commands/platform/process/main.cpp




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


[Lldb-commits] [lldb] bb61021 - [lldb][NFC] Remove giant do{...}while(false); in ClangASTSource::FindExternalVisibleDecls

2020-02-19 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-02-19T17:35:07+01:00
New Revision: bb61021a8fcc21676af65e4cbbf4d495831fad52

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

LOG: [lldb][NFC] Remove giant do{...}while(false); in 
ClangASTSource::FindExternalVisibleDecls

Added: 


Modified: 
lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp 
b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
index ade1aef9..02b1f9bcd4a0 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp
@@ -705,149 +705,146 @@ void ClangASTSource::FindExternalVisibleDecls(
 }
   }
 
-  do {
-if (context.m_found.type)
-  break;
+  if (context.m_found.type)
+return;
 
-TypeList types;
-const bool exact_match = true;
-llvm::DenseSet searched_symbol_files;
-if (module_sp && namespace_decl)
-  module_sp->FindTypesInNamespace(name, namespace_decl, 1, types);
-else {
-  m_target->GetImages().FindTypes(module_sp.get(), name, exact_match, 1,
-  searched_symbol_files, types);
-}
+  TypeList types;
+  const bool exact_match = true;
+  llvm::DenseSet searched_symbol_files;
+  if (module_sp && namespace_decl)
+module_sp->FindTypesInNamespace(name, namespace_decl, 1, types);
+  else {
+m_target->GetImages().FindTypes(module_sp.get(), name, exact_match, 1,
+searched_symbol_files, types);
+  }
 
-if (size_t num_types = types.GetSize()) {
-  for (size_t ti = 0; ti < num_types; ++ti) {
-lldb::TypeSP type_sp = types.GetTypeAtIndex(ti);
+  if (size_t num_types = types.GetSize()) {
+for (size_t ti = 0; ti < num_types; ++ti) {
+  lldb::TypeSP type_sp = types.GetTypeAtIndex(ti);
 
-if (log) {
-  const char *name_string = type_sp->GetName().GetCString();
+  if (log) {
+const char *name_string = type_sp->GetName().GetCString();
 
-  LLDB_LOG(log, "  CAS::FEVD[{0}] Matching type found for \"{1}\": 
{2}",
-   current_id, name,
-   (name_string ? name_string : ""));
-}
+LLDB_LOG(log, "  CAS::FEVD[{0}] Matching type found for \"{1}\": {2}",
+ current_id, name,
+ (name_string ? name_string : ""));
+  }
 
-CompilerType full_type = type_sp->GetFullCompilerType();
+  CompilerType full_type = type_sp->GetFullCompilerType();
 
-CompilerType copied_clang_type(GuardedCopyType(full_type));
+  CompilerType copied_clang_type(GuardedCopyType(full_type));
 
-if (!copied_clang_type) {
-  LLDB_LOG(log, "  CAS::FEVD[{0}] - Couldn't export a type",
-   current_id);
+  if (!copied_clang_type) {
+LLDB_LOG(log, "  CAS::FEVD[{0}] - Couldn't export a type",
+ current_id);
 
-  continue;
-}
+continue;
+  }
 
-context.AddTypeDecl(copied_clang_type);
+  context.AddTypeDecl(copied_clang_type);
 
-context.m_found.type = true;
-break;
-  }
+  context.m_found.type = true;
+  break;
 }
+  }
 
-if (!context.m_found.type) {
-  // Try the modules next.
+  if (!context.m_found.type) {
+// Try the modules next.
 
-  do {
-if (ClangModulesDeclVendor *modules_decl_vendor =
-m_target->GetClangModulesDeclVendor()) {
-  bool append = false;
-  uint32_t max_matches = 1;
-  std::vector decls;
+do {
+  if (ClangModulesDeclVendor *modules_decl_vendor =
+  m_target->GetClangModulesDeclVendor()) {
+bool append = false;
+uint32_t max_matches = 1;
+std::vector decls;
 
-  if (!modules_decl_vendor->FindDecls(name, append, max_matches, 
decls))
-break;
+if (!modules_decl_vendor->FindDecls(name, append, max_matches, decls))
+  break;
 
-  if (log) {
-LLDB_LOG(log,
- "  CAS::FEVD[{0}] Matching entity found for \"{1}\" in "
- "the modules",
- current_id, name);
-  }
+if (log) {
+  LLDB_LOG(log,
+   "  CAS::FEVD[{0}] Matching entity found for \"{1}\" in "
+   "the modules",
+   current_id, name);
+}
 
-  clang::NamedDecl *const decl_from_modules = decls[0];
+clang::NamedDecl *const decl_from_modules = decls[0];
 
-  if (llvm::isa(decl_from_modules) ||
-  llvm::isa(decl_from_modules) ||
-  llvm::isa(decl_from_modules)) {
-

[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 245424.
mib retitled this revision from "[lldb/Target] Add process crash-info command" 
to "[lldb/Plugins] Add `platform process crash-info` command".
mib edited the summary of this revision.
mib added a comment.

Moved implementation from Process to Platform / PlatformDarwin and made it more 
generic and extensive so other platforms could also use it.
Added documentation and addressed comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657

Files:
  lldb/bindings/interface/SBPlatform.i
  lldb/include/lldb/API/SBPlatform.h
  lldb/include/lldb/API/SBStructuredData.h
  lldb/include/lldb/API/SBTarget.h
  lldb/include/lldb/Target/Platform.h
  lldb/include/lldb/Target/Process.h
  lldb/source/API/SBPlatform.cpp
  lldb/source/Commands/CommandObjectPlatform.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/source/Target/Platform.cpp
  lldb/test/API/commands/platform/process/crash-info/Makefile
  
lldb/test/API/commands/platform/process/crash-info/TestPlatformProcessCrashInfo.py
  lldb/test/API/commands/platform/process/crash-info/main.c

Index: lldb/test/API/commands/platform/process/crash-info/main.c
===
--- /dev/null
+++ lldb/test/API/commands/platform/process/crash-info/main.c
@@ -0,0 +1,7 @@
+#include 
+int main() {
+  int *var = malloc(sizeof(int));
+  free(var);
+  free(var);
+  return 0;
+}
Index: lldb/test/API/commands/platform/process/crash-info/TestPlatformProcessCrashInfo.py
===
--- /dev/null
+++ lldb/test/API/commands/platform/process/crash-info/TestPlatformProcessCrashInfo.py
@@ -0,0 +1,63 @@
+"""
+Test lldb platform process crash info.
+"""
+
+import os
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class PlatformProcessCrashInfoTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+self.runCmd("settings set auto-confirm true")
+
+def tearDown(self):
+self.runCmd("settings clear auto-confirm")
+TestBase.tearDown(self)
+
+@skipUnlessDarwin
+def test_cli(self):
+"""Test that platform process crash-info fetches the extended crash
+information array from the command-line properly."""
+self.build()
+exe = self.getBuildArtifact("a.out")
+self.expect("file " + exe,
+patterns=["Current executable set to .*a.out"])
+
+self.expect('process launch',
+patterns=["Process .* launched: .*a.out"])
+
+self.expect('platform process crash-info',
+patterns=["\"message\".*pointer being freed was not allocated"])
+
+
+@skipUnlessDarwin
+def test_api(self):
+"""Test that platform process crash-info fetches the extended crash
+information array from the api properly."""
+self.build()
+target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+self.assertTrue(target, VALID_TARGET)
+
+target.LaunchSimple(None, None, os.getcwd())
+
+platform = target.GetPlatform()
+
+stream = lldb.SBStream()
+self.assertTrue(stream)
+
+crash_info = platform.GetExtendedCrashInformation(target)
+
+error = crash_info.GetAsJSON(stream)
+
+self.assertTrue(error.Success())
+
+self.assertTrue(crash_info.IsValid())
+
+self.assertIn("pointer being freed was not allocated", stream.GetData())
Index: lldb/test/API/commands/platform/process/crash-info/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/platform/process/crash-info/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+
+include Makefile.rules
+
Index: lldb/source/Target/Platform.cpp
===
--- lldb/source/Target/Platform.cpp
+++ lldb/source/Target/Platform.cpp
@@ -384,7 +384,8 @@
   m_rsync_opts(), m_rsync_prefix(), m_supports_ssh(false), m_ssh_opts(),
   m_ignores_remote_hostname(false), m_trap_handlers(),
   m_calculated_trap_handlers(false),
-  m_module_cache(std::make_unique()) {
+  m_module_cache(std::make_unique()),
+  m_extended_crash_info(nullptr) {
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OBJECT));
   LLDB_LOGF(log, "%p Platform::Platform()", static_cast(this));
 }
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -12,6 +12,7 @@
 #include "Plugins/Platform/POSIX/PlatformPOSIX.h"
 #i

[Lldb-commits] [PATCH] D74839: [lldb] Remove license headers from all test source files

2020-02-19 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.

Perfect, we already agreed upon this in the past, thanks for making things 
consistent!


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D74839



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


[Lldb-commits] [PATCH] D74798: [lldb-vscode] Use libOption with tablegen to parse command line options.

2020-02-19 Thread Ivan Hernandez via Phabricator via lldb-commits
ivanhernandez13 updated this revision to Diff 245442.
ivanhernandez13 marked 2 inline comments as done.
ivanhernandez13 added a comment.

- Rename opts to options to be consistent with the lldb driver and add a test 
case around setting an invalid port.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74798

Files:
  lldb/test/Shell/VSCode/TestOptions.test
  lldb/test/Shell/helper/toolchain.py
  lldb/tools/lldb-vscode/CMakeLists.txt
  lldb/tools/lldb-vscode/Options.td
  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
@@ -41,8 +41,12 @@
 #include 
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/Option/Arg.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -64,6 +68,34 @@
 using namespace lldb_vscode;
 
 namespace {
+enum ID {
+  OPT_INVALID = 0, // This is not an option ID.
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  \
+   HELPTEXT, METAVAR, VALUES)  \
+  OPT_##ID,
+#include "Opts.inc"
+#undef OPTION
+};
+
+#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#include "Opts.inc"
+#undef PREFIX
+
+static const llvm::opt::OptTable::Info InfoTable[] = {
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  \
+   HELPTEXT, METAVAR, VALUES)  \
+{  \
+  PREFIX,  NAME,  HELPTEXT,\
+  METAVAR, OPT_##ID,  llvm::opt::Option::KIND##Class,  \
+  PARAM,   FLAGS, OPT_##GROUP, \
+  OPT_##ALIAS, ALIASARGS, VALUES},
+#include "Opts.inc"
+#undef OPTION
+};
+class LLDBVSCodeOptTable : public llvm::opt::OptTable {
+public:
+  LLDBVSCodeOptTable() : OptTable(InfoTable, true) {}
+};
 
 typedef void (*RequestCallback)(const llvm::json::Object &command);
 
@@ -2719,31 +2751,70 @@
 
 } // anonymous namespace
 
+static void printHelp(LLDBVSCodeOptTable &table, llvm::StringRef tool_name) {
+  std::string usage_str = tool_name.str() + "options";
+  table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB VSCode", false);
+
+  std::string examples = R"___(
+EXAMPLES:
+  The debug adapter can be started in two modes.
+
+  Running lldb-vscode without any arguments will start communicating with the
+  parent over stdio. Passing a port number causes lldb-vscode to start listening
+  for connections on that port.
+
+lldb-vscode -p 
+
+  Passing --wait-for-debugger will pause the process at startup and wait for a
+  debugger to attach to the process.
+
+lldb-vscode -g
+  )___";
+  llvm::outs() << examples;
+}
+
 int main(int argc, char *argv[]) {
 
   // Initialize LLDB first before we do anything.
   lldb::SBDebugger::Initialize();
 
-  if (argc == 2) {
-const char *arg = argv[1];
+  int portno = -1;
+
+  LLDBVSCodeOptTable T;
+  unsigned MAI, MAC;
+  llvm::ArrayRef ArgsArr = llvm::makeArrayRef(argv + 1, argc);
+  llvm::opt::InputArgList input_args = T.ParseArgs(ArgsArr, MAI, MAC);
+
+  if (input_args.hasArg(OPT_help)) {
+printHelp(T, llvm::sys::path::filename(argv[0]));
+return 0;
+  }
+
+  if (auto *arg = input_args.getLastArg(OPT_port)) {
+auto optarg = arg->getValue();
+char *remainder;
+portno = strtol(optarg, &remainder, 0);
+if (remainder == optarg || *remainder != '\0') {
+  fprintf(stderr, "'%s' is not a valid port number.\n", optarg);
+  exit(1);
+}
+  }
+
 #if !defined(_WIN32)
-if (strcmp(arg, "-g") == 0) {
-  printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid());
-  pause();
-} else {
-#else
-{
+  if (input_args.hasArg(OPT_wait_for_debugger)) {
+printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid());
+pause();
+  }
 #endif
-  int portno = atoi(arg);
-  printf("Listening on port %i...\n", portno);
-  SOCKET socket_fd = AcceptConnection(portno);
-  if (socket_fd >= 0) {
-g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
-g_vsc.output.descriptor =
-StreamDescriptor::from_socket(socket_fd, false);
-  } else {
-exit(1);
-  }
+  if (portno != -1) {
+printf("Listening on port %i...\n", portno);
+SOCKET socket_fd = AcceptConnection(portno);
+if (socket_fd >= 0) {
+  g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
+  g_vsc.output.descriptor =
+  StreamDescriptor::from_socke

[Lldb-commits] [PATCH] D74798: [lldb-vscode] Use libOption with tablegen to parse command line options.

2020-02-19 Thread Ivan Hernandez via Phabricator via lldb-commits
ivanhernandez13 added a comment.

I added the test file but atm the two existing arguments (--wait-for-debugger 
and --port) will cause lldb-vscode to hang and await some sort of action from 
an external process causing the test runner to hang. I added a single test case 
for handling an invalid port since that will cause the process to exit 
immediately but not certain on how to handle the other cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74798



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


[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Target/Platform.h:838
+  /// \return
+  /// A Structured Data Dictionnary containing at each entry an array for
+  /// each different crash information type. Or a nullptr if the process 
has

I had a hard time understanding this sentence. Is the `crash information type` 
the key of the entry or the values in the array? 



Comment at: lldb/include/lldb/Target/Platform.h:881
   const std::unique_ptr m_module_cache;
+  StructuredData::DictionarySP m_extended_crash_info;
 

I find it suspicious that this member is stored here but not used. Does it need 
to be stored in the first place? Given the FetchExtendedCrashInformation I'd 
expect these dictionaries to be different per target? 



Comment at: lldb/source/Commands/CommandObjectPlatform.cpp:1520
 
+// CommandObjectPlatformProcessCrashInfo
+#pragma mark CommandObjectPlatformProcessCrashInfo

This comment is useless. 



Comment at: lldb/source/Commands/CommandObjectPlatform.cpp:1521
+// CommandObjectPlatformProcessCrashInfo
+#pragma mark CommandObjectPlatformProcessCrashInfo
+

As I've said in other reviews I really dislike the `#pragma mark`. It's fine if 
the file already uses them but I really don't want to encourage new ones being 
added. 



Comment at: lldb/source/Commands/CommandObjectPlatform.cpp:1541
+if (!platform_sp) {
+  result.AppendError("Couldn'retrieve the selected platform");
+  return result.Succeeded();

Shouldn't you update the return status? Same below.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp:1514
+LLDB_LOG(log, "Couldn't extract crash information annotations");
+  }
+

The braces are inconsistent with the single-line ifs below. Why not wrap this 
log statement in the if check below? 
```
if (!annotations)
LLDB_LOG(log, "Couldn't extract crash information annotations")
else
m_extended_crash_info->AddItem("crash-info annotations", annotations);
```
If you want the log statement to stay close to the 
`ExtractCrashInfoAnnotations` call (which I think you should), you could move 
the `!m_extended_crash_info` check up.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp:1596
+
+if (!annotations.message2) {
+  LLDB_LOG(log, "No message2 available for module {0}.", module_name);

braces



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h:93
+  // This struct should only be available in macOS but could be used on other
+  // platforms. #ifdef HAVE_CRASHREPORTERCLIENT_H #include
+  //  #endif

Assuming the header defines this struct, why not do 

```
#ifdef HAVE_CRASHREPORTERCLIENT_H 
#include  
#else 
struct CrashInfoAnnotations {
  ...
}
#endif 
```



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h:124
+  ExtractCrashInfoAnnotations(lldb_private::Target &target,
+  lldb_private::Log *log);
+

The log is a singleton, why pass it around? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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


[Lldb-commits] [PATCH] D74798: [lldb-vscode] Use libOption with tablegen to parse command line options.

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D74798#1882994 , @ivanhernandez13 
wrote:

> I added the test file but atm the two existing arguments (--wait-for-debugger 
> and --port) will cause lldb-vscode to hang and await some sort of action from 
> an external process causing the test runner to hang. I added a single test 
> case for handling an invalid port since that will cause the process to exit 
> immediately but not certain on how to handle the other cases.


I think for these particular cases it's sufficient to check the help output and 
make sure the flags are there.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74798



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


[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

This looks like a great feature, I see myself using this a lot in the future. 
Thanks for working on this!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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


[Lldb-commits] [PATCH] D74816: [lldb/Core] Remove more duplicate code in PluginManager (NFCI)

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D74816#1882389 , @labath wrote:

> Very nice.
>
> I'm not really sure why we need that mutex in the first place. All the plugin 
> registration happens when we're still single-threaded. I'd be tempted to just 
> delete it.


Sounds good to me :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74816



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


[Lldb-commits] [lldb] df590f5 - [lldb/Core] Remove locking in the PluginManager

2020-02-19 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-19T10:04:05-08:00
New Revision: df590f51b62d57c19f8cae8e87c1641dc0382f55

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

LOG: [lldb/Core] Remove locking in the PluginManager

Remove locking as all the plugin registration takes place from a single
thread. Addresses Pavel's feedback in D74816.

Added: 


Modified: 
lldb/source/Core/PluginManager.cpp

Removed: 




diff  --git a/lldb/source/Core/PluginManager.cpp 
b/lldb/source/Core/PluginManager.cpp
index de723284135c..2a1f094534d9 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -205,11 +205,9 @@ template  class PluginInstances {
   Args &&... args) {
 if (!callback)
   return false;
-
 assert((bool)name);
 Instance instance =
 Instance(name, description, callback, std::forward(args)...);
-std::lock_guard guard(m_mutex);
 m_instances.push_back(instance);
 return false;
   }
@@ -217,7 +215,6 @@ template  class PluginInstances {
   bool UnregisterPlugin(typename Instance::CallbackType callback) {
 if (!callback)
   return false;
-std::lock_guard guard(m_mutex);
 auto pos = m_instances.begin();
 auto end = m_instances.end();
 for (; pos != end; ++pos) {
@@ -230,21 +227,18 @@ template  class PluginInstances {
   }
 
   typename Instance::CallbackType GetCallbackAtIndex(uint32_t idx) {
-std::lock_guard guard(m_mutex);
 if (Instance *instance = GetInstanceAtIndex(idx))
   return instance->create_callback;
 return nullptr;
   }
 
   const char *GetDescriptionAtIndex(uint32_t idx) {
-std::lock_guard guard(m_mutex);
 if (Instance *instance = GetInstanceAtIndex(idx))
   return instance->description.c_str();
 return nullptr;
   }
 
   const char *GetNameAtIndex(uint32_t idx) {
-std::lock_guard guard(m_mutex);
 if (Instance *instance = GetInstanceAtIndex(idx))
   return instance->name.GetCString();
 return nullptr;
@@ -253,7 +247,6 @@ template  class PluginInstances {
   typename Instance::CallbackType GetCallbackForName(ConstString name) {
 if (!name)
   return nullptr;
-std::lock_guard guard(m_mutex);
 for (auto &instance : m_instances) {
   if (name == instance.name)
 return instance.create_callback;
@@ -262,25 +255,21 @@ template  class PluginInstances {
   }
 
   void PerformDebuggerCallback(Debugger &debugger) {
-std::lock_guard guard(m_mutex);
 for (auto &instance : m_instances) {
   if (instance.debugger_init_callback)
 instance.debugger_init_callback(debugger);
 }
   }
 
-  std::recursive_mutex &GetMutex() { return m_mutex; }
   const std::vector &GetInstances() const { return m_instances; }
   std::vector &GetInstances() { return m_instances; }
 
 private:
   Instance *GetInstanceAtIndex(uint32_t idx) {
-// Caller locks.
 if (idx < m_instances.size())
   return &m_instances[idx];
 return nullptr;
   }
-  std::recursive_mutex m_mutex;
   std::vector m_instances;
 };
 
@@ -312,11 +301,6 @@ ABICreateInstance 
PluginManager::GetABICreateCallbackAtIndex(uint32_t idx) {
 typedef PluginInstance ArchitectureInstance;
 typedef std::vector ArchitectureInstances;
 
-static std::mutex &GetArchitectureMutex() {
-  static std::mutex g_architecture_mutex;
-  return g_architecture_mutex;
-}
-
 static ArchitectureInstances &GetArchitectureInstances() {
   static ArchitectureInstances g_instances;
   return g_instances;
@@ -325,14 +309,12 @@ static ArchitectureInstances &GetArchitectureInstances() {
 void PluginManager::RegisterPlugin(ConstString name,
llvm::StringRef description,
ArchitectureCreateInstance create_callback) 
{
-  std::lock_guard guard(GetArchitectureMutex());
   GetArchitectureInstances().push_back(
   {name, std::string(description), create_callback});
 }
 
 void PluginManager::UnregisterPlugin(
 ArchitectureCreateInstance create_callback) {
-  std::lock_guard guard(GetArchitectureMutex());
   auto &instances = GetArchitectureInstances();
 
   for (auto pos = instances.begin(), end = instances.end(); pos != end; ++pos) 
{
@@ -346,7 +328,6 @@ void PluginManager::UnregisterPlugin(
 
 std::unique_ptr
 PluginManager::CreateArchitectureInstance(const ArchSpec &arch) {
-  std::lock_guard guard(GetArchitectureMutex());
   for (const auto &instances : GetArchitectureInstances()) {
 if (auto plugin_up = instances.create_callback(arch))
   return plugin_up;
@@ -585,8 +566,6 @@ 
PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(uint32_t idx) {
 
 LanguageRuntimeGetCommandObject
 PluginManager::GetLanguageRuntimeGetCommandObjectAtIndex(uint32_t idx) {
-  std::lock_guard guard

[Lldb-commits] [PATCH] D74816: [lldb/Core] Remove more duplicate code in PluginManager (NFCI)

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

In D74816#1883023 , @JDevlieghere 
wrote:

> In D74816#1882389 , @labath wrote:
>
> > Very nice.
> >
> > I'm not really sure why we need that mutex in the first place. All the 
> > plugin registration happens when we're still single-threaded. I'd be 
> > tempted to just delete it.
>
>
> Sounds good to me :-)


Done in `df590f51b62d57c19f8cae8e87c1641dc0382f55`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74816



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


[Lldb-commits] [PATCH] D74798: [lldb-vscode] Use libOption with tablegen to parse command line options.

2020-02-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D74798#1883015 , @JDevlieghere 
wrote:

> In D74798#1882994 , @ivanhernandez13 
> wrote:
>
> > I added the test file but atm the two existing arguments 
> > (--wait-for-debugger and --port) will cause lldb-vscode to hang and await 
> > some sort of action from an external process causing the test runner to 
> > hang. I added a single test case for handling an invalid port since that 
> > will cause the process to exit immediately but not certain on how to handle 
> > the other cases.
>
>
> I think for these particular cases it's sufficient to check the help output 
> and make sure the flags are there.


yeah just test for the options themselves in the help output. 
--wait-for-debugger is only when you need to debug lldb-vscode's initial 
packets with a debugger, so it is not a user facing argument. We might choose 
to hide this option by default. I know LLVM option parsing can do this.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74798



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


[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked 10 inline comments as done.
mib added inline comments.



Comment at: lldb/include/lldb/Target/Platform.h:838
+  /// \return
+  /// A Structured Data Dictionnary containing at each entry an array for
+  /// each different crash information type. Or a nullptr if the process 
has

JDevlieghere wrote:
> I had a hard time understanding this sentence. Is the `crash information 
> type` the key of the entry or the values in the array? 
As I was trying to explain it on the diff summary, the "crash information type" 
(i.e. `crash-info annotations) is the key of the dictionary entry and the value 
is a dictionary array that contains all the entries for that specific crash 
information type



Comment at: lldb/include/lldb/Target/Platform.h:881
   const std::unique_ptr m_module_cache;
+  StructuredData::DictionarySP m_extended_crash_info;
 

JDevlieghere wrote:
> I find it suspicious that this member is stored here but not used. Does it 
> need to be stored in the first place? Given the FetchExtendedCrashInformation 
> I'd expect these dictionaries to be different per target? 
I did that so other platforms just need to implement 
`FetchExtendedCrashInformation` and also to make sure the SBAPI method keeps 
the same behaviour regardless of the platform.



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h:93
+  // This struct should only be available in macOS but could be used on other
+  // platforms. #ifdef HAVE_CRASHREPORTERCLIENT_H #include
+  //  #endif

JDevlieghere wrote:
> Assuming the header defines this struct, why not do 
> 
> ```
> #ifdef HAVE_CRASHREPORTERCLIENT_H 
> #include  
> #else 
> struct CrashInfoAnnotations {
>   ...
> }
> #endif 
> ```
The struct have a different name in the header (which is not a big deal), but I 
don't see the point of including the header if I give the structure definition 
below it.

I put the header comment following @teemperor's feedback 
(https://reviews.llvm.org/D74657#inline-679127) but maybe I could get rid of it 
?




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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


[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib marked an inline comment as done.
mib added a comment.

In D74657#1883019 , @JDevlieghere 
wrote:

> This looks like a great feature, I see myself using this a lot in the future. 
> Thanks for working on this!


Appreciated it!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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


[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/include/lldb/Target/Platform.h:838
+  /// \return
+  /// A Structured Data Dictionnary containing at each entry an array for
+  /// each different crash information type. Or a nullptr if the process 
has

mib wrote:
> JDevlieghere wrote:
> > I had a hard time understanding this sentence. Is the `crash information 
> > type` the key of the entry or the values in the array? 
> As I was trying to explain it on the diff summary, the "crash information 
> type" (i.e. `crash-info annotations) is the key of the dictionary entry and 
> the value is a dictionary array that contains all the entries for that 
> specific crash information type
Would you mind updating the comment to explain it that way? 



Comment at: lldb/include/lldb/Target/Platform.h:881
   const std::unique_ptr m_module_cache;
+  StructuredData::DictionarySP m_extended_crash_info;
 

mib wrote:
> JDevlieghere wrote:
> > I find it suspicious that this member is stored here but not used. Does it 
> > need to be stored in the first place? Given the 
> > FetchExtendedCrashInformation I'd expect these dictionaries to be different 
> > per target? 
> I did that so other platforms just need to implement 
> `FetchExtendedCrashInformation` and also to make sure the SBAPI method keeps 
> the same behaviour regardless of the platform.
I'm not sure I understand how that answers my questions. The SB API calls 
FetchExtendedCrashInformation, what does it care about the member? Why not 
return a new DictionarySP every time?



Comment at: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h:93
+  // This struct should only be available in macOS but could be used on other
+  // platforms. #ifdef HAVE_CRASHREPORTERCLIENT_H #include
+  //  #endif

mib wrote:
> JDevlieghere wrote:
> > Assuming the header defines this struct, why not do 
> > 
> > ```
> > #ifdef HAVE_CRASHREPORTERCLIENT_H 
> > #include  
> > #else 
> > struct CrashInfoAnnotations {
> >   ...
> > }
> > #endif 
> > ```
> The struct have a different name in the header (which is not a big deal), but 
> I don't see the point of including the header if I give the structure 
> definition below it.
> 
> I put the header comment following @teemperor's feedback 
> (https://reviews.llvm.org/D74657#inline-679127) but maybe I could get rid of 
> it ?
> 
> 
I'll leave it up to your discretion, but I'd either specify the struct myself 
and say it's defined in `CrashReporterClient.h`, or alternatively put the 
ifdefs in the code and include the header and typedef it if the header is 
available, and use the custom struct otherwise, which means we still have the 
layout and type info Raphael asked about. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657



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


[Lldb-commits] [PATCH] D73119: [lldb/Initializers] Rename plugins to match their entry points

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere abandoned this revision.
JDevlieghere added a comment.

This is no longer relevant.


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

https://reviews.llvm.org/D73119



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


[Lldb-commits] [PATCH] D73125: [lldb/Plugins] Move entry points out of plugin namespace

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere abandoned this revision.
JDevlieghere added a comment.

This is no longer relevant


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D73125



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


[Lldb-commits] [PATCH] D74859: [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY

2020-02-19 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
rupprecht added reviewers: labath, JDevlieghere, friss.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

lldb's format string (line one) is:
`lldb version $clang_version ($lldb_repo revision $lldb_revision)`

When only using $lldb_revision and not $lldb_repo, this might look like:
`lldb version 11 ( revision 12345)`
which looks pretty ugly.

Aside: I'm not sure we really need all the different versions since we've moved 
to the monorepo layout -- I don't think anyone is using different 
llvm/clang/lldb revisions, are they? We could likely tidy this up further if we 
knew how people consumed the output of lldb --version.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D74859

Files:
  lldb/source/lldb.cpp


Index: lldb/source/lldb.cpp
===
--- lldb/source/lldb.cpp
+++ lldb/source/lldb.cpp
@@ -50,8 +50,10 @@
   g_version_str += " (";
   if (lldb_repo)
 g_version_str += lldb_repo;
+  if (lldb_repo && lldb_rev)
+g_version_str += " ";
   if (lldb_rev) {
-g_version_str += " revision ";
+g_version_str += "revision ";
 g_version_str += lldb_rev;
   }
   g_version_str += ")";


Index: lldb/source/lldb.cpp
===
--- lldb/source/lldb.cpp
+++ lldb/source/lldb.cpp
@@ -50,8 +50,10 @@
   g_version_str += " (";
   if (lldb_repo)
 g_version_str += lldb_repo;
+  if (lldb_repo && lldb_rev)
+g_version_str += " ";
   if (lldb_rev) {
-g_version_str += " revision ";
+g_version_str += "revision ";
 g_version_str += lldb_rev;
   }
   g_version_str += ")";
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D74727: Allow customized relative PYTHONHOME

2020-02-19 Thread Haibo Huang via Phabricator via lldb-commits
hhb updated this revision to Diff 245499.
hhb added a comment.

Rename LLDB_RELOCATABLE_PYTHON to LLDB_EMBED_PYTHON_HOME.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74727

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -279,12 +279,34 @@
   void InitializePythonHome() {
 #if defined(LLDB_PYTHON_HOME)
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, &size);
+typedef const wchar_t* str_type;
 #else
-static char g_python_home[] = LLDB_PYTHON_HOME;
+typedef char* str_type;
 #endif
-Py_SetPythonHome(g_python_home);
+static str_type g_python_home = []() -> str_type {
+  const char *lldb_python_home = LLDB_PYTHON_HOME;
+  const char *absolute_python_home = nullptr;
+  llvm::SmallString<64> path;
+  if (llvm::sys::path::is_absolute(lldb_python_home)) {
+absolute_python_home = lldb_python_home;
+  } else {
+FileSpec spec = HostInfo::GetShlibDir();
+if (!spec)
+  return nullptr;
+spec.GetPath(path);
+llvm::sys::path::append(path, lldb_python_home);
+absolute_python_home = path.c_str();
+  }
+#if PY_MAJOR_VERSION >= 3
+  size_t size = 0;
+  return Py_DecodeLocale(absolute_python_home, &size);
+#else
+  return strdup(absolute_python_home);
+#endif
+}();
+if (g_python_home != nullptr) {
+  Py_SetPythonHome(g_python_home);
+}
 #else
 #if defined(__APPLE__) && PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION == 7
 // For Darwin, the only Python version supported is the one shipped in the
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -59,7 +59,15 @@
 add_optional_dependency(LLDB_ENABLE_PYTHON "Enable Python scripting support in 
LLDB" PythonInterpAndLibs PYTHONINTERPANDLIBS_FOUND)
 add_optional_dependency(LLDB_ENABLE_LIBXML2 "Enable Libxml 2 support in LLDB" 
LibXml2 LIBXML2_FOUND VERSION 2.8)
 
-option(LLDB_RELOCATABLE_PYTHON "Use the PYTHONHOME environment variable to 
locate Python." OFF)
+if(CMAKE_SYSTEM_NAME MATCHES "Windows")
+  set(default_embed_python_home ON)
+else()
+  set(default_embed_python_home OFF)
+endif()
+
+option(LLDB_EMBED_PYTHON_HOME
+   "Embed PYTHONHOME in the binary. If set to OFF, PYTHONHOME environment 
variable will \
+   be used to to locate Python." ${default_embed_python_home})
 option(LLDB_USE_SYSTEM_SIX "Use six.py shipped with system and do not install 
a copy of it" OFF)
 option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" 
ON)
 option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
@@ -141,9 +149,11 @@
 
 if (LLDB_ENABLE_PYTHON)
   include_directories(${PYTHON_INCLUDE_DIRS})
-  if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" AND NOT 
LLDB_RELOCATABLE_PYTHON)
+  if (LLDB_EMBED_PYTHON_HOME)
 get_filename_component(PYTHON_HOME "${PYTHON_EXECUTABLE}" DIRECTORY)
-file(TO_CMAKE_PATH "${PYTHON_HOME}" LLDB_PYTHON_HOME)
+set(LLDB_PYTHON_HOME "${PYTHON_HOME}" CACHE STRING
+  "Path to use as PYTHONHOME in lldb. If a relative path is specified, \
+  it will be resolved at runtime relative to liblldb directory.")
   endif()
 endif()
 


Index: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
===
--- lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -279,12 +279,34 @@
   void InitializePythonHome() {
 #if defined(LLDB_PYTHON_HOME)
 #if PY_MAJOR_VERSION >= 3
-size_t size = 0;
-static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, &size);
+typedef const wchar_t* str_type;
 #else
-static char g_python_home[] = LLDB_PYTHON_HOME;
+typedef char* str_type;
 #endif
-Py_SetPythonHome(g_python_home);
+static str_type g_python_home = []() -> str_type {
+  const char *lldb_python_home = LLDB_PYTHON_HOME;
+  const char *absolute_python_home = nullptr;
+  llvm::SmallString<64> path;
+  if (llvm::sys::path::is_absolute(lldb_python_home)) {
+absolute_python_home = lldb_python_home;
+  } else {
+FileSpec spec = HostInfo::GetShlibDir();
+if (!spec)
+  return nullptr;
+spec.GetPath(path);
+llvm::sys::path::append(path, lldb_python_home);
+absolute_python

[Lldb-commits] [PATCH] D74798: [lldb-vscode] Use libOption with tablegen to parse command line options.

2020-02-19 Thread Ivan Hernandez via Phabricator via lldb-commits
ivanhernandez13 updated this revision to Diff 245517.
ivanhernandez13 added a comment.

- Update ldb-vscode options test to simply look for the expected flags when 
passing the --help option.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74798

Files:
  lldb/test/Shell/VSCode/TestOptions.test
  lldb/test/Shell/helper/toolchain.py
  lldb/tools/lldb-vscode/CMakeLists.txt
  lldb/tools/lldb-vscode/Options.td
  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
@@ -41,8 +41,12 @@
 #include 
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/Option/Arg.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -64,6 +68,34 @@
 using namespace lldb_vscode;
 
 namespace {
+enum ID {
+  OPT_INVALID = 0, // This is not an option ID.
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  \
+   HELPTEXT, METAVAR, VALUES)  \
+  OPT_##ID,
+#include "Options.inc"
+#undef OPTION
+};
+
+#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#include "Options.inc"
+#undef PREFIX
+
+static const llvm::opt::OptTable::Info InfoTable[] = {
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  \
+   HELPTEXT, METAVAR, VALUES)  \
+{  \
+  PREFIX,  NAME,  HELPTEXT,\
+  METAVAR, OPT_##ID,  llvm::opt::Option::KIND##Class,  \
+  PARAM,   FLAGS, OPT_##GROUP, \
+  OPT_##ALIAS, ALIASARGS, VALUES},
+#include "Options.inc"
+#undef OPTION
+};
+class LLDBVSCodeOptTable : public llvm::opt::OptTable {
+public:
+  LLDBVSCodeOptTable() : OptTable(InfoTable, true) {}
+};
 
 typedef void (*RequestCallback)(const llvm::json::Object &command);
 
@@ -2719,31 +2751,70 @@
 
 } // anonymous namespace
 
+static void printHelp(LLDBVSCodeOptTable &table, llvm::StringRef tool_name) {
+  std::string usage_str = tool_name.str() + "options";
+  table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB VSCode", false);
+
+  std::string examples = R"___(
+EXAMPLES:
+  The debug adapter can be started in two modes.
+
+  Running lldb-vscode without any arguments will start communicating with the
+  parent over stdio. Passing a port number causes lldb-vscode to start listening
+  for connections on that port.
+
+lldb-vscode -p 
+
+  Passing --wait-for-debugger will pause the process at startup and wait for a
+  debugger to attach to the process.
+
+lldb-vscode -g
+  )___";
+  llvm::outs() << examples;
+}
+
 int main(int argc, char *argv[]) {
 
   // Initialize LLDB first before we do anything.
   lldb::SBDebugger::Initialize();
 
-  if (argc == 2) {
-const char *arg = argv[1];
+  int portno = -1;
+
+  LLDBVSCodeOptTable T;
+  unsigned MAI, MAC;
+  llvm::ArrayRef ArgsArr = llvm::makeArrayRef(argv + 1, argc);
+  llvm::opt::InputArgList input_args = T.ParseArgs(ArgsArr, MAI, MAC);
+
+  if (input_args.hasArg(OPT_help)) {
+printHelp(T, llvm::sys::path::filename(argv[0]));
+return 0;
+  }
+
+  if (auto *arg = input_args.getLastArg(OPT_port)) {
+auto optarg = arg->getValue();
+char *remainder;
+portno = strtol(optarg, &remainder, 0);
+if (remainder == optarg || *remainder != '\0') {
+  fprintf(stderr, "'%s' is not a valid port number.\n", optarg);
+  exit(1);
+}
+  }
+
 #if !defined(_WIN32)
-if (strcmp(arg, "-g") == 0) {
-  printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid());
-  pause();
-} else {
-#else
-{
+  if (input_args.hasArg(OPT_wait_for_debugger)) {
+printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid());
+pause();
+  }
 #endif
-  int portno = atoi(arg);
-  printf("Listening on port %i...\n", portno);
-  SOCKET socket_fd = AcceptConnection(portno);
-  if (socket_fd >= 0) {
-g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
-g_vsc.output.descriptor =
-StreamDescriptor::from_socket(socket_fd, false);
-  } else {
-exit(1);
-  }
+  if (portno != -1) {
+printf("Listening on port %i...\n", portno);
+SOCKET socket_fd = AcceptConnection(portno);
+if (socket_fd >= 0) {
+  g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
+  g_vsc.output.descriptor =
+  StreamDescriptor::from_socket(socket_fd, false);
+} else {
+  exit(1);
  

[Lldb-commits] [PATCH] D74798: [lldb-vscode] Use libOption with tablegen to parse command line options.

2020-02-19 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added inline comments.



Comment at: lldb/test/Shell/VSCode/TestOptions.test:8
+# CHECK: --wait-for-debugger
\ No newline at end of file


Missing newline


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74798



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


[Lldb-commits] [PATCH] D74798: [lldb-vscode] Use libOption with tablegen to parse command line options.

2020-02-19 Thread Ivan Hernandez via Phabricator via lldb-commits
ivanhernandez13 updated this revision to Diff 245523.
ivanhernandez13 added a comment.

- Add missing newline.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74798

Files:
  lldb/test/Shell/VSCode/TestOptions.test
  lldb/test/Shell/helper/toolchain.py
  lldb/tools/lldb-vscode/CMakeLists.txt
  lldb/tools/lldb-vscode/Options.td
  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
@@ -41,8 +41,12 @@
 #include 
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/Option/Arg.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Option/Option.h"
 #include "llvm/Support/Errno.h"
 #include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/raw_ostream.h"
 
 #include "JSONUtils.h"
@@ -64,6 +68,34 @@
 using namespace lldb_vscode;
 
 namespace {
+enum ID {
+  OPT_INVALID = 0, // This is not an option ID.
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  \
+   HELPTEXT, METAVAR, VALUES)  \
+  OPT_##ID,
+#include "Options.inc"
+#undef OPTION
+};
+
+#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#include "Options.inc"
+#undef PREFIX
+
+static const llvm::opt::OptTable::Info InfoTable[] = {
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM,  \
+   HELPTEXT, METAVAR, VALUES)  \
+{  \
+  PREFIX,  NAME,  HELPTEXT,\
+  METAVAR, OPT_##ID,  llvm::opt::Option::KIND##Class,  \
+  PARAM,   FLAGS, OPT_##GROUP, \
+  OPT_##ALIAS, ALIASARGS, VALUES},
+#include "Options.inc"
+#undef OPTION
+};
+class LLDBVSCodeOptTable : public llvm::opt::OptTable {
+public:
+  LLDBVSCodeOptTable() : OptTable(InfoTable, true) {}
+};
 
 typedef void (*RequestCallback)(const llvm::json::Object &command);
 
@@ -2719,31 +2751,70 @@
 
 } // anonymous namespace
 
+static void printHelp(LLDBVSCodeOptTable &table, llvm::StringRef tool_name) {
+  std::string usage_str = tool_name.str() + "options";
+  table.PrintHelp(llvm::outs(), usage_str.c_str(), "LLDB VSCode", false);
+
+  std::string examples = R"___(
+EXAMPLES:
+  The debug adapter can be started in two modes.
+
+  Running lldb-vscode without any arguments will start communicating with the
+  parent over stdio. Passing a port number causes lldb-vscode to start listening
+  for connections on that port.
+
+lldb-vscode -p 
+
+  Passing --wait-for-debugger will pause the process at startup and wait for a
+  debugger to attach to the process.
+
+lldb-vscode -g
+  )___";
+  llvm::outs() << examples;
+}
+
 int main(int argc, char *argv[]) {
 
   // Initialize LLDB first before we do anything.
   lldb::SBDebugger::Initialize();
 
-  if (argc == 2) {
-const char *arg = argv[1];
+  int portno = -1;
+
+  LLDBVSCodeOptTable T;
+  unsigned MAI, MAC;
+  llvm::ArrayRef ArgsArr = llvm::makeArrayRef(argv + 1, argc);
+  llvm::opt::InputArgList input_args = T.ParseArgs(ArgsArr, MAI, MAC);
+
+  if (input_args.hasArg(OPT_help)) {
+printHelp(T, llvm::sys::path::filename(argv[0]));
+return 0;
+  }
+
+  if (auto *arg = input_args.getLastArg(OPT_port)) {
+auto optarg = arg->getValue();
+char *remainder;
+portno = strtol(optarg, &remainder, 0);
+if (remainder == optarg || *remainder != '\0') {
+  fprintf(stderr, "'%s' is not a valid port number.\n", optarg);
+  exit(1);
+}
+  }
+
 #if !defined(_WIN32)
-if (strcmp(arg, "-g") == 0) {
-  printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid());
-  pause();
-} else {
-#else
-{
+  if (input_args.hasArg(OPT_wait_for_debugger)) {
+printf("Paused waiting for debugger to attach (pid = %i)...\n", getpid());
+pause();
+  }
 #endif
-  int portno = atoi(arg);
-  printf("Listening on port %i...\n", portno);
-  SOCKET socket_fd = AcceptConnection(portno);
-  if (socket_fd >= 0) {
-g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
-g_vsc.output.descriptor =
-StreamDescriptor::from_socket(socket_fd, false);
-  } else {
-exit(1);
-  }
+  if (portno != -1) {
+printf("Listening on port %i...\n", portno);
+SOCKET socket_fd = AcceptConnection(portno);
+if (socket_fd >= 0) {
+  g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
+  g_vsc.output.descriptor =
+  StreamDescriptor::from_socket(socket_fd, false);
+} else {
+  exit(1);
 }
   } else {
 g_vsc.input.descriptor = StreamDescriptor::from_file(fileno

[Lldb-commits] [PATCH] D74657: [lldb/Plugins] Add `platform process crash-info` command

2020-02-19 Thread Med Ismail Bennani via Phabricator via lldb-commits
mib updated this revision to Diff 245528.
mib added a comment.

Update documentation.
Address Jonas' comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74657

Files:
  lldb/bindings/interface/SBPlatform.i
  lldb/include/lldb/API/SBPlatform.h
  lldb/include/lldb/API/SBStructuredData.h
  lldb/include/lldb/API/SBTarget.h
  lldb/include/lldb/Target/Platform.h
  lldb/include/lldb/Target/Process.h
  lldb/source/API/SBPlatform.cpp
  lldb/source/Commands/CommandObjectPlatform.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
  lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
  lldb/test/API/commands/platform/process/crash-info/Makefile
  
lldb/test/API/commands/platform/process/crash-info/TestPlatformProcessCrashInfo.py
  lldb/test/API/commands/platform/process/crash-info/main.c

Index: lldb/test/API/commands/platform/process/crash-info/main.c
===
--- /dev/null
+++ lldb/test/API/commands/platform/process/crash-info/main.c
@@ -0,0 +1,7 @@
+#include 
+int main() {
+  int *var = malloc(sizeof(int));
+  free(var);
+  free(var);
+  return 0;
+}
Index: lldb/test/API/commands/platform/process/crash-info/TestPlatformProcessCrashInfo.py
===
--- /dev/null
+++ lldb/test/API/commands/platform/process/crash-info/TestPlatformProcessCrashInfo.py
@@ -0,0 +1,63 @@
+"""
+Test lldb platform process crash info.
+"""
+
+import os
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+class PlatformProcessCrashInfoTestCase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+self.runCmd("settings set auto-confirm true")
+
+def tearDown(self):
+self.runCmd("settings clear auto-confirm")
+TestBase.tearDown(self)
+
+@skipUnlessDarwin
+def test_cli(self):
+"""Test that platform process crash-info fetches the extended crash
+information array from the command-line properly."""
+self.build()
+exe = self.getBuildArtifact("a.out")
+self.expect("file " + exe,
+patterns=["Current executable set to .*a.out"])
+
+self.expect('process launch',
+patterns=["Process .* launched: .*a.out"])
+
+self.expect('platform process crash-info',
+patterns=["\"message\".*pointer being freed was not allocated"])
+
+
+@skipUnlessDarwin
+def test_api(self):
+"""Test that platform process crash-info fetches the extended crash
+information array from the api properly."""
+self.build()
+target = self.dbg.CreateTarget(self.getBuildArtifact("a.out"))
+self.assertTrue(target, VALID_TARGET)
+
+target.LaunchSimple(None, None, os.getcwd())
+
+platform = target.GetPlatform()
+
+stream = lldb.SBStream()
+self.assertTrue(stream)
+
+crash_info = platform.GetExtendedCrashInformation(target)
+
+error = crash_info.GetAsJSON(stream)
+
+self.assertTrue(error.Success())
+
+self.assertTrue(crash_info.IsValid())
+
+self.assertIn("pointer being freed was not allocated", stream.GetData())
Index: lldb/test/API/commands/platform/process/crash-info/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/platform/process/crash-info/Makefile
@@ -0,0 +1,4 @@
+C_SOURCES := main.c
+
+include Makefile.rules
+
Index: lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
===
--- lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -12,6 +12,7 @@
 #include "Plugins/Platform/POSIX/PlatformPOSIX.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Utility/FileSpec.h"
+#include "lldb/Utility/StructuredData.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/FileSystem.h"
 
@@ -84,7 +85,43 @@
 iPhoneOS,
   };
 
+  lldb_private::StructuredData::DictionarySP
+  FetchExtendedCrashInformation(lldb_private::Target &target) override;
+
 protected:
+#ifdef HAVE_CRASHREPORTERCLIENT_H
+#include 
+  typedef crashreporter_annotations_t CrashInfoAnnotations;
+#else
+  struct CrashInfoAnnotations {
+uint64_t version;  // unsigned long
+uint64_t message;  // char *
+uint64_t signature_string; // char *
+uint64_t backtrace;// char *
+uint64_t message2; // char *
+uint64_t thread;   // uint64_t
+uint64_t dialog_mode;  // unsigned int
+uint64_t abort_cause;  // unsigned int
+  };
+#endif
+
+  /// Extract the `__crash_info` annotations from each of of the target's
+  /// modules.
+  ///
+  /// If the platform have

[Lldb-commits] [PATCH] D74636: [lldb-vscode] Add inheritEnvironment option

2020-02-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Very close, just need to check for the "host" platform and possibly add windows 
support, or return an error on windows, if LLVM doesn't have a OS abstracted 
wrapper that allows access to the current environment.




Comment at: 
lldb/test/API/tools/lldb-vscode/environmentVariables/TestVSCode_environmentVariables.py:2
+"""
+Test lldb-vscode completions request
+"""

This comment seems to need fixing, probably due to copying from a previous test 
case file.



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:52
 
+extern char **environ;
+

Will this work on windows or non unix systems? Are there any llvm functions 
that get the environment that we might be able to use?



Comment at: lldb/tools/lldb-vscode/lldb-vscode.cpp:1376
   auto envs = GetStrings(arguments, "env");
+  if (launchWithDebuggerEnvironment) {
+char** env_var_pointer = environ;

I think we need to grab the platform form the target and see if the platform is 
the "host" platform here and error out if we catch someone trying to forward an 
environment to another remote platform. Maybe something like:
```
if (launchWithDebuggerEnvironment) {
  const char *platform_name = g_vsc.target.GetPlatform().GetName();
  if (platform_name && strcmp(platform_name, "host") != 0) {
response["success"] = llvm::json::Value(false);
EmplaceSafeString(response, "message", "can't use inheritEnvironment on a 
remote process");
g_vsc.SendJSON(llvm::json::Value(std::move(response)));
return;
  }
}
```



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74636



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


[Lldb-commits] [lldb] 6990eaf - [lldb/Test] Skip VSCode test on embedded Darwin

2020-02-19 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-19T17:34:01-08:00
New Revision: 6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4

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

LOG: [lldb/Test] Skip VSCode test on embedded Darwin

These tests are not configured to run on the device.

Added: 


Modified: 
lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py

lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py

lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
lldb/test/API/tools/lldb-vscode/stackTrace/TestVSCode_stackTrace.py
lldb/test/API/tools/lldb-vscode/step/TestVSCode_step.py
lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py 
b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
index 58b95ed5dd66..c2fc20a326ee 100644
--- a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
+++ b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
@@ -46,6 +46,7 @@ def set_and_hit_breakpoint(self, continueToExit=True):
 
 @skipIfWindows
 @skipIfNetBSD # Hangs on NetBSD as well
+@skipIfDarwinEmbedded
 def test_by_pid(self):
 '''
 Tests attaching to a process by process ID.
@@ -61,6 +62,7 @@ def test_by_pid(self):
 
 @skipIfWindows
 @skipIfNetBSD # Hangs on NetBSD as well
+@skipIfDarwinEmbedded
 def test_by_name(self):
 '''
 Tests attaching to a process by process name.

diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
index c3e2697d194a..ad345a904971 100644
--- a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
+++ b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
@@ -17,6 +17,7 @@ class 
TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @skipIfWindows
+@skipIfDarwinEmbedded
 def test_set_and_clear(self):
 '''Tests setting and clearing source file and line breakpoints.
This packet is a bit tricky on the debug adaptor side since there
@@ -148,6 +149,7 @@ def test_set_and_clear(self):
 "expect breakpoint still verified")
 
 @skipIfWindows
+@skipIfDarwinEmbedded
 def test_functionality(self):
 '''Tests hitting breakpoints and the functionality of a single
breakpoint, like 'conditions' and 'hitCondition' settings.'''

diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py
 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py
index d20a3434188e..bc3295565be6 100644
--- 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py
+++ 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py
@@ -18,6 +18,7 @@ class TestVSCode_setExceptionBreakpoints(
 
 @skipIfWindows
 @expectedFailureNetBSD
+@skipIfDarwinEmbedded
 def test_functionality(self):
 '''Tests setting and clearing exception breakpoints.
This packet is a bit tricky on the debug adaptor side since there

diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
index 2734c37a928e..84abe923e3a7 100644
--- 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
+++ 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
@@ -17,6 +17,7 @@ class TestVSCode_setFunctionBreakpoints(
 mydir = TestBase.compute_mydir(__file__)
 
 @skipIfWindows
+@skipIfDarwinEmbedded
 def test_set_and_clear(self):
 '''Tests setting and clearing function breakpoints.
This packet is a bit tricky on the debug adaptor side since there
@@ -107,6 +108,7 @@ def test_set_and_clear(self):
 "expect %u source breakpoints" % (len(functions)))
 
 @skipIfWindows
+@skipIfDarwinEmbedded
 def test_functionality(self):
 '''Tests hitting breakpoints and the functionality of a single
breakpoint, like 'conditions' and 'hitCondition' settings.'''

diff  --git a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py 
b/lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
index f9aa1bdf8a0e..f56283aaed18 100644
--- a/lldb/test/API/tools

Re: [Lldb-commits] [lldb] 6990eaf - [lldb/Test] Skip VSCode test on embedded Darwin

2020-02-19 Thread Davide Italiano via lldb-commits


> On Feb 19, 2020, at 17:34, Jonas Devlieghere via lldb-commits 
>  wrote:
> 
> 
> Author: Jonas Devlieghere
> Date: 2020-02-19T17:34:01-08:00
> New Revision: 6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4
> DIFF: 
> https://github.com/llvm/llvm-project/commit/6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4.diff
> 
> LOG: [lldb/Test] Skip VSCode test on embedded Darwin
> 
> These tests are not configured to run on the device.


I’ve never seen these failing. Did you?

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


Re: [Lldb-commits] [lldb] 6990eaf - [lldb/Test] Skip VSCode test on embedded Darwin

2020-02-19 Thread Frédéric Riss via lldb-commits


> On Feb 19, 2020, at 5:44 PM, Davide Italiano via lldb-commits 
>  wrote:
> 
> 
> 
>> On Feb 19, 2020, at 17:34, Jonas Devlieghere via lldb-commits 
>>  wrote:
>> 
>> 
>> Author: Jonas Devlieghere
>> Date: 2020-02-19T17:34:01-08:00
>> New Revision: 6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4
>> 
>> URL: 
>> https://github.com/llvm/llvm-project/commit/6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4
>> DIFF: 
>> https://github.com/llvm/llvm-project/commit/6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4.diff
>> 
>> LOG: [lldb/Test] Skip VSCode test on embedded Darwin
>> 
>> These tests are not configured to run on the device.
> 
> 
> I’ve never seen these failing. Did you?

Yes, I did. All of them fail for me and 2 of them hang.

`@skipIfDarwinEmbedded` obviously works for us, but I’m wondering if 
`@skipIfRemote` would not be a better/more generic fix?

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


Re: [Lldb-commits] [lldb] 6990eaf - [lldb/Test] Skip VSCode test on embedded Darwin

2020-02-19 Thread Davide Italiano via lldb-commits


> On Feb 19, 2020, at 17:52, Frédéric Riss  wrote:
> 
> 
> 
>> On Feb 19, 2020, at 5:44 PM, Davide Italiano via lldb-commits 
>>  wrote:
>> 
>> 
>> 
>>> On Feb 19, 2020, at 17:34, Jonas Devlieghere via lldb-commits 
>>>  wrote:
>>> 
>>> 
>>> Author: Jonas Devlieghere
>>> Date: 2020-02-19T17:34:01-08:00
>>> New Revision: 6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4
>>> 
>>> URL: 
>>> https://github.com/llvm/llvm-project/commit/6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4
>>> DIFF: 
>>> https://github.com/llvm/llvm-project/commit/6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4.diff
>>> 
>>> LOG: [lldb/Test] Skip VSCode test on embedded Darwin
>>> 
>>> These tests are not configured to run on the device.
>> 
>> 
>> I’ve never seen these failing. Did you?
> 
> Yes, I did. All of them fail for me and 2 of them hang.
> 
> `@skipIfDarwinEmbedded` obviously works for us, but I’m wondering if 
> `@skipIfRemote` would not be a better/more generic fix?

@skipIfRemote is obviously a better fix.
It would be nice if all the vscode tests could be categorized and we could put 
a single annotation on them, so that in case somebody adds another test, we 
don’t have to do this decorator gymnastics.

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


Re: [Lldb-commits] [lldb] 6990eaf - [lldb/Test] Skip VSCode test on embedded Darwin

2020-02-19 Thread Jonas Devlieghere via lldb-commits
On Wed, Feb 19, 2020 at 5:57 PM Davide Italiano  wrote:

>
>
> On Feb 19, 2020, at 17:52, Frédéric Riss  wrote:
>
>
>
> On Feb 19, 2020, at 5:44 PM, Davide Italiano via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>
>
> On Feb 19, 2020, at 17:34, Jonas Devlieghere via lldb-commits <
> lldb-commits@lists.llvm.org> wrote:
>
>
> Author: Jonas Devlieghere
> Date: 2020-02-19T17:34:01-08:00
> New Revision: 6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4
>
> URL:
> https://github.com/llvm/llvm-project/commit/6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4
> DIFF:
> https://github.com/llvm/llvm-project/commit/6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4.diff
>
> LOG: [lldb/Test] Skip VSCode test on embedded Darwin
>
> These tests are not configured to run on the device.
>
>
>
> I’ve never seen these failing. Did you?
>
>
> Yes, I did. All of them fail for me and 2 of them hang.
>
> `@skipIfDarwinEmbedded` obviously works for us, but I’m wondering if
> `@skipIfRemote` would not be a better/more generic fix?
>
>
> @skipIfRemote is obviously a better fix.
>

I can update the decorators.


> It would be nice if all the vscode tests could be categorized and we could
> put a single annotation on them, so that in case somebody adds another
> test, we don’t have to do this decorator gymnastics.
>

Agreed, but unfortunately that's not how dotest works. Now that the tests
actually live under test/API we might be able to change the way we discover
them and reuse lit's capabilities with lit.local.cfg files.


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


[Lldb-commits] [PATCH] D74798: [lldb-vscode] Use libOption with tablegen to parse command line options.

2020-02-19 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.

LTGM.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74798



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


[Lldb-commits] [lldb] 14fb317 - [lldb/Test] s/skipIfDarwinEmbedded/skipIfRemote/ in VSCode tests.

2020-02-19 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-02-19T20:20:36-08:00
New Revision: 14fb31795a4bd25798bc2788dd4d4e38e3ea41c7

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

LOG: [lldb/Test] s/skipIfDarwinEmbedded/skipIfRemote/ in VSCode tests.

As pointed out on lldb-commits this skipIfRemote is the better fit for
the decorator.

Added: 


Modified: 
lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py

lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py

lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
lldb/test/API/tools/lldb-vscode/stackTrace/TestVSCode_stackTrace.py
lldb/test/API/tools/lldb-vscode/step/TestVSCode_step.py
lldb/test/API/tools/lldb-vscode/variables/TestVSCode_variables.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py 
b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
index c2fc20a326ee..9d9553fcdf68 100644
--- a/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
+++ b/lldb/test/API/tools/lldb-vscode/attach/TestVSCode_attach.py
@@ -46,7 +46,7 @@ def set_and_hit_breakpoint(self, continueToExit=True):
 
 @skipIfWindows
 @skipIfNetBSD # Hangs on NetBSD as well
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_by_pid(self):
 '''
 Tests attaching to a process by process ID.
@@ -62,7 +62,7 @@ def test_by_pid(self):
 
 @skipIfWindows
 @skipIfNetBSD # Hangs on NetBSD as well
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_by_name(self):
 '''
 Tests attaching to a process by process name.

diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
index ad345a904971..aff210d9f8ac 100644
--- a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
+++ b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setBreakpoints.py
@@ -17,7 +17,7 @@ class 
TestVSCode_setBreakpoints(lldbvscode_testcase.VSCodeTestCaseBase):
 mydir = TestBase.compute_mydir(__file__)
 
 @skipIfWindows
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_set_and_clear(self):
 '''Tests setting and clearing source file and line breakpoints.
This packet is a bit tricky on the debug adaptor side since there
@@ -149,7 +149,7 @@ def test_set_and_clear(self):
 "expect breakpoint still verified")
 
 @skipIfWindows
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_functionality(self):
 '''Tests hitting breakpoints and the functionality of a single
breakpoint, like 'conditions' and 'hitCondition' settings.'''

diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py
 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py
index bc3295565be6..36c0cfe82dc3 100644
--- 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py
+++ 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setExceptionBreakpoints.py
@@ -18,7 +18,7 @@ class TestVSCode_setExceptionBreakpoints(
 
 @skipIfWindows
 @expectedFailureNetBSD
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_functionality(self):
 '''Tests setting and clearing exception breakpoints.
This packet is a bit tricky on the debug adaptor side since there

diff  --git 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
index 84abe923e3a7..306c1ce8077a 100644
--- 
a/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
+++ 
b/lldb/test/API/tools/lldb-vscode/breakpoint/TestVSCode_setFunctionBreakpoints.py
@@ -17,7 +17,7 @@ class TestVSCode_setFunctionBreakpoints(
 mydir = TestBase.compute_mydir(__file__)
 
 @skipIfWindows
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_set_and_clear(self):
 '''Tests setting and clearing function breakpoints.
This packet is a bit tricky on the debug adaptor side since there
@@ -108,7 +108,7 @@ def test_set_and_clear(self):
 "expect %u source breakpoints" % (len(functions)))
 
 @skipIfWindows
-@skipIfDarwinEmbedded
+@skipIfRemote
 def test_functionality(self):
 '''Tests hitting breakpoints and the functionality of a single
breakpoint, like 'conditions' and 'hitCondition' settings.'''

diff  --git a/lldb

[Lldb-commits] [PATCH] D74217: Add target.xml support for qXfer request.

2020-02-19 Thread Muhammad Omair Javaid via Phabricator via lldb-commits
omjavaid added a comment.

In D74217#1882539 , @PatriosTheGreat 
wrote:

> Hi Muhammad,
>  Thank you for review.
>  Could you or Pavel commit this to master, since I don't have commit access?


Hi Patrios,

There was some problem with our buildbot and it went down overnight. I have put 
it back in place and will commit your patch today.


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

https://reviews.llvm.org/D74217



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


[Lldb-commits] [PATCH] D74859: [lldb] Fix version string when using LLDB_REVISION but not LLDB_REPOSITORY

2020-02-19 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.

> Aside: I'm not sure we really need all the different versions since we've 
> moved to the monorepo layout -- I don't think anyone is using different 
> llvm/clang/lldb revisions, are they?

The standalone build of lldb (and clang) still works, and there are people that 
use it (some distros build their packages this way, and it's the "official" 
build method in the swift fork afaik). So, in theory one could build 
lldb+clang+llvm from three different revisions (but I hope noone actually does 
that).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74859



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


Re: [Lldb-commits] [lldb] 6990eaf - [lldb/Test] Skip VSCode test on embedded Darwin

2020-02-19 Thread Pavel Labath via lldb-commits
On 20/02/2020 02:56, Davide Italiano via lldb-commits wrote:
> 
> 
>> On Feb 19, 2020, at 17:52, Frédéric Riss > > wrote:
>>
>>
>>
>>> On Feb 19, 2020, at 5:44 PM, Davide Italiano via lldb-commits
>>> mailto:lldb-commits@lists.llvm.org>> wrote:
>>>
>>>
>>>
 On Feb 19, 2020, at 17:34, Jonas Devlieghere via lldb-commits
 mailto:lldb-commits@lists.llvm.org>>
 wrote:


 Author: Jonas Devlieghere
 Date: 2020-02-19T17:34:01-08:00
 New Revision: 6990eaf1fe00e9736fbfbcae160e18c5edbcd1d4

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

 LOG: [lldb/Test] Skip VSCode test on embedded Darwin

 These tests are not configured to run on the device.
>>>
>>>
>>> I’ve never seen these failing. Did you?
>>
>> Yes, I did. All of them fail for me and 2 of them hang.
>>
>> `@skipIfDarwinEmbedded` obviously works for us, but I’m wondering if
>> `@skipIfRemote` would not be a better/more generic fix?
> 
> @skipIfRemote is obviously a better fix.
> It would be nice if all the vscode tests could be categorized and we
> could put a single annotation on them, so that in case somebody adds
> another test, we don’t have to do this decorator gymnastics.


dotest has the option to skip tests based on categories. If we add a
.categories file with the "vscode" category to the vscode test root,
then you'd just need to pass the "--skip-categories vscode" option to
dotest when running the test suite (I assume you already need to pass a
bunch of options to set up the remote tests so this extra option could
be added there).

Or we could even add a "local-only" category, and then you could skip
all tests which are not remote ready with one stroke.

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