[Lldb-commits] [PATCH] D61686: Enable lldb-server on Windows

2019-05-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: cmake/modules/LLDBConfig.cmake:421
 # ensure we build lldb-server when an lldb target is being built.
-if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
+if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows")
 set(LLDB_CAN_USE_LLDB_SERVER 1)

Should we just remove `LLDB_CAN_USE_LLDB_SERVER` instead?


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

https://reviews.llvm.org/D61686



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


[Lldb-commits] [lldb] r360753 - Replace assert with static_assert here applicable.

2019-05-14 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue May 14 22:39:41 2019
New Revision: 360753

URL: http://llvm.org/viewvc/llvm-project?rev=360753=rev
Log:
Replace assert with static_assert here applicable.

Replaces assert() with static_assert() if the condition is can be
evaluated at compile time.

Modified:
lldb/trunk/source/Expression/IRExecutionUnit.cpp
lldb/trunk/source/Interpreter/CommandObject.cpp

lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachVMRegion.cpp

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=360753=360752=360753=diff
==
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Tue May 14 22:39:41 2019
@@ -1023,7 +1023,7 @@ IRExecutionUnit::MemoryManager::getSymbo
 
 void *IRExecutionUnit::MemoryManager::getPointerToNamedFunction(
 const std::string , bool AbortOnFailure) {
-  assert(sizeof(void *) == 8);
+  static_assert(sizeof(void *) == 8, "");
 
   return (void *)getSymbolAddress(Name);
 }

Modified: lldb/trunk/source/Interpreter/CommandObject.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandObject.cpp?rev=360753=360752=360753=diff
==
--- lldb/trunk/source/Interpreter/CommandObject.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandObject.cpp Tue May 14 22:39:41 2019
@@ -1103,7 +1103,8 @@ CommandObject::ArgumentTableEntry Comman
 const CommandObject::ArgumentTableEntry *CommandObject::GetArgumentTable() {
   // If this assertion fires, then the table above is out of date with the
   // CommandArgumentType enumeration
-  assert((sizeof(CommandObject::g_arguments_data) /
-  sizeof(CommandObject::ArgumentTableEntry)) == eArgTypeLastArg);
+  static_assert((sizeof(CommandObject::g_arguments_data) /
+ sizeof(CommandObject::ArgumentTableEntry)) == eArgTypeLastArg,
+"");
   return CommandObject::g_arguments_data;
 }

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=360753=360752=360753=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
 Tue May 14 22:39:41 2019
@@ -1972,8 +1972,8 @@ bool RenderScriptRuntime::JITTypePacked(
 
   // We want 4 elements from packed data
   const uint32_t num_exprs = 4;
-  assert(num_exprs == (eExprTypeElemPtr - eExprTypeDimX + 1) &&
- "Invalid number of expressions");
+  static_assert(num_exprs == (eExprTypeElemPtr - eExprTypeDimX + 1),
+"Invalid number of expressions");
 
   char expr_bufs[num_exprs][jit_max_expr_size];
   uint64_t results[num_exprs];
@@ -2031,8 +2031,8 @@ bool RenderScriptRuntime::JITElementPack
 
   // We want 4 elements from packed data
   const uint32_t num_exprs = 4;
-  assert(num_exprs == (eExprElementFieldCount - eExprElementType + 1) &&
- "Invalid number of expressions");
+  static_assert(num_exprs == (eExprElementFieldCount - eExprElementType + 1),
+"Invalid number of expressions");
 
   char expr_bufs[num_exprs][jit_max_expr_size];
   uint64_t results[num_exprs];
@@ -2090,8 +2090,8 @@ bool RenderScriptRuntime::JITSubelements
   }
 
   const short num_exprs = 3;
-  assert(num_exprs == (eExprSubelementsArrSize - eExprSubelementsId + 1) &&
- "Invalid number of expressions");
+  static_assert(num_exprs == (eExprSubelementsArrSize - eExprSubelementsId + 
1),
+"Invalid number of expressions");
 
   char expr_buffer[jit_max_expr_size];
   uint64_t results;

Modified: 
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp?rev=360753=360752=360753=diff
==
--- 
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp 
(original)
+++ 
lldb/trunk/source/Plugins/Process/minidump/RegisterContextMinidump_ARM64.cpp 
Tue May 14 22:39:41 2019
@@ -782,7 +782,7 @@ RegisterContextMinidump_ARM64::RegisterC
   auto regs_data = data.GetData(, sizeof(m_regs.v));
   if (regs_data)
 memcpy(m_regs.v, regs_data, sizeof(m_regs.v));
-  

[Lldb-commits] [lldb] r360751 - Mark private unimplemented functions as deleted

2019-05-14 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue May 14 22:31:14 2019
New Revision: 360751

URL: http://llvm.org/viewvc/llvm-project?rev=360751=rev
Log:
Mark private unimplemented functions as deleted

Applies modernize-use-equals-delete to the LLDB code base and removes
the now redundant comments.

Modified:
lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h
lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
lldb/trunk/include/lldb/Symbol/Variable.h
lldb/trunk/include/lldb/Target/QueueList.h
lldb/trunk/include/lldb/Target/ThreadList.h
lldb/trunk/include/lldb/Target/UnwindAssembly.h
lldb/trunk/include/lldb/Utility/Event.h
lldb/trunk/include/lldb/Utility/SharingPtr.h
lldb/trunk/source/Host/macosx/cfcpp/CFCBundle.h
lldb/trunk/tools/debugserver/source/MacOSX/MachTask.h
lldb/trunk/tools/debugserver/source/PThreadEvent.h
lldb/trunk/tools/debugserver/source/PseudoTerminal.h
lldb/trunk/tools/debugserver/source/RNBContext.h
lldb/trunk/tools/debugserver/source/RNBRemote.h
lldb/trunk/tools/debugserver/source/RNBSocket.h

Modified: lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h?rev=360751=360750=360751=diff
==
--- lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/StoppointLocation.h Tue May 14 22:31:14 
2019
@@ -78,7 +78,7 @@ protected:
 private:
   // For StoppointLocation only
   DISALLOW_COPY_AND_ASSIGN(StoppointLocation);
-  StoppointLocation(); // Disallow default constructor
+  StoppointLocation() = delete;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h?rev=360751=360750=360751=diff
==
--- lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h (original)
+++ lldb/trunk/include/lldb/Host/macosx/HostInfoMacOSX.h Tue May 14 22:31:14 
2019
@@ -22,8 +22,8 @@ class HostInfoMacOSX : public HostInfoPo
 
 private:
   // Static class, unconstructable.
-  HostInfoMacOSX();
-  ~HostInfoMacOSX();
+  HostInfoMacOSX() = delete;
+  ~HostInfoMacOSX() = delete;
 
 public:
   static llvm::VersionTuple GetOSVersion();

Modified: lldb/trunk/include/lldb/Symbol/Variable.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Variable.h?rev=360751=360750=360751=diff
==
--- lldb/trunk/include/lldb/Symbol/Variable.h (original)
+++ lldb/trunk/include/lldb/Symbol/Variable.h Tue May 14 22:31:14 2019
@@ -128,8 +128,8 @@ protected:
   m_static_member : 1; // Non-zero if variable is static member of a class
// or struct.
 private:
-  Variable(const Variable );
-  Variable =(const Variable );
+  Variable(const Variable ) = delete;
+  Variable =(const Variable ) = delete;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Target/QueueList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/QueueList.h?rev=360751=360750=360751=diff
==
--- lldb/trunk/include/lldb/Target/QueueList.h (original)
+++ lldb/trunk/include/lldb/Target/QueueList.h Tue May 14 22:31:14 2019
@@ -102,7 +102,7 @@ protected:
   std::mutex m_mutex;
 
 private:
-  QueueList();
+  QueueList() = delete;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Target/ThreadList.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/ThreadList.h?rev=360751=360750=360751=diff
==
--- lldb/trunk/include/lldb/Target/ThreadList.h (original)
+++ lldb/trunk/include/lldb/Target/ThreadList.h Tue May 14 22:31:14 2019
@@ -151,7 +151,7 @@ protected:
   std::vector m_expression_tid_stack;
 
 private:
-  ThreadList();
+  ThreadList() = delete;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/include/lldb/Target/UnwindAssembly.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/UnwindAssembly.h?rev=360751=360750=360751=diff
==
--- lldb/trunk/include/lldb/Target/UnwindAssembly.h (original)
+++ lldb/trunk/include/lldb/Target/UnwindAssembly.h Tue May 14 22:31:14 2019
@@ -44,7 +44,7 @@ protected:
   ArchSpec m_arch;
 
 private:
-  UnwindAssembly(); // Outlaw default constructor
+  UnwindAssembly() = delete;
   DISALLOW_COPY_AND_ASSIGN(UnwindAssembly);
 };
 

Modified: lldb/trunk/include/lldb/Utility/Event.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Event.h?rev=360751=360750=360751=diff

[Lldb-commits] [PATCH] D61686: Enable lldb-server on Windows

2019-05-14 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 199555.
asmith edited the summary of this revision.

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

https://reviews.llvm.org/D61686

Files:
  cmake/modules/LLDBConfig.cmake
  source/Host/windows/Host.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
  source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
  tools/lldb-server/lldb-gdbserver.cpp
  tools/lldb-server/lldb-platform.cpp

Index: tools/lldb-server/lldb-platform.cpp
===
--- tools/lldb-server/lldb-platform.cpp
+++ tools/lldb-server/lldb-platform.cpp
@@ -15,8 +15,9 @@
 #include 
 #include 
 #include 
+#if !defined(_WIN32)
 #include 
-
+#endif
 #include 
 
 #include "llvm/Support/FileSystem.h"
@@ -67,6 +68,7 @@
 #define HIGH_PORT (49151u)
 #endif
 
+#if !defined(_WIN32)
 // Watch for signals
 static void signal_handler(int signo) {
   switch (signo) {
@@ -81,6 +83,7 @@
 break;
   }
 }
