[Lldb-commits] [lldb] 8aeb212 - [debugserver] Fix that is_dot_app is producing unused warnings

2020-08-03 Thread Raphael Isemann via lldb-commits

Author: Raphael Isemann
Date: 2020-08-03T10:24:21+02:00
New Revision: 8aeb212887024a615ca02437cd12fa055bd54b6f

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

LOG: [debugserver] Fix that is_dot_app is producing unused warnings

Some build configurations don't use this static function.

Added: 


Modified: 
lldb/tools/debugserver/source/debugserver.cpp

Removed: 




diff  --git a/lldb/tools/debugserver/source/debugserver.cpp 
b/lldb/tools/debugserver/source/debugserver.cpp
index 4e6aa39e52d3..04cbd2c8b503 100644
--- a/lldb/tools/debugserver/source/debugserver.cpp
+++ b/lldb/tools/debugserver/source/debugserver.cpp
@@ -212,19 +212,21 @@ RNBRunLoopMode RNBRunLoopLaunchInferior(RNBRemote *remote,
 // Our default launch method is posix spawn
 launch_flavor = eLaunchFlavorPosixSpawn;
 
+const bool dot_app = is_dot_app(inferior_argv[0]);
+(void)dot_app;
 #if defined WITH_FBS
 // Check if we have an app bundle, if so launch using BackBoard Services.
-if (is_dot_app(inferior_argv[0])) {
+if (dot_app) {
   launch_flavor = eLaunchFlavorFBS;
 }
 #elif defined WITH_BKS
 // Check if we have an app bundle, if so launch using BackBoard Services.
-if (is_dot_app(inferior_argv[0])) {
+if (dot_app) {
   launch_flavor = eLaunchFlavorBKS;
 }
 #elif defined WITH_SPRINGBOARD
 // Check if we have an app bundle, if so launch using SpringBoard.
-if (is_dot_app(inferior_argv[0])) {
+if (dot_app) {
   launch_flavor = eLaunchFlavorSpringBoard;
 }
 #endif



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


[Lldb-commits] [PATCH] D84886: Create LoopNestPass

2020-08-03 Thread Ta-Wei Tu via Phabricator via lldb-commits
TaWeiTu updated this revision to Diff 281985.
TaWeiTu removed reviewers: jdoerfert, sstefan1, DavidTruby, aartbik, ftynse, 
baziotis, libc++.
TaWeiTu removed projects: MLIR, libc-project, OpenMP, libc++, LLDB, Sanitizers.
TaWeiTu added a comment.

Propagate the requirement of MemorySSA from loop passes to loop nest passes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84886

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  llvm/include/llvm/Analysis/LoopNestAnalysis.h
  llvm/include/llvm/Analysis/LoopNestAnalysisManager.h
  llvm/include/llvm/Passes/PassBuilder.h
  llvm/include/llvm/Transforms/Scalar/LoopNestPassManager.h
  llvm/include/llvm/Transforms/Scalar/LoopPassManager.h
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Analysis/CMakeLists.txt
  llvm/lib/Analysis/LoopNestAnalysis.cpp
  llvm/lib/Analysis/LoopNestAnalysisManager.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/Passes/PassBuilder.cpp
  llvm/lib/Passes/PassRegistry.def
  llvm/lib/Transforms/Scalar/CMakeLists.txt
  llvm/lib/Transforms/Scalar/LoopNestPassManager.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/LICM/assume.ll
  llvm/test/Transforms/LoopDeletion/invalidation.ll
  llvm/test/Transforms/LoopDeletion/multiple-exit-conditions.ll
  llvm/test/Transforms/LoopNest/print.ll
  llvm/test/Transforms/LoopRotate/basic.ll
  llvm/test/Transforms/LoopRotate/freeze-crash.ll
  llvm/test/Transforms/LoopRotate/multiple-deopt-exits.ll
  llvm/test/Transforms/LoopRotate/pr35210.ll
  llvm/tools/llvm-opt-fuzzer/llvm-opt-fuzzer.cpp
  llvm/tools/opt/NewPMDriver.cpp
  llvm/unittests/IR/PassBuilderCallbacksTest.cpp
  llvm/unittests/Transforms/Scalar/LICMTest.cpp
  polly/unittests/ScopPassManager/PassManagerTest.cpp

Index: polly/unittests/ScopPassManager/PassManagerTest.cpp
===
--- polly/unittests/ScopPassManager/PassManagerTest.cpp
+++ polly/unittests/ScopPassManager/PassManagerTest.cpp
@@ -16,6 +16,7 @@
 protected:
   ModuleAnalysisManager MAM;
   FunctionAnalysisManager FAM;
+  LoopNestAnalysisManager LNAM;
   LoopAnalysisManager LAM;
   CGSCCAnalysisManager CGAM;
   ScopAnalysisManager SAM;
@@ -26,13 +27,14 @@
   ScopPassRegistry(const ScopPassRegistry &) = delete;
   ScopPassRegistry &operator=(ScopPassRegistry &&) = delete;
   ScopPassRegistry &operator=(const ScopPassRegistry &) = delete;
-  ScopPassRegistry() {
+  ScopPassRegistry() : LNAM(LAM) {
 PassBuilder PB;
 
 AM = PB.buildDefaultAAPipeline();
 PB.registerModuleAnalyses(MAM);
 PB.registerFunctionAnalyses(FAM);
 PB.registerLoopAnalyses(LAM);
+PB.registerLoopNestAnalyses(LNAM);
 PB.registerCGSCCAnalyses(CGAM);
 
 FAM.registerPass([] { return ScopAnalysis(); });
@@ -43,7 +45,7 @@
 // SAM.registerPass([] { return DependenceAnalysis(); });
 SAM.registerPass([this] { return FunctionAnalysisManagerScopProxy(FAM); });
 
-PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
+PB.crossRegisterProxies(LAM, LNAM, FAM, CGAM, MAM);
   }
 };
 
Index: llvm/unittests/Transforms/Scalar/LICMTest.cpp
===
--- llvm/unittests/Transforms/Scalar/LICMTest.cpp
+++ llvm/unittests/Transforms/Scalar/LICMTest.cpp
@@ -22,6 +22,7 @@
   ModulePassManager MPM;
   PassBuilder PB;
   LoopAnalysisManager LAM;
+  LoopNestAnalysisManager LNAM(LAM);
   FunctionAnalysisManager FAM;
   CGSCCAnalysisManager CGAM;
   ModuleAnalysisManager MAM;
@@ -30,7 +31,8 @@
   PB.registerCGSCCAnalyses(CGAM);
   PB.registerFunctionAnalyses(FAM);
   PB.registerLoopAnalyses(LAM);
-  PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
+  PB.registerLoopNestAnalyses(LNAM);
+  PB.crossRegisterProxies(LAM, LNAM, FAM, CGAM, MAM);
 
   StringRef PipelineStr = "require,loop(licm)";
   ASSERT_THAT_ERROR(PB.parsePassPipeline(MPM, PipelineStr), Succeeded());
Index: llvm/unittests/IR/PassBuilderCallbacksTest.cpp
===
--- llvm/unittests/IR/PassBuilderCallbacksTest.cpp
+++ llvm/unittests/IR/PassBuilderCallbacksTest.cpp
@@ -174,6 +174,24 @@
   MockPassHandle() { setDefaults(); }
 };
 
+template <>
+struct MockPassHandle
+: MockPassHandleBase, LoopNest,
+ LoopNestAnalysisManager, LoopStandardAnalysisResults &,
+ LNPMUpdater &> {
+  MOCK_METHOD4(run,
+   PreservedAnalyses(LoopNest &, LoopNestAnalysisManager &,
+ LoopStandardAnalysisResults &, LNPMUpdater &));
+
+  static void invalidateLoopNest(LoopNest &LN, LoopNestAnalysisManager &,
+ LoopStandardAnalysisResults &,
+ LNPMUpdater &Updater) {
+Updater.markLoopNestAsDeleted(LN, LN.getName());
+  }
+
+  MockPassHandle() { setDefaults(); }
+};
+
 template <>
 struct MockPassHandle
 : MockPassHandleBase, Function> {
@@ -226,6 +24

[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-08-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

Added some comments on the new code. Also we should be able to see these spaces 
in the pexpect output, so I guess we should be able to test this too? To make 
this special case less fragile to test, you can make a new subtest in the Test 
case by just defining a new function:

  @skipIfAsan
  @skipIfEditlineSupportMissing
  def test_hidden_autosuggestion(self):
  @skipIfAsan
  @skipIfEditlineSupportMissing
  def test_autosuggestion(self):
  self.launch(extra_args=["-o", "settings set show-autosuggestion true", 
"-o", "settings set use-color true"])
  self.expect("help frame v")
  self.expect("help frame info")
  [type 'help frame v' and check for the three space after the grey part to 
cover up the "nfo" text]

So, I *believe* that everything that we want to have in this patch has been 
addressed? There are quite a few comments in this thread so it's hard to say if 
there are open issues. I played around with the current patch for a bit and I 
couldn't find anymore issues, so I think this is in pretty good shape in any 
case.

Let's see if @labath or @JDevlieghere have any more comments, otherwise I would 
say this can go in and the rest can be fixed as follow up commits.




Comment at: lldb/include/lldb/Host/Editline.h:377
+  void *m_suggestion_callback_baton = nullptr;
+  int m_previous_autosuggestion_size = 0;
   std::mutex m_output_mutex;

This probably should be `std::size_t` type (a negative previous suggestion size 
seems weird). Also add a comment that this is the length of the previous 
autosuggestion + user input in bytes.



Comment at: lldb/source/Host/common/Editline.cpp:1071
+  (int)to_add.getValue().length();
+if (spaces_to_print > 0) {
+  std::string spaces = std::string(spaces_to_print, ' ');

Whoever sees this in the future will really wonder why we print a bunch of 
spaces here, so I think a comment like "Print spaces to hide any remains of a 
previous longer autosuggestion".



Comment at: lldb/source/Host/common/Editline.cpp:1504
 #endif
+  if ((int)line.length() > m_previous_autosuggestion_size)
+m_previous_autosuggestion_size = (int)line.length();

I don't think the value of `m_previous_autosuggestion_size` should only grow 
(which is what this `if` is doing), as this way we just keep printing a longer 
and longer space buffer over time. Just printing enough to clear the buffer of 
the previous completion is enough.

Also you can just do this calculation directly after you calculated `int 
spaces_to_print` above. This way this code is closer together which hopefully 
makes this easier to understand.


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

https://reviews.llvm.org/D81001

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


[Lldb-commits] [lldb] 18d4069 - fix lldb test on lib64 systems

2020-08-03 Thread Luboš Luňák via lldb-commits

Author: Luboš Luňák
Date: 2020-08-03T11:19:07+02:00
New Revision: 18d4069503e729442158476960a797df963cf293

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

LOG: fix lldb test on lib64 systems

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

Added: 


Modified: 
lldb/unittests/Expression/ClangParserTest.cpp

Removed: 




diff  --git a/lldb/unittests/Expression/ClangParserTest.cpp 
b/lldb/unittests/Expression/ClangParserTest.cpp
index 81f9ed839fcc..4df557475314 100644
--- a/lldb/unittests/Expression/ClangParserTest.cpp
+++ b/lldb/unittests/Expression/ClangParserTest.cpp
@@ -11,6 +11,7 @@
 #include "Plugins/ExpressionParser/Clang/ClangHost.h"
 #include "TestingSupport/SubsystemRAII.h"
 #include "TestingSupport/TestUtilities.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/FileSpec.h"
@@ -36,7 +37,7 @@ static std::string ComputeClangResourceDir(std::string 
lldb_shlib_path,
 TEST_F(ClangHostTest, ComputeClangResourceDirectory) {
 #if !defined(_WIN32)
   std::string path_to_liblldb = "/foo/bar/lib/";
-  std::string path_to_clang_dir = "/foo/bar/lib/clang/" CLANG_VERSION_STRING;
+  std::string path_to_clang_dir = "/foo/bar/lib" LLDB_LIBDIR_SUFFIX "/clang/" 
CLANG_VERSION_STRING;
 #else
   std::string path_to_liblldb = "C:\\foo\\bar\\lib";
   std::string path_to_clang_dir = "C:\\foo\\bar\\lib\\clang\\" 
CLANG_VERSION_STRING;



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


[Lldb-commits] [PATCH] D85096: Fix lldb test on lib64 systems

2020-08-03 Thread Luboš Luňák via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG18d4069503e7: fix lldb test on lib64 systems (authored by 
llunak).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85096

Files:
  lldb/unittests/Expression/ClangParserTest.cpp


Index: lldb/unittests/Expression/ClangParserTest.cpp
===
--- lldb/unittests/Expression/ClangParserTest.cpp
+++ lldb/unittests/Expression/ClangParserTest.cpp
@@ -11,6 +11,7 @@
 #include "Plugins/ExpressionParser/Clang/ClangHost.h"
 #include "TestingSupport/SubsystemRAII.h"
 #include "TestingSupport/TestUtilities.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/FileSpec.h"
@@ -36,7 +37,7 @@
 TEST_F(ClangHostTest, ComputeClangResourceDirectory) {
 #if !defined(_WIN32)
   std::string path_to_liblldb = "/foo/bar/lib/";
-  std::string path_to_clang_dir = "/foo/bar/lib/clang/" CLANG_VERSION_STRING;
+  std::string path_to_clang_dir = "/foo/bar/lib" LLDB_LIBDIR_SUFFIX "/clang/" 
CLANG_VERSION_STRING;
 #else
   std::string path_to_liblldb = "C:\\foo\\bar\\lib";
   std::string path_to_clang_dir = "C:\\foo\\bar\\lib\\clang\\" 
CLANG_VERSION_STRING;


Index: lldb/unittests/Expression/ClangParserTest.cpp
===
--- lldb/unittests/Expression/ClangParserTest.cpp
+++ lldb/unittests/Expression/ClangParserTest.cpp
@@ -11,6 +11,7 @@
 #include "Plugins/ExpressionParser/Clang/ClangHost.h"
 #include "TestingSupport/SubsystemRAII.h"
 #include "TestingSupport/TestUtilities.h"
+#include "lldb/Host/Config.h"
 #include "lldb/Host/FileSystem.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Utility/FileSpec.h"
@@ -36,7 +37,7 @@
 TEST_F(ClangHostTest, ComputeClangResourceDirectory) {
 #if !defined(_WIN32)
   std::string path_to_liblldb = "/foo/bar/lib/";
-  std::string path_to_clang_dir = "/foo/bar/lib/clang/" CLANG_VERSION_STRING;
+  std::string path_to_clang_dir = "/foo/bar/lib" LLDB_LIBDIR_SUFFIX "/clang/" CLANG_VERSION_STRING;
 #else
   std::string path_to_liblldb = "C:\\foo\\bar\\lib";
   std::string path_to_clang_dir = "C:\\foo\\bar\\lib\\clang\\" CLANG_VERSION_STRING;
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85107: Add a test for 'b' (toggle breakpoint)

2020-08-03 Thread Luboš Luňák via Phabricator via lldb-commits
llunak updated this revision to Diff 282543.
llunak edited the summary of this revision.
llunak added a comment.

Removed use of curses python module, lldbexpect hardcodes TERM=vt100, so the 
escape sequence should be actually hardcoded too. The previous version didn't 
work e.g. in Linux console.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D85107

Files:
  lldb/test/API/commands/gui/breakpoints/Makefile
  lldb/test/API/commands/gui/breakpoints/TestGuiBreakpoints.py
  lldb/test/API/commands/gui/breakpoints/main.c


Index: lldb/test/API/commands/gui/breakpoints/main.c
===
--- /dev/null
+++ lldb/test/API/commands/gui/breakpoints/main.c
@@ -0,0 +1,6 @@
+int main(int argc, char **argv) {
+  int var1 = 1; // First break here
+  int var2 = 2;
+  int var3 = 3;
+  return var1 + var2 + var3;
+}
Index: lldb/test/API/commands/gui/breakpoints/TestGuiBreakpoints.py
===
--- /dev/null
+++ lldb/test/API/commands/gui/breakpoints/TestGuiBreakpoints.py
@@ -0,0 +1,75 @@
+"""
+Test the 'gui' shortcut 'b' (toggle breakpoint).
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class TestGuiBasicDebugCommandTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+# PExpect uses many timeouts internally and doesn't play well
+# under ASAN on a loaded machine..
+@skipIfAsan
+@skipIfCursesSupportMissing
+@skipIfRemote # "run" command will not work correctly for remote debug
+def test_gui(self):
+self.build()
+
+self.launch(executable=self.getBuildArtifact("a.out"), 
dimensions=(100,500))
+self.expect('br set -o true -f main.c -p "// First break here"', 
substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
+
+self.child.sendline("breakpoint list")
+self.child.expect_exact("No breakpoints currently set.")
+
+escape_key = chr(27).encode()
+down_key = chr(27)+'OB' # for vt100 terminal (lldbexpect sets 
TERM=vt100)
+
+# Start the GUI and close the welcome window.
+self.child.sendline("gui")
+self.child.send(escape_key)
+self.child.expect_exact("Sources") # wait for gui
+
+# Go to next line, set a breakpoint.
+self.child.send(down_key)
+self.child.send('b')
+self.child.send(escape_key)
+self.expect_prompt()
+self.child.sendline("breakpoint list")
+self.child.expect("2: file = '[^']*main.c', line = 3,.*")
+self.child.sendline("gui")
+self.child.expect_exact("Sources")
+
+# Go two lines down ("gui" resets position), set a breakpoint.
+self.child.send(down_key)
+self.child.send(down_key)
+self.child.send('b')
+self.child.send(escape_key)
+self.expect_prompt()
+self.child.sendline("breakpoint list")
+self.child.expect("2: file = '[^']*main.c', line = 3,")
+self.child.expect("3: file = '[^']*main.c', line = 4,")
+self.child.sendline("gui")
+self.child.expect_exact("Sources")
+
+# Toggle both the breakpoints (remove them).
+self.child.send(down_key)
+self.child.send('b')
+self.child.send(down_key)
+self.child.send('b')
+self.child.send(escape_key)
+self.expect_prompt()
+self.child.sendline("breakpoint list")
+self.child.expect_exact("No breakpoints currently set.")
+self.child.sendline("gui")
+self.child.expect_exact("Sources")
+
+# Press escape to quit the gui
+self.child.send(escape_key)
+
+self.expect_prompt()
+self.quit()
Index: lldb/test/API/commands/gui/breakpoints/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/gui/breakpoints/Makefile
@@ -0,0 +1,2 @@
+C_SOURCES := main.c
+include Makefile.rules


Index: lldb/test/API/commands/gui/breakpoints/main.c
===
--- /dev/null
+++ lldb/test/API/commands/gui/breakpoints/main.c
@@ -0,0 +1,6 @@
+int main(int argc, char **argv) {
+  int var1 = 1; // First break here
+  int var2 = 2;
+  int var3 = 3;
+  return var1 + var2 + var3;
+}
Index: lldb/test/API/commands/gui/breakpoints/TestGuiBreakpoints.py
===
--- /dev/null
+++ lldb/test/API/commands/gui/breakpoints/TestGuiBreakpoints.py
@@ -0,0 +1,75 @@
+"""
+Test the 'gui' shortcut 'b' (toggle breakpoint).
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class TestGuiBasicDebugCommandTest(PExpectTest):
+
+mydir = Tes

[Lldb-commits] [PATCH] D84957: [lldb/Process/Windows] Attempt to kill exited/detached process in not error

2020-08-03 Thread Tatyana Krasnukha via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe97c693bb0ec: [lldb/Process/Windows] Attempting to kill 
exited/detached process in not an… (authored by tatyana-krasnukha).

Changed prior to commit:
  https://reviews.llvm.org/D84957?vs=281989&id=282556#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84957

Files:
  lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp


Index: lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
+++ lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
@@ -227,22 +227,20 @@
 debugger_thread = m_session_data->m_debugger;
   }
 
-  Status error;
-  if (state != eStateExited && state != eStateDetached) {
-LLDB_LOG(
-log, "Shutting down process {0}.",
-debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
-error = debugger_thread->StopDebugging(true);
-
-// By the time StopDebugging returns, there is no more debugger thread, so
-// we can be assured that no other thread will race for the session data.
-m_session_data.reset();
-  } else {
-error.SetErrorStringWithFormat("cannot destroy process %" PRIx64
-   " while state = %d",
-   GetDebuggedProcessId(), state);
-LLDB_LOG(log, "error: {0}", error);
+  if (state == eStateExited || state == eStateDetached) {
+LLDB_LOG(log, "warning: cannot destroy process {0} while state = {1}.",
+ GetDebuggedProcessId(), state);
+return Status();
   }
+
+  LLDB_LOG(log, "Shutting down process {0}.",
+   debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
+  auto error = debugger_thread->StopDebugging(true);
+
+  // By the time StopDebugging returns, there is no more debugger thread, so
+  // we can be assured that no other thread will race for the session data.
+  m_session_data.reset();
+
   return error;
 }
 


Index: lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
===
--- lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
+++ lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
@@ -227,22 +227,20 @@
 debugger_thread = m_session_data->m_debugger;
   }
 
-  Status error;
-  if (state != eStateExited && state != eStateDetached) {
-LLDB_LOG(
-log, "Shutting down process {0}.",
-debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
-error = debugger_thread->StopDebugging(true);
-
-// By the time StopDebugging returns, there is no more debugger thread, so
-// we can be assured that no other thread will race for the session data.
-m_session_data.reset();
-  } else {
-error.SetErrorStringWithFormat("cannot destroy process %" PRIx64
-   " while state = %d",
-   GetDebuggedProcessId(), state);
-LLDB_LOG(log, "error: {0}", error);
+  if (state == eStateExited || state == eStateDetached) {
+LLDB_LOG(log, "warning: cannot destroy process {0} while state = {1}.",
+ GetDebuggedProcessId(), state);
+return Status();
   }
+
+  LLDB_LOG(log, "Shutting down process {0}.",
+   debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
+  auto error = debugger_thread->StopDebugging(true);
+
+  // By the time StopDebugging returns, there is no more debugger thread, so
+  // we can be assured that no other thread will race for the session data.
+  m_session_data.reset();
+
   return error;
 }
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] e97c693 - [lldb/Process/Windows] Attempting to kill exited/detached process in not an error

2020-08-03 Thread Tatyana Krasnukha via lldb-commits

Author: Tatyana Krasnukha
Date: 2020-08-03T12:52:43+03:00
New Revision: e97c693bb0ece2d9a2b0db75034927405fe3bfdf

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

LOG: [lldb/Process/Windows] Attempting to kill exited/detached process in not 
an error

The lldb test-suite on Windows reports a 'CLEANUP ERROR' when attempting to kill
an exited/detached process. This change makes ProcessWindows consistent with
the other processes which only log the error. After this change a number of
'CLEANUP ERROR' messages are now removed.

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

Added: 


Modified: 
lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp 
b/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
index 8a85c8ba6f4e..07a81cdf69cc 100644
--- a/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
@@ -227,22 +227,20 @@ Status ProcessDebugger::DestroyProcess(const 
lldb::StateType state) {
 debugger_thread = m_session_data->m_debugger;
   }
 
-  Status error;
-  if (state != eStateExited && state != eStateDetached) {
-LLDB_LOG(
-log, "Shutting down process {0}.",
-debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
-error = debugger_thread->StopDebugging(true);
-
-// By the time StopDebugging returns, there is no more debugger thread, so
-// we can be assured that no other thread will race for the session data.
-m_session_data.reset();
-  } else {
-error.SetErrorStringWithFormat("cannot destroy process %" PRIx64
-   " while state = %d",
-   GetDebuggedProcessId(), state);
-LLDB_LOG(log, "error: {0}", error);
+  if (state == eStateExited || state == eStateDetached) {
+LLDB_LOG(log, "warning: cannot destroy process {0} while state = {1}.",
+ GetDebuggedProcessId(), state);
+return Status();
   }
+
+  LLDB_LOG(log, "Shutting down process {0}.",
+   debugger_thread->GetProcess().GetNativeProcess().GetSystemHandle());
+  auto error = debugger_thread->StopDebugging(true);
+
+  // By the time StopDebugging returns, there is no more debugger thread, so
+  // we can be assured that no other thread will race for the session data.
+  m_session_data.reset();
+
   return error;
 }
 



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


[Lldb-commits] [PATCH] D84957: [lldb/Process/Windows] Attempt to kill exited/detached process in not error

2020-08-03 Thread Tatyana Krasnukha via Phabricator via lldb-commits
tatyana-krasnukha added a comment.

Thank you! I fixed the commit title and description as you suggested.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84957

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


[Lldb-commits] [PATCH] D85123: Truncate long lines/names if needed in lldb gui

2020-08-03 Thread Luboš Luňák via Phabricator via lldb-commits
llunak created this revision.
llunak added a reviewer: clayborg.
llunak requested review of this revision.

Without this, sources with long lines or variable names may overwrite panel 
frames, or even overrun to the following line. There's currently no way to 
scroll left/right in the views, so that should be added to handle these cases.
This commit includes fixing constness of some Window functions, and also makes 
PutCStringTruncated() consistent with the added printf-like variant to take the 
padding as the first argument (can't add it after the format to the printf-like 
function).


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D85123

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp
  lldb/test/API/commands/gui/viewlarge/Makefile
  lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
  lldb/test/API/commands/gui/viewlarge/main.c

Index: lldb/test/API/commands/gui/viewlarge/main.c
===
--- /dev/null
+++ lldb/test/API/commands/gui/viewlarge/main.c
@@ -0,0 +1,7 @@
+int main(int argc, char **argv) {
+  // This is to be viewed in a 80-column terminal, so make the line below more
+  // than 120 characters wide, to span at least two lines.
+  int a_variable_with_a_very_loong_name = 22;
+  int shortvar = 1;
+  return 0; // Break here
+}
Index: lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
===
--- /dev/null
+++ lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
@@ -0,0 +1,50 @@
+"""
+Test that the 'gui' displays long lines/names correctly without overruns.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class GuiViewLargeCommandTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+# PExpect uses many timeouts internally and doesn't play well
+# under ASAN on a loaded machine..
+@skipIfAsan
+@skipIfCursesSupportMissing
+@skipIfRemote # "run" command will not work correctly for remote debug
+def test_gui(self):
+self.build()
+
+# Limit columns to 80, so that long lines will not be displayed completely.
+self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,80))
+self.expect('br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
+
+escape_key = chr(27).encode()
+
+# Start the GUI and close the welcome window.
+self.child.sendline("gui")
+self.child.send(escape_key)
+
+# Check the sources window.
+self.child.expect_exact("Sources")
+# The string is copy&pasted from a 80-columns terminal. It will be followed by some
+# kind of an escape sequence (color, frame, etc.).
+self.child.expect_exact("int a_variable_with_a_very_looo"+chr(27))
+# The escape here checks that there's no content drawn by the previous line.
+self.child.expect_exact("int shortvar = 1;"+chr(27))
+
+# Check the variable window.
+self.child.expect_exact("Variables")
+self.child.expect_exact("(int) a_variable_with_a_very_looo"+chr(27))
+self.child.expect_exact("(int) shortvar = 1"+chr(27))
+
+# Press escape to quit the gui
+self.child.send(escape_key)
+
+self.expect_prompt()
+self.quit()
Index: lldb/test/API/commands/gui/viewlarge/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/gui/viewlarge/Makefile
@@ -0,0 +1,2 @@
+C_SOURCES := main.c
+include Makefile.rules
Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -362,23 +362,23 @@
   }
   void Clear() { ::wclear(m_window); }
   void Erase() { ::werase(m_window); }
-  Rect GetBounds() {
+  Rect GetBounds() const {
 return Rect(GetParentOrigin(), GetSize());
   } // Get the rectangle in our parent window
   int GetChar() { return ::wgetch(m_window); }
-  int GetCursorX() { return getcurx(m_window); }
-  int GetCursorY() { return getcury(m_window); }
-  Rect GetFrame() {
+  int GetCursorX() const { return getcurx(m_window); }
+  int GetCursorY() const { return getcury(m_window); }
+  Rect GetFrame() const {
 return Rect(Point(), GetSize());
   } // Get our rectangle in our own coordinate system
-  Point GetParentOrigin() { return Point(GetParentX(), GetParentY()); }
-  Size GetSize() { return Size(GetWidth(), GetHeight()); }
-  int GetParentX() { return getparx(m_window); }
-  int GetParentY() { return getpary(m_window); }
-  int GetMaxX() { return getmaxx(m_window);

[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-08-03 Thread Shu Anzai via Phabricator via lldb-commits
gedatsu217 added a comment.

  @skipIfAsan
  @skipIfEditlineSupportMissing
  def test_hidden_autosuggestion(self):
  @skipIfAsan
  @skipIfEditlineSupportMissing
  def test_autosuggestion(self):
  self.launch(extra_args=["-o", "settings set show-autosuggestion true", 
"-o", "settings set use-color true"])
  self.expect("help frame v")
  self.expect("help frame info")
  [type 'help frame v' and check for the three space after the grey part to 
cover up the "nfo" text]

Sorry, would you tell me about this code in more detail? Does this mean that I 
should make test_hidden_autosuggestion and test if there are spaces there? What 
is the difference between test_hidden_autosuggestion and test_autosuggestion?

> I don't think the value of m_previous_autosuggestion_size should only grow 
> (which is what this if is doing), as this way we just keep printing a longer 
> and longer space buffer over time. Just printing enough to clear the buffer 
> of the previous completion is enough.

If I keep the number of characters of the only previous command, I think there 
is a problem.  For example, If I type "help frame var" → "help frame info" → 
"help frame v", the remains are hidden. However, If I type  "help frame var" → 
"help frame info" → "help" → "help frame v", the number of characters of "help 
frame var" is more than that of "help", so "help frame v[aro]" is displayed. 
What do you think?

> Also you can just do this calculation directly after you calculated int 
> spaces_to_print above. This way this code is closer together which hopefully 
> makes this easier to understand.

For example, if the user executes a command directly after using 
tab-completion, Editline::TypedCharacter is not called, so spaces_to_print is 
not calculated. That is because I can calculate this here.

By the way, I found a bug again. The gray characters remain when only one 
character is completed by tab-completion.  
For instance, when I type "b" and press tab-key after I execute "breakpoint", b 
[eakpoint] is displayed. [eakpoint] should not be displayed.  This problem will 
be probably solved by my previous diff 
(https://reviews.llvm.org/D81001?id=276468). But this diff changes 
Editline::TabCommand significantly. Would you tell me a good way if any?


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

https://reviews.llvm.org/D81001

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


[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-08-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a comment.

In D81001#2190646 , @gedatsu217 wrote:

>   @skipIfAsan
>   @skipIfEditlineSupportMissing
>   def test_hidden_autosuggestion(self):
>   @skipIfAsan
>   @skipIfEditlineSupportMissing
>   def test_autosuggestion(self):
>   self.launch(extra_args=["-o", "settings set show-autosuggestion true", 
> "-o", "settings set use-color true"])
>   self.expect("help frame v")
>   self.expect("help frame info")
>   [type 'help frame v' and check for the three space after the grey part 
> to cover up the "nfo" text]
>
> Sorry, would you tell me about this code in more detail? Does this mean that 
> I should make test_hidden_autosuggestion and test if there are spaces there? 
> What is the difference between test_hidden_autosuggestion and 
> test_autosuggestion?

Every `Test*.py` file can have multiple `test_` methods that are each their own 
separate test. First the test suite would run `test_autosuggestion ` and then 
would run `test_hidden_autosuggestion`, but each is its own isolated test. My 
point was that the test with the spaces relies on having exactly two commands 
in that order in the command history to work, so you probably should make a new 
subtest for this so that the test doesn't break if someone extends the test and 
runs another command. So, if you *would* add the test for the spaces to the 
existing test, then if someone would add a command like `help frame va` to the 
history it would break.

>> I don't think the value of m_previous_autosuggestion_size should only grow 
>> (which is what this if is doing), as this way we just keep printing a longer 
>> and longer space buffer over time. Just printing enough to clear the buffer 
>> of the previous completion is enough.
>
> If I keep the number of characters of the only previous command, I think 
> there is a problem.  For example, If I type "help frame var" → "help frame 
> info" → "help frame v", the remains are hidden. However, If I type  "help 
> frame var" → "help frame info" → "help" → "help frame v", the number of 
> characters of "help frame var" is more than that of "help", so "help frame 
> v[aro]" is displayed. What do you think?

Not sure if I understand your example correctly, but as soon as you type "help 
frame ", you should have an autosuggestion of "help frame info" and then typing 
the "v" should clear the "nfo" part. The "help" autosuggestion should not be 
involved at all in any logic after you typed "help "?

>> Also you can just do this calculation directly after you calculated int 
>> spaces_to_print above. This way this code is closer together which hopefully 
>> makes this easier to understand.
>
> For example, if the user executes a command directly after using 
> tab-completion, Editline::TypedCharacter is not called, so spaces_to_print is 
> not calculated. That is because I can calculate this here.

Can you give me an example input where this breaks? I'm not sure how the tab 
completion would influence until what column we would need to overwrite the 
line buffer (that should still be the same).

> By the way, I found a bug again. The gray characters remain when only one 
> character is completed by tab-completion.  
> For instance, when I type "b" and press tab-key after I execute "breakpoint", 
> b [eakpoint] is displayed. [eakpoint] should not be displayed.  This problem 
> will be probably solved by my previous diff 
> (https://reviews.llvm.org/D81001?id=276468). But this diff changes 
> Editline::TabCommand significantly. Would you tell me a good way if any?

That probably comes from the fact that "b" is a command and we just insert a 
space when you tab complete it. And it seems the space we insert into the 
el_insertstr function doesn't seem to overwrite the existing buffer:

  switch (completion.GetMode()) { 
  case CompletionMode::Normal: {  
std::string to_add = completion.GetCompletion();  
to_add = to_add.substr(request.GetCursorArgumentPrefix().size()); 
if (request.GetParsedArg().IsQuoted())
  to_add.push_back(request.GetParsedArg().GetQuoteChar());
to_add.push_back(' '); <- here we add the space. Changing this to another 
character seems to correctly overwrite the buffer.  
 
el_insertstr(m_editline, to_add.c_str()); <- This space doesn't seem to 
overwrite the buffer? 
return CC_REFRESH;
  }

Did you try if your previous code fixes this issue?


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

https://reviews.llvm.org/D81001

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

[Lldb-commits] [PATCH] D85123: Truncate long lines/names if needed in lldb gui

2020-08-03 Thread Luboš Luňák via Phabricator via lldb-commits
llunak updated this revision to Diff 282607.
llunak added a comment.

Handle properly also the "<<< Thread 1: breakpoint 1.1"  marker.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D85123

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp
  lldb/test/API/commands/gui/viewlarge/Makefile
  lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
  lldb/test/API/commands/gui/viewlarge/main.c

Index: lldb/test/API/commands/gui/viewlarge/main.c
===
--- /dev/null
+++ lldb/test/API/commands/gui/viewlarge/main.c
@@ -0,0 +1,7 @@
+int main(int argc, char **argv) {
+  // This is to be viewed in a 80-column terminal, so make the line below more
+  // than 120 characters wide, to span at least two lines.
+  int a_variable_with_a_very_loong_name = 22;
+  int shortvar = 1;
+  return a_variable_with_a_very_loong_name; // Break here
+}
Index: lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
===
--- /dev/null
+++ lldb/test/API/commands/gui/viewlarge/TestGuiViewLarge.py
@@ -0,0 +1,52 @@
+"""
+Test that the 'gui' displays long lines/names correctly without overruns.
+"""
+
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test.lldbpexpect import PExpectTest
+
+class GuiViewLargeCommandTest(PExpectTest):
+
+mydir = TestBase.compute_mydir(__file__)
+
+# PExpect uses many timeouts internally and doesn't play well
+# under ASAN on a loaded machine..
+@skipIfAsan
+@skipIfCursesSupportMissing
+@skipIfRemote # "run" command will not work correctly for remote debug
+def test_gui(self):
+self.build()
+
+# Limit columns to 80, so that long lines will not be displayed completely.
+self.launch(executable=self.getBuildArtifact("a.out"), dimensions=(100,80))
+self.expect('br set -f main.c -p "// Break here"', substrs=["Breakpoint 1", "address ="])
+self.expect("run", substrs=["stop reason ="])
+
+escape_key = chr(27).encode()
+
+# Start the GUI and close the welcome window.
+self.child.sendline("gui")
+self.child.send(escape_key)
+
+# Check the sources window.
+self.child.expect_exact("Sources")
+# The string is copy&pasted from a 80-columns terminal. It will be followed by some
+# kind of an escape sequence (color, frame, etc.).
+self.child.expect_exact("int a_variable_with_a_very_looo"+chr(27))
+# The escape here checks that there's no content drawn by the previous line.
+self.child.expect_exact("int shortvar = 1;"+chr(27))
+# Check the triggered breakpoint marker on a long line.
+self.child.expect_exact("<<< Thread 1: breakpoint 1.1"+chr(27))
+
+# Check the variable window.
+self.child.expect_exact("Variables")
+self.child.expect_exact("(int) a_variable_with_a_very_looo"+chr(27))
+self.child.expect_exact("(int) shortvar = 1"+chr(27))
+
+# Press escape to quit the gui
+self.child.send(escape_key)
+
+self.expect_prompt()
+self.quit()
Index: lldb/test/API/commands/gui/viewlarge/Makefile
===
--- /dev/null
+++ lldb/test/API/commands/gui/viewlarge/Makefile
@@ -0,0 +1,2 @@
+C_SOURCES := main.c
+include Makefile.rules
Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -362,23 +362,23 @@
   }
   void Clear() { ::wclear(m_window); }
   void Erase() { ::werase(m_window); }
-  Rect GetBounds() {
+  Rect GetBounds() const {
 return Rect(GetParentOrigin(), GetSize());
   } // Get the rectangle in our parent window
   int GetChar() { return ::wgetch(m_window); }
-  int GetCursorX() { return getcurx(m_window); }
-  int GetCursorY() { return getcury(m_window); }
-  Rect GetFrame() {
+  int GetCursorX() const { return getcurx(m_window); }
+  int GetCursorY() const { return getcury(m_window); }
+  Rect GetFrame() const {
 return Rect(Point(), GetSize());
   } // Get our rectangle in our own coordinate system
-  Point GetParentOrigin() { return Point(GetParentX(), GetParentY()); }
-  Size GetSize() { return Size(GetWidth(), GetHeight()); }
-  int GetParentX() { return getparx(m_window); }
-  int GetParentY() { return getpary(m_window); }
-  int GetMaxX() { return getmaxx(m_window); }
-  int GetMaxY() { return getmaxy(m_window); }
-  int GetWidth() { return GetMaxX(); }
-  int GetHeight() { return GetMaxY(); }

[Lldb-commits] [PATCH] D85134: [lldb][AArch64] Correct compile options for Neon corefile

2020-08-03 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added subscribers: lldb-commits, danielkiss, kristof.beyls.
Herald added a reviewer: rengolin.
Herald added a project: LLDB.
DavidSpickett requested review of this revision.
Herald added a subscriber: JDevlieghere.

SVE is not required, it has its own test. Note that
there is no "+neon" so "+simd" is used instead.

Also rename the file to match the name of the corefile
it produces.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85134

Files:
  lldb/test/API/functionalities/postmortem/elf-core/aarch64-neon.c
  lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-neon.c


Index: lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-neon.c
===
--- lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-neon.c
+++ lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-neon.c
@@ -1,6 +1,6 @@
-// compile with -march=armv8-a+sve on compatible aarch64 compiler
-// linux-aarch64-sve.core was generated by: aarch64-linux-gnu-gcc-8
-// commandline: -march=armv8-a+sve -nostdlib -static -g linux-aarch64-sve.c
+// compile with -march=armv8-a+simd on compatible aarch64 compiler
+// linux-aarch64-neon.core was generated by: aarch64-linux-gnu-gcc-8
+// commandline: -march=armv8-a+simd -nostdlib -static -g linux-aarch64-neon.c
 static void bar(char *boom) {
   char F = 'b';
   asm volatile("fmov d0,  #0.5\n\t");


Index: lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-neon.c
===
--- lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-neon.c
+++ lldb/test/API/functionalities/postmortem/elf-core/linux-aarch64-neon.c
@@ -1,6 +1,6 @@
-// compile with -march=armv8-a+sve on compatible aarch64 compiler
-// linux-aarch64-sve.core was generated by: aarch64-linux-gnu-gcc-8
-// commandline: -march=armv8-a+sve -nostdlib -static -g linux-aarch64-sve.c
+// compile with -march=armv8-a+simd on compatible aarch64 compiler
+// linux-aarch64-neon.core was generated by: aarch64-linux-gnu-gcc-8
+// commandline: -march=armv8-a+simd -nostdlib -static -g linux-aarch64-neon.c
 static void bar(char *boom) {
   char F = 'b';
   asm volatile("fmov d0,  #0.5\n\t");
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85134: [lldb][AArch64] Correct compile options for Neon corefile

2020-08-03 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added a reviewer: omjavaid.
DavidSpickett added a comment.

Originally added in https://reviews.llvm.org/D77793.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85134

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


[Lldb-commits] [PATCH] D81001: [lldb] Display autosuggestion part in gray if there is one possible suggestion

2020-08-03 Thread Shu Anzai via Phabricator via lldb-commits
gedatsu217 added a comment.

>>> I don't think the value of m_previous_autosuggestion_size should only grow 
>>> (which is what this if is doing), as this way we just keep printing a 
>>> longer and longer space buffer over time. Just printing enough to clear the 
>>> buffer of the previous completion is enough.
>>
>> If I keep the number of characters of the only previous command, I think 
>> there is a problem. For example, If I type "help frame var" → "help frame 
>> info" → "help frame v", the remains are hidden. However, If I type "help 
>> frame var" → "help frame info" → "help" → "help frame v", the number of 
>> characters of "help frame var" is more than that of "help", so "help frame 
>> v[aro]" is displayed. What do you think?
>
> Not sure if I understand your example correctly, but as soon as you type 
> "help frame ", you should have an autosuggestion of "help frame info" and 
> then typing the "v" should clear the "nfo" part. The "help" autosuggestion 
> should not be involved at all in any logic after you typed "help "?

What I mean is that if I should keep the length of characters of the only 
previous command, following thing occurs.

1. execution "help frame var" and m_previous_autosuggestion_size = len("help 
frame var") = 14
2. execution "help frame info" and m_previous_autosuggestion_size = len("help 
frame info") = 15
3. execution "help" and m_previous_autosuggestion_size = len("help") = 4
4. Typing "help frame v". Then, spaces_to_print = 
m_previous_autosuggestion_size - line.size() - to_add.getValue().length() = 4 - 
12 - 2 < 0. So, spaces are not added. (In short, "help frame v[aro]" is 
displayed.)

(Maybe, I do not understand what you say. )

>>> Also you can just do this calculation directly after you calculated int 
>>> spaces_to_print above. This way this code is closer together which 
>>> hopefully makes this easier to understand.
>>
>> For example, if the user executes a command directly after using 
>> tab-completion, Editline::TypedCharacter is not called, so spaces_to_print 
>> is not calculated. That is because I can calculate this here.
>
> Can you give me an example input where this breaks? I'm not sure how the tab 
> completion would influence until what column we would need to overwrite the 
> line buffer (that should still be the same).

If m_previous_autosuggestion_size is calculated in Editline::TypedCharacter,

1. Execution "help frame info", m_previous_autosuggestion_size = len("help 
frame info") = 15
2. Typing "help frame va" and pressing tab-key. "help frame variable" is 
executed. m_previous_autosuggestion_size = len("help frame va") = 13. (because 
m_previous_autosuggestion_size is not calculated in Editline::TabCommand.)
3. Typing "help frame i". Then, spaces_to_print = 
m_previous_autosuggestion_size - line.size() - to_add.getValue().length() = 13 
- 12 - 3 < 0. So, spaces are not added. "help frame i[nfoable] is displayed.

> Did you try if your previous code fixes this issue?

Not yet. I will try it.


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

https://reviews.llvm.org/D81001

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


[Lldb-commits] [PATCH] D84966: Remove special Hexagon packet traversal code

2020-08-03 Thread Ted Woodward via Phabricator via lldb-commits
ted updated this revision to Diff 282640.
ted added a comment.

Fixed formatting flagged by Lint: Pre-merge checks


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84966

Files:
  lldb/include/lldb/Core/Disassembler.h
  lldb/source/Core/Disassembler.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/ThreadPlanStepRange.cpp

Index: lldb/source/Target/ThreadPlanStepRange.cpp
===
--- lldb/source/Target/ThreadPlanStepRange.cpp
+++ lldb/source/Target/ThreadPlanStepRange.cpp
@@ -327,13 +327,9 @@
   if (instructions == nullptr)
 return false;
   else {
-Target &target = GetThread().GetProcess()->GetTarget();
 const bool ignore_calls = GetKind() == eKindStepOverRange;
-uint32_t branch_index =
-instructions->GetIndexOfNextBranchInstruction(pc_index, target,
-  ignore_calls, 
-  &m_found_calls);
-
+uint32_t branch_index = instructions->GetIndexOfNextBranchInstruction(
+pc_index, ignore_calls, &m_found_calls);
 Address run_to_address;
 
 // If we didn't find a branch, run to the end of the range.
Index: lldb/source/Target/Process.cpp
===
--- lldb/source/Target/Process.cpp
+++ lldb/source/Target/Process.cpp
@@ -5947,10 +5947,8 @@
 return retval;
   }
 
-  uint32_t branch_index =
-  insn_list->GetIndexOfNextBranchInstruction(insn_offset, target,
- false /* ignore_calls*/,
- nullptr);
+  uint32_t branch_index = insn_list->GetIndexOfNextBranchInstruction(
+  insn_offset, false /* ignore_calls*/, nullptr);
   if (branch_index == UINT32_MAX) {
 return retval;
   }
Index: lldb/source/Core/Disassembler.cpp
===
--- lldb/source/Core/Disassembler.cpp
+++ lldb/source/Core/Disassembler.cpp
@@ -990,17 +990,15 @@
 
 uint32_t
 InstructionList::GetIndexOfNextBranchInstruction(uint32_t start,
- Target &target,
  bool ignore_calls,
  bool *found_calls) const {
   size_t num_instructions = m_instructions.size();
 
   uint32_t next_branch = UINT32_MAX;
-  size_t i;
   
   if (found_calls)
 *found_calls = false;
-  for (i = start; i < num_instructions; i++) {
+  for (size_t i = start; i < num_instructions; i++) {
 if (m_instructions[i]->DoesBranch()) {
   if (ignore_calls && m_instructions[i]->IsCall()) {
 if (found_calls)
@@ -1012,42 +1010,6 @@
 }
   }
 
-  // Hexagon needs the first instruction of the packet with the branch. Go
-  // backwards until we find an instruction marked end-of-packet, or until we
-  // hit start.
-  if (target.GetArchitecture().GetTriple().getArch() == llvm::Triple::hexagon) {
-// If we didn't find a branch, find the last packet start.
-if (next_branch == UINT32_MAX) {
-  i = num_instructions - 1;
-}
-
-while (i > start) {
-  --i;
-
-  Status error;
-  uint32_t inst_bytes;
-  bool prefer_file_cache = false; // Read from process if process is running
-  lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
-  target.ReadMemory(m_instructions[i]->GetAddress(), prefer_file_cache,
-&inst_bytes, sizeof(inst_bytes), error, &load_addr);
-  // If we have an error reading memory, return start
-  if (!error.Success())
-return start;
-  // check if this is the last instruction in a packet bits 15:14 will be
-  // 11b or 00b for a duplex
-  if (((inst_bytes & 0xC000) == 0xC000) ||
-  ((inst_bytes & 0xC000) == 0x)) {
-// instruction after this should be the start of next packet
-next_branch = i + 1;
-break;
-  }
-}
-
-if (next_branch == UINT32_MAX) {
-  // We couldn't find the previous packet, so return start
-  next_branch = start;
-}
-  }
   return next_branch;
 }
 
Index: lldb/include/lldb/Core/Disassembler.h
===
--- lldb/include/lldb/Core/Disassembler.h
+++ lldb/include/lldb/Core/Disassembler.h
@@ -279,9 +279,6 @@
   /// @param[in] start
   /// The instruction index of the first instruction to check.
   ///
-  /// @param[in] target
-  /// A LLDB target object that is used to resolve addresses.
-  ///
   /// @param[in] ignore_calls
   /// It true, then fine the first branch instruction that isn't
   /// a function call (a branch that calls and returns to the next
@@ -298,7 +295,6 @@
   /// found.
   //--
   uint32_t GetIndexOfNe

[Lldb-commits] [PATCH] D85145: Use syntax highlighting also in gui mode

2020-08-03 Thread Luboš Luňák via Phabricator via lldb-commits
llunak created this revision.
llunak added a reviewer: clayborg.
llunak requested review of this revision.

Use the same functionality as the non-gui mode, the colors just need 
translating to curses colors.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D85145

Files:
  lldb/source/Core/IOHandlerCursesGUI.cpp

Index: lldb/source/Core/IOHandlerCursesGUI.cpp
===
--- lldb/source/Core/IOHandlerCursesGUI.cpp
+++ lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -391,11 +391,11 @@
 ::wbkgd(m_window, COLOR_PAIR(color_pair_idx));
   }
 
-  void PutCStringTruncated(int right_pad, const char *s) {
+  void PutCStringTruncated(int right_pad, const char *s, int len = -1) {
 int bytes_left = GetWidth() - GetCursorX();
 if (bytes_left > right_pad) {
   bytes_left -= right_pad;
-  ::waddnstr(m_window, s, bytes_left);
+  ::waddnstr(m_window, s, len < 0 ? bytes_left : std::min(bytes_left, len));
 }
   }
 
@@ -455,6 +455,61 @@
 return std::min(length, std::max(0, GetWidth() - GetCursorX() - 1));
   }
 
+  // Curses doesn't allow direct output of color escape sequences, but that's
+  // how we get source lines from the Highligher class. Read the line and
+  // convert color escape sequences to curses color attributes.
+  void OutputColoredStringTruncated(int right_pad, const StringRef &string,
+bool blue) {
+int last_text = -1;  // Last position in string that's been written.
+int text_length = 0; // Size of normal characters to be written.
+attr_t saved_attr;
+short saved_pair;
+int saved_opts;
+::wattr_get(m_window, &saved_attr, &saved_pair, &saved_opts);
+if (blue)
+  ::wattron(m_window, COLOR_PAIR(16));
+for (size_t i = 0; i < string.size(); ++i) {
+  if (string[i] != '\x1b') { // esc
+++text_length;
+continue;
+  } else {
+if (text_length > 0) {
+  PutCStringTruncated(right_pad, string.data() + last_text + 1,
+  text_length);
+  text_length = 0;
+}
+++i;
+// Our Highlighter doesn't use any other escape sequences.
+assert(string[i] == '[');
+++i;
+const int esc_start = i;
+while (string[i] != 'm') {
+  // No semicolons, our Highlighter doesn't use them.
+  assert(string[i] >= '0' && string[i] <= '9');
+  ++i;
+  assert(i < string.size());
+}
+const int value = atoi(string.data() + esc_start);
+if (value == 0) { // Reset.
+  ::wattr_set(m_window, saved_attr, saved_pair, &saved_opts);
+  if (blue)
+::wattron(m_window, COLOR_PAIR(16));
+} else {
+  // Only 8 basic foreground colors, our Highlighter doesn't use
+  // anything else.
+  assert(value >= 30 && value <= 37);
+  // Mapped directly to first 16 color pairs (black/blue background).
+  ::wattron(m_window, COLOR_PAIR(value - 30 + 1 + (blue ? 8 : 0)));
+}
+last_text = i;
+  }
+}
+if (text_length > 0)
+  PutCStringTruncated(right_pad, string.data() + last_text + 1,
+  text_length);
+::wattr_set(m_window, saved_attr, saved_pair, &saved_opts);
+  }
+
   void Touch() {
 ::touchwin(m_window);
 if (m_parent)
@@ -543,7 +598,7 @@
   void DrawTitleBox(const char *title, const char *bottom_message = nullptr) {
 attr_t attr = 0;
 if (IsActive())
-  attr = A_BOLD | COLOR_PAIR(2);
+  attr = A_BOLD | COLOR_PAIR(18);
 else
   attr = 0;
 if (attr)
@@ -944,9 +999,9 @@
   } else {
 const int shortcut_key = m_key_value;
 bool underlined_shortcut = false;
-const attr_t hilgight_attr = A_REVERSE;
+const attr_t highlight_attr = A_REVERSE;
 if (highlight)
-  window.AttributeOn(hilgight_attr);
+  window.AttributeOn(highlight_attr);
 if (llvm::isPrint(shortcut_key)) {
   size_t lower_pos = m_name.find(tolower(shortcut_key));
   size_t upper_pos = m_name.find(toupper(shortcut_key));
@@ -973,18 +1028,18 @@
 }
 
 if (highlight)
-  window.AttributeOff(hilgight_attr);
+  window.AttributeOff(highlight_attr);
 
 if (m_key_name.empty()) {
   if (!underlined_shortcut && llvm::isPrint(m_key_value)) {
-window.AttributeOn(COLOR_PAIR(3));
+window.AttributeOn(COLOR_PAIR(19));
 window.Printf(" (%c)", m_key_value);
-window.AttributeOff(COLOR_PAIR(3));
+window.AttributeOff(COLOR_PAIR(19));
   }
 } else {
-  window.AttributeOn(COLOR_PAIR(3));
+  window.AttributeOn(COLOR_PAIR(19));
   window.Printf(" (%s)", m_key_name.c_str());
-  window.AttributeOff(COLOR_PAIR(3));
+  window.AttributeOff(COLOR_PAIR(19));
 }
   }
 }
@@ -996,7 +1051,7 @@
   Menu::Type menu_type = GetType();
   switch (menu_type) {
   case Menu::Type::Bar: {
-window.SetBackground(2);
+windo

[Lldb-commits] [PATCH] D85145: Use syntax highlighting also in gui mode

2020-08-03 Thread Raphael Isemann via Phabricator via lldb-commits
teemperor added a reviewer: teemperor.
teemperor added a comment.

Btw, the highlighter supports any kind of delimiter string when 'highlighting' 
source. So you could add a parameter for a custom highlighter too and then pass 
a more convenient highlighter 'style' in to make the parsing simpler. See the 
only call MakeVimStyle (which generates the style that adds the color escapes) 
and the HighlighterStyle where you can set any kind of delimiter.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D85145

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


[Lldb-commits] [PATCH] D84555: [lldb-vscode ]Add Syntax Highlighting to Disassembly View

2020-08-03 Thread Yifan Shen via Phabricator via lldb-commits
aelitashen updated this revision to Diff 282703.
aelitashen added a comment.
Herald added a subscriber: JDevlieghere.

Cover ARM and ARM64 case in disassembly syntax highlighting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84555

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  llvm/utils/vscode/llvm/disasm_sample/arm.disasm
  llvm/utils/vscode/llvm/disasm_sample/arm64.disasm
  llvm/utils/vscode/llvm/disasm_sample/x86.disasm
  llvm/utils/vscode/llvm/package.json
  llvm/utils/vscode/llvm/syntaxes/disassembly.json

Index: llvm/utils/vscode/llvm/syntaxes/disassembly.json
===
--- /dev/null
+++ llvm/utils/vscode/llvm/syntaxes/disassembly.json
@@ -0,0 +1,64 @@
+{
+  "name": "Disassembly",
+  "scopeName": "source.disassembly",
+  "uuid": "9ade615f-5d82-4ac5-b22f-a1998c356ebe",
+  "patterns": [
+{
+  "comment": "x86 Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^([A-Za-z0-9]+):\\s([A-Z0-9]{2}\\s)+>?\\s+(\\w+)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "ARM Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^libIGL.so\\[([A-Za-z0-9]+)\\]\\s+(\\<\\+[0-9]*\\>):\\s+([A-Za-z]+.?[A-Za-z]*)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "ARM64 Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^liblog.so\\[([A-Za-z0-9]+)\\]\\s+(\\<\\+[0-9]*\\>):\\s+([A-Za-z]+.?[A-Za-z]*)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "Numeric constant",
+  "name": "constant.numeric",
+  "match": "(\\$|\\b)((0x)|[0-9])[A-Za-z0-9]+\\b"
+},
+{
+  "comment": "x86 Register",
+  "name": "variable.language",
+  "match": "%[A-Za-z][A-Za-z0-9]*"
+},
+{
+  "comment": "ARM Register",
+  "name": "variable.language",
+  "match": "r\\d+"
+},
+{
+  "comment": "ARM Register Shortnames",
+  "name": "variable.language",
+  "match": "(fp|sp|lr|pc|wzr|xzr)"
+},
+{
+  "comment": "ARM64 Register",
+  "name": "variable.language",
+  "match": "(x|w)[0-9]+"
+},
+{
+  "comment": "End of line comment",
+  "name": "comment.line.semicolon",
+  "match": ";.*$"
+}
+  ]
+}
Index: llvm/utils/vscode/llvm/package.json
===
--- llvm/utils/vscode/llvm/package.json
+++ llvm/utils/vscode/llvm/package.json
@@ -39,6 +39,15 @@
 ".ll"
 ],
 "configuration": "./language-configuration.json"
+},
+{
+"id": "lldb.disassembly",
+"aliases": [
+"Disassembly"
+],
+"extensions": [
+".disasm"
+]
 }
 ],
 "grammars": [
@@ -51,6 +60,11 @@
 "language": "llvm",
 "scopeName": "source.llvm",
 "path": "./syntaxes/ll.tmLanguage.json"
+},
+{
+"language": "lldb.disassembly",
+"scopeName": "source.disassembly",
+"path": "./syntaxes/disassembly.json"
 }
 ],
 "taskDefinitions": [
Index: llvm/utils/vscode/llvm/disasm_sample/x86.disasm
===
--- /dev/null
+++ llvm/utils/vscode/llvm/disasm_sample/x86.disasm
@@ -0,0 +1,28 @@
+0x18000: <0> popq %rdi
+0x18001: <1>pushq $0x0
+0x18003: <3> movq %rsp, %rbp
+0x18006: <6> andq $-0x10, %rsp
+0x1800A: <10>subq $0x10, %rsp
+0x1800E: <14>movl 0x8(%rbp), %esi
+0x18011: <17>leaq 0x10(%rbp), %rdx
+0x18015: <21>leaq -0x101c(%rip), %rcx
+0x1801C: <28>leaq -0x8(%rbp), %r8
+0x18020: <32>   callq 0x18062# dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*)
+0x18025: <37>movq -0x8(%rbp), %rdi
+0x18029: <41>cmpq $0x0, %rdi
+0x1802D: <45> jne 0x1803f# <+63>
+0x1802F: <47>movq %rbp, %rsp
+0x18032: <50>addq $0x8, %rsp
+0x18036: <54>movq $0x0, %rbp
+0x1803D: <61>jmpq *%rax
+0x1803F: <63>addq $0x10, %rsp
+0x18043: <67>   pushq %rdi
+0x18044: <68>movq 0x8(%rbp), %rdi
+0x18048: <72>leaq 0x10(%rbp), %rsi
+0x1804C: <76>  

[Lldb-commits] [PATCH] D84555: [lldb-vscode ]Add Syntax Highlighting to Disassembly View

2020-08-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

Move the sample files to the syntaxes folder.
Besides, the path /llvm/syntaxes/disassembly.json should just be 
syntaxes/disassembly.json. There's no need to have that llvm subfolder there


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84555

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


[Lldb-commits] [PATCH] D85145: Use syntax highlighting also in gui mode

2020-08-03 Thread Luboš Luňák via Phabricator via lldb-commits
llunak added a comment.

In D85145#2191421 , @teemperor wrote:

> Btw, the highlighter supports any kind of delimiter string when 
> 'highlighting' source. So you could add a parameter for a custom highlighter 
> too and then pass a more convenient highlighter 'style' in to make the 
> parsing simpler. See the only call MakeVimStyle (which generates the style 
> that adds the color escapes) and the HighlighterStyle where you can set any 
> kind of delimiter.

I think I don't want to do that. The gui mode should preferably use the same 
highlighting as the non-gui one, so if I added a new style, the colors would 
still need to be mapped somewhen. Moreover the ^[m style parser is 
actually pretty simple, much simpler than I was originally afraid it'd be, and 
possibly it could be later needed for something else too.


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D85145

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


[Lldb-commits] [PATCH] D85158: [intel-pt] Refactor 3: refactor PTDecoder into SBPTProcess

2020-08-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace created this revision.
wallace added reviewers: clayborg, kusmour.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.
wallace requested review of this revision.
Herald added a subscriber: JDevlieghere.

Depends on D85070 .
I don't think PTDecoder is structured very well, and the name is also 
misleading,
and it doesn't just "decode". Given that the Python API generation has been
broken for a long time and that one of my recent patches fix it, I assume
there's no problem in changing the API, as there has been no users.

A first fundamental change I want to do is to stop having PTDecoder as a top
level class that receives an SBProcess for any action it needs to do. The
existing way requires  a good amount of boilerplate code here and there with
little to no benefit. 
Instead, I'm renaming it into SBPTProcess. I think the SB is consistent with the
LLDB SB API, and this class now directly manages one SBProcess. This means that
whenever you want to trace or decode an SBProcess, you create a SBPTProcess
class, which is easier to reason about in an OOP way.

I've updated the test accordingly, and I've noticed that the code is now much
simpler, with less faiture points and checks.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85158

Files:
  lldb/test/API/tools/intel-features/intel-pt/test/TestIntelPTSimpleBinary.py
  lldb/tools/intel-features/intel-pt/include/intel-pt/API/PTDecoder.h
  lldb/tools/intel-features/intel-pt/include/intel-pt/API/SBPTProcess.h
  lldb/tools/intel-features/intel-pt/include/intel-pt/API/cli-wrapper-pt.h
  lldb/tools/intel-features/intel-pt/include/intel-pt/Core/Decoder.h
  lldb/tools/intel-features/intel-pt/include/intel-pt/Core/PTProcess.h
  lldb/tools/intel-features/intel-pt/interface/PTDecoder.i
  lldb/tools/intel-features/intel-pt/interface/SBPTProcess.i
  lldb/tools/intel-features/intel-pt/source/API/CMakeLists.txt
  lldb/tools/intel-features/intel-pt/source/API/PTDecoder.cpp
  lldb/tools/intel-features/intel-pt/source/API/SBPTProcess.cpp
  lldb/tools/intel-features/intel-pt/source/API/cli-wrapper-pt.cpp
  lldb/tools/intel-features/intel-pt/source/Core/CMakeLists.txt
  lldb/tools/intel-features/intel-pt/source/Core/Decoder.cpp
  lldb/tools/intel-features/intel-pt/source/Core/PTProcess.cpp
  lldb/tools/intel-features/scripts/lldb-intel-features.swig

Index: lldb/tools/intel-features/scripts/lldb-intel-features.swig
===
--- lldb/tools/intel-features/scripts/lldb-intel-features.swig
+++ lldb/tools/intel-features/scripts/lldb-intel-features.swig
@@ -20,7 +20,7 @@
 
 %{
 #include "lldb/lldb-public.h"
-#include "intel-pt/API/PTDecoder.h"
+#include "intel-pt/API/SBPTProcess.h"
 using namespace intelpt;
 %}
 
@@ -31,4 +31,4 @@
 %include "python-typemaps.txt"
 
 /* Feature specific python interface files*/
-%include "../intel-pt/interface/PTDecoder.i"
+%include "../intel-pt/interface/SBPTProcess.i"
Index: lldb/tools/intel-features/intel-pt/source/Core/PTProcess.cpp
===
--- lldb/tools/intel-features/intel-pt/source/Core/PTProcess.cpp
+++ lldb/tools/intel-features/intel-pt/source/Core/PTProcess.cpp
@@ -1,4 +1,4 @@
-//===-- Decoder.cpp -*- C++ -*-===//
+//===-- PTProcess.cpp ---*- C++ -*-===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,7 +6,7 @@
 //
 //===--===//
 
-#include "intel-pt/Core/Decoder.h"
+#include "intel-pt/Core/PTProcess.h"
 
 // C/C++ Includes
 #include 
@@ -18,77 +18,37 @@
 
 using namespace intelpt_private;
 
-// This function removes entries of all the processes/threads which were once
+// This function removes entries of all the threads which were once
 // registered in the class but are not alive anymore because they died or
 // finished executing.
-void Decoder::RemoveDeadProcessesAndThreads(lldb::SBProcess &sbprocess) {
-  lldb::SBTarget sbtarget = sbprocess.GetTarget();
-  lldb::SBDebugger sbdebugger = sbtarget.GetDebugger();
-  uint32_t num_targets = sbdebugger.GetNumTargets();
-
-  auto itr_process = m_mapProcessUID_mapThreadID_TraceInfo.begin();
-  while (itr_process != m_mapProcessUID_mapThreadID_TraceInfo.end()) {
-bool process_found = false;
-lldb::SBTarget target;
-lldb::SBProcess process;
-for (uint32_t i = 0; i < num_targets; i++) {
-  target = sbdebugger.GetTargetAtIndex(i);
-  process = target.GetProcess();
-  if (process.GetUniqueID() == itr_process->first) {
-process_found = true;
-break;
-  }
-}
-
-// Remove the process's entry if it was not found in SBDebugger
-if (!process_found) {
-  itr_process = m_mapProcessUID_mapThread

[Lldb-commits] [PATCH] D84555: [lldb-vscode ]Add Syntax Highlighting to Disassembly View

2020-08-03 Thread Yifan Shen via Phabricator via lldb-commits
aelitashen updated this revision to Diff 282720.
aelitashen added a comment.

Move everything to the right place


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84555

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  lldb/tools/lldb-vscode/package.json
  lldb/tools/lldb-vscode/syntaxes/arm.disasm
  lldb/tools/lldb-vscode/syntaxes/arm64.disasm
  lldb/tools/lldb-vscode/syntaxes/disassembly.json
  lldb/tools/lldb-vscode/syntaxes/x86.disasm

Index: lldb/tools/lldb-vscode/syntaxes/x86.disasm
===
--- /dev/null
+++ lldb/tools/lldb-vscode/syntaxes/x86.disasm
@@ -0,0 +1,28 @@
+0x18000: <0> popq %rdi
+0x18001: <1>pushq $0x0
+0x18003: <3> movq %rsp, %rbp
+0x18006: <6> andq $-0x10, %rsp
+0x1800A: <10>subq $0x10, %rsp
+0x1800E: <14>movl 0x8(%rbp), %esi
+0x18011: <17>leaq 0x10(%rbp), %rdx
+0x18015: <21>leaq -0x101c(%rip), %rcx
+0x1801C: <28>leaq -0x8(%rbp), %r8
+0x18020: <32>   callq 0x18062# dyldbootstrap::start(dyld3::MachOLoaded const*, int, char const**, dyld3::MachOLoaded const*, unsigned long*)
+0x18025: <37>movq -0x8(%rbp), %rdi
+0x18029: <41>cmpq $0x0, %rdi
+0x1802D: <45> jne 0x1803f# <+63>
+0x1802F: <47>movq %rbp, %rsp
+0x18032: <50>addq $0x8, %rsp
+0x18036: <54>movq $0x0, %rbp
+0x1803D: <61>jmpq *%rax
+0x1803F: <63>addq $0x10, %rsp
+0x18043: <67>   pushq %rdi
+0x18044: <68>movq 0x8(%rbp), %rdi
+0x18048: <72>leaq 0x10(%rbp), %rsi
+0x1804C: <76>leaq 0x8(%rsi,%rdi,8), %rdx
+0x18051: <81>movq %rdx, %rcx
+0x18054: <84>movq (%rcx), %r8
+0x18057: <87>addq $0x8, %rcx
+0x1805B: <91>   testq %r8, %r8
+0x1805E: <94> jne 0x18054# <+84>
+0x18060: <96>jmpq *%rax
Index: lldb/tools/lldb-vscode/syntaxes/disassembly.json
===
--- /dev/null
+++ lldb/tools/lldb-vscode/syntaxes/disassembly.json
@@ -0,0 +1,64 @@
+{
+  "name": "Disassembly",
+  "scopeName": "source.disassembly",
+  "uuid": "9ade615f-5d82-4ac5-b22f-a1998c356ebe",
+  "patterns": [
+{
+  "comment": "x86 Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^([A-Za-z0-9]+):\\s([A-Z0-9]{2}\\s)+>?\\s+(\\w+)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "ARM Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^libIGL.so\\[([A-Za-z0-9]+)\\]\\s+(\\<\\+[0-9]*\\>):\\s+([A-Za-z]+.?[A-Za-z]*)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "ARM64 Address, bytes and opcode",
+  "name": "meta.instruction",
+  "match": "^liblog.so\\[([A-Za-z0-9]+)\\]\\s+(\\<\\+[0-9]*\\>):\\s+([A-Za-z]+.?[A-Za-z]*)",
+  "captures": {
+"1": {"name": "constant.numeric"},
+"3": {"name": "keyword.opcode"}
+  }
+},
+{
+  "comment": "Numeric constant",
+  "name": "constant.numeric",
+  "match": "(\\$|\\b)((0x)|[0-9])[A-Za-z0-9]+\\b"
+},
+{
+  "comment": "x86 Register",
+  "name": "variable.language",
+  "match": "%[A-Za-z][A-Za-z0-9]*"
+},
+{
+  "comment": "ARM Register",
+  "name": "variable.language",
+  "match": "r\\d+"
+},
+{
+  "comment": "ARM Register Shortnames",
+  "name": "variable.language",
+  "match": "(fp|sp|lr|pc|wzr|xzr)"
+},
+{
+  "comment": "ARM64 Register",
+  "name": "variable.language",
+  "match": "(x|w)[0-9]+"
+},
+{
+  "comment": "End of line comment",
+  "name": "comment.line.semicolon",
+  "match": ";.*$"
+}
+  ]
+}
Index: lldb/tools/lldb-vscode/syntaxes/arm64.disasm
===
--- /dev/null
+++ lldb/tools/lldb-vscode/syntaxes/arm64.disasm
@@ -0,0 +1,91 @@
+(lldb) disassemble --name __android_log_config_read
+liblog.so`::__android_log_config_read():
+liblog.so[0x6014] <+0>:   stpx22, x21, [sp, #-0x30]!
+liblog.so[0x6018] <+4>:   stpx20, x19, [sp, #0x10]
+liblog.so[0x601c] <+8>:   stpx29, x30, [sp, #0x20]
+liblog.so[0x6020] <+12>:  addx29, sp, #0x20; =0x20
+liblog.so[0x6024] <+16>:  adrp   x8, 15
+liblog.so[0x6028] <+20>:  ldrx8, [x8, #0x230]
+liblog.so[0x602c] <+24>:  ldrw8, [x8]
+liblog.so[0x6030] <+28>:  cbzw8, 0x6038; <+36> at config_read.cpp
+liblog.so[0x

[Lldb-commits] [PATCH] D84810: [intel-pt] Simplify Python API configuration

2020-08-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace abandoned this revision.
wallace added a comment.
Herald added a subscriber: JDevlieghere.

After syncing up with Greg, we decided to redo this in a different way


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84810

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


[Lldb-commits] [PATCH] D85068: [intel-pt] Refactor 1: rename the namespace

2020-08-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace abandoned this revision.
wallace added a comment.

After syncing up with Greg, we decided to redo this in a different way


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85068

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


[Lldb-commits] [PATCH] D85158: [intel-pt] Refactor 3: refactor PTDecoder into SBPTProcess

2020-08-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace abandoned this revision.
wallace added a comment.

After syncing up with Greg, we decided to redo this in a different way


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85158

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


[Lldb-commits] [PATCH] D85070: [intel-pt] Refactor 2: create a new folder structure

2020-08-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace abandoned this revision.
wallace added a comment.

After syncing up with Greg, we decided to redo this in a different way


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85070

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


[Lldb-commits] [PATCH] D84791: [intel-pt] Fix python support and add a full python test

2020-08-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace abandoned this revision.
wallace added a comment.
Herald added a subscriber: JDevlieghere.

After syncing up with Greg, we decided to redo this in a different way


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84791

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


[Lldb-commits] [PATCH] D84269: [lldb] Add some example type anotations to python.swig

2020-08-03 Thread Nathan Lanza via Phabricator via lldb-commits
lanza added a comment.
Herald added a subscriber: JDevlieghere.

Sounds good, just sent out a message to the mailing list.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84269

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


[Lldb-commits] [PATCH] D84555: [lldb-vscode ]Add Syntax Highlighting to Disassembly View

2020-08-03 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

Looks better. Can we test this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84555

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


[Lldb-commits] [PATCH] D85049: Unify the code that updates the ArchSpec after finding a fat binary with how it is done for a lean binary

2020-08-03 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

It would be nice to (in a follow-up-patch) clearly state what this function's 
goal is and then re-implement it with slightly fewer fallbacks. The code as it 
is is very convoluted.


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

https://reviews.llvm.org/D85049

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


[Lldb-commits] [PATCH] D84263: [debugserver/Apple Silicon] Handoff connections when attaching to translated processes

2020-08-03 Thread Davide Italiano via Phabricator via lldb-commits
davide closed this revision.
davide added a comment.

https://github.com/llvm/llvm-project/commit/57605758b5de3726eec1d6e587de1003af1ab5b7


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

https://reviews.llvm.org/D84263

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


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
rupprecht requested review of this revision.
Herald added a subscriber: JDevlieghere.

If the test suite is misconfigured when it's run (a bad regexp, wrong test 
directory, etc.), the test suite may not discover any tests. When this happens, 
the test runner exits happily because no tests failed:

  Ran 0 tests in 0.000s
  RESULT: PASSED (0 passes, 0 failures, 0 errors, 0 skipped, 0 expected 
failures, 0 unexpected successes)

Change this to return an error so the misconfiguration can be more easily 
detected. Verified that `lldb-dotest -p TestDoesNotExist.py` successfully fails.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85169

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 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.

LGTM




Comment at: lldb/packages/Python/lldbsuite/test/dotest.py:1043
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)

Maybe `did not discover any (matching) tests` to make it clear that this might 
be the result of user input?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85169

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


[Lldb-commits] [PATCH] D84555: [lldb-vscode ]Add Syntax Highlighting to Disassembly View

2020-08-03 Thread walter erquinigo via Phabricator via lldb-commits
wallace added a comment.

I don't think there's any easy way to test this. I was reading the VSCode 
documentation and there's no nice test framework for this. So at this point I'm 
okay with it without test, as it's very easy to check that it works by visual 
inspection.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84555

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


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/dotest.py:1043
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)

JDevlieghere wrote:
> Maybe `did not discover any (matching) tests` to make it clear that this 
> might be the result of user input?
`sys.stderr.write` or `print(..., file=sys.stderr)` (which appends a newline)

Trailing full stops are not recommended for error messages if the project does 
not already have the convention 
http://llvm.org/docs/CodingStandards.html#error-and-warning-messages

Looking around, several messages do not have a full stop.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85169

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


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: lldb/packages/Python/lldbsuite/test/dotest.py:1043
+if configuration.suite.countTestCases() == 0:
+print("error: did not discover any tests.")
+exitTestSuite(1)

MaskRay wrote:
> JDevlieghere wrote:
> > Maybe `did not discover any (matching) tests` to make it clear that this 
> > might be the result of user input?
> `sys.stderr.write` or `print(..., file=sys.stderr)` (which appends a newline)
> 
> Trailing full stops are not recommended for error messages if the project 
> does not already have the convention 
> http://llvm.org/docs/CodingStandards.html#error-and-warning-messages
> 
> Looking around, several messages do not have a full stop.
Let's use `logging.error` like the other error messages if we want this to go 
to stderr.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85169

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


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht updated this revision to Diff 282759.
rupprecht added a comment.

- Use logging.error
- Remove trailing stop
- Edit message to indicate that matching tests weren't found (user error)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85169

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

Thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85169

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


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht added a comment.

Thanks for the quick review!

I have a few more boring changes coming up, but hopefully some interesting ones 
after that.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85169

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


[Lldb-commits] [lldb] adb5c23 - [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2020-08-03T16:32:12-07:00
New Revision: adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d

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

LOG: [test] Exit with an error if no tests are run.

If the test suite is misconfigured when it's run (a bad regexp, wrong test 
directory, etc.), the test suite may not discover any tests. When this happens, 
the test runner exits happily because no tests failed:

```
Ran 0 tests in 0.000s
RESULT: PASSED (0 passes, 0 failures, 0 errors, 0 skipped, 0 expected failures, 
0 unexpected successes)
```

Change this to return an error so the misconfiguration can be more easily 
detected. Verified that `lldb-dotest -p TestDoesNotExist.py` successfully fails.

Reviewed By: JDevlieghere

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

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/dotest.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
b/lldb/packages/Python/lldbsuite/test/dotest.py
index 3fb802f1c1aa..6607f52c49db 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@ def run_suite():
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(



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


[Lldb-commits] [PATCH] D85169: [test] Exit with an error if no tests are run.

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGadb5c23f8c0d: [test] Exit with an error if no tests are run. 
(authored by rupprecht).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85169

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,6 +1039,10 @@
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
+if configuration.suite.countTestCases() == 0:
+logging.error("did not discover any matching tests")
+exitTestSuite(1)
+
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84576: Fix debugserver's qProcessInfo reporting of maccatalyst binaries

2020-08-03 Thread Frederic Riss via Phabricator via lldb-commits
friss added a comment.

This looks good outside of 2 cross-platform issues in the tests themselves.




Comment at: lldb/test/API/macosx/macCatalyst/TestMacCatalyst.py:27
+self.expect("image list -t -b",
+patterns=["x86_64.*-apple-ios.*-macabi a\.out"])
+self.expect("fr v s", "Hello macCatalyst")

hardcoded architecture and no architecture decorator.



Comment at: 
lldb/test/API/macosx/macCatalystAppMacOSFramework/TestMacCatalystAppWithMacOSFramework.py:27-28
+self.expect("image list -t -b",
+patterns=["x86_64.*-apple-ios.*-macabi a\.out",
+  "x86_64.*-apple-macosx.* libfoo.dylib[^(]"])
+self.expect("fr v s", "Hello macCatalyst")

ditto


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

https://reviews.llvm.org/D84576

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


[Lldb-commits] [PATCH] D85175: [test] Use abspath instead of realpath sometimes

2020-08-03 Thread Jordan Rupprecht via Phabricator via lldb-commits
rupprecht created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
rupprecht requested review of this revision.
Herald added a subscriber: JDevlieghere.

In these two cases, use of `os.path.realpath` is problematic:

- The name of the compiler is significant [1] . For testing purposes, we might 
provide a compiler called "clang" which is actually a symlink to some build 
script (which does some flag processing before invoking the real clang). The 
destination the symlink may not be called "clang", but we still want it to be 
treated as such.
- When using a build system that puts build artifacts in an arbitrary build 
location, and later creates a symlink for it (e.g. creates a "/lldbsuite/test/dotest.py" symlinks that points to 
"/build/artifact//dotest.py"), looking at the realpath will not match the 
"test" convention required here.

[1] See `Makefile.rules` in the lldb tree, e.g. we use different flags if the 
compiler is named "clang"


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85175

Files:
  lldb/packages/Python/lldbsuite/test/dotest.py


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -241,7 +241,7 @@
 do_help = True
 
 if args.compiler:
-configuration.compiler = os.path.realpath(args.compiler)
+configuration.compiler = os.path.abspath(args.compiler)
 if not is_exe(configuration.compiler):
 configuration.compiler = which(args.compiler)
 if not is_exe(configuration.compiler):
@@ -461,7 +461,7 @@
 if "DOTEST_PROFILE" in os.environ and "DOTEST_SCRIPT_DIR" in os.environ:
 scriptPath = os.environ["DOTEST_SCRIPT_DIR"]
 else:
-scriptPath = os.path.dirname(os.path.realpath(__file__))
+scriptPath = os.path.dirname(os.path.abspath(__file__))
 if not scriptPath.endswith('test'):
 print("This script expects to reside in lldb's test directory.")
 sys.exit(-1)


Index: lldb/packages/Python/lldbsuite/test/dotest.py
===
--- lldb/packages/Python/lldbsuite/test/dotest.py
+++ lldb/packages/Python/lldbsuite/test/dotest.py
@@ -241,7 +241,7 @@
 do_help = True
 
 if args.compiler:
-configuration.compiler = os.path.realpath(args.compiler)
+configuration.compiler = os.path.abspath(args.compiler)
 if not is_exe(configuration.compiler):
 configuration.compiler = which(args.compiler)
 if not is_exe(configuration.compiler):
@@ -461,7 +461,7 @@
 if "DOTEST_PROFILE" in os.environ and "DOTEST_SCRIPT_DIR" in os.environ:
 scriptPath = os.environ["DOTEST_SCRIPT_DIR"]
 else:
-scriptPath = os.path.dirname(os.path.realpath(__file__))
+scriptPath = os.path.dirname(os.path.abspath(__file__))
 if not scriptPath.endswith('test'):
 print("This script expects to reside in lldb's test directory.")
 sys.exit(-1)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] a06c28d - Temporarily revert "[test] Exit with an error if no tests are run."

2020-08-03 Thread Jordan Rupprecht via lldb-commits

Author: Jordan Rupprecht
Date: 2020-08-03T18:37:50-07:00
New Revision: a06c28df3e8c85ceb665d3d9a1ebc2853dfd87a9

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

LOG: Temporarily revert "[test] Exit with an error if no tests are run."

This reverts commit adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d. It surprisingly 
fails on a windows build bot: 
http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/18009

Will reland after some investigation and/or after adding some extra logging to 
help debug the issue.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/dotest.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
b/lldb/packages/Python/lldbsuite/test/dotest.py
index 6607f52c49db..3fb802f1c1aa 100644
--- a/lldb/packages/Python/lldbsuite/test/dotest.py
+++ b/lldb/packages/Python/lldbsuite/test/dotest.py
@@ -1039,10 +1039,6 @@ def run_suite():
 (configuration.suite.countTestCases(),
  configuration.suite.countTestCases() != 1 and "s" or ""))
 
-if configuration.suite.countTestCases() == 0:
-logging.error("did not discover any matching tests")
-exitTestSuite(1)
-
 # Invoke the test runner.
 if configuration.count == 1:
 result = unittest2.TextTestRunner(



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


[Lldb-commits] [lldb] d6a5cce - [lldb/Test] Fix skipTestIfFn for fucntions that return a value

2020-08-03 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2020-08-03T19:56:12-07:00
New Revision: d6a5cce0e7d65562f081569a61595e53cdb8d5d0

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

LOG: [lldb/Test] Fix skipTestIfFn for fucntions that return a value

Sometimes the decorator is used on a common function rather than the
test method, which can return a value. This fails with decorators that
use skipTestIfFn under the hood.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/decorators.py

Removed: 




diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 8c8f2509a863..873952e4c91a 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -132,7 +132,7 @@ def wrapper(*args, **kwargs):
 if reason is not None:
 self.skipTest(reason)
 else:
-func(*args, **kwargs)
+return func(*args, **kwargs)
 return wrapper
 
 # Some decorators can be called both with no arguments (e.g. 
@expectedFailureWindows)



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


Re: [Lldb-commits] [lldb] a06c28d - Temporarily revert "[test] Exit with an error if no tests are run."

2020-08-03 Thread Raphael “Teemperor” Isemann via lldb-commits
If it helps, all the failing tests are pexpect tests which are always disabled 
on Windows (like, they don't even exist from the test runners POV I believe). 
So I guess that's accidentially triggering that error.

- Raphael

> On 4 Aug 2020, at 03:39, Jordan Rupprecht via lldb-commits 
>  wrote:
> 
> 
> Author: Jordan Rupprecht
> Date: 2020-08-03T18:37:50-07:00
> New Revision: a06c28df3e8c85ceb665d3d9a1ebc2853dfd87a9
> 
> URL: 
> https://github.com/llvm/llvm-project/commit/a06c28df3e8c85ceb665d3d9a1ebc2853dfd87a9
> DIFF: 
> https://github.com/llvm/llvm-project/commit/a06c28df3e8c85ceb665d3d9a1ebc2853dfd87a9.diff
> 
> LOG: Temporarily revert "[test] Exit with an error if no tests are run."
> 
> This reverts commit adb5c23f8c0d60eeec41dcbe21d1b26184e1c97d. It surprisingly 
> fails on a windows build bot: 
> http://lab.llvm.org:8011/builders/lldb-x64-windows-ninja/builds/18009
> 
> Will reland after some investigation and/or after adding some extra logging 
> to help debug the issue.
> 
> Added: 
> 
> 
> Modified: 
>lldb/packages/Python/lldbsuite/test/dotest.py
> 
> Removed: 
> 
> 
> 
> 
> diff  --git a/lldb/packages/Python/lldbsuite/test/dotest.py 
> b/lldb/packages/Python/lldbsuite/test/dotest.py
> index 6607f52c49db..3fb802f1c1aa 100644
> --- a/lldb/packages/Python/lldbsuite/test/dotest.py
> +++ b/lldb/packages/Python/lldbsuite/test/dotest.py
> @@ -1039,10 +1039,6 @@ def run_suite():
> (configuration.suite.countTestCases(),
>  configuration.suite.countTestCases() != 1 and "s" or ""))
> 
> -if configuration.suite.countTestCases() == 0:
> -logging.error("did not discover any matching tests")
> -exitTestSuite(1)
> -
> # Invoke the test runner.
> if configuration.count == 1:
> result = unittest2.TextTestRunner(
> 
> 
> 
> ___
> lldb-commits mailing list
> lldb-commits@lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

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