+#endif
 
 static void display_usage(const char *progname, const char *subcommand) {
   fprintf(stderr, "Usage:\n  %s %s [--log-file log-file-name] [--log-channels "
@@ -131,8 +134,10 @@
   const char *subcommand = argv[1];
   argc--;
   argv++;
+#if !defined(_WIN32)
   signal(SIGPIPE, SIG_IGN);
   signal(SIGHUP, signal_handler);
+#endif
   int long_option_index = 0;
   Status error;
   std::string listen_host_port;
Index: tools/lldb-server/lldb-gdbserver.cpp
===
--- tools/lldb-server/lldb-gdbserver.cpp
+++ tools/lldb-server/lldb-gdbserver.cpp
@@ -515,7 +515,7 @@
 handle_launch(gdb_server, argc, argv);
 
   // Print version info.
-  printf("%s-%s", LLGS_PROGRAM_NAME, LLGS_VERSION_STR);
+  printf("%s-%s\n", LLGS_PROGRAM_NAME, LLGS_VERSION_STR);
 
   ConnectToRemote(mainloop, gdb_server, reverse_connect, host_and_port,
   progname, subcommand, named_pipe_path.c_str(), 
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp
@@ -214,8 +214,15 @@
   m_process_launch_info.GetFlags().Set(eLaunchFlagDebug);
 
   if (should_forward_stdio) {
+// No pty support on Windows so far that means neither O* or I*
+// notification packets will be generated about the inferior. However
+// in most cases the missing notifications do not affect the major
+// use of the lldb-server.  So here temporarily relax the following
+// for Windows.
+#if !defined(_WIN32)
 if (llvm::Error Err = m_process_launch_info.SetUpPtyRedirection())
   return Status(std::move(Err));
+#endif
   }
 
   {
Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
===
--- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
+++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
@@ -38,6 +38,8 @@
 
 #if defined(__APPLE__)
 #define DEBUGSERVER_BASENAME "debugserver"
+#elif defined(_WIN32)
+#define DEBUGSERVER_BASENAME "lldb-server.exe"
 #else
 #define DEBUGSERVER_BASENAME "lldb-server"
 #endif
Index: source/Host/windows/Host.cpp
===
--- source/Host/windows/Host.cpp
+++ source/Host/windows/Host.cpp
@@ -169,7 +169,23 @@
   GetProcessExecutableAndTriple(handle, process_info);
 
   // Need to read the PEB to get parent process and command line arguments.
-  return true;
+
+  AutoHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
+  if (!snapshot.IsValid())
+return false;
+
+  PROCESSENTRY32W pe;
+  pe.dwSize = sizeof(PROCESSENTRY32W);
+  if (Process32FirstW(snapshot.get(), )) {
+do {
+  if (pe.th32ProcessID == pid) {
+process_info.SetParentProcessID(pe.th32ParentProcessID);
+return true;
+  }
+} while (Process32NextW(snapshot.get(), ));
+  }
+
+  return false;
 }
 
 HostThread Host::StartMonitoringChildProcess(
Index: cmake/modules/LLDBConfig.cmake
===
--- cmake/modules/LLDBConfig.cmake
+++ cmake/modules/LLDBConfig.cmake
@@ -418,7 +418,7 @@
 
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
-if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
+if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD|Windows")
 set(LLDB_CAN_USE_LLDB_SERVER 1)
 else()
 set(LLDB_CAN_USE_LLDB_SERVER 0)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61687: Update Python tests for lldb-server on Windows

2019-05-14 Thread Aaron Smith via Phabricator via lldb-commits
asmith updated this revision to Diff 199554.

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

https://reviews.llvm.org/D61687

Files:
  packages/Python/lldbsuite/test/dotest.py
  packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
  packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
  packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py
  packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
  packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py
  
packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
  
packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
  packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py
  packages/Python/lldbsuite/test/tools/lldb-server/TestLldbGdbServer.py
  packages/Python/lldbsuite/test/tools/lldb-server/commandline/TestStubSetSID.py
  packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
  
packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
  packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
  
packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
  
packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py

Index: packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/thread-name/TestGdbRemoteThreadName.py
@@ -29,6 +29,7 @@
 kv_dict = self.parse_key_val_dict(context.get("key_vals_text"))
 self.assertEqual(expected_name, kv_dict.get("name"))
 
+@skipIfWindows # the test is not updated for Windows.
 @llgs_test
 def test(self):
 """ Make sure lldb-server can retrieve inferior thread name"""
Index: packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/signal-filtering/TestGdbRemote_QPassSignals.py
@@ -81,6 +81,7 @@
 self.ignore_signals(signals_to_ignore)
 self.expect_exit_code(len(signals_to_ignore))
 
+@skipIfWindows # no signal support
 @llgs_test
 def test_default_signals_behavior(self):
 self.init_llgs_test()
Index: packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/lldbgdbserverutils.py
@@ -926,6 +926,12 @@
 # Convert text pids to ints
 process_ids = [int(text_pid)
for text_pid in text_process_ids if text_pid != '']
+elif platform.system() == 'Windows':
+output = subprocess.check_output(
+"for /f \"tokens=2 delims=,\" %F in ('tasklist /nh /fi \"PID ne 0\" /fo csv') do @echo %~F", shell=True).decode("utf-8")
+text_process_ids = output.split('\n')[1:]
+process_ids = [int(text_pid)
+   for text_pid in text_process_ids if text_pid != '']
 # elif {your_platform_here}:
 #   fill in process_ids as a list of int type process IDs running on
 #   the local system.
Index: packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/inferior-crash/TestGdbRemoteAbort.py
@@ -37,6 +37,7 @@
 self.build()
 self.inferior_abort_received()
 
+@skipIfWindows # For now the signo in T* packet is always 0.
 @llgs_test
 # std::abort() on <= API 16 raises SIGSEGV - b.android.com/179836
 @expectedFailureAndroid(api_levels=list(range(16 + 1)))
Index: packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
===
--- packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
+++ packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py
@@ -235,6 +235,10 @@
 # Remote platforms don't support named pipe based port negotiation
 use_named_pipe = False
 
+triple = self.dbg.GetSelectedPlatform().GetTriple()
+if re.match(".*-.*-windows", triple):
+self.skipTest("Remotely testing is not supported on Windows yet.")
+
 # Grab the 

[Lldb-commits] [lldb] r360748 - [Docs] Document lldb-dotest

2019-05-14 Thread Jonas Devlieghere via lldb-commits
Author: jdevlieghere
Date: Tue May 14 21:42:30 2019
New Revision: 360748

URL: http://llvm.org/viewvc/llvm-project?rev=360748=rev
Log:
[Docs] Document lldb-dotest

Document the lldb-dotest binary.

Modified:
lldb/trunk/docs/resources/test.rst

Modified: lldb/trunk/docs/resources/test.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/test.rst?rev=360748=360747=360748=diff
==
--- lldb/trunk/docs/resources/test.rst (original)
+++ lldb/trunk/docs/resources/test.rst Tue May 14 21:42:30 2019
@@ -10,16 +10,25 @@ verify both the LLDB command line interf
 .. contents::
:local:
 
+.. note::
+
+   On Windows any invocations of python should be replaced with python_d, the
+   debug interpreter, when running the test suite against a debug version of
+   LLDB.
+
+.. note::
+
+   On NetBSD you must export ``LD_LIBRARY_PATH=$PWD/lib`` in your environment.
+   This is due to lack of the ``$ORIGIN`` linker feature.
+
 Running the Full Test Suite
 ---
 
-**Windows Note**: In the examples that follow, any invocations of python should
-be replaced with python_d, the debug interpreter, when running the test suite
-against a debug version of LLDB.
-
 The easiest way to run the LLDB test suite is to use the ``check-lldb`` build
-target. By default, the ``check-lldb`` target builds the test programs with the
-same compiler that was used to build LLDB. To build the tests with a different
+target.
+
+By default, the ``check-lldb`` target builds the test programs with the same
+compiler that was used to build LLDB. To build the tests with a different
 compiler, you can set the ``LLDB_TEST_C_COMPILER`` or the
 ``LLDB_TEST_CXX_COMPILER`` CMake variables. These variables are ignored unless
 the respective ``LLDB_TEST_USE_CUSTOM_C_COMPILER`` and
@@ -38,23 +47,36 @@ built with a custom version of clang, do
 Note that multiple ``-A`` and ``-C`` flags can be specified to
 ``LLDB_TEST_USER_ARGS``.
 
-Note that on NetBSD you must export ``LD_LIBRARY_PATH=$PWD/lib`` in your
-environment. This is due to lack of the ``$ORIGIN`` linker feature.
 
 Running a Specific Test or Set of Tests
 ---
 
-In addition to running all the LLDB test suites with the "check-lldb" CMake
-target above, it is possible to run individual LLDB tests. For example, to run
-the test cases defined in TestInferiorCrashing.py, run:
+In addition to running all the LLDB test suites with the ``check-lldb`` CMake
+target above, it is possible to run individual LLDB tests. If you have a CMake
+build you can use the ``lldb-dotest`` binary, which is a wrapper around
+``dotest.py`` that passes all the arguments configured by CMake. Alternatively,
+you can use ``dotest.py`` directly, if you want to run a test one-off with a
+different configuration.
+
+
+For example, to run the test cases defined in TestInferiorCrashing.py, run:
+
+::
+
+   > lldb-dotest -p TestInferiorCrashing.py
 
 ::
 
> cd $lldb/test
> python dotest.py --executable  -p TestInferiorCrashing.py 
../packages/Python/lldbsuite/test
 
-If the test is not specified by name (e.g. if you leave the -p argument off),
-LLDB will run all tests in that directory:
+If the test is not specified by name (e.g. if you leave the ``-p`` argument
+off),  all tests in that directory will be executed:
+
+
+::
+
+   > lldb-dotest functionalities/data-formatter
 
 ::
 


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


[Lldb-commits] [lldb] r360745 - Revert "build: use the correct variable"

2019-05-14 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Tue May 14 20:57:07 2019
New Revision: 360745

URL: http://llvm.org/viewvc/llvm-project?rev=360745=rev
Log:
Revert "build: use the correct variable"

This reverts commit b5a8abd57f23e2f621d5ceb0f64f1bb8f9579c3f.  This
should not be needed as the lldb-server tool will add
`LLDB_CAN_USE_LLDB_SERVER` which will never be set to true on Windows.

Modified:
lldb/trunk/unittests/tools/CMakeLists.txt

Modified: lldb/trunk/unittests/tools/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/CMakeLists.txt?rev=360745=360744=360745=diff
==
--- lldb/trunk/unittests/tools/CMakeLists.txt (original)
+++ lldb/trunk/unittests/tools/CMakeLists.txt Tue May 14 20:57:07 2019
@@ -1,6 +1,6 @@
 if(LLDB_TOOL_LLDB_MI_BUILD)
   add_subdirectory(lldb-mi)
 endif()
-if(LLDB_CAN_USE_LLDB_SERVER)
+if(LLDB_TOOL_LLDB_SERVER_BUILD)
   add_subdirectory(lldb-server)
 endif()


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


[Lldb-commits] [lldb] r360744 - [lldb] [lit] Fix whitespace in matches for remaining AVX512 tests

2019-05-14 Thread Michal Gorny via lldb-commits
Author: mgorny
Date: Tue May 14 20:32:47 2019
New Revision: 360744

URL: http://llvm.org/viewvc/llvm-project?rev=360744=rev
Log:
[lldb] [lit] Fix whitespace in matches for remaining AVX512 tests

Modified:
lldb/trunk/lit/Register/x86-64-xmm16-read.test
lldb/trunk/lit/Register/x86-64-ymm16-read.test
lldb/trunk/lit/Register/x86-zmm-read.test

Modified: lldb/trunk/lit/Register/x86-64-xmm16-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-64-xmm16-read.test?rev=360744=360743=360744=diff
==
--- lldb/trunk/lit/Register/x86-64-xmm16-read.test (original)
+++ lldb/trunk/lit/Register/x86-64-xmm16-read.test Tue May 14 20:32:47 2019
@@ -9,22 +9,22 @@
 process launch
 
 register read --all
-# CHECK-DAG: xmm16 = {0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 
0x1b 0x1c 0x1d 0x1e 0x1f }
-# CHECK-DAG: xmm17 = {0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 
0x1c 0x1d 0x1e 0x1f 0x20 }
-# CHECK-DAG: xmm18 = {0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 
0x1d 0x1e 0x1f 0x20 0x21 }
-# CHECK-DAG: xmm19 = {0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 
0x1e 0x1f 0x20 0x21 0x22 }
-# CHECK-DAG: xmm20 = {0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 
0x1f 0x20 0x21 0x22 0x23 }
-# CHECK-DAG: xmm21 = {0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 
0x20 0x21 0x22 0x23 0x24 }
-# CHECK-DAG: xmm22 = {0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 
0x21 0x22 0x23 0x24 0x25 }
-# CHECK-DAG: xmm23 = {0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 
0x22 0x23 0x24 0x25 0x26 }
-# CHECK-DAG: xmm24 = {0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 
0x23 0x24 0x25 0x26 0x27 }
-# CHECK-DAG: xmm25 = {0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 
0x24 0x25 0x26 0x27 0x28 }
-# CHECK-DAG: xmm26 = {0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 
0x25 0x26 0x27 0x28 0x29 }
-# CHECK-DAG: xmm27 = {0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 
0x26 0x27 0x28 0x29 0x2a }
-# CHECK-DAG: xmm28 = {0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 
0x27 0x28 0x29 0x2a 0x2b }
-# CHECK-DAG: xmm29 = {0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 
0x28 0x29 0x2a 0x2b 0x2c }
-# CHECK-DAG: xmm30 = {0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 
0x29 0x2a 0x2b 0x2c 0x2d }
-# CHECK-DAG: xmm31 = {0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 
0x2a 0x2b 0x2c 0x2d 0x2e }
+# CHECK-DAG: xmm16 = {0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 
0x1b 0x1c 0x1d 0x1e 0x1f}
+# CHECK-DAG: xmm17 = {0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 
0x1c 0x1d 0x1e 0x1f 0x20}
+# CHECK-DAG: xmm18 = {0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 
0x1d 0x1e 0x1f 0x20 0x21}
+# CHECK-DAG: xmm19 = {0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 
0x1e 0x1f 0x20 0x21 0x22}
+# CHECK-DAG: xmm20 = {0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 
0x1f 0x20 0x21 0x22 0x23}
+# CHECK-DAG: xmm21 = {0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 
0x20 0x21 0x22 0x23 0x24}
+# CHECK-DAG: xmm22 = {0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 
0x21 0x22 0x23 0x24 0x25}
+# CHECK-DAG: xmm23 = {0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 
0x22 0x23 0x24 0x25 0x26}
+# CHECK-DAG: xmm24 = {0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 
0x23 0x24 0x25 0x26 0x27}
+# CHECK-DAG: xmm25 = {0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 
0x24 0x25 0x26 0x27 0x28}
+# CHECK-DAG: xmm26 = {0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 
0x25 0x26 0x27 0x28 0x29}
+# CHECK-DAG: xmm27 = {0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 
0x26 0x27 0x28 0x29 0x2a}
+# CHECK-DAG: xmm28 = {0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 
0x27 0x28 0x29 0x2a 0x2b}
+# CHECK-DAG: xmm29 = {0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 
0x28 0x29 0x2a 0x2b 0x2c}
+# CHECK-DAG: xmm30 = {0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 
0x29 0x2a 0x2b 0x2c 0x2d}
+# CHECK-DAG: xmm31 = {0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 
0x2a 0x2b 0x2c 0x2d 0x2e}
 
 process continue
 # CHECK: Process {{[0-9]+}} exited with status = 0

Modified: lldb/trunk/lit/Register/x86-64-ymm16-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-64-ymm16-read.test?rev=360744=360743=360744=diff
==
--- lldb/trunk/lit/Register/x86-64-ymm16-read.test (original)
+++ lldb/trunk/lit/Register/x86-64-ymm16-read.test Tue May 14 20:32:47 2019
@@ -9,22 +9,22 @@
 process launch
 
 register read --all
-# CHECK-DAG: ymm16 = {0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 
0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 
0x2b 0x2c 0x2d 0x2e 0x2f }
-# CHECK-DAG: ymm17 = {0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 
0x1c 0x1d 0x1e 0x1f 0x20 

[Lldb-commits] [PATCH] D61776: [Target] Generalize some behavior in Thread

2019-05-14 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB360741: [Target] Generalize some behavior in Thread 
(authored by xiaobai, committed by ).
Herald added a subscriber: teemperor.
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D61776?vs=199364=199544#toc

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61776

Files:
  packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
  
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
  source/Target/Thread.cpp


Index: packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
===
--- packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
+++ packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
@@ -196,11 +196,12 @@
 self.expect("thread list",
 substrs=['stopped', 'stop reason = signal SIGABRT'])
 
-self.expect('thread exception', substrs=[])
+self.expect('thread exception', substrs=['exception ='])
 
 process = self.dbg.GetSelectedTarget().process
 thread = process.GetSelectedThread()
 
-# C++ exceptions are not exposed in the API (yet).
-self.assertFalse(thread.GetCurrentException().IsValid())
+self.assertTrue(thread.GetCurrentException().IsValid())
+
+# C++ exception backtraces are not exposed in the API (yet).
 self.assertFalse(thread.GetCurrentExceptionBacktrace().IsValid())
Index: source/Target/Thread.cpp
===
--- source/Target/Thread.cpp
+++ source/Target/Thread.cpp
@@ -2209,25 +2209,31 @@
   if (auto e = recognized_frame->GetExceptionObject())
 return e;
 
-  // FIXME: For now, only ObjC exceptions are supported. This should really
-  // iterate over all language runtimes and ask them all to give us the current
-  // exception.
-  if (auto runtime = GetProcess()->GetObjCLanguageRuntime())
-if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
-  return e;
+  // NOTE: Even though this behavior is generalized, only ObjC is actually
+  // supported at the moment.
+  for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) 
{
+if (auto runtime = GetProcess()->GetLanguageRuntime(
+static_cast(lang)))
+  if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
+return e;
+  }
 
   return ValueObjectSP();
 }
 
 ThreadSP Thread::GetCurrentExceptionBacktrace() {
   ValueObjectSP exception = GetCurrentException();
-  if (!exception) return ThreadSP();
+  if (!exception)
+return ThreadSP();
 
-  // FIXME: For now, only ObjC exceptions are supported. This should really
-  // iterate over all language runtimes and ask them all to give us the current
-  // exception.
-  auto runtime = GetProcess()->GetObjCLanguageRuntime();
-  if (!runtime) return ThreadSP();
+  // NOTE: Even though this behavior is generalized, only ObjC is actually
+  // supported at the moment.
+  for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) 
{
+if (auto runtime = GetProcess()->GetLanguageRuntime(
+static_cast(lang)))
+  if (auto bt = runtime->GetBacktraceThreadFromException(exception))
+return bt;
+  }
 
-  return runtime->GetBacktraceThreadFromException(exception);
+  return ThreadSP();
 }
Index: 
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
===
--- 
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ 
source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -594,6 +594,10 @@
   addr_t exception_addr =
   m_process->ReadPointerFromMemory(result_ptr - ptr_size, error);
 
+  if (!error.Success()) {
+return ValueObjectSP();
+  }
+
   lldb_private::formatters::InferiorSizedWord exception_isw(exception_addr,
 *m_process);
   ValueObjectSP exception = ValueObject::CreateValueObjectFromData(


Index: packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
===
--- packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
+++ packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
@@ -196,11 +196,12 @@
 self.expect("thread list",
 substrs=['stopped', 'stop reason = signal SIGABRT'])
 
-self.expect('thread exception', substrs=[])
+self.expect('thread exception', substrs=['exception ='])
 
 process = self.dbg.GetSelectedTarget().process
 thread = process.GetSelectedThread()
 
-# C++ 

[Lldb-commits] [lldb] r360741 - [Target] Generalize some behavior in Thread

2019-05-14 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue May 14 18:46:45 2019
New Revision: 360741

URL: http://llvm.org/viewvc/llvm-project?rev=360741=rev
Log:
[Target] Generalize some behavior in Thread

Summary:
I don't think there's a good reason for this behavior to be considered
ObjC-specific. We can generalize this.

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py

lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
lldb/trunk/source/Target/Thread.cpp

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py?rev=360741=360740=360741=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py
 Tue May 14 18:46:45 2019
@@ -196,11 +196,12 @@ class ObjCExceptionsTestCase(TestBase):
 self.expect("thread list",
 substrs=['stopped', 'stop reason = signal SIGABRT'])
 
-self.expect('thread exception', substrs=[])
+self.expect('thread exception', substrs=['exception ='])
 
 process = self.dbg.GetSelectedTarget().process
 thread = process.GetSelectedThread()
 
-# C++ exceptions are not exposed in the API (yet).
-self.assertFalse(thread.GetCurrentException().IsValid())
+self.assertTrue(thread.GetCurrentException().IsValid())
+
+# C++ exception backtraces are not exposed in the API (yet).
 self.assertFalse(thread.GetCurrentExceptionBacktrace().IsValid())

Modified: 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp?rev=360741=360740=360741=diff
==
--- 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 (original)
+++ 
lldb/trunk/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
 Tue May 14 18:46:45 2019
@@ -594,6 +594,10 @@ ValueObjectSP ItaniumABILanguageRuntime:
   addr_t exception_addr =
   m_process->ReadPointerFromMemory(result_ptr - ptr_size, error);
 
+  if (!error.Success()) {
+return ValueObjectSP();
+  }
+
   lldb_private::formatters::InferiorSizedWord exception_isw(exception_addr,
 *m_process);
   ValueObjectSP exception = ValueObject::CreateValueObjectFromData(

Modified: lldb/trunk/source/Target/Thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Thread.cpp?rev=360741=360740=360741=diff
==
--- lldb/trunk/source/Target/Thread.cpp (original)
+++ lldb/trunk/source/Target/Thread.cpp Tue May 14 18:46:45 2019
@@ -2209,25 +2209,31 @@ ValueObjectSP Thread::GetCurrentExceptio
   if (auto e = recognized_frame->GetExceptionObject())
 return e;
 
-  // FIXME: For now, only ObjC exceptions are supported. This should really
-  // iterate over all language runtimes and ask them all to give us the current
-  // exception.
-  if (auto runtime = GetProcess()->GetObjCLanguageRuntime())
-if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
-  return e;
+  // NOTE: Even though this behavior is generalized, only ObjC is actually
+  // supported at the moment.
+  for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) 
{
+if (auto runtime = GetProcess()->GetLanguageRuntime(
+static_cast(lang)))
+  if (auto e = runtime->GetExceptionObjectForThread(shared_from_this()))
+return e;
+  }
 
   return ValueObjectSP();
 }
 
 ThreadSP Thread::GetCurrentExceptionBacktrace() {
   ValueObjectSP exception = GetCurrentException();
-  if (!exception) return ThreadSP();
+  if (!exception)
+return ThreadSP();
 
-  // FIXME: For now, only ObjC exceptions are supported. This should really
-  // iterate over all language runtimes and ask them all to give us the current
-  // exception.
-  auto runtime = GetProcess()->GetObjCLanguageRuntime();
-  if (!runtime) return ThreadSP();
+  // NOTE: Even though this behavior is generalized, only ObjC is actually
+  // supported at the moment.
+  for (unsigned lang = eLanguageTypeUnknown; lang < eNumLanguageTypes; lang++) 
{
+if (auto runtime = GetProcess()->GetLanguageRuntime(
+static_cast(lang)))
+  if (auto bt = runtime->GetBacktraceThreadFromException(exception))
+return bt;
+  }
 
-  return 

[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

In D61921#1502338 , @jingham wrote:

> Getting it from the Process's m_language_runtimes is probably fine.  On 
> reflection, I can't think of a reason why you would want to iterate over all 
> the available LanguageRuntimes, including the ones that hadn't been 
> recognized in this Process yet.
>
> It's fine to do that in a separate patch.  If you do that it would be good to 
> back port it to the other iterations over the LanguageRuntimes.


Excellent, sounds good. I definitely intend to backport it to any other 
iterations over LanguageRuntimes that I find. As for iterating over all 
available LanguageRuntimes, this patch and my last few have sufficient 
motivation for doing so, no? Maybe I'm misunderstanding what you mean.

> I don't see a really strong reason to make GetStepThroughTrampolinePlan a 
> pure virtual method, this isn't required behavior for a language runtime.  
> Why not make a default method that returns an empty thread plan?

Thinking about it further, you're probably right here. Not every language might 
have the need to handle this scenario. I'll update this patch with your 
suggestion.


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

https://reviews.llvm.org/D61921



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


[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-14 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Getting it from the Process's m_language_runtimes is probably fine.  On 
reflection, I can't think of a reason why you would want to iterate over all 
the available LanguageRuntimes, including the ones that hadn't been recognized 
in this Process yet.

It's fine to do that in a separate patch.  If you do that it would be good to 
back port it to the other iterations over the LanguageRuntimes.

I don't see a really strong reason to make GetStepThroughTrampolinePlan a pure 
virtual method, this isn't required behavior for a language runtime.  Why not 
make a default method that returns an empty thread plan?


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

https://reviews.llvm.org/D61921



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


[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added a comment.

In D61921#1502254 , @jingham wrote:

> There is a TypeSystemEnumerateSupportedLanguages that we use so that we don't 
> have to enumerate over all the language in the languages enums.  After all 
> the plugin manager knows which languages we have type systems for. If you're 
> going to be doing a lot of this generalization, can you add a similar 
> enumeration for the LanguageRuntimes?   There are 40 or so languages in the 
> language enum but we only have a couple of LanguageRuntimes...


My understanding is `TypeSystemEnumerateSupportedLanguages` is just for getting 
what languages are supported by the currently loaded TypeSystems (e.g. 
ClangASTContext) and not necessarily all the loaded language plugins. From what 
I understand, this is handled by Language itself using a map that it populates 
on-demand.

The same is probably achievable with LanguageRuntimes. I think adding a 
`ForEachLanguageRuntime` method to Process that would populate its 
LanguageRuntimes map on demand much like Language does would probably give us a 
similar effect. I could do this in a follow up commit to make these kinds of 
situations a little more efficient. What do you think of this plan?


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

https://reviews.llvm.org/D61921



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


[Lldb-commits] [PATCH] D61602: Handle function parameters of RunCommandInterpreter (script bridge)

2019-05-14 Thread Jim Ingham via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB360730: Make SBDebugger.RunCommandInterpreter callable 
from Python. (authored by jingham, committed by ).

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61602

Files:
  
packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py
  scripts/interface/SBDebugger.i


Index: scripts/interface/SBDebugger.i
===
--- scripts/interface/SBDebugger.i
+++ scripts/interface/SBDebugger.i
@@ -423,6 +423,32 @@
 lldb::SBTypeSynthetic
 GetSyntheticForType (lldb::SBTypeNameSpecifier);
 
+%feature("docstring",
+"Launch a command interpreter session. Commands are read from standard input or
+from the input handle specified for the debugger object. Output/errors are
+similarly redirected to standard output/error or the configured handles.
+
+@param[in] auto_handle_events If true, automatically handle resulting events.
+@param[in] spawn_thread If true, start a new thread for IO handling.
+@param[in] options Parameter collection of type SBCommandInterpreterRunOptions.
+@param[in] num_errors Initial error counter.
+@param[in] quit_requested Initial quit request flag.
+@param[in] stopped_for_crash Initial crash flag.
+
+@return
+A tuple with the number of errors encountered by the interpreter, a boolean
+indicating whether quitting the interpreter was requested and another boolean
+set to True in case of a crash.
+
+Example:
+
+# Start an interactive lldb session from a script (with a valid debugger object
+# created beforehand):
+n_errors, quit_requested, has_crashed = debugger.RunCommandInterpreter(True,
+False, lldb.SBCommandInterpreterRunOptions(), 0, False, False)") 
RunCommandInterpreter;
+%apply int& INOUT { int& num_errors };
+%apply bool& INOUT { bool& quit_requested };
+%apply bool& INOUT { bool& stopped_for_crash };
 void
 RunCommandInterpreter (bool auto_handle_events,
bool spawn_thread,
Index: 
packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py
===
--- 
packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py
+++ 
packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py
@@ -0,0 +1,38 @@
+"""Test the RunCommandInterpreter API."""
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class CommandRunInterpreterAPICase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+self.stdin_path = self.getBuildArtifact("stdin.txt")
+
+with open(self.stdin_path, 'w') as input_handle:
+input_handle.write("nonexistingcommand\nquit")
+
+with open(self.stdin_path, 'r') as input_handle:
+self.dbg.SetInputFileHandle(input_handle, False)
+
+# No need to track the output
+devnull = open(os.devnull, 'w')
+self.dbg.SetOutputFileHandle(devnull, False)
+self.dbg.SetErrorFileHandle(devnull, False)
+
+@add_test_categories(['pyapi'])
+def test_run_session_with_error_and_quit(self):
+"""Run non-existing and quit command returns appropriate values"""
+
+n_errors, quit_requested, has_crashed = self.dbg.RunCommandInterpreter(
+True, False, lldb.SBCommandInterpreterRunOptions(), 0, False,
+False)
+
+self.assertGreater(n_errors, 0)
+self.assertTrue(quit_requested)
+self.assertFalse(has_crashed)


Index: scripts/interface/SBDebugger.i
===
--- scripts/interface/SBDebugger.i
+++ scripts/interface/SBDebugger.i
@@ -423,6 +423,32 @@
 lldb::SBTypeSynthetic
 GetSyntheticForType (lldb::SBTypeNameSpecifier);
 
+%feature("docstring",
+"Launch a command interpreter session. Commands are read from standard input or
+from the input handle specified for the debugger object. Output/errors are
+similarly redirected to standard output/error or the configured handles.
+
+@param[in] auto_handle_events If true, automatically handle resulting events.
+@param[in] spawn_thread If true, start a new thread for IO handling.
+@param[in] options Parameter collection of type SBCommandInterpreterRunOptions.
+@param[in] num_errors Initial error counter.
+@param[in] quit_requested Initial quit request flag.
+@param[in] stopped_for_crash Initial crash flag.
+
+@return
+A tuple with the number of errors encountered by the interpreter, a boolean
+indicating whether quitting the interpreter was requested and another boolean
+set to True in case of a crash.
+
+Example:
+
+# Start an interactive lldb session from a script (with a valid debugger object
+# created 

[Lldb-commits] [lldb] r360730 - Make SBDebugger.RunCommandInterpreter callable from Python.

2019-05-14 Thread Jim Ingham via lldb-commits
Author: jingham
Date: Tue May 14 17:08:55 2019
New Revision: 360730

URL: http://llvm.org/viewvc/llvm-project?rev=360730=rev
Log:
Make SBDebugger.RunCommandInterpreter callable from Python.

Authored by: Lukas Boger

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

Added:

lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py
Modified:
lldb/trunk/scripts/interface/SBDebugger.i

Added: 
lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py?rev=360730=auto
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py
 (added)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestRunCommandInterpreterAPI.py
 Tue May 14 17:08:55 2019
@@ -0,0 +1,38 @@
+"""Test the RunCommandInterpreter API."""
+
+import os
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+
+class CommandRunInterpreterAPICase(TestBase):
+
+mydir = TestBase.compute_mydir(__file__)
+
+def setUp(self):
+TestBase.setUp(self)
+
+self.stdin_path = self.getBuildArtifact("stdin.txt")
+
+with open(self.stdin_path, 'w') as input_handle:
+input_handle.write("nonexistingcommand\nquit")
+
+with open(self.stdin_path, 'r') as input_handle:
+self.dbg.SetInputFileHandle(input_handle, False)
+
+# No need to track the output
+devnull = open(os.devnull, 'w')
+self.dbg.SetOutputFileHandle(devnull, False)
+self.dbg.SetErrorFileHandle(devnull, False)
+
+@add_test_categories(['pyapi'])
+def test_run_session_with_error_and_quit(self):
+"""Run non-existing and quit command returns appropriate values"""
+
+n_errors, quit_requested, has_crashed = self.dbg.RunCommandInterpreter(
+True, False, lldb.SBCommandInterpreterRunOptions(), 0, False,
+False)
+
+self.assertGreater(n_errors, 0)
+self.assertTrue(quit_requested)
+self.assertFalse(has_crashed)

Modified: lldb/trunk/scripts/interface/SBDebugger.i
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/interface/SBDebugger.i?rev=360730=360729=360730=diff
==
--- lldb/trunk/scripts/interface/SBDebugger.i (original)
+++ lldb/trunk/scripts/interface/SBDebugger.i Tue May 14 17:08:55 2019
@@ -423,6 +423,32 @@ public:
 lldb::SBTypeSynthetic
 GetSyntheticForType (lldb::SBTypeNameSpecifier);
 
+%feature("docstring",
+"Launch a command interpreter session. Commands are read from standard input or
+from the input handle specified for the debugger object. Output/errors are
+similarly redirected to standard output/error or the configured handles.
+
+@param[in] auto_handle_events If true, automatically handle resulting events.
+@param[in] spawn_thread If true, start a new thread for IO handling.
+@param[in] options Parameter collection of type SBCommandInterpreterRunOptions.
+@param[in] num_errors Initial error counter.
+@param[in] quit_requested Initial quit request flag.
+@param[in] stopped_for_crash Initial crash flag.
+
+@return
+A tuple with the number of errors encountered by the interpreter, a boolean
+indicating whether quitting the interpreter was requested and another boolean
+set to True in case of a crash.
+
+Example:
+
+# Start an interactive lldb session from a script (with a valid debugger object
+# created beforehand):
+n_errors, quit_requested, has_crashed = debugger.RunCommandInterpreter(True,
+False, lldb.SBCommandInterpreterRunOptions(), 0, False, False)") 
RunCommandInterpreter;
+%apply int& INOUT { int& num_errors };
+%apply bool& INOUT { bool& quit_requested };
+%apply bool& INOUT { bool& stopped_for_crash };
 void
 RunCommandInterpreter (bool auto_handle_events,
bool spawn_thread,


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


[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-14 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

There is a TypeSystemEnumerateSupportedLanguages that we use so that we don't 
have to enumerate over all the language in the languages enums.  After all the 
plugin manager knows which languages we have type systems for.  If you're going 
to be doing a lot of this generalization, can you add a similar enumeration for 
the LanguageRuntimes?   There are 40 or so languages in the language enum but 
we only have a couple of LanguageRuntimes...


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

https://reviews.llvm.org/D61921



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


[Lldb-commits] [lldb] r360725 - [lit/Register] Fix matching of the output.

2019-05-14 Thread Davide Italiano via lldb-commits
Author: davide
Date: Tue May 14 16:17:12 2019
New Revision: 360725

URL: http://llvm.org/viewvc/llvm-project?rev=360725=rev
Log:
[lit/Register] Fix matching of the output.

Modified:
lldb/trunk/lit/Register/x86-64-zmm-read.test

Modified: lldb/trunk/lit/Register/x86-64-zmm-read.test
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/Register/x86-64-zmm-read.test?rev=360725=360724=360725=diff
==
--- lldb/trunk/lit/Register/x86-64-zmm-read.test (original)
+++ lldb/trunk/lit/Register/x86-64-zmm-read.test Tue May 14 16:17:12 2019
@@ -8,38 +8,38 @@
 process launch
 
 register read --all
-# CHECK-DAG: zmm0 = {0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 
0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 
0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 
0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 
0x3b 0x3c 0x3d 0x3e 0x3f }
-# CHECK-DAG: zmm1 = {0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 
0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 
0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 
0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 
0x3c 0x3d 0x3e 0x3f 0x40 }
-# CHECK-DAG: zmm2 = {0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 
0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 
0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 
0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 
0x3d 0x3e 0x3f 0x40 0x41 }
-# CHECK-DAG: zmm3 = {0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 
0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 
0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 
0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 
0x3e 0x3f 0x40 0x41 0x42 }
-# CHECK-DAG: zmm4 = {0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 
0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 
0x1f 0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 
0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 
0x3f 0x40 0x41 0x42 0x43 }
-# CHECK-DAG: zmm5 = {0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 
0x10 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 
0x20 0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 
0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 
0x40 0x41 0x42 0x43 0x44 }
-# CHECK-DAG: zmm6 = {0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 
0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 
0x21 0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 
0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 
0x41 0x42 0x43 0x44 0x45 }
-# CHECK-DAG: zmm7 = {0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 
0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 
0x22 0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 
0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 
0x42 0x43 0x44 0x45 0x46 }
-# CHECK-DAG: zmm8 = {0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 
0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 
0x23 0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 
0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 
0x43 0x44 0x45 0x46 0x47 }
-# CHECK-DAG: zmm9 = {0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 
0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 
0x24 0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 
0x34 0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 
0x44 0x45 0x46 0x47 0x48 }
-# CHECK-DAG: zmm10 = {0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 
0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 
0x25 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 
0x35 0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 
0x45 0x46 0x47 0x48 0x49 }
-# CHECK-DAG: zmm11 = {0x0b 0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 
0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 
0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 
0x36 0x37 0x38 0x39 0x3a 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 
0x46 0x47 0x48 0x49 0x4a }
-# CHECK-DAG: zmm12 = {0x0c 0x0d 0x0e 0x0f 0x10 0x11 0x12 0x13 0x14 0x15 0x16 
0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 

[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-14 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: source/Target/ThreadPlanStepThrough.cpp:91
+  if (!m_sub_plan_sp) {
+for (unsigned lang = eLanguageTypeUnknown;
+ !m_sub_plan_sp && lang < eNumLanguageTypes; lang++) {

xiaobai wrote:
> JDevlieghere wrote:
> >  Given that we seem to have this pattern in a bunch of places, would it be 
> > worth extracting this into some kind of convenience function?
> Yeah, I'm getting tired of writing it. We could pull it into Process, into a 
> `ForEachLanguageRuntime` or something. I can either do that before this goes 
> in or in a follow up
Alright, either works for me. 



Comment at: source/Target/ThreadPlanStepThrough.cpp:96
+m_sub_plan_sp =
+runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+  }

xiaobai wrote:
> JDevlieghere wrote:
> > Should there be a break here?
> I put a `!m_sub_plan_sp` in the for loop's condition. If you think it would 
> be more readable to put a break here, I could do that instead.
Aha, you're right, I missed that. I think the break is slightly more readable, 
but I'll leave it up to you. 


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

https://reviews.llvm.org/D61921



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


[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai marked 2 inline comments as done.
xiaobai added inline comments.



Comment at: source/Target/ThreadPlanStepThrough.cpp:91
+  if (!m_sub_plan_sp) {
+for (unsigned lang = eLanguageTypeUnknown;
+ !m_sub_plan_sp && lang < eNumLanguageTypes; lang++) {

JDevlieghere wrote:
>  Given that we seem to have this pattern in a bunch of places, would it be 
> worth extracting this into some kind of convenience function?
Yeah, I'm getting tired of writing it. We could pull it into Process, into a 
`ForEachLanguageRuntime` or something. I can either do that before this goes in 
or in a follow up



Comment at: source/Target/ThreadPlanStepThrough.cpp:96
+m_sub_plan_sp =
+runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+  }

JDevlieghere wrote:
> Should there be a break here?
I put a `!m_sub_plan_sp` in the for loop's condition. If you think it would be 
more readable to put a break here, I could do that instead.


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

https://reviews.llvm.org/D61921



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


[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-14 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: source/Target/ThreadPlanStepThrough.cpp:91
+  if (!m_sub_plan_sp) {
+for (unsigned lang = eLanguageTypeUnknown;
+ !m_sub_plan_sp && lang < eNumLanguageTypes; lang++) {

 Given that we seem to have this pattern in a bunch of places, would it be 
worth extracting this into some kind of convenience function?



Comment at: source/Target/ThreadPlanStepThrough.cpp:96
+m_sub_plan_sp =
+runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+  }

Should there be a break here?


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

https://reviews.llvm.org/D61921



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


[Lldb-commits] [PATCH] D61921: [Target] Generalize language-specific behavior in ThreadPlanStepThrough

2019-05-14 Thread Alex Langford via Phabricator via lldb-commits
xiaobai created this revision.
xiaobai added reviewers: jingham, JDevlieghere.

When creating a ThreadPlan to step through a trampoline, we ask the
ObjC language runtime and the CPP language runtime to come up with such a thread
plan if the dynamic loader fails to give us one. I don't see why this behavior
can't be language agnostic.


https://reviews.llvm.org/D61921

Files:
  include/lldb/Target/CPPLanguageRuntime.h
  include/lldb/Target/LanguageRuntime.h
  include/lldb/Target/ObjCLanguageRuntime.h
  source/Target/ThreadPlanStepThrough.cpp


Index: source/Target/ThreadPlanStepThrough.cpp
===
--- source/Target/ThreadPlanStepThrough.cpp
+++ source/Target/ThreadPlanStepThrough.cpp
@@ -85,22 +85,17 @@
 m_sub_plan_sp =
 loader->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
 
-  // If that didn't come up with anything, try the ObjC runtime plugin:
-  if (!m_sub_plan_sp.get()) {
-ObjCLanguageRuntime *objc_runtime =
-m_thread.GetProcess()->GetObjCLanguageRuntime();
-if (objc_runtime)
-  m_sub_plan_sp =
-  objc_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
-
-CPPLanguageRuntime *cpp_runtime =
-m_thread.GetProcess()->GetCPPLanguageRuntime();
-
-// If the ObjC runtime did not provide us with a step though plan then if 
we
-// have it check the C++ runtime for a step though plan.
-if (!m_sub_plan_sp.get() && cpp_runtime)
-  m_sub_plan_sp =
-  cpp_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+  // If the DynamicLoader was unable to provide us with a ThreadPlan, then we
+  // try the LanguageRuntimes.
+  if (!m_sub_plan_sp) {
+for (unsigned lang = eLanguageTypeUnknown;
+ !m_sub_plan_sp && lang < eNumLanguageTypes; lang++) {
+  if (auto runtime = m_thread.GetProcess()->GetLanguageRuntime(
+  static_cast(lang))) {
+m_sub_plan_sp =
+runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+  }
+}
   }
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
Index: include/lldb/Target/ObjCLanguageRuntime.h
===
--- include/lldb/Target/ObjCLanguageRuntime.h
+++ include/lldb/Target/ObjCLanguageRuntime.h
@@ -216,9 +216,6 @@
 
   virtual bool HasReadObjCLibrary() = 0;
 
-  virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread ,
-  bool stop_others) = 
0;
-
   lldb::addr_t LookupInMethodCache(lldb::addr_t class_addr, lldb::addr_t sel);
 
   void AddToMethodCache(lldb::addr_t class_addr, lldb::addr_t sel,
Index: include/lldb/Target/LanguageRuntime.h
===
--- include/lldb/Target/LanguageRuntime.h
+++ include/lldb/Target/LanguageRuntime.h
@@ -143,6 +143,9 @@
 return false;
   }
 
+  virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread ,
+  bool stop_others) = 
0;
+
   /// Identify whether a value is a language implementation detaul
   /// that should be hidden from the user interface by default.
   virtual bool IsRuntimeSupportValue(ValueObject ) { return false; }
Index: include/lldb/Target/CPPLanguageRuntime.h
===
--- include/lldb/Target/CPPLanguageRuntime.h
+++ include/lldb/Target/CPPLanguageRuntime.h
@@ -61,7 +61,7 @@
   /// \return
   ///  A ThreadPlan Shared pointer
   lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread ,
-  bool stop_others);
+  bool stop_others) override;
 
   bool IsRuntimeSupportValue(ValueObject ) override;
 protected:


Index: source/Target/ThreadPlanStepThrough.cpp
===
--- source/Target/ThreadPlanStepThrough.cpp
+++ source/Target/ThreadPlanStepThrough.cpp
@@ -85,22 +85,17 @@
 m_sub_plan_sp =
 loader->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
 
-  // If that didn't come up with anything, try the ObjC runtime plugin:
-  if (!m_sub_plan_sp.get()) {
-ObjCLanguageRuntime *objc_runtime =
-m_thread.GetProcess()->GetObjCLanguageRuntime();
-if (objc_runtime)
-  m_sub_plan_sp =
-  objc_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
-
-CPPLanguageRuntime *cpp_runtime =
-m_thread.GetProcess()->GetCPPLanguageRuntime();
-
-// If the ObjC runtime did not provide us with a step though plan then if we
-// have it check the C++ runtime for a step though plan.
-if (!m_sub_plan_sp.get() && cpp_runtime)
-  m_sub_plan_sp =
-  cpp_runtime->GetStepThroughTrampolinePlan(m_thread, m_stop_others);
+  // If the DynamicLoader was unable to provide us with a ThreadPlan, then we
+  // 

[Lldb-commits] [PATCH] D61913: Get back the navigation sidebar on the LLDB website

2019-05-14 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl added a comment.

Do you think the fact that sphinx doesn't update the css will be a problem on 
lldb.llvm.org with the way the script is run? (ninja clean does not delete the 
html directory either).


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

https://reviews.llvm.org/D61913



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


[Lldb-commits] [PATCH] D61913: [WIP] Get back the navigation sidebar on the LLDB website

2019-05-14 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl updated this revision to Diff 199510.
aprantl added a comment.

Make Doxygen links in sidebar work.


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

https://reviews.llvm.org/D61913

Files:
  lldb/docs/_static/lldb.css
  lldb/docs/conf.py
  lldb/docs/index.rst

Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -21,7 +21,9 @@
 ==
 
 .. toctree::
+   :hidden:
:maxdepth: 1
+   :caption: Goals & Status
 
status/about
status/goals
@@ -34,6 +36,7 @@
 
 .. toctree::
:maxdepth: 1
+   :caption: Use & Extension
 
use/tutorial
use/map
@@ -52,6 +55,7 @@
 
 .. toctree::
:maxdepth: 1
+   :caption: Resources
 
resources/download
resources/source
@@ -63,13 +67,21 @@
 API Documentation
 =
 
-* `Public Python API Reference `_
-* `Public C++ API Reference `_
-* `Private C++ Reference `_
+.. toctree::
+   :maxdepth: 1
+   :caption: API Documentation
+
+   Public Python API Reference 
+   Public C++ API Reference 
+   Private C++ Reference 
 
 External Links
 ==
 
-* `Source Code `_
-* `Code Reviews `_
-* `Bug Reports `_
+.. toctree::
+   :maxdepth: 1
+   :caption: External Links
+
+   Source Code 
+   Code Reviews 
+   Bug Reports 
Index: lldb/docs/conf.py
===
--- lldb/docs/conf.py
+++ lldb/docs/conf.py
@@ -92,12 +92,14 @@
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'haiku'
+html_theme = 'alabaster'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
-#html_theme_options = {}
+html_theme_options = {
+'font_size': '12pt'
+}
 
 # Add any paths that contain custom themes here, relative to this directory.
 #html_theme_path = []
Index: lldb/docs/_static/lldb.css
===
--- lldb/docs/_static/lldb.css
+++ lldb/docs/_static/lldb.css
@@ -24,3 +24,30 @@
   padding-bottom: 15px;
 }
 
+div.sphinxsidebar h3, div.sphinxsidebar h4,
+div.sphinxsidebar p, div.sphinxsidebar p a {
+font: bold 13px Verdana;
+color: white;
+background: #606060; 
+margin-bottom: 0; /*bottom spacing between header and rest of content*/
+text-transform: uppercase;
+padding: 7px 0 7px 7px;
+}
+
+div.sphinxsidebar ul,
+div.sphinxsidebar ul a {
+font: normal 12px Arial;
+color: black;
+background: #E9E9E9;
+display: block;
+padding: 5px 0;
+line-height: 17px;
+padding-left: 5px;
+text-decoration: none;
+border-bottom: 1px solid white;
+}
+
+div.sphinxsidebar ul li a:hover { /*hover state CSS*/
+color: black;
+background: #bb;
+}
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61913: [WIP] Get back the navigation sidebar on the LLDB website

2019-05-14 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl created this revision.
aprantl added a reviewer: JDevlieghere.
Herald added subscribers: lldb-commits, arphaman.
Herald added a project: LLDB.

This is a little experiment to get back the navigation sidebar on the LLDB 
website like it used to be: 
https://web.archive.org/web/20170204135403/http://lldb.llvm.org/


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61913

Files:
  lldb/docs/_static/lldb.css
  lldb/docs/conf.py
  lldb/docs/index.rst


Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -22,6 +22,7 @@
 
 .. toctree::
:maxdepth: 1
+   :caption: Goals & Status
 
status/about
status/goals
@@ -34,6 +35,7 @@
 
 .. toctree::
:maxdepth: 1
+   :caption: Use & Extension
 
use/tutorial
use/map
@@ -52,6 +54,7 @@
 
 .. toctree::
:maxdepth: 1
+   :caption: Resources
 
resources/download
resources/source
@@ -63,6 +66,10 @@
 API Documentation
 =
 
+.. toctree::
+   :maxdepth: 1
+   :caption: API Documentation
+
 * `Public Python API Reference 
`_
 * `Public C++ API Reference 
`_
 * `Private C++ Reference `_
@@ -70,6 +77,10 @@
 External Links
 ==
 
+.. toctree::
+   :maxdepth: 1
+   :caption: External Links
+
 * `Source Code `_
 * `Code Reviews `_
 * `Bug Reports `_
Index: lldb/docs/conf.py
===
--- lldb/docs/conf.py
+++ lldb/docs/conf.py
@@ -92,12 +92,14 @@
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'haiku'
+html_theme = 'alabaster'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
-#html_theme_options = {}
+html_theme_options = {
+'font_size': '12pt'
+}
 
 # Add any paths that contain custom themes here, relative to this directory.
 #html_theme_path = []
Index: lldb/docs/_static/lldb.css
===
--- lldb/docs/_static/lldb.css
+++ lldb/docs/_static/lldb.css
@@ -24,3 +24,24 @@
   padding-bottom: 15px;
 }
 
+div.sphinxsidebar h3, div.sphinxsidebar h4,
+div.sphinxsidebar p, div.sphinxsidebar p a {
+font: bold 13px Verdana;
+color: white;
+background: #606060; 
+margin-bottom: 0; /*bottom spacing between header and rest of content*/
+text-transform: uppercase;
+padding: 7px 0 7px 7px;
+}
+
+div.sphinxsidebar ul,
+div.sphinxsidebar ul a {
+font: normal 12px Arial;
+color: black;
+background: #E9E9E9;
+display: block;
+padding: 5px 0;
+line-height: 17px;
+padding-left: 14px;
+text-decoration: none;
+}


Index: lldb/docs/index.rst
===
--- lldb/docs/index.rst
+++ lldb/docs/index.rst
@@ -22,6 +22,7 @@
 
 .. toctree::
:maxdepth: 1
+   :caption: Goals & Status
 
status/about
status/goals
@@ -34,6 +35,7 @@
 
 .. toctree::
:maxdepth: 1
+   :caption: Use & Extension
 
use/tutorial
use/map
@@ -52,6 +54,7 @@
 
 .. toctree::
:maxdepth: 1
+   :caption: Resources
 
resources/download
resources/source
@@ -63,6 +66,10 @@
 API Documentation
 =
 
+.. toctree::
+   :maxdepth: 1
+   :caption: API Documentation
+
 * `Public Python API Reference `_
 * `Public C++ API Reference `_
 * `Private C++ Reference `_
@@ -70,6 +77,10 @@
 External Links
 ==
 
+.. toctree::
+   :maxdepth: 1
+   :caption: External Links
+
 * `Source Code `_
 * `Code Reviews `_
 * `Bug Reports `_
Index: lldb/docs/conf.py
===
--- lldb/docs/conf.py
+++ lldb/docs/conf.py
@@ -92,12 +92,14 @@
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'haiku'
+html_theme = 'alabaster'
 
 # Theme options are theme-specific and customize the look and feel of a theme
 # further.  For a list of options available for each theme, see the
 # documentation.
-#html_theme_options = {}
+html_theme_options = {
+'font_size': '12pt'
+}
 
 # Add any paths that contain custom themes here, relative to this directory.
 #html_theme_path = []
Index: lldb/docs/_static/lldb.css
===
--- lldb/docs/_static/lldb.css
+++ lldb/docs/_static/lldb.css
@@ -24,3 +24,24 @@
   padding-bottom: 

[Lldb-commits] [PATCH] D61913: [WIP] Get back the navigation sidebar on the LLDB website

2019-05-14 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl marked an inline comment as done.
aprantl added inline comments.



Comment at: lldb/docs/_static/lldb.css:27
 
+div.sphinxsidebar h3, div.sphinxsidebar h4,
+div.sphinxsidebar p, div.sphinxsidebar p a {

This is copied & pasted from the old static website.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61913



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


[Lldb-commits] [PATCH] D61502: Permit cross-CU references

2019-05-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 199490.
jankratochvil retitled this revision from "03/06: New CUDIERef" to "Permit 
cross-CU references".
jankratochvil edited the summary of this revision.

Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61502

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DIERef.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFAttribute.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3312,7 +3312,7 @@
 }
   } break;
   case DW_AT_specification:
-spec_die = GetDIE(DIERef(form_value));
+spec_die = form_value.Reference();
 break;
   case DW_AT_start_scope: {
 if (form_value.Form() == DW_FORM_sec_offset) {
@@ -3587,12 +3587,11 @@
 case DW_TAG_subprogram:
 case DW_TAG_inlined_subroutine:
 case DW_TAG_lexical_block: {
-  if (die.GetAttributeValueAsReference(
-  DW_AT_specification, DW_INVALID_OFFSET) == spec_block_die_offset)
+  if (die.GetAttributeValueAsReference(DW_AT_specification).GetOffset() ==
+  spec_block_die_offset)
 return die;
 
-  if (die.GetAttributeValueAsReference(DW_AT_abstract_origin,
-   DW_INVALID_OFFSET) ==
+  if (die.GetAttributeValueAsReference(DW_AT_abstract_origin).GetOffset() ==
   spec_block_die_offset)
 return die;
 } break;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -541,13 +541,10 @@
 if (die_offset == (*pos).GetOffset())
   return DWARFDIE(this, &(*pos));
   }
-} else {
-  // Don't specify the compile unit offset as we don't know it because the
-  // DIE belongs to
-  // a different compile unit in the same symbol file.
-  return m_dwarf->DebugInfo()->GetDIEForDIEOffset(GetDebugSection(),
-  die_offset);
-}
+} else
+  GetSymbolFileDWARF()->GetObjectFile()->GetModule()->ReportError(
+  "GetDIE for DIE 0x%" PRIx32 " is outside of its CU 0x%" PRIx32,
+  die_offset, GetOffset());
   }
   return DWARFDIE(); // Not found
 }
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
@@ -14,6 +14,7 @@
 
 class DWARFUnit;
 class SymbolFileDWARF;
+class DWARFDIE;
 
 class DWARFFormValue {
 public:
@@ -57,7 +58,6 @@
   DWARFFormValue();
   DWARFFormValue(const DWARFUnit *cu);
   DWARFFormValue(const DWARFUnit *cu, dw_form_t form);
-  const DWARFUnit *GetCompileUnit() const { return m_cu; }
   void SetCompileUnit(const DWARFUnit *cu) { m_cu = cu; }
   dw_form_t Form() const { return m_form; }
   dw_form_t& FormRef() { return m_form; }
@@ -70,7 +70,7 @@
   bool ExtractValue(const lldb_private::DWARFDataExtractor ,
 lldb::offset_t *offset_ptr);
   const uint8_t *BlockData() const;
-  uint64_t Reference() const;
+  DWARFDIE Reference() const;
   uint64_t Reference(dw_offset_t offset) const;
   bool Boolean() const { return m_value.value.uval != 0; }
   uint64_t Unsigned() const { return m_value.value.uval; }
@@ -93,7 +93,9 @@
   static bool FormIsSupported(dw_form_t form);
 
 protected:
-  const DWARFUnit *m_cu;// Compile unit for this form
+  // Compile unit where m_value was located.
+  // It may be different from compile unit where m_value refers to.
+  const DWARFUnit *m_cu;
   dw_form_t m_form; // Form for this value
   ValueType m_value;// Contains all data for the form
 };
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ 

[Lldb-commits] [PATCH] D61504: 05/06: Track CUs and TUs separately

2019-05-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil abandoned this revision.
jankratochvil added a comment.

Obsoleted by: D61908 


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61504



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


[Lldb-commits] [PATCH] D61503: 04/06: Track .debug_types vs. .debug_info difference

2019-05-14 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil abandoned this revision.
jankratochvil added a comment.

Obsoleted by: D61908 


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61503



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


[Lldb-commits] [PATCH] D61908: DWARF: Add ability to reference debug info coming from multiple sections

2019-05-14 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

See inline comments. Nice patch overall though, real close.




Comment at: source/Plugins/SymbolFile/DWARF/DIERef.cpp:18
   if (form_value.IsValid()) {
 const DWARFUnit *dwarf_cu = form_value.GetCompileUnit();
 if (dwarf_cu) {

We should maybe rename DWARFFormValue::GetCompileUnit() to 
DWARFFormValue::GetUnit()? Also we might use "unit" instead of "dwarf_cu" here?



Comment at: source/Plugins/SymbolFile/DWARF/DIERef.h:19
 struct DIERef {
+  enum DebugSection : uint8_t { InfoSection, TypesSection };
+

Use enum class?
```
enum class Section : uint8_t { DebugInfo, DebugTypes };
```



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp:141
+  uint32_t idx = FindUnitIndex(section, cu_offset);
   DWARFUnit *result = GetUnitAtIndex(idx);
   if (result && result->GetOffset() != cu_offset) {

Does the "GetUnitAtIndex" call need to take "section" to get the right unit?



Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp:162
+  uint32_t idx = FindUnitIndex(section, die_offset);
   DWARFUnit *result = GetUnitAtIndex(idx);
   if (result && !result->ContainsDIEOffset(die_offset))

Does the "GetUnitAtIndex" call need to take "section" to get the right unit?





Comment at: source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h:51-52
   struct DIEInfo {
 dw_offset_t cu_offset;
 dw_offset_t offset; // The DIE offset
 dw_tag_t tag;

Should we use a DIERef here instead of these two members?



Comment at: source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h:61
+explicit operator DIERef() const {
+  return {DIERef::InfoSection, cu_offset, offset};
+}

just return the DIERef member variable if we switch according to above inline 
comment


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

https://reviews.llvm.org/D61908



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


Re: [Lldb-commits] [lldb] r360695 - build: use the correct variable

2019-05-14 Thread Jonas Devlieghere via lldb-commits
Hey Saleem,

Why is this necessary after Pavel's change in r360652? Now that the
 LLDB_CAN_USE_LLDB_SERVER is defined correctly, the
LLDB_TOOL_LLDB_SERVER_BUILD option should never be set.

Thanks,
Jonas

On Tue, May 14, 2019 at 10:22 AM Saleem Abdulrasool via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: compnerd
> Date: Tue May 14 10:24:45 2019
> New Revision: 360695
>
> URL: http://llvm.org/viewvc/llvm-project?rev=360695=rev
> Log:
> build: use the correct variable
>
> Adjust the variable that controls whether the unit tests use `lldb-server`.
> This should repair the default build on Windows.
>
> Modified:
> lldb/trunk/unittests/tools/CMakeLists.txt
>
> Modified: lldb/trunk/unittests/tools/CMakeLists.txt
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/CMakeLists.txt?rev=360695=360694=360695=diff
>
> ==
> --- lldb/trunk/unittests/tools/CMakeLists.txt (original)
> +++ lldb/trunk/unittests/tools/CMakeLists.txt Tue May 14 10:24:45 2019
> @@ -1,6 +1,6 @@
>  if(LLDB_TOOL_LLDB_MI_BUILD)
>add_subdirectory(lldb-mi)
>  endif()
> -if(LLDB_TOOL_LLDB_SERVER_BUILD)
> +if(LLDB_CAN_USE_LLDB_SERVER)
>add_subdirectory(lldb-server)
>  endif()
>
>
> ___
> 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


Re: [Lldb-commits] [lldb] r360652 - [CMake] Correctly reinstate LLDB_CAN_USE_LLDB_SERVER

2019-05-14 Thread Jonas Devlieghere via lldb-commits
Thanks Pavel!

On Tue, May 14, 2019 at 1:15 AM Pavel Labath via lldb-commits <
lldb-commits@lists.llvm.org> wrote:

> Author: labath
> Date: Tue May 14 01:18:06 2019
> New Revision: 360652
>
> URL: http://llvm.org/viewvc/llvm-project?rev=360652=rev
> Log:
> [CMake] Correctly reinstate LLDB_CAN_USE_LLDB_SERVER
>
> r360631 introduced a "syntax error" which meant that cmake was still not
> honoring the value of LLDB_CAN_USE_LLDB_SERVER variable. The correct
> syntax for seting an internal cache variable is "set(VAR value CACHE
> INTERNAL)", but the patch omitted the "CACHE" keyword. The "syntax
> error" is in quotes because without the CACHE keyword this is still
> valid syntax for setting the value of LLDB_CAN_USE_LLDB_SERVER to "1
> INTERNAL".
>
> There doesn't seem to be a need for this to be a cache variable so I'm
> reverting this variable to a plain one, as it was before r360621.
>
> This will hopefully fix the windows build.
>
> Modified:
> lldb/trunk/cmake/modules/LLDBConfig.cmake
>
> Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=360652=360651=360652=diff
>
> ==
> --- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
> +++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue May 14 01:18:06 2019
> @@ -417,9 +417,9 @@ list(APPEND system_libs ${CMAKE_DL_LIBS}
>  # Figure out if lldb could use lldb-server.  If so, then we'll
>  # ensure we build lldb-server when an lldb target is being built.
>  if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
> -  set(LLDB_CAN_USE_LLDB_SERVER 1 INTERNAL)
> +  set(LLDB_CAN_USE_LLDB_SERVER 1)
>  else()
> -  set(LLDB_CAN_USE_LLDB_SERVER 0 INTERNAL)
> +  set(LLDB_CAN_USE_LLDB_SERVER 0)
>  endif()
>
>  # Figure out if lldb could use debugserver.  If so, then we'll
>
>
> ___
> 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


[Lldb-commits] [lldb] r360695 - build: use the correct variable

2019-05-14 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Tue May 14 10:24:45 2019
New Revision: 360695

URL: http://llvm.org/viewvc/llvm-project?rev=360695=rev
Log:
build: use the correct variable

Adjust the variable that controls whether the unit tests use `lldb-server`.
This should repair the default build on Windows.

Modified:
lldb/trunk/unittests/tools/CMakeLists.txt

Modified: lldb/trunk/unittests/tools/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/CMakeLists.txt?rev=360695=360694=360695=diff
==
--- lldb/trunk/unittests/tools/CMakeLists.txt (original)
+++ lldb/trunk/unittests/tools/CMakeLists.txt Tue May 14 10:24:45 2019
@@ -1,6 +1,6 @@
 if(LLDB_TOOL_LLDB_MI_BUILD)
   add_subdirectory(lldb-mi)
 endif()
-if(LLDB_TOOL_LLDB_SERVER_BUILD)
+if(LLDB_CAN_USE_LLDB_SERVER)
   add_subdirectory(lldb-server)
 endif()


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


[Lldb-commits] [lldb] r360693 - lldb-server: rename `llgs::terminate` (NFC)

2019-05-14 Thread Saleem Abdulrasool via lldb-commits
Author: compnerd
Date: Tue May 14 10:07:36 2019
New Revision: 360693

URL: http://llvm.org/viewvc/llvm-project?rev=360693=rev
Log:
lldb-server: rename `llgs::terminate` (NFC)

`terminate` overlaps with a C function on Windows:

```
D:\a\1\s\lldb\tools\lldb-server\lldb-server.cpp(45,13):  warning: 'terminate' 
redeclared without 'dllimport' attribute: 'dllexport' attribute added 
[-Winconsistent-dllimport]
static void terminate() { g_debugger_lifetime->Terminate(); }
^
C:\Program Files (x86)\Windows 
Kits\10\include\10.0.17763.0\ucrt\corecrt_terminate.h(29,48):  note: previous 
declaration is here
_ACRTIMP __declspec(noreturn) void __cdecl terminate() throw();
   ^
D:\a\1\s\lldb\tools\lldb-server\lldb-server.cpp(45,61):  warning: function 
declared 'noreturn' should not return [-Winvalid-noreturn]
static void terminate() { g_debugger_lifetime->Terminate(); }
^
```

Rename the function to `terminate_debugger` to avoid the errant match.

Modified:
lldb/trunk/tools/lldb-server/lldb-server.cpp

Modified: lldb/trunk/tools/lldb-server/lldb-server.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/lldb-server.cpp?rev=360693=360692=360693=diff
==
--- lldb/trunk/tools/lldb-server/lldb-server.cpp (original)
+++ lldb/trunk/tools/lldb-server/lldb-server.cpp Tue May 14 10:07:36 2019
@@ -43,7 +43,7 @@ static void initialize() {
 llvm::consumeError(std::move(e));
 }
 
-static void terminate() { g_debugger_lifetime->Terminate(); }
+static void terminate_debugger() { g_debugger_lifetime->Terminate(); }
 } // namespace llgs
 
 // main
@@ -63,12 +63,12 @@ int main(int argc, char *argv[]) {
   case 'g':
 llgs::initialize();
 main_gdbserver(argc, argv);
-llgs::terminate();
+llgs::terminate_debugger();
 break;
   case 'p':
 llgs::initialize();
 main_platform(argc, argv);
-llgs::terminate();
+llgs::terminate_debugger();
 break;
   case 'v':
 fprintf(stderr, "%s\n", lldb_private::GetVersion());


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


[Lldb-commits] [PATCH] D61877: [CMake] Add error to clarify that lldb requires libcxx

2019-05-14 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz accepted this revision.
sgraenitz added a comment.
This revision is now accepted and ready to land.

Sure, will commit this on your behalf tomorrow. (If nothing else comes up.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61877



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


[Lldb-commits] [lldb] r360691 - Rename MacOS X -> macOS where applicable.

2019-05-14 Thread Adrian Prantl via lldb-commits
Author: adrian
Date: Tue May 14 09:37:43 2019
New Revision: 360691

URL: http://llvm.org/viewvc/llvm-project?rev=360691=rev
Log:
Rename MacOS X -> macOS where applicable.

Modified:
lldb/trunk/docs/lldb-gdb-remote.txt
lldb/trunk/docs/resources/build.rst
lldb/trunk/docs/status/about.rst
lldb/trunk/docs/status/features.rst
lldb/trunk/docs/status/status.rst
lldb/trunk/docs/testsuite/a-detailed-walkthrough.txt
lldb/trunk/docs/use/map.rst
lldb/trunk/docs/use/python-reference.rst
lldb/trunk/docs/use/remote.rst
lldb/trunk/docs/use/symbolication.rst
lldb/trunk/docs/use/troubleshooting.rst
lldb/trunk/docs/use/variable.rst

Modified: lldb/trunk/docs/lldb-gdb-remote.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/lldb-gdb-remote.txt?rev=360691=360690=360691=diff
==
--- lldb/trunk/docs/lldb-gdb-remote.txt (original)
+++ lldb/trunk/docs/lldb-gdb-remote.txt Tue May 14 09:37:43 2019
@@ -1086,7 +1086,7 @@ tuples to return are:
 If the address requested is not in a mapped region (e.g. we've jumped through
 a NULL pointer and are at 0x0) currently lldb expects to get back the size 
 of the unmapped region -- that is, the distance to the next valid region.
-For instance, with a Mac OS X process which has nothing mapped in the first
+For instance, with a macOS process which has nothing mapped in the first
 4GB of its address space, if we're asking about address 0x2,
 
   qMemoryRegionInfo:2
@@ -1611,7 +1611,7 @@ for this region.
 //
 // Because this is a JSON string, the thread number is provided in base10.
 // Additional key-value pairs may be provided by lldb to the gdb remote
-// stub.  For instance, on some versions of Mac OS X, lldb can read offset
+// stub.  For instance, on some versions of macOS, lldb can read offset
 // information out of the system libraries.  Using those offsets, debugserver
 // is able to find the Thread Specific Address (TSD) for a thread and include
 // that in the return information.  So lldb will send these additional fields
@@ -1620,7 +1620,7 @@ for this region.
 //   
jThreadExtendedInfo:{"plo_pthread_tsd_base_address_offset":0,"plo_pthread_tsd_base_offset":224,"plo_pthread_tsd_entry_size":8,"thread":612910}
 //
 // There are no requirements for what is included in the response.  A simple 
-// reply on a Mac OS X Yosemite / iOS 8 may include the pthread_t value, the
+// reply on a OS X Yosemite / iOS 8 may include the pthread_t value, the
 // Thread Specific Data (TSD) address, the dispatch_queue_t value if the thread
 // is associated with a GCD queue, and the requested Quality of Service (QoS)
 // information about that thread.  For instance, a reply may look like:
@@ -1740,7 +1740,7 @@ for this region.
 //  out of memory with generic read packets) but also adds additional 
information in the form of the 
 //  filename of the shared libraries (which is not available in the mach-o 
header/load commands.)
 //  
-//  An example using the Mac OS X 10.11 style call:
+//  An example using the OS X 10.11 style call:
 //
 //  LLDB SENDS: 
jGetLoadedDynamicLibrariesInfos:{"image_count":1,"image_list_address":140734800075128}
 //  STUB REPLIES: 
${"images":[{"load_address":4294967296,"mod_date":0,"pathname":"/tmp/a.out","uuid":"02CF262C-ED6F-3965-9E14-63538B465CFF","mach_header":{"magic":4277009103,"cputype":16777223,"cpusubtype":18446744071562067971,"filetype":2},"segments":{"name":"__PAGEZERO","vmaddr":0,"vmsize":4294967296,"fileoff":0,"filesize":0,"maxprot":0},{"name":"__TEXT","vmaddr":4294967296,"vmsize":4096,"fileoff":0,"filesize":4096,"maxprot":7},{"name":"__LINKEDIT","vmaddr":4294971392,"vmsize":4096,"fileoff":4096,"filesize":152,"maxprot":7}}]}#00
@@ -1797,7 +1797,7 @@ for this region.
 // would need to work correctly on this platform.
 //
 // PRIORITY TO IMPLEMENT
-//  On Mac OS X 10.11, iOS 9, tvOS 9, watchOS 2 and older: Low.  If this 
packet is absent, 
+//  On OS X 10.11, iOS 9, tvOS 9, watchOS 2 and older: Low.  If this packet is 
absent, 
 //  lldb will read the Mach-O headers/load commands out of memory.
 //  On macOS 10.12, iOS 10, tvOS 10, watchOS 3 and newer: High.  If this 
packet is absent,
 //  lldb will not know anything about shared libraries in the inferior, or 
where the main

Modified: lldb/trunk/docs/resources/build.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/build.rst?rev=360691=360690=360691=diff
==
--- lldb/trunk/docs/resources/build.rst (original)
+++ lldb/trunk/docs/resources/build.rst Tue May 14 09:37:43 2019
@@ -113,7 +113,7 @@ and the working directory to point to bi
 Building LLDB on macOS
 --
 
-There are two ways to build LLDB on Mac OS X: Using Xcode and using CMake
+There are two ways to build LLDB on macOS: Using Xcode and using CMake
 
 **Preliminaries**
 
@@ -122,13 +122,12 @@ There are two ways to 

[Lldb-commits] [PATCH] D61877: [CMake] Add error to clarify that lldb requires libcxx

2019-05-14 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61877



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


[Lldb-commits] [PATCH] D61438: [ASTImporter] Use llvm::Expected and Error in the importer API

2019-05-14 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.

Alright, thanks for taking the time to walk me through the thought process!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61438



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


[Lldb-commits] [PATCH] D61885: Minidump: Add support for the MemoryList stream

2019-05-14 Thread James Henderson via Phabricator via lldb-commits
jhenderson added inline comments.



Comment at: include/llvm/Object/Minidump.h:85-86
+  /// error is returned if the file does not contain this stream, or if the
+  /// stream is not large enough to contain the number of threads declared in
+  /// the stream header. The consistency of the Thread entries themselves is 
not
+  /// checked in any way.

These two lines talk about threads. Is that a copy/paste error?



Comment at: include/llvm/ObjectYAML/MinidumpYAML.h:92
+/// A structure containing all data describing a single memory region.
+struct ParsedMemoryRange {
+  static constexpr Stream::StreamKind Kind = Stream::StreamKind::MemoryList;

Would it make more sense to call this ParsedMermoryList, to match the 
StreamType?



Comment at: test/tools/obj2yaml/basic-minidump.yaml:54-57
+  - Type:MemoryList
+Memory Ranges:   
+  - Start of Memory Range: 0x7C7D7E7F80818283
+Content: '8485868788'

I'd probably find this neater if the Indentation of values for each entry were 
more consistent, but I'm not too fussed.

Also, in the ThreadList above, the Content is not quoted, but here it is. 
Please standardise it on one or the other.



Comment at: unittests/Object/MinidumpTest.cpp:483
+  };
+  // Same as before, but with a padded thread list.
+  std::vector PaddedRange{

thread? Copy/paste error?


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61885



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


[Lldb-commits] [lldb] r360669 - DWARF/NFC: Centralize DIERef conversions

2019-05-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue May 14 05:44:40 2019
New Revision: 360669

URL: http://llvm.org/viewvc/llvm-project?rev=360669=rev
Log:
DWARF/NFC: Centralize DIERef conversions

apple and manual indexing code were creating a DIERef in a bunch of
places. Though the code itself is not much, it is also easy to simplify
by factoring out the DIERef creation. In HashedNameToDIE I create a
conversion operator from DIEInfo to DIERef, and in ManualDWARFIndex I
just create the DIERef in a global variable up-front.

This also reduces the diff in follow-up patches which change how DIERefs
are constructed.

Modified:
lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp?rev=360669=360668=360669=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp Tue May 14 
05:44:40 2019
@@ -13,8 +13,7 @@ void DWARFMappedHash::ExtractDIEArray(co
   DIEArray _offsets) {
   const size_t count = die_info_array.size();
   for (size_t i = 0; i < count; ++i)
-die_offsets.emplace_back(die_info_array[i].cu_offset,
- die_info_array[i].offset);
+die_offsets.emplace_back(die_info_array[i]);
 }
 
 void DWARFMappedHash::ExtractDIEArray(const DIEInfoArray _info_array,
@@ -33,8 +32,7 @@ void DWARFMappedHash::ExtractDIEArray(co
   tag == DW_TAG_structure_type || tag == DW_TAG_class_type;
   }
   if (tag_matches)
-die_offsets.emplace_back(die_info_array[i].cu_offset,
- die_info_array[i].offset);
+die_offsets.emplace_back(die_info_array[i]);
 }
   }
 }
@@ -58,8 +56,7 @@ void DWARFMappedHash::ExtractDIEArray(co
   tag == DW_TAG_structure_type || tag == DW_TAG_class_type;
   }
   if (tag_matches)
-die_offsets.emplace_back(die_info_array[i].cu_offset,
- die_info_array[i].offset);
+die_offsets.emplace_back(die_info_array[i]);
 }
   }
 }
@@ -77,8 +74,7 @@ void DWARFMappedHash::ExtractClassOrStru
   // We found the one true definition for this class, so only return
   // that
   die_offsets.clear();
-  die_offsets.emplace_back(die_info_array[i].cu_offset,
-   die_info_array[i].offset);
+  die_offsets.emplace_back(die_info_array[i]);
   return;
 } else {
   // Put the one true definition as the first entry so it matches first
@@ -86,8 +82,7 @@ void DWARFMappedHash::ExtractClassOrStru
   die_info_array[i].offset);
 }
   } else {
-die_offsets.emplace_back(die_info_array[i].cu_offset,
- die_info_array[i].offset);
+die_offsets.emplace_back(die_info_array[i]);
   }
 }
   }
@@ -99,8 +94,7 @@ void DWARFMappedHash::ExtractTypesFromDI
   const size_t count = die_info_array.size();
   for (size_t i = 0; i < count; ++i) {
 if ((die_info_array[i].type_flags & type_flag_mask) == type_flag_value)
-  die_offsets.emplace_back(die_info_array[i].cu_offset,
-   die_info_array[i].offset);
+  die_offsets.emplace_back(die_info_array[i]);
   }
 }
 

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h?rev=360669=360668=360669=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h Tue May 14 
05:44:40 2019
@@ -56,6 +56,8 @@ public:
 
 DIEInfo();
 DIEInfo(dw_offset_t c, dw_offset_t o, dw_tag_t t, uint32_t f, uint32_t h);
+
+explicit operator DIERef() const { return {cu_offset, offset}; }
   };
 
   struct Atom {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp?rev=360669=360668=360669=diff
==
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp Tue May 14 
05:44:40 2019
@@ -245,6 +245,7 @@ void ManualDWARFIndex::IndexUnitImpl(
   }
 }
 
+DIERef ref(cu_offset, die.GetOffset());
 switch (tag) {
 case DW_TAG_inlined_subroutine:
 case 

[Lldb-commits] [PATCH] D61438: [ASTImporter] Use llvm::Expected and Error in the importer API

2019-05-14 Thread Gabor Marton via Phabricator via lldb-commits
martong marked an inline comment as done.
martong added inline comments.



Comment at: clang/include/clang/AST/ASTImporter.h:203
 /// context, or the import error.
-llvm::Expected Import_New(TypeSourceInfo *FromTSI);
-// FIXME: Remove this version.
-TypeSourceInfo *Import(TypeSourceInfo *FromTSI);
+llvm::Expected Import(TypeSourceInfo *FromTSI);
 

aprantl wrote:
> martong wrote:
> > aprantl wrote:
> > > Wouldn't it make more sense to return `Expected`?
> > That would not be consistent with the other changes. In this patch we 
> > change the signature of each functions similarly:
> > From `T foo(...)` to `Expected foo(...)`.
> > Also, `TypeSourceInfo` factory functions in `ASTContext` do return with a 
> > pointer. For example:
> > ```
> >   TypeSourceInfo *CreateTypeSourceInfo(QualType T, unsigned Size = 0) const;
> > 
> >   /// Allocate a TypeSourceInfo where all locations have been
> >   /// initialized to a given location, which defaults to the empty
> >   /// location.
> >   TypeSourceInfo *
> >   getTrivialTypeSourceInfo(QualType T,
> >SourceLocation Loc = SourceLocation()) const;
> > 
> > ```
> I believe that LLVM's practice of passing non-null pointers around is bad API 
> design because it's never quite clear from looking at an API which pointer 
> parameters are nullable, so I was hoping that we could correct some of that 
> at least in the cases where we introduce API that return Expected<> objects 
> to make it obvious that this is either an error or a valid object. If you 
> that the perceived inconsistency weighs stronger than the readability 
> improvements let me know and I can reconsider.
I couldn't agree more that having non-null-able pointers is a bad API, and we'd 
be better to have references in these cases. However, I think the situation is 
more complex than that.

If we changed `TypeSourceInfo *` to `TypeSourceInfo &` in this patch, that 
would involve to make similar changes with other importer functions 
(NestedNameSpecifier *, Decl *, Expr *, etc.). That would result in a **huge** 
patch and I am afraid we could not follow the incremental development 
suggestion in the LLVM dev policy. Thus, even if we decide to change to 
references I propose to do that in a separate patch.

Also, some AST nodes are indeed null-able. E.g. the body of a FunctionDecl 
might be null. Or the described class template of a CXXRecordDecl may be null 
(and we rely on this, because first we create the CXXRecordDecl then we import 
the ClassTemplateDecl and only then we set the relation).
The point is that we should identify those AST nodes which are really 
non-nullable in the AST. This does not seem trivial.
Besides, since the ASTImporter class is part of the AST lib, it would look 
strange if we changed to use references only in the ASTImporter. Perhaps, we 
should change in the whole AST API, but that might broke too many dependencies 
I guess. Still, this may worth an RFC on cfe-dev.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61438



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


[Lldb-commits] [PATCH] D61877: [CMake] Add error to clarify that lldb requires libcxx

2019-05-14 Thread J. Ryan Stinnett via Phabricator via lldb-commits
jryans marked 3 inline comments as done.
jryans added a comment.

Thanks all for the review! 

In D61877#1500981 , @sgraenitz wrote:

> Thanks for adding this. Would it make sense to use 
> `LLVM_ENABLE_PROJECTS_USED`? 
> https://github.com/llvm/llvm-project/blob/a568222d/llvm/CMakeLists.txt#L128
>
> BTW `LLVM_ENABLE_PROJECTS` can be "all" but LLVM should already have handled 
> it at this point.


`LLVM_ENABLE_PROJECTS_USED` seems to be about "what did we use last time", 
which felt confusing to test here, so I have avoided that so far.

In the updated version, I have changed to testing `if(NOT TARGET cxx)`, which 
should cover all cases, including:

- LLVM_ENABLE_PROJECTS='clang;lldb;libcxx'
- LLVM_ENABLE_PROJECTS='all'
- Old layout




Comment at: lldb/CMakeLists.txt:127
   else()
+if(NOT libcxx IN_LIST LLVM_ENABLE_PROJECTS)
+  message(FATAL_ERROR

sgraenitz wrote:
> JDevlieghere wrote:
> > Should we check that LLVM_ENABLE_PROJECTS is not empty, for people that are 
> > still using the old layout?
> +1
Ah yes, thanks for catching that! I have updated this to support the old layout 
as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61877



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


[Lldb-commits] [PATCH] D61877: [CMake] Add error to clarify that lldb requires libcxx

2019-05-14 Thread J. Ryan Stinnett via Phabricator via lldb-commits
jryans updated this revision to Diff 199394.
jryans added a comment.

Updated to support old project layout as well


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61877

Files:
  lldb/CMakeLists.txt
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -152,6 +152,12 @@
 LLVM, then you can pass LLVM-specific CMake variables to cmake when building
 LLDB.
 
+If you are building both Clang and LLDB together, be sure to also add libc++,
+which is currently required for testing on macOS:
+
+::
+
+  > cmake -D LLVM_ENABLE_PROJECTS='clang;lldb;libcxx' $PATH_TO_LLVM -G Ninja
 
 Here are some commonly used LLDB-specific CMake variables:
 
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -124,6 +124,24 @@
   message(WARNING "LLDB test suite requires libc++ in 
llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
 endif()
   else()
+# We require libcxx for the test suite, so if we aren't building it,
+# try to provide a helpful error about how to resolve the situation.
+if(NOT TARGET cxx)
+  if(LLVM_ENABLE_PROJECTS STREQUAL "")
+# If `LLVM_ENABLE_PROJECTS` is not being used (implying that we are
+# using the old layout), suggest checking it out.
+message(FATAL_ERROR
+  "LLDB test suite requires libc++, but it is currently disabled. "
+  "Please checkout `libcxx` in `llvm/projects` or disable tests "
+  "via `LLDB_INCLUDE_TESTS=OFF`.")
+  else()
+# If `LLVM_ENABLE_PROJECTS` is being used, suggest adding it.
+message(FATAL_ERROR
+  "LLDB test suite requires libc++, but it is currently disabled. "
+  "Please add `libcxx` to `LLVM_ENABLE_PROJECTS` or disable tests "
+  "via `LLDB_INCLUDE_TESTS=OFF`.")
+  endif()
+endif()
 list(APPEND LLDB_TEST_DEPS cxx)
   endif()
 endif()


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -152,6 +152,12 @@
 LLVM, then you can pass LLVM-specific CMake variables to cmake when building
 LLDB.
 
+If you are building both Clang and LLDB together, be sure to also add libc++,
+which is currently required for testing on macOS:
+
+::
+
+  > cmake -D LLVM_ENABLE_PROJECTS='clang;lldb;libcxx' $PATH_TO_LLVM -G Ninja
 
 Here are some commonly used LLDB-specific CMake variables:
 
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -124,6 +124,24 @@
   message(WARNING "LLDB test suite requires libc++ in llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
 endif()
   else()
+# We require libcxx for the test suite, so if we aren't building it,
+# try to provide a helpful error about how to resolve the situation.
+if(NOT TARGET cxx)
+  if(LLVM_ENABLE_PROJECTS STREQUAL "")
+# If `LLVM_ENABLE_PROJECTS` is not being used (implying that we are
+# using the old layout), suggest checking it out.
+message(FATAL_ERROR
+  "LLDB test suite requires libc++, but it is currently disabled. "
+  "Please checkout `libcxx` in `llvm/projects` or disable tests "
+  "via `LLDB_INCLUDE_TESTS=OFF`.")
+  else()
+# If `LLVM_ENABLE_PROJECTS` is being used, suggest adding it.
+message(FATAL_ERROR
+  "LLDB test suite requires libc++, but it is currently disabled. "
+  "Please add `libcxx` to `LLVM_ENABLE_PROJECTS` or disable tests "
+  "via `LLDB_INCLUDE_TESTS=OFF`.")
+  endif()
+endif()
 list(APPEND LLDB_TEST_DEPS cxx)
   endif()
 endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D61886: Support member functions construction and lookup in PdbAstBuilder

2019-05-14 Thread Mikhail Senkov via Phabricator via lldb-commits
zloyrobot created this revision.
zloyrobot added reviewers: amccarth, aleksandr.urakov, stella.stamenova.
zloyrobot added a project: LLDB.
Herald added subscribers: lldb-commits, teemperor.

This path implements member function support in 
PdbAstBuilder::GetOrCreateFunctionDecl. It allows to lookup and evaluate struct 
fields inside struct members


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D61886

Files:
  lldb/lit/SymbolFile/NativePDB/Inputs/struct-fields.lldbinit
  lldb/lit/SymbolFile/NativePDB/struct-fields.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
  lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h

Index: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
===
--- lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
+++ lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h
@@ -109,6 +109,9 @@
   clang::VarDecl *CreateVariableDecl(PdbSymUid uid,
  llvm::codeview::CVSymbol sym,
  clang::DeclContext );
+  clang::CXXMethodDecl* LookupOrCreateMethodDecl(clang::CXXRecordDecl* parent,
+  const llvm::codeview::ProcSym& method_sym,
+  llvm::StringRef proc_name);
   clang::DeclContext *
   GetParentDeclContextForSymbol(const llvm::codeview::CVSymbol );
 
Index: lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
===
--- lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
+++ lldb/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp
@@ -983,19 +983,39 @@
   return qt;
 }
 
+clang::CXXMethodDecl *
+PdbAstBuilder::LookupOrCreateMethodDecl(clang::CXXRecordDecl* parent,
+const ProcSym& method_sym,
+llvm::StringRef proc_name) {
+  
+  PdbTypeSymId type_id(method_sym.FunctionType);
+  clang::QualType qt = GetOrCreateType(type_id);
+  if (qt.isNull())
+return nullptr;
+
+  CompilerType parent_tag = m_clang.GetTypeForDecl(parent);
+  if (parent_tag.GetCompleteType()) {
+for (clang::CXXMethodDecl *method : parent->methods()) {
+  if (method->getNameAsString() == proc_name && method->getType() == qt)
+return method;
+}
+  }
+
+  PdbTypeSymId type = PdbTypeSymId(method_sym.FunctionType);
+  clang::QualType method_qt = GetOrCreateType(type);
+  CompleteType(method_qt);
+
+  return clang().AddMethodToCXXRecordType(parent_tag.GetOpaqueQualType(),
+proc_name.data(),nullptr, ToCompilerType(method_qt),
+lldb::eAccessPublic,false,false,false,
+false,false,false);
+}
+
 clang::FunctionDecl *
 PdbAstBuilder::GetOrCreateFunctionDecl(PdbCompilandSymId func_id) {
   if (clang::Decl *decl = TryGetDecl(func_id))
 return llvm::dyn_cast(decl);
 
-  clang::DeclContext *parent = GetParentDeclContext(PdbSymUid(func_id));
-  std::string context_name;
-  if (clang::NamespaceDecl *ns = llvm::dyn_cast(parent)) {
-context_name = ns->getQualifiedNameAsString();
-  } else if (clang::TagDecl *tag = llvm::dyn_cast(parent)) {
-context_name = tag->getQualifiedNameAsString();
-  }
-
   CVSymbol cvs = m_index.ReadSymbolRecord(func_id);
   ProcSym proc(static_cast(cvs.kind()));
   llvm::cantFail(SymbolDeserializer::deserializeAs(cvs, proc));
@@ -1005,21 +1025,27 @@
   if (qt.isNull())
 return nullptr;
 
-  clang::StorageClass storage = clang::SC_None;
-  if (proc.Kind == SymbolRecordKind::ProcSym)
-storage = clang::SC_Static;
-
-  const clang::FunctionProtoType *func_type =
-  llvm::dyn_cast(qt);
+  clang::DeclContext *parent = GetParentDeclContext(PdbSymUid(func_id));
+  
+  llvm::StringRef proc_name = proc.Name;
+  if (clang::NamedDecl *ns = llvm::dyn_cast(parent)) {
+proc_name.consume_front(ns->getQualifiedNameAsString());
+proc_name.consume_front("::");
+  }
 
-  CompilerType func_ct = ToCompilerType(qt);
+  clang::FunctionDecl *function_decl = nullptr;
+  if (clang::CXXRecordDecl *tag = llvm::dyn_cast(parent))
+function_decl = LookupOrCreateMethodDecl(tag, proc, proc_name);
 
-  llvm::StringRef proc_name = proc.Name;
-  proc_name.consume_front(context_name);
-  proc_name.consume_front("::");
+  if (function_decl == nullptr) {
+clang::StorageClass storage = clang::SC_None;
+if (proc.Kind == SymbolRecordKind::ProcSym)
+  storage = clang::SC_Static;
 
-  clang::FunctionDecl *function_decl = m_clang.CreateFunctionDeclaration(
+CompilerType func_ct = ToCompilerType(qt);
+function_decl = m_clang.CreateFunctionDeclaration(
   parent, proc_name.str().c_str(), func_ct, storage, false);
+  }
 
   lldbassert(m_uid_to_decl.count(toOpaqueUid(func_id)) == 0);
   m_uid_to_decl[toOpaqueUid(func_id)] = function_decl;
@@ -1028,7 +1054,9 @@
   status.uid = toOpaqueUid(func_id);
   m_decl_to_status.insert({function_decl, status});
 
-  

[Lldb-commits] [PATCH] D61877: [CMake] Add error to clarify that lldb requires libcxx

2019-05-14 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz added a comment.

Thanks for adding this. Would it make sense to use `LLVM_ENABLE_PROJECTS_USED`? 
https://github.com/llvm/llvm-project/blob/a568222d/llvm/CMakeLists.txt#L128

BTW `LLVM_ENABLE_PROJECTS` can be "all" but LLVM should already have handled it 
at this point.




Comment at: lldb/CMakeLists.txt:127
   else()
+if(NOT libcxx IN_LIST LLVM_ENABLE_PROJECTS)
+  message(FATAL_ERROR

JDevlieghere wrote:
> Should we check that LLVM_ENABLE_PROJECTS is not empty, for people that are 
> still using the old layout?
+1


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61877



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


[Lldb-commits] [PATCH] D61885: Minidump: Add support for the MemoryList stream

2019-05-14 Thread Pavel Labath via Phabricator via lldb-commits
labath created this revision.
labath added reviewers: amccarth, jhenderson, clayborg.
Herald added a project: LLVM.

the stream format is exactly the same as for ThreadList and ModuleList
streams, only the entry types are slightly different, so the changes in
this patch are just straight-forward applications of established
patterns.


Repository:
  rL LLVM

https://reviews.llvm.org/D61885

Files:
  include/llvm/Object/Minidump.h
  include/llvm/ObjectYAML/MinidumpYAML.h
  lib/Object/Minidump.cpp
  lib/ObjectYAML/MinidumpYAML.cpp
  test/tools/obj2yaml/basic-minidump.yaml
  unittests/Object/MinidumpTest.cpp

Index: unittests/Object/MinidumpTest.cpp
===
--- unittests/Object/MinidumpTest.cpp
+++ unittests/Object/MinidumpTest.cpp
@@ -463,3 +463,51 @@
 EXPECT_EQ(0x08070605u, T.Context.RVA);
   }
 }
+
+TEST(MinidumpFile, getMemoryList) {
+  std::vector OneRange{
+  // Header
+  'M', 'D', 'M', 'P', 0x93, 0xa7, 0, 0, // Signature, Version
+  1, 0, 0, 0,   // NumberOfStreams,
+  32, 0, 0, 0,  // StreamDirectoryRVA
+  0, 1, 2, 3, 4, 5, 6, 7,   // Checksum, TimeDateStamp
+  0, 0, 0, 0, 0, 0, 0, 0,   // Flags
+// Stream Directory
+  5, 0, 0, 0, 20, 0, 0, 0,  // Type, DataSize,
+  44, 0, 0, 0,  // RVA
+  // MemoryDescriptor
+  1, 0, 0, 0, // NumberOfMemoryRanges
+  5, 6, 7, 8, 9, 0, 1, 2, // StartOfMemoryRange
+  3, 4, 5, 6, 7, 8, 9, 0, // DataSize, RVA
+  };
+  // Same as before, but with a padded thread list.
+  std::vector PaddedRange{
+  // Header
+  'M', 'D', 'M', 'P', 0x93, 0xa7, 0, 0, // Signature, Version
+  1, 0, 0, 0,   // NumberOfStreams,
+  32, 0, 0, 0,  // StreamDirectoryRVA
+  0, 1, 2, 3, 4, 5, 6, 7,   // Checksum, TimeDateStamp
+  0, 0, 0, 0, 0, 0, 0, 0,   // Flags
+// Stream Directory
+  5, 0, 0, 0, 24, 0, 0, 0,  // Type, DataSize,
+  44, 0, 0, 0,  // RVA
+  // MemoryDescriptor
+  1, 0, 0, 0, // NumberOfMemoryRanges
+  0, 0, 0, 0, // Padding
+  5, 6, 7, 8, 9, 0, 1, 2, // StartOfMemoryRange
+  3, 4, 5, 6, 7, 8, 9, 0, // DataSize, RVA
+  };
+
+  for (ArrayRef Data : {OneRange, PaddedRange}) {
+auto ExpectedFile = create(Data);
+ASSERT_THAT_EXPECTED(ExpectedFile, Succeeded());
+const MinidumpFile  = **ExpectedFile;
+Expected> ExpectedRanges = File.getMemoryList();
+ASSERT_THAT_EXPECTED(ExpectedRanges, Succeeded());
+ASSERT_EQ(1u, ExpectedRanges->size());
+const MemoryDescriptor  = ExpectedRanges.get()[0];
+EXPECT_EQ(0x0201000908070605u, MD.StartOfMemoryRange);
+EXPECT_EQ(0x06050403u, MD.Memory.DataSize);
+EXPECT_EQ(0x00090807u, MD.Memory.RVA);
+  }
+}
Index: test/tools/obj2yaml/basic-minidump.yaml
===
--- test/tools/obj2yaml/basic-minidump.yaml
+++ test/tools/obj2yaml/basic-minidump.yaml
@@ -51,6 +51,10 @@
 Stack:
   Start of Memory Range: 0x6C6D6E6F70717273
   Content: 7475767778797A7B
+  - Type:MemoryList
+Memory Ranges:   
+  - Start of Memory Range: 0x7C7D7E7F80818283
+Content: '8485868788'
 ...
 
 # CHECK:  --- !minidump
@@ -104,4 +108,8 @@
 # CHECK-NEXT: Stack:
 # CHECK-NEXT:   Start of Memory Range: 0x6C6D6E6F70717273
 # CHECK-NEXT:   Content: 7475767778797A7B
+# CHECK-NEXT:   - Type:MemoryList
+# CHECK-NEXT: Memory Ranges:   
+# CHECK-NEXT:   - Start of Memory Range: 0x7C7D7E7F80818283
+# CHECK-NEXT: Content: '8485868788'
 # CHECK-NEXT: ...
Index: lib/ObjectYAML/MinidumpYAML.cpp
===
--- lib/ObjectYAML/MinidumpYAML.cpp
+++ lib/ObjectYAML/MinidumpYAML.cpp
@@ -168,6 +168,8 @@
 
 Stream::StreamKind Stream::getKind(StreamType Type) {
   switch (Type) {
+  case StreamType::MemoryList:
+return StreamKind::MemoryList;
   case StreamType::ModuleList:
 return StreamKind::ModuleList;
   case StreamType::SystemInfo:
@@ -190,6 +192,8 @@
 std::unique_ptr Stream::create(StreamType Type) {
   StreamKind Kind = getKind(Type);
   switch (Kind) {
+  case StreamKind::MemoryList:
+return llvm::make_unique();
   case StreamKind::ModuleList:
 return llvm::make_unique();
   case StreamKind::RawContent:
@@ -353,6 +357,16 @@
   return "";
 }
 
+void yaml::MappingTraits::mapping(
+IO , MemoryListStream::entry_type ) {
+  MappingContextTraits::mapping(
+  IO, Range.Entry, Range.Content);
+}
+
+static void streamMapping(yaml::IO , MemoryListStream ) {
+  IO.mapRequired("Memory Ranges", Stream.Entries);

[Lldb-commits] [lldb] r360655 - TestMinidumpNew.py: Use yaml2obj where possible

2019-05-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue May 14 01:59:08 2019
New Revision: 360655

URL: http://llvm.org/viewvc/llvm-project?rev=360655=rev
Log:
TestMinidumpNew.py: Use yaml2obj where possible

Replace checked-in minidumps with their yaml forms now that yaml2obj
supports the ThreadList stream. I delete the test_modules_in_mini_dump
test altogether as this functionality is covered more systematically in
TestMinidumpUUID.py.

Added:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-linux.yaml

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-macos.yaml

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm64-macos.yaml

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/linux-x86_64.yaml

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.yaml
Removed:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-linux.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm-macos.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/arm64-macos.dmp

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/regions-linux-map.dmp
Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py?rev=360655=360654=360655=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/minidump-new/TestMiniDumpNew.py
 Tue May 14 01:59:08 2019
@@ -31,6 +31,13 @@ class MiniDumpNewTestCase(TestBase):
 lldb.DBG.SetSelectedPlatform(self._initial_platform)
 super(MiniDumpNewTestCase, self).tearDown()
 
+def process_from_yaml(self, yaml_file):
+minidump_path = self.getBuildArtifact(os.path.basename(yaml_file) + 
".dmp")
+self.yaml2obj(yaml_file, minidump_path)
+self.target = self.dbg.CreateTarget(None)
+self.process = self.target.LoadCore(minidump_path)
+return self.process
+
 def check_state(self):
 with open(os.devnull) as devnul:
 # sanitize test output
@@ -61,17 +68,17 @@ class MiniDumpNewTestCase(TestBase):
 
 def test_loadcore_error_status(self):
 """Test the SBTarget.LoadCore(core, error) overload."""
-self.dbg.CreateTarget(None)
-self.target = self.dbg.GetSelectedTarget()
+minidump_path = self.getBuildArtifact("linux-x86_64.dmp")
+self.yaml2obj("linux-x86_64.yaml", minidump_path)
+self.target = self.dbg.CreateTarget(None)
 error = lldb.SBError()
-self.process = self.target.LoadCore("linux-x86_64.dmp", error)
+self.process = self.target.LoadCore(minidump_path, error)
 self.assertTrue(self.process, PROCESS_IS_VALID)
 self.assertTrue(error.Success())
 
 def test_loadcore_error_status_failure(self):
 """Test the SBTarget.LoadCore(core, error) overload."""
-self.dbg.CreateTarget(None)
-self.target = self.dbg.GetSelectedTarget()
+self.target = self.dbg.CreateTarget(None)
 error = lldb.SBError()
 self.process = self.target.LoadCore("non-existent.dmp", error)
 self.assertFalse(self.process, PROCESS_IS_VALID)
@@ -79,19 +86,14 @@ class MiniDumpNewTestCase(TestBase):
 
 def test_process_info_in_minidump(self):
 """Test that lldb can read the process information from the 
Minidump."""
-# target create -c linux-x86_64.dmp
-self.dbg.CreateTarget(None)
-self.target = self.dbg.GetSelectedTarget()
-self.process = self.target.LoadCore("linux-x86_64.dmp")
+self.process_from_yaml("linux-x86_64.yaml")
 self.assertTrue(self.process, PROCESS_IS_VALID)
 self.assertEqual(self.process.GetNumThreads(), 1)
 self.assertEqual(self.process.GetProcessID(), self._linux_x86_64_pid)
 self.check_state()
 
 def test_memory_region_name(self):
-self.dbg.CreateTarget(None)
-self.target = self.dbg.GetSelectedTarget()
-self.process = self.target.LoadCore("regions-linux-map.dmp")
+self.process_from_yaml("regions-linux-map.yaml")
 result = lldb.SBCommandReturnObject()
 addr_region_name_pairs = [
 ("0x400d9000", "/system/bin/app_process"),
@@ -118,63 +120,9 @@ class MiniDumpNewTestCase(TestBase):
 region_name, command)
 

[Lldb-commits] [lldb] r360654 - typedef enum -> enum

2019-05-14 Thread Fangrui Song via lldb-commits
Author: maskray
Date: Tue May 14 01:55:50 2019
New Revision: 360654

URL: http://llvm.org/viewvc/llvm-project?rev=360654=rev
Log:
typedef enum -> enum

Reviewed By: labath

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

Modified:
lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
lldb/trunk/include/lldb/Core/Address.h
lldb/trunk/include/lldb/Core/AddressResolver.h
lldb/trunk/include/lldb/Core/SearchFilter.h
lldb/trunk/include/lldb/Host/Socket.h
lldb/trunk/include/lldb/Interpreter/CommandCompletions.h
lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h
lldb/trunk/include/lldb/Interpreter/OptionValue.h
lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
lldb/trunk/include/lldb/Symbol/ObjectFile.h
lldb/trunk/include/lldb/Symbol/SymbolContext.h
lldb/trunk/include/lldb/Symbol/Symtab.h
lldb/trunk/include/lldb/Symbol/Type.h
lldb/trunk/include/lldb/Target/Process.h
lldb/trunk/include/lldb/Target/Target.h
lldb/trunk/include/lldb/Target/ThreadPlan.h
lldb/trunk/include/lldb/Target/ThreadPlanTracer.h
lldb/trunk/include/lldb/Utility/DataExtractor.h
lldb/trunk/include/lldb/Utility/IOObject.h
lldb/trunk/include/lldb/Utility/Predicate.h
lldb/trunk/include/lldb/lldb-private-enumerations.h

lldb/trunk/packages/Python/lldbsuite/test/expression_command/cast_int_to_anonymous_enum/main.cpp
lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/main.cpp
lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/main.cpp
lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
lldb/trunk/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.h
lldb/trunk/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp

lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.h
lldb/trunk/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
lldb/trunk/source/Plugins/Process/MacOSX-Kernel/CommunicationKDP.h
lldb/trunk/source/Plugins/Process/Utility/ARMDefines.h
lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.h
lldb/trunk/source/Target/Target.cpp
lldb/trunk/tools/debugserver/source/DNBDataRef.h
lldb/trunk/tools/debugserver/source/DNBDefs.h
lldb/trunk/tools/debugserver/source/DNBError.h
lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
lldb/trunk/tools/debugserver/source/MacOSX/arm64/DNBArchImplARM64.h
lldb/trunk/tools/debugserver/source/MacOSX/i386/DNBArchImplI386.h
lldb/trunk/tools/debugserver/source/MacOSX/ppc/DNBArchImpl.h
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.h
lldb/trunk/tools/debugserver/source/RNBDefs.h
lldb/trunk/tools/debugserver/source/RNBRemote.h
lldb/trunk/tools/debugserver/source/debugserver.cpp
lldb/trunk/tools/debugserver/source/libdebugserver.cpp
lldb/trunk/tools/driver/Driver.h

Modified: lldb/trunk/include/lldb/Breakpoint/Breakpoint.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Breakpoint/Breakpoint.h?rev=360654=360653=360654=diff
==
--- lldb/trunk/include/lldb/Breakpoint/Breakpoint.h (original)
+++ lldb/trunk/include/lldb/Breakpoint/Breakpoint.h Tue May 14 01:55:50 2019
@@ -82,7 +82,7 @@ public:
 
   /// An enum specifying the match style for breakpoint settings.  At present
   /// only used for function name style breakpoints.
-  typedef enum { Exact, Regexp, Glob } MatchType;
+  enum MatchType { Exact, Regexp, Glob };
 
 private:
   enum class OptionNames : uint32_t { Names = 0, Hardware, LastOptionName };

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=360654=360653=360654=diff
==
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Tue May 14 01:55:50 2019
@@ -81,7 +81,7 @@ class Address {
 public:
   /// Dump styles allow the Address::Dump(Stream *,DumpStyle) const function
   /// to display Address contents in a variety of ways.
-  typedef enum {
+  enum DumpStyle {
 DumpStyleInvalid,   ///< Invalid dump style
 DumpStyleSectionNameOffset, ///< Display as the section name + offset.
 ///< \code
@@ -97,7 +97,7 @@ public:
 /// // address for printf in libSystem.B.dylib as a file address
 /// 0x0005dcff \endcode
 DumpStyleModuleWithFileAddress, ///< Display as the file address with the
-///module name prepended (if any).
+/// module name prepended (if any).
 ///< \code
 /// // address for printf in 

[Lldb-commits] [lldb] r360652 - [CMake] Correctly reinstate LLDB_CAN_USE_LLDB_SERVER

2019-05-14 Thread Pavel Labath via lldb-commits
Author: labath
Date: Tue May 14 01:18:06 2019
New Revision: 360652

URL: http://llvm.org/viewvc/llvm-project?rev=360652=rev
Log:
[CMake] Correctly reinstate LLDB_CAN_USE_LLDB_SERVER

r360631 introduced a "syntax error" which meant that cmake was still not
honoring the value of LLDB_CAN_USE_LLDB_SERVER variable. The correct
syntax for seting an internal cache variable is "set(VAR value CACHE
INTERNAL)", but the patch omitted the "CACHE" keyword. The "syntax
error" is in quotes because without the CACHE keyword this is still
valid syntax for setting the value of LLDB_CAN_USE_LLDB_SERVER to "1
INTERNAL".

There doesn't seem to be a need for this to be a cache variable so I'm
reverting this variable to a plain one, as it was before r360621.

This will hopefully fix the windows build.

Modified:
lldb/trunk/cmake/modules/LLDBConfig.cmake

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=360652=360651=360652=diff
==
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue May 14 01:18:06 2019
@@ -417,9 +417,9 @@ list(APPEND system_libs ${CMAKE_DL_LIBS}
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
 if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
-  set(LLDB_CAN_USE_LLDB_SERVER 1 INTERNAL)
+  set(LLDB_CAN_USE_LLDB_SERVER 1)
 else()
-  set(LLDB_CAN_USE_LLDB_SERVER 0 INTERNAL)
+  set(LLDB_CAN_USE_LLDB_SERVER 0)
 endif()
 
 # Figure out if lldb could use debugserver.  If so, then we'll


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


[Lldb-commits] [PATCH] D61687: Update Python tests for lldb-server on Windows

2019-05-14 Thread Pavel Labath via Phabricator via lldb-commits
labath added inline comments.



Comment at: 
packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteModuleInfo.py:24-27
+# Replace path separators in the json string either with "" or "/" 
on Windows.
+triple = self.dbg.GetSelectedPlatform().GetTriple()
+if re.match(".*-.*-windows", triple):
+module_path = module_path.replace(os.path.sep, '/')

Hui wrote:
> clayborg wrote:
> > labath wrote:
> > > It sounds like you could just unconditionally replace all backslashes 
> > > with double-backslashes here. That would result in us also correctly 
> > > handling posix paths that happen to contain a backslash.
> > Remove
> The 'jModulesInfo' packet is a json string. I tested with json.loads as 
> follows.
> It seemed to me that module_path needs to be escaped, i.e. 'd:abc' or be  
> 'd:/abc'.
> 
> not-working case:
> 
> ```
> >>> module_path = 'd:\abc'
> >>> json.dumps(module_path)
> '"d:\\u0007bc"'
> >>> json.loads('[{"[file":"%s"}]' % json.dumps(module_path))
> Traceback (most recent call last):
>   File "", line 1, in 
>   File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
> return _default_decoder.decode(s)
>   File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
> obj, end = self.raw_decode(s, idx=_w(s, 0).end())
>   File "/usr/lib/python2.7/json/decoder.py", line 380, in raw_decode
> obj, end = self.scan_once(s, idx)
> ValueError: Expecting , delimiter: line 1 column 13 (char 12)
> 
> ```
> working case:
> 
> ```
> >>> module_path = 'd:abc'
> >>> json.loads('[{"[file":"%s"}]' % module_path)
> [{u'[file': u'd:\\abc'}]
> ```
> 
> 
> 
There are multiple levels of quoting happening here, and I believe you're 
getting them mixed up:
> >>> module_path = 'd:\abc'
This is already wrong, because python will interpret the \a as the ASCII BEL 
character, resulting in the string consisting of: 'd', ':', BEL, 'b', 'c'
```
>>> "d:\abc"
'd:\x07bc'
```
The easiest fix is to use "raw" python strings:
```
r"d:\abc"
'd:\\abc'
```
Note that the '\' in the output string it's not doubled, it is just how the 
python dumper makes sure the output is unambiguous. You can for instance check 
that with: `len(r"d:\abc")` which returns `6` as expected.

After that, your not-working case works almost fine:
```
>>> json.loads('[{"[file":"%s"}]' % json.dumps(module_path))
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
  File "/usr/lib64/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 13 (char 
12)
>>> json.loads('[{"[file":%s}]' % json.dumps(module_path))
[{'[file': 'd:\\abc'}]
```
Note I removed the superfluous quotes in the second attempt. However, if we're 
going to be using the json package for this, then there's an even simpler way 
to write this:
```
>>> json.dumps([{"file": module_path}])
'[{"file": "d:abc"}]'
>>> json.loads(json.dumps([{"file": module_path}]))
[{'file': 'd:\\abc'}]
```


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D61687



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


[Lldb-commits] [PATCH] D61833: Fix IPv6 support on lldb-server platform

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

Looks fine to me. Thank you for fixing this.




Comment at: lldb/unittests/Host/SocketTestUtilities.cpp:16
+namespace {
+void AcceptThread(Socket *listen_socket, bool child_processes_inherit,
+  Socket **accept_socket, Status *error) {

LLVM prefers static functions over ones in anonymous namespaces.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D61833



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