[Lldb-commits] [lldb] r365458 - [CMake] Don't initialize LLVM_INSTALL_TOOLCHAIN_ONLY in Apple-lldb-base cache

2019-07-09 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Tue Jul  9 03:29:00 2019
New Revision: 365458

URL: http://llvm.org/viewvc/llvm-project?rev=365458&view=rev
Log:
[CMake] Don't initialize LLVM_INSTALL_TOOLCHAIN_ONLY in Apple-lldb-base cache

Modified:
lldb/trunk/cmake/caches/Apple-lldb-base.cmake

Modified: lldb/trunk/cmake/caches/Apple-lldb-base.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/caches/Apple-lldb-base.cmake?rev=365458&r1=365457&r2=365458&view=diff
==
--- lldb/trunk/cmake/caches/Apple-lldb-base.cmake (original)
+++ lldb/trunk/cmake/caches/Apple-lldb-base.cmake Tue Jul  9 03:29:00 2019
@@ -2,7 +2,6 @@ set(CMAKE_BUILD_TYPE RelWithDebInfo CACH
 set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "")
 
 set(LLVM_TARGETS_TO_BUILD X86;ARM;AArch64 CACHE STRING "")
-set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
 set(LLVM_ENABLE_ASSERTIONS ON CACHE BOOL "")
 set(LLVM_ENABLE_MODULES ON CACHE BOOL "")
 


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


[Lldb-commits] [lldb] r365457 - [CMake] Remove old lldb_setup_framework_rpaths_in_tool()

2019-07-09 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Tue Jul  9 03:28:53 2019
New Revision: 365457

URL: http://llvm.org/viewvc/llvm-project?rev=365457&view=rev
Log:
[CMake] Remove old lldb_setup_framework_rpaths_in_tool()

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

Modified: lldb/trunk/cmake/modules/AddLLDB.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/AddLLDB.cmake?rev=365457&r1=365456&r2=365457&view=diff
==
--- lldb/trunk/cmake/modules/AddLLDB.cmake (original)
+++ lldb/trunk/cmake/modules/AddLLDB.cmake Tue Jul  9 03:28:53 2019
@@ -170,45 +170,6 @@ function(lldb_append_link_flags target_n
   set_target_properties(${target_name} PROPERTIES LINK_FLAGS ${new_link_flags})
 endfunction()
 
-# For tools that depend on liblldb, account for varying directory structures in
-# which LLDB.framework can be used and distributed: In the build-tree we find 
it
-# by its absolute target path. This is only relevant for running the test 
suite.
-# In the install step CMake will remove this entry and insert the final RPATHs.
-# These are relative to the file path from where the tool will be loaded on the
-# enduser system.
-#
-# Note that the LLVM install-tree doesn't match the enduser system structure
-# for LLDB.framework, so by default dependent tools will not be functional in
-# their install location. The LLDB_FRAMEWORK_INSTALL_DIR variable allows to fix
-# this. If specified, it causes the install-tree location of the framework to 
be
-# added as an extra RPATH below.
-#
-function(lldb_setup_framework_rpaths_in_tool name)
-  # The installed framework is relocatable and can be in different locations.
-  set(rpaths_install_tree)
-
-  if(LLDB_FRAMEWORK_INSTALL_DIR)
-list(APPEND rpaths_install_tree 
"@loader_path/../${LLDB_FRAMEWORK_INSTALL_DIR}")
-  endif()
-
-  list(APPEND rpaths_install_tree "@loader_path/../../../SharedFrameworks")
-  list(APPEND rpaths_install_tree 
"@loader_path/../../System/Library/PrivateFrameworks")
-  list(APPEND rpaths_install_tree 
"@loader_path/../../Library/PrivateFrameworks")
-
-  # In the build-tree, we know the exact path to the framework directory.
-  get_target_property(framework_target_dir liblldb LIBRARY_OUTPUT_DIRECTORY)
-
-  # If LLDB_NO_INSTALL_DEFAULT_RPATH was NOT enabled (default), this overwrites
-  # the default settings from llvm_setup_rpath().
-  set_target_properties(${name} PROPERTIES
-BUILD_WITH_INSTALL_RPATH OFF
-BUILD_RPATH "${framework_target_dir}"
-INSTALL_RPATH "${rpaths_install_tree}"
-  )
-
-  add_dependencies(${name} lldb-framework)
-endfunction()
-
 # Unified handling for executable LLDB.framework resources. Given the name of 
an
 # executable target, this function adds a post-build step to copy it to the
 # framework bundle in the build-tree.


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


[Lldb-commits] [lldb] r365459 - [CMake] Polish a comment

2019-07-09 Thread Stefan Granitz via lldb-commits
Author: stefan.graenitz
Date: Tue Jul  9 03:29:07 2019
New Revision: 365459

URL: http://llvm.org/viewvc/llvm-project?rev=365459&view=rev
Log:
[CMake] Polish a comment

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

Modified: lldb/trunk/cmake/modules/LLDBFramework.cmake
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBFramework.cmake?rev=365459&r1=365458&r2=365459&view=diff
==
--- lldb/trunk/cmake/modules/LLDBFramework.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBFramework.cmake Tue Jul  9 03:29:07 2019
@@ -26,7 +26,8 @@ set_target_properties(liblldb PROPERTIES
   MACOSX_FRAMEWORK_INFO_PLIST ${LLDB_SOURCE_DIR}/resources/LLDB-Info.plist.in
 )
 
-# Defined in AddLLVM.cmake; handles edge cases for multi-config generators
+# Used in llvm_add_library() to set default output directories for multi-config
+# generators. Overwrite to account for special framework output directory.
 set_output_directory(liblldb
   BINARY_DIR ${framework_target_dir}
   LIBRARY_DIR ${framework_target_dir}


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


[Lldb-commits] [PATCH] D64395: [CMake] Avoid libcxxabi dependency when building LLDB from the monorepo on macOS by default

2019-07-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: JDevlieghere, davide.
Herald added a subscriber: mgorny.
Herald added a reviewer: EricWF.
Herald added a project: LLDB.

libc++abi became mandatory to link the libc++ binaries. LLDB only needs the 
build artifacts and not the linked output (we don't ship libc++.dylib and/or 
libc++.a). Disable the respective link steps to avoid the dependency to 
libc++abi.
Commit 1665dd63466b 
 (SVN 
r365038) set the default in the Apple-lldb-base cache, but it would be good to 
have this even when not using the cache.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64395

Files:
  lldb/cmake/modules/LLDBConfig.cmake


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -73,6 +73,15 @@
   endif()
 endif()
 
+if(APPLE)
+  # Force-disable libc++ link steps to avoid the libc++abi dependency,
+  # if not enabled explicitly in builds from the monorepo.
+  if("libcxx" IN_LIST LLVM_ENABLE_PROJECTS AND NOT "libcxxabi" IN_LIST 
LLVM_ENABLE_PROJECTS)
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "" FORCE)
+set(LIBCXX_ENABLE_STATIC OFF CACHE BOOL "" FORCE)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")


Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -73,6 +73,15 @@
   endif()
 endif()
 
+if(APPLE)
+  # Force-disable libc++ link steps to avoid the libc++abi dependency,
+  # if not enabled explicitly in builds from the monorepo.
+  if("libcxx" IN_LIST LLVM_ENABLE_PROJECTS AND NOT "libcxxabi" IN_LIST LLVM_ENABLE_PROJECTS)
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "" FORCE)
+set(LIBCXX_ENABLE_STATIC OFF CACHE BOOL "" FORCE)
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 "Causes lldb to export all symbols when building liblldb.")
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64395: [CMake] Avoid libcxxabi dependency when building LLDB from the monorepo on macOS by default

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

This is a no-op when used in conjunction with 
`lldb/cmake/cache/Apple-lldb-base.cmake`. Otherwise it touches the cache at 
configuration time, which typically causes ninja to re-run cmake before 
starting the build. I think it's acceptable, given that we do this in other 
situations too, but it's worth noting that using the cache script is a little 
more elegant.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64395



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


[Lldb-commits] [PATCH] D64397: [CMake] Remove extra lldb-framework target

2019-07-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added a reviewer: xiaobai.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

The custom lldb-framework target was meant to encapsulate all build steps that 
LLDB.framework needs on top of the ordinaly liblldb. In the end all of it 
happens in post-build steps, so we can do the same with liblldb and cut down 
another source of confusion.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64397

Files:
  lldb/CMakeLists.txt
  lldb/cmake/modules/LLDBFramework.cmake


Index: lldb/cmake/modules/LLDBFramework.cmake
===
--- lldb/cmake/modules/LLDBFramework.cmake
+++ lldb/cmake/modules/LLDBFramework.cmake
@@ -42,12 +42,8 @@
 XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "${MACOSX_DEPLOYMENT_TARGET}")
 endif()
 
-# Target to capture extra steps for a fully functional framework bundle.
-add_custom_target(lldb-framework ALL)
-add_dependencies(lldb-framework liblldb)
-
 # Apart from this one, CMake creates all required symlinks in the framework 
bundle.
-add_custom_command(TARGET lldb-framework POST_BUILD
+add_custom_command(TARGET liblldb POST_BUILD
   COMMAND ${CMAKE_COMMAND} -E create_symlink
   Versions/Current/Headers
   ${framework_target_dir}/LLDB.framework/Headers
@@ -79,12 +75,12 @@
 endforeach()
 
 # Wrap output in a target, so lldb-framework can depend on it.
-add_custom_target(lldb-framework-headers DEPENDS ${lldb_staged_headers})
-add_dependencies(lldb-framework lldb-framework-headers)
+add_custom_target(liblldb-resource-headers DEPENDS ${lldb_staged_headers})
+add_dependencies(liblldb liblldb-resource-headers)
 
 # At build time, copy the staged headers into the framework bundle (and do
 # some post-processing in-place).
-add_custom_command(TARGET lldb-framework-headers POST_BUILD
+add_custom_command(TARGET liblldb POST_BUILD
   COMMAND ${CMAKE_COMMAND} -E copy_directory ${lldb_header_staging} 
$/Headers
   COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh 
$/Headers ${LLDB_VERSION}
   COMMENT "LLDB.framework: copy framework headers"
@@ -93,7 +89,7 @@
 # Copy vendor-specific headers from clang (without staging).
 if(NOT IOS)
   if (TARGET clang-resource-headers)
-add_dependencies(lldb-framework clang-resource-headers)
+add_dependencies(liblldb clang-resource-headers)
 set(clang_resource_headers_dir 
$)
   else()
 # In standalone builds try the best possible guess
@@ -115,7 +111,7 @@
 endif()
   endif()
 
-  add_custom_command(TARGET lldb-framework POST_BUILD
+  add_custom_command(TARGET liblldb POST_BUILD
 COMMAND ${CMAKE_COMMAND} -E copy_directory
 ${clang_resource_headers_dir}
 $/Resources/Clang/include
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -203,10 +203,6 @@
 # Ensure we do the python post-build step when building lldb.
 add_dependencies(lldb finish_swig)
 
-if(LLDB_BUILD_FRAMEWORK)
-  add_dependencies(lldb-framework finish_swig)
-endif()
-
 # Add a Post-Build Event to copy the custom Python DLL to the lldb 
binaries dir so that Windows can find it when launching
 # lldb.exe or any other executables that were linked with liblldb.
 if (WIN32 AND NOT "${PYTHON_DLL}" STREQUAL "")


Index: lldb/cmake/modules/LLDBFramework.cmake
===
--- lldb/cmake/modules/LLDBFramework.cmake
+++ lldb/cmake/modules/LLDBFramework.cmake
@@ -42,12 +42,8 @@
 XCODE_ATTRIBUTE_MACOSX_DEPLOYMENT_TARGET "${MACOSX_DEPLOYMENT_TARGET}")
 endif()
 
-# Target to capture extra steps for a fully functional framework bundle.
-add_custom_target(lldb-framework ALL)
-add_dependencies(lldb-framework liblldb)
-
 # Apart from this one, CMake creates all required symlinks in the framework bundle.
-add_custom_command(TARGET lldb-framework POST_BUILD
+add_custom_command(TARGET liblldb POST_BUILD
   COMMAND ${CMAKE_COMMAND} -E create_symlink
   Versions/Current/Headers
   ${framework_target_dir}/LLDB.framework/Headers
@@ -79,12 +75,12 @@
 endforeach()
 
 # Wrap output in a target, so lldb-framework can depend on it.
-add_custom_target(lldb-framework-headers DEPENDS ${lldb_staged_headers})
-add_dependencies(lldb-framework lldb-framework-headers)
+add_custom_target(liblldb-resource-headers DEPENDS ${lldb_staged_headers})
+add_dependencies(liblldb liblldb-resource-headers)
 
 # At build time, copy the staged headers into the framework bundle (and do
 # some post-processing in-place).
-add_custom_command(TARGET lldb-framework-headers POST_BUILD
+add_custom_command(TARGET liblldb POST_BUILD
   COMMAND ${CMAKE_COMMAND} -E copy_directory ${lldb_header_staging} $/Headers
   COMMAND ${LLDB_SOURCE_DIR}/scripts/framework-header-fix.sh $/Headers ${LLDB_VERSION}
   COMMENT "LLDB.framework: copy framework headers"
@@ -93,7 +89,7 @@
 # Cop

[Lldb-commits] [PATCH] D64398: [LLDB] Fix FreeBSD build

2019-07-09 Thread David CARLIER via Phabricator via lldb-commits
devnexen created this revision.
devnexen added reviewers: mgorny, MaskRay.
devnexen created this object with visibility "All Users".
Herald added subscribers: lldb-commits, jfb, emaste.
Herald added a project: LLDB.

Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64398

Files:
  lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
  lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h

Index: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
===
--- lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
+++ lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
@@ -183,8 +183,8 @@
 private:
   ProcessFreeBSD *m_process;
 
-  lldb_private::HostThread m_operation_thread;
-  lldb_private::HostThread m_monitor_thread;
+  llvm::Expected m_operation_thread;
+  llvm::Expected m_monitor_thread;
   lldb::pid_t m_pid;
 
   int m_terminal_fd;
Index: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -708,7 +708,7 @@
 const lldb_private::ProcessLaunchInfo & /* launch_info */,
 lldb_private::Status &error)
 : m_process(static_cast(process)),
-  m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), m_operation(0) {
+  m_operation_thread(nullptr), m_monitor_thread(nullptr), m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), m_operation(0) {
   using namespace std::placeholders;
 
   std::unique_ptr args(
@@ -738,7 +738,7 @@
   m_monitor_thread = Host::StartMonitoringChildProcess(
   std::bind(&ProcessMonitor::MonitorCallback, this, _1, _2, _3, _4),
   GetPID(), true);
-  if (!m_monitor_thread.IsJoinable()) {
+  if (!m_monitor_thread->IsJoinable()) {
 error.SetErrorToGenericError();
 error.SetErrorString("Process launch failed.");
 return;
@@ -747,8 +747,8 @@
 
 ProcessMonitor::ProcessMonitor(ProcessFreeBSD *process, lldb::pid_t pid,
lldb_private::Status &error)
-: m_process(static_cast(process)), m_pid(pid),
-  m_terminal_fd(-1), m_operation(0) {
+: m_process(static_cast(process)),
+  m_operation_thread(nullptr), m_monitor_thread(nullptr), m_pid(pid), m_terminal_fd(-1), m_operation(0) {
   using namespace std::placeholders;
 
   sem_init(&m_operation_pending, 0, 0);
@@ -776,7 +776,7 @@
   m_monitor_thread = Host::StartMonitoringChildProcess(
   std::bind(&ProcessMonitor::MonitorCallback, this, _1, _2, _3, _4),
   GetPID(), true);
-  if (!m_monitor_thread.IsJoinable()) {
+  if (!m_monitor_thread->IsJoinable()) {
 error.SetErrorToGenericError();
 error.SetErrorString("Process attach failed.");
 return;
@@ -789,11 +789,15 @@
 void ProcessMonitor::StartLaunchOpThread(LaunchArgs *args, Status &error) {
   static const char *g_thread_name = "lldb.process.freebsd.operation";
 
-  if (m_operation_thread.IsJoinable())
+  if (m_operation_thread->IsJoinable())
 return;
 
   m_operation_thread =
-  ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args, &error);
+  ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args);
+  if (!m_operation_thread) {
+ Status e("Start launch thread failed");
+ error = e;
+  }
 }
 
 void *ProcessMonitor::LaunchOpThread(void *arg) {
@@ -955,11 +959,16 @@
  lldb_private::Status &error) {
   static const char *g_thread_name = "lldb.process.freebsd.operation";
 
-  if (m_operation_thread.IsJoinable())
+  if (m_operation_thread->IsJoinable())
 return;
 
   m_operation_thread =
-  ThreadLauncher::LaunchThread(g_thread_name, AttachOpThread, args, &error);
+  ThreadLauncher::LaunchThread(g_thread_name, AttachOpThread, args);
+
+  if (!m_operation_thread) {
+  	Status e("Start attach thread failed");
+	error = e;
+  }
 }
 
 void *ProcessMonitor::AttachOpThread(void *arg) {
@@ -1379,10 +1388,10 @@
 }
 
 void ProcessMonitor::StopMonitoringChildProcess() {
-  if (m_monitor_thread.IsJoinable()) {
-m_monitor_thread.Cancel();
-m_monitor_thread.Join(nullptr);
-m_monitor_thread.Reset();
+  if (m_monitor_thread->IsJoinable()) {
+m_monitor_thread->Cancel();
+m_monitor_thread->Join(nullptr);
+m_monitor_thread->Reset();
   }
 }
 
@@ -1417,10 +1426,10 @@
 bool ProcessMonitor::WaitForInitialTIDStop(lldb::tid_t tid) { return true; }
 
 void ProcessMonitor::StopOpThread() {
-  if (!m_operation_thread.IsJoinable())
+  if (!m_operation_thread->IsJoinable())
 return;
 
-  m_operation_thread.Cancel();
-  m_operation_thread.Join(nullptr);
-  m_operation_thread.Reset();
+  m_operation_thread->Cancel();
+  m_operation_thread->Join(nullptr);
+  m_operation_thread->Reset();
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64398: [LLDB] Fix FreeBSD build

2019-07-09 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added inline comments.



Comment at: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp:798
+  if (!m_operation_thread) {
+ Status e("Start launch thread failed");
+ error = e;

See D64163/r365226


Repository:
  rLLDB LLDB

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

https://reviews.llvm.org/D64398



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


[Lldb-commits] [PATCH] D64399: [CMake] Distribution builds for LLDB standalone

2019-07-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: xiaobai, mgorny, JDevlieghere, davide.
Herald added a project: LLDB.

Enable `distribution` and `install-distribution` targets in LLDB standalone and 
pre-populate the cache accordingly on macOS.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64399

Files:
  lldb/CMakeLists.txt
  lldb/cmake/caches/Apple-lldb-macOS.cmake


Index: lldb/cmake/caches/Apple-lldb-macOS.cmake
===
--- lldb/cmake/caches/Apple-lldb-macOS.cmake
+++ lldb/cmake/caches/Apple-lldb-macOS.cmake
@@ -15,5 +15,13 @@
 
 # Release builds may change these:
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
-set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER OFF CACHE BOOL "")
 set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  lldb
+  liblldb
+  lldb-argdumper
+  darwin-debug
+  debugserver
+  CACHE STRING "")
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -220,3 +220,7 @@
 COMMENT "Copying Python DLL to LLDB binaries directory.")
 endif ()
 endif ()
+
+if(LLDB_BUILT_STANDALONE)
+  llvm_distribution_add_targets()
+endif()


Index: lldb/cmake/caches/Apple-lldb-macOS.cmake
===
--- lldb/cmake/caches/Apple-lldb-macOS.cmake
+++ lldb/cmake/caches/Apple-lldb-macOS.cmake
@@ -15,5 +15,13 @@
 
 # Release builds may change these:
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
-set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER OFF CACHE BOOL "")
 set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  lldb
+  liblldb
+  lldb-argdumper
+  darwin-debug
+  debugserver
+  CACHE STRING "")
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -220,3 +220,7 @@
 COMMENT "Copying Python DLL to LLDB binaries directory.")
 endif ()
 endif ()
+
+if(LLDB_BUILT_STANDALONE)
+  llvm_distribution_add_targets()
+endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64397: [CMake] Remove extra lldb-framework target

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

This simplifies my proposal in D64399 , 
because I don't need it in `LLVM_DISTRIBUTION_COMPONENTS` and avoid dummy 
`install-distribution` and `install-distribution-stripped` targets.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64397



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


[Lldb-commits] [PATCH] D64398: [LLDB] Fix FreeBSD build

2019-07-09 Thread David CARLIER via Phabricator via lldb-commits
devnexen marked an inline comment as done.
devnexen added inline comments.



Comment at: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp:798
+  if (!m_operation_thread) {
+ Status e("Start launch thread failed");
+ error = e;

MaskRay wrote:
> See D64163/r365226
Very good point !


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

https://reviews.llvm.org/D64398



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


[Lldb-commits] [PATCH] D64398: [LLDB] Fix FreeBSD build

2019-07-09 Thread David CARLIER via Phabricator via lldb-commits
devnexen updated this revision to Diff 208649.

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

https://reviews.llvm.org/D64398

Files:
  lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
  lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h

Index: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
===
--- lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
+++ lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.h
@@ -183,8 +183,8 @@
 private:
   ProcessFreeBSD *m_process;
 
-  lldb_private::HostThread m_operation_thread;
-  lldb_private::HostThread m_monitor_thread;
+  llvm::Expected m_operation_thread;
+  llvm::Expected m_monitor_thread;
   lldb::pid_t m_pid;
 
   int m_terminal_fd;
Index: lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
===
--- lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
+++ lldb/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
@@ -708,7 +708,7 @@
 const lldb_private::ProcessLaunchInfo & /* launch_info */,
 lldb_private::Status &error)
 : m_process(static_cast(process)),
-  m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), m_operation(0) {
+  m_operation_thread(nullptr), m_monitor_thread(nullptr), m_pid(LLDB_INVALID_PROCESS_ID), m_terminal_fd(-1), m_operation(0) {
   using namespace std::placeholders;
 
   std::unique_ptr args(
@@ -738,7 +738,7 @@
   m_monitor_thread = Host::StartMonitoringChildProcess(
   std::bind(&ProcessMonitor::MonitorCallback, this, _1, _2, _3, _4),
   GetPID(), true);
-  if (!m_monitor_thread.IsJoinable()) {
+  if (!m_monitor_thread->IsJoinable()) {
 error.SetErrorToGenericError();
 error.SetErrorString("Process launch failed.");
 return;
@@ -747,8 +747,8 @@
 
 ProcessMonitor::ProcessMonitor(ProcessFreeBSD *process, lldb::pid_t pid,
lldb_private::Status &error)
-: m_process(static_cast(process)), m_pid(pid),
-  m_terminal_fd(-1), m_operation(0) {
+: m_process(static_cast(process)),
+  m_operation_thread(nullptr), m_monitor_thread(nullptr), m_pid(pid), m_terminal_fd(-1), m_operation(0) {
   using namespace std::placeholders;
 
   sem_init(&m_operation_pending, 0, 0);
@@ -776,7 +776,7 @@
   m_monitor_thread = Host::StartMonitoringChildProcess(
   std::bind(&ProcessMonitor::MonitorCallback, this, _1, _2, _3, _4),
   GetPID(), true);
-  if (!m_monitor_thread.IsJoinable()) {
+  if (!m_monitor_thread->IsJoinable()) {
 error.SetErrorToGenericError();
 error.SetErrorString("Process attach failed.");
 return;
@@ -789,11 +789,13 @@
 void ProcessMonitor::StartLaunchOpThread(LaunchArgs *args, Status &error) {
   static const char *g_thread_name = "lldb.process.freebsd.operation";
 
-  if (m_operation_thread.IsJoinable())
+  if (m_operation_thread->IsJoinable())
 return;
 
   m_operation_thread =
-  ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args, &error);
+  ThreadLauncher::LaunchThread(g_thread_name, LaunchOpThread, args);
+  if (!m_operation_thread)
+ error = m_operation_thread.takeError();
 }
 
 void *ProcessMonitor::LaunchOpThread(void *arg) {
@@ -955,11 +957,14 @@
  lldb_private::Status &error) {
   static const char *g_thread_name = "lldb.process.freebsd.operation";
 
-  if (m_operation_thread.IsJoinable())
+  if (m_operation_thread->IsJoinable())
 return;
 
   m_operation_thread =
-  ThreadLauncher::LaunchThread(g_thread_name, AttachOpThread, args, &error);
+  ThreadLauncher::LaunchThread(g_thread_name, AttachOpThread, args);
+
+  if (!m_operation_thread)
+	error = m_operation_thread.takeError();
 }
 
 void *ProcessMonitor::AttachOpThread(void *arg) {
@@ -1379,10 +1384,10 @@
 }
 
 void ProcessMonitor::StopMonitoringChildProcess() {
-  if (m_monitor_thread.IsJoinable()) {
-m_monitor_thread.Cancel();
-m_monitor_thread.Join(nullptr);
-m_monitor_thread.Reset();
+  if (m_monitor_thread->IsJoinable()) {
+m_monitor_thread->Cancel();
+m_monitor_thread->Join(nullptr);
+m_monitor_thread->Reset();
   }
 }
 
@@ -1417,10 +1422,10 @@
 bool ProcessMonitor::WaitForInitialTIDStop(lldb::tid_t tid) { return true; }
 
 void ProcessMonitor::StopOpThread() {
-  if (!m_operation_thread.IsJoinable())
+  if (!m_operation_thread->IsJoinable())
 return;
 
-  m_operation_thread.Cancel();
-  m_operation_thread.Join(nullptr);
-  m_operation_thread.Reset();
+  m_operation_thread->Cancel();
+  m_operation_thread->Join(nullptr);
+  m_operation_thread->Reset();
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64398: [LLDB] Fix FreeBSD build

2019-07-09 Thread David CARLIER via Phabricator via lldb-commits
devnexen added a comment.

By the way quick question, I did not commit since quite a time, is it still 
subversion ?


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

https://reviews.llvm.org/D64398



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


[Lldb-commits] [PATCH] D64408: [CMake] `install-distribution` for LLDB on Darwin

2019-07-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz created this revision.
sgraenitz added reviewers: xiaobai, compnerd, JDevlieghere, davide, labath, 
mgorny.
Herald added a project: LLDB.

There's a number of requirements for installing LLDB on macOS that are 
untypical for LLVM projects: use special install-prefix for LLDB.framework, 
ship headers and tools as framework resources, patch RPATHs, externalize 
debug-info to dSYM's and strip binaries with `-ST`.
For some of it we could use `llvm_externalize_debuginfo()` in the past and just 
add special cases. However, this complicates the code for all projects and 
comes with the major drawback, that it adds all these actions at build-time. 
i.e. dSYM creation and stripping take a lot of time and don't make sense at 
build-time.

LLVM's distribution mechanism 
(https://llvm.org/docs/BuildingADistribution.html) appears to be the natural 
alternative. Based on D64399 , which proposes 
to enable it in standalone builds, this patch integrates framework installation 
with the distribution mechanism and adds custom stripping flags and dSYM 
creation at install-time.
Unlike the abandoned D61952 , it leaves 
build-tree binaries untouched, so there's no side-effects on testing. Potential 
install-order issues must be handled externally.

Please let me know what you think, while I run a few more tests and add 
remarks+documentation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64408

Files:
  lldb/cmake/caches/Apple-lldb-macOS.cmake
  lldb/cmake/modules/AddLLDB.cmake
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/cmake/modules/LLDBFramework.cmake
  lldb/source/API/CMakeLists.txt
  lldb/tools/argdumper/CMakeLists.txt
  lldb/tools/darwin-debug/CMakeLists.txt
  lldb/tools/debugserver/source/CMakeLists.txt

Index: lldb/tools/debugserver/source/CMakeLists.txt
===
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -272,22 +272,14 @@
  COMPILE_DEFINITIONS HAVE_LIBCOMPRESSION)
   endif()
   set(LLVM_OPTIONAL_SOURCES ${lldbDebugserverCommonSources})
-  add_lldb_tool(debugserver
+  add_lldb_tool(debugserver ADD_TO_FRAMEWORK
 debugserver.cpp
-
-LINK_LIBS
-  lldbDebugserverCommon
-
-ENTITLEMENTS
-  ${entitlements}
-)
+LINK_LIBS lldbDebugserverCommon
+ENTITLEMENTS ${entitlements}
+  )
 
   set_target_properties(debugserver PROPERTIES FOLDER "lldb libraries/debugserver")
 
-  if(LLDB_BUILD_FRAMEWORK)
-lldb_add_to_framework(debugserver)
-  endif()
-
   if(IOS)
 set_property(TARGET lldbDebugserverCommon APPEND PROPERTY COMPILE_DEFINITIONS
   WITH_LOCKDOWN
Index: lldb/tools/darwin-debug/CMakeLists.txt
===
--- lldb/tools/darwin-debug/CMakeLists.txt
+++ lldb/tools/darwin-debug/CMakeLists.txt
@@ -1,7 +1,3 @@
-add_lldb_tool(darwin-debug
+add_lldb_tool(darwin-debug ADD_TO_FRAMEWORK
   darwin-debug.cpp
-  )
-
-if(LLDB_BUILD_FRAMEWORK)
-  lldb_add_to_framework(darwin-debug)
-endif()
+)
Index: lldb/tools/argdumper/CMakeLists.txt
===
--- lldb/tools/argdumper/CMakeLists.txt
+++ lldb/tools/argdumper/CMakeLists.txt
@@ -1,10 +1,6 @@
-add_lldb_tool(lldb-argdumper
+add_lldb_tool(lldb-argdumper ADD_TO_FRAMEWORK
   argdumper.cpp
 
   LINK_LIBS
 lldbUtility
-  )
-
-if(LLDB_BUILD_FRAMEWORK)
-  lldb_add_to_framework(lldb-argdumper)
-endif()
+)
Index: lldb/source/API/CMakeLists.txt
===
--- lldb/source/API/CMakeLists.txt
+++ lldb/source/API/CMakeLists.txt
@@ -9,8 +9,8 @@
   set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
 endif()
 
-if(LLDB_BUILD_FRAMEWORK AND LLVM_EXTERNALIZE_DEBUGINFO)
-  set(LLVM_EXTERNALIZE_DEBUGINFO_EXTENSION framework.dSYM)
+if(LLDB_BUILD_FRAMEWORK)
+  set(option_install_prefix INSTALL_PREFIX ${LLDB_FRAMEWORK_INSTALL_DIR})
 endif()
 
 add_lldb_library(liblldb SHARED
@@ -99,7 +99,9 @@
 ${LLDB_ALL_PLUGINS}
   LINK_COMPONENTS
 Support
-  )
+
+  ${option_install_prefix}
+)
 
 if (MSVC)
   set_source_files_properties(SBReproducer.cpp PROPERTIES COMPILE_FLAGS /bigobj)
Index: lldb/cmake/modules/LLDBFramework.cmake
===
--- lldb/cmake/modules/LLDBFramework.cmake
+++ lldb/cmake/modules/LLDBFramework.cmake
@@ -33,6 +33,8 @@
   LIBRARY_DIR ${framework_target_dir}
 )
 
+lldb_add_post_install_steps_darwin(liblldb ${LLDB_FRAMEWORK_INSTALL_DIR})
+
 # Affects the layout of the framework bundle (default is macOS layout).
 if(IOS)
   set_target_properties(liblldb PROPERTIES
Index: lldb/cmake/modules/LLDBConfig.cmake
===
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -65,12 +65,9 @@
   set(LLDB_FRAMEWORK_BUILD_

[Lldb-commits] [PATCH] D64398: [LLDB] Fix FreeBSD build

2019-07-09 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

In D64398#1575713 , @devnexen wrote:

> By the way quick question, I did not commit since quite a time, is it still 
> subversion ?


Many people switched to the git monorepo github.com/llvm/llvm-project && `git 
llvm push` (I think it invokes svn under the hood)
The subversion repo still works.
I'm still using the git multirepo && `git svn dcommit`


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

https://reviews.llvm.org/D64398



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


[Lldb-commits] [PATCH] D64395: [CMake] Avoid libcxxabi dependency when building LLDB from the monorepo on macOS by default

2019-07-09 Thread Louis Dionne via Phabricator via lldb-commits
ldionne added a comment.

When is `LLDBConfig.cmake` used? I'm trying to understand when the 
`LIBCXX_ENABLE_SHARED=OFF` setting will come into play. Will it influence 
whether `libc++.dylib` is built in the monorepo whenever you also happen to 
build LLDB?




Comment at: lldb/cmake/modules/LLDBConfig.cmake:79
+  # if not enabled explicitly in builds from the monorepo.
+  if("libcxx" IN_LIST LLVM_ENABLE_PROJECTS AND NOT "libcxxabi" IN_LIST 
LLVM_ENABLE_PROJECTS)
+set(LIBCXX_ENABLE_SHARED OFF CACHE BOOL "" FORCE)

So when both `libcxxabi` and `libcxx` are enabled, we will build `libc++.dylib` 
and `libc++.a`? Why not always disable it?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64395



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


[Lldb-commits] [PATCH] D64395: [CMake] Avoid libcxxabi dependency when building LLDB from the monorepo on macOS by default

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

Thanks for taking a look.

In D64395#1575967 , @ldionne wrote:

> When is `LLDBConfig.cmake` used?


Very early in the LLDB config process: 
https://github.com/llvm/llvm-project/blob/e0a3ee79c5ff/lldb/CMakeLists.txt#L15
Globally, I think LLDB is always configured after libc++. Does libc++ make 
decisions based on these values?

> Will it influence whether `libc++.dylib` is built in the monorepo whenever 
> you also happen to build LLDB?

Yes, I think so. Adding lldb to `LLVM_ENABLE_PROJECTS` will disable 
`libc++.dylib` globally, ...

> So when both libcxxabi and libcxx are enabled, we will build libc++.dylib and 
> libc++.a? Why not always disable it?

... if and only if libcxxabi is not enabled. Thus the restriction.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64395



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


[Lldb-commits] [PATCH] D64408: [CMake] `install-distribution` for LLDB on Darwin

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

Usage example that should work in conjunction with D64397 
 and D64399 :

  $ cd path/to/lldb-deps-relwithdebinfo
  $ cmake -GNinja 
-C/path/to/llvm-project/lldb/cmake/caches/Apple-lldb-base.cmake \
  -DLLVM_ENABLE_PROJECTS="clang;libcxx" \
  /path/to/llvm-project/llvm
  $ cmake --build .
  
  $ cd lldb-relwithdebinfo
  $ cmake -GNinja 
-C/path/to/llvm-project/lldb/cmake/caches/Apple-lldb-macOS.cmake \
  -DLLVM_DIR=/path/to/lldb-deps-relwithdebinfo/lib/cmake/llvm \
  -DClang_DIR=/path/to/lldb-deps-relwithdebinfo/lib/cmake/clang 
\
  /path/to/llvm-project/lldb
  $ cmake --build . --target distribution
  $ DESTDIR=/path/to/install/location cmake --build . --target 
install-distribution
  
  $ tree /path/to/install/location | grep -v -E "(h|py)$"
  /path/to/install/location
  ├── Applications
  │   └── Xcode.app
  │   └── Contents
  │   ├── Developer
  │   │   └── usr
  │   │   └── bin
  │   │   └── lldb
  │   └── SharedFrameworks
  │   └── LLDB.framework
  │   ├── Headers -> Versions/Current/Headers
  │   ├── LLDB -> Versions/Current/LLDB
  │   ├── Resources -> Versions/Current/Resources
  │   └── Versions
  │   ├── A
  │   │   ├── Headers
  │   │   ├── LLDB
  │   │   └── Resources
  │   │   ├── Info.plist
  │   │   ├── Python
  │   │   │   ├── lldb
  │   │   │   │   ├── _lldb.so -> ../../../LLDB
  │   │   │   │   ├── diagnose
  │   │   │   │   ├── formatters
  │   │   │   │   │   ├── cpp
  │   │   │   │   ├── macosx
  │   │   │   │   │   ├── heap
  │   │   │   │   │   │   ├── Makefile
  │   │   │   │   │   │   └── heap_find.cpp
  │   │   │   │   ├── runtime
  │   │   │   │   └── utils
  │   │   ├── darwin-debug
  │   │   ├── debugserver
  │   │   └── lldb-argdumper
  │   └── Current -> A
  └── debuginfo
  ├── LLDB.framework.dSYM
  │   └── Contents
  │   ├── Info.plist
  │   └── Resources
  │   └── DWARF
  │   └── LLDB
  ├── darwin-debug.dSYM
  │   └── Contents
  │   ├── Info.plist
  │   └── Resources
  │   └── DWARF
  │   └── darwin-debug
  ├── debugserver.dSYM
  │   └── Contents
  │   ├── Info.plist
  │   └── Resources
  │   └── DWARF
  │   └── debugserver
  └── lldb-argdumper.dSYM
  └── Contents
  ├── Info.plist
  └── Resources
  └── DWARF
  └── lldb-argdumper
  
  41 directories, 114 files


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64408



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


[Lldb-commits] [PATCH] D64408: [CMake] `install-distribution` for LLDB on Darwin

2019-07-09 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

I'm not very familiar with the details here, but this approach seems reasonable 
to me...


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64408



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


[Lldb-commits] [PATCH] D64399: [CMake] Distribution builds for LLDB standalone

2019-07-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz updated this revision to Diff 208695.
sgraenitz added a comment.

Add `include(LLVMDistributionSupport)` which went into the wrong patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64399

Files:
  lldb/CMakeLists.txt
  lldb/cmake/caches/Apple-lldb-macOS.cmake
  lldb/cmake/modules/LLDBStandalone.cmake


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -85,6 +85,7 @@
   include(TableGen)
   include(HandleLLVMOptions)
   include(CheckAtomic)
+  include(LLVMDistributionSupport)
 
   if (PYTHON_EXECUTABLE STREQUAL "")
 set(Python_ADDITIONAL_VERSIONS 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
Index: lldb/cmake/caches/Apple-lldb-macOS.cmake
===
--- lldb/cmake/caches/Apple-lldb-macOS.cmake
+++ lldb/cmake/caches/Apple-lldb-macOS.cmake
@@ -15,5 +15,13 @@
 
 # Release builds may change these:
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
-set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER OFF CACHE BOOL "")
 set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  lldb
+  liblldb
+  lldb-argdumper
+  darwin-debug
+  debugserver
+  CACHE STRING "")
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -220,3 +220,7 @@
 COMMENT "Copying Python DLL to LLDB binaries directory.")
 endif ()
 endif ()
+
+if(LLDB_BUILT_STANDALONE)
+  llvm_distribution_add_targets()
+endif()


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -85,6 +85,7 @@
   include(TableGen)
   include(HandleLLVMOptions)
   include(CheckAtomic)
+  include(LLVMDistributionSupport)
 
   if (PYTHON_EXECUTABLE STREQUAL "")
 set(Python_ADDITIONAL_VERSIONS 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
Index: lldb/cmake/caches/Apple-lldb-macOS.cmake
===
--- lldb/cmake/caches/Apple-lldb-macOS.cmake
+++ lldb/cmake/caches/Apple-lldb-macOS.cmake
@@ -15,5 +15,13 @@
 
 # Release builds may change these:
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
-set(LLDB_USE_SYSTEM_DEBUGSERVER ON CACHE BOOL "")
+set(LLDB_USE_SYSTEM_DEBUGSERVER OFF CACHE BOOL "")
 set(LLVM_EXTERNALIZE_DEBUGINFO OFF CACHE BOOL "")
+
+set(LLVM_DISTRIBUTION_COMPONENTS
+  lldb
+  liblldb
+  lldb-argdumper
+  darwin-debug
+  debugserver
+  CACHE STRING "")
Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -220,3 +220,7 @@
 COMMENT "Copying Python DLL to LLDB binaries directory.")
 endif ()
 endif ()
+
+if(LLDB_BUILT_STANDALONE)
+  llvm_distribution_add_targets()
+endif()
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64399: [CMake] Distribution builds for LLDB standalone

2019-07-09 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


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64399



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


[Lldb-commits] [PATCH] D64194: [lldb] Fix crash due to unicode characters and dollars in variable names.

2019-07-09 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added inline comments.



Comment at: 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp:223
+// Returns true if this is the last token we get from the lexer.
+exit = lex.LexFromRawLexer(token);
+

Can we write this as `while(!lex.LexFromRawLexer(token))`?


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

https://reviews.llvm.org/D64194



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


[Lldb-commits] [PATCH] D64408: [CMake] `install-distribution` for LLDB on Darwin

2019-07-09 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.
This revision is now accepted and ready to land.

I like the idea a lot and the implementation looks alright. LGTM


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64408



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


[Lldb-commits] [PATCH] D64397: [CMake] Remove extra lldb-framework target

2019-07-09 Thread Alex Langford via Phabricator via lldb-commits
xiaobai accepted this revision.
xiaobai added a comment.
This revision is now accepted and ready to land.

Thanks for cleaning this up!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64397



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


[Lldb-commits] [lldb] r365526 - [lldb, windows] Update two more locations that use LaunchThread to the new function signature

2019-07-09 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Tue Jul  9 11:10:36 2019
New Revision: 365526

URL: http://llvm.org/viewvc/llvm-project?rev=365526&view=rev
Log:
[lldb, windows] Update two more locations that use LaunchThread to the new 
function signature

Modified:
lldb/trunk/source/Host/windows/HostProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp

Modified: lldb/trunk/source/Host/windows/HostProcessWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/windows/HostProcessWindows.cpp?rev=365526&r1=365525&r2=365526&view=diff
==
--- lldb/trunk/source/Host/windows/HostProcessWindows.cpp (original)
+++ lldb/trunk/source/Host/windows/HostProcessWindows.cpp Tue Jul  9 11:10:36 
2019
@@ -14,6 +14,7 @@
 
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/WindowsError.h"
 
 #include 
 
@@ -94,8 +95,7 @@ llvm::Expected HostProcessWi
 HostProcessWindows::MonitorThread,
 info);
   } else {
-DWORD err = GetLastError();
-return llvm::errorCodeToError(std::error_code(err, 
std::system_category()));
+return llvm::errorCodeToError(llvm::mapWindowsError(GetLastError()));
   }
 }
 

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp?rev=365526&r1=365525&r2=365526&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/DebuggerThread.cpp Tue Jul 
 9 11:10:36 2019
@@ -63,16 +63,18 @@ Status DebuggerThread::DebugLaunch(const
   Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
   LLDB_LOG(log, "launching '{0}'", launch_info.GetExecutableFile().GetPath());
 
-  Status error;
+  Status result;
   DebugLaunchContext *context = new DebugLaunchContext(this, launch_info);
-  HostThread slave_thread(ThreadLauncher::LaunchThread(
-  "lldb.plugin.process-windows.slave[?]", DebuggerThreadLaunchRoutine,
-  context, &error));
 
-  if (!error.Success())
-LLDB_LOG(log, "couldn't launch debugger thread. {0}", error);
+  llvm::Expected slave_thread = ThreadLauncher::LaunchThread(
+  "lldb.plugin.process-windows.slave[?]", DebuggerThreadLaunchRoutine,
+  context);
+  if (!slave_thread) {
+result = Status(slave_thread.takeError());
+LLDB_LOG(log, "couldn't launch debugger thread. {0}", result);
+  }
 
-  return error;
+  return result;
 }
 
 Status DebuggerThread::DebugAttach(lldb::pid_t pid,
@@ -80,16 +82,18 @@ Status DebuggerThread::DebugAttach(lldb:
   Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
   LLDB_LOG(log, "attaching to '{0}'", pid);
 
-  Status error;
+  Status result;
   DebugAttachContext *context = new DebugAttachContext(this, pid, attach_info);
-  HostThread slave_thread(ThreadLauncher::LaunchThread(
-  "lldb.plugin.process-windows.slave[?]", DebuggerThreadAttachRoutine,
-  context, &error));
 
-  if (!error.Success())
-LLDB_LOG(log, "couldn't attach to process '{0}'. {1}", pid, error);
+  llvm::Expected slave_thread = ThreadLauncher::LaunchThread(
+  "lldb.plugin.process-windows.slave[?]", DebuggerThreadAttachRoutine,
+  context);
+  if (!slave_thread) {
+result = Status(slave_thread.takeError());
+LLDB_LOG(log, "couldn't attach to process '{0}'. {1}", pid, result);
+  }
 
-  return error;
+  return result;
 }
 
 lldb::thread_result_t DebuggerThread::DebuggerThreadLaunchRoutine(void *data) {


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


[Lldb-commits] [lldb] r365527 - [lldb-suite] Skip TestMachCore on Windows

2019-07-09 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Tue Jul  9 11:18:02 2019
New Revision: 365527

URL: http://llvm.org/viewvc/llvm-project?rev=365527&view=rev
Log:
[lldb-suite] Skip TestMachCore on Windows

This test was originally marked as expected failure on Windows, but it is 
timing out instead of outright failing now. The expectedFailure attribute does 
not correctly track timeouts (as in, they don't count as failures), so now this 
is causing the test suite to fail.

Modified:

lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py?rev=365527&r1=365526&r2=365527&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/functionalities/postmortem/mach-core/TestMachCore.py
 Tue Jul  9 11:18:02 2019
@@ -26,7 +26,10 @@ class MachCoreTestCase(TestBase):
 lldb.DBG.SetSelectedPlatform(self._initial_platform)
 super(MachCoreTestCase, self).tearDown()
 
-@expectedFailureAll(bugnumber="llvm.org/pr37371", hostoslist=["windows"])
+# This was originally marked as expected failure on Windows, but it has
+# started timing out instead, so the expectedFailure attribute no longer
+# correctly tracks it: llvm.org/pr37371
+@skipIfWindows
 def test_selected_thread(self):
 """Test that the right thread is selected after a core is loaded."""
 # Create core form YAML.


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


[Lldb-commits] [lldb] r365533 - [lldb, windows] Include WindowsError instead of ErrorHandling in ThreadLauncher

2019-07-09 Thread Stella Stamenova via lldb-commits
Author: stella.stamenova
Date: Tue Jul  9 11:41:31 2019
New Revision: 365533

URL: http://llvm.org/viewvc/llvm-project?rev=365533&view=rev
Log:
[lldb, windows] Include WindowsError instead of ErrorHandling in ThreadLauncher

ErrorHandling.h does not include WindowsError.h which is needed for 
mapWindowsError

Modified:
lldb/trunk/source/Host/common/ThreadLauncher.cpp

Modified: lldb/trunk/source/Host/common/ThreadLauncher.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/ThreadLauncher.cpp?rev=365533&r1=365532&r2=365533&view=diff
==
--- lldb/trunk/source/Host/common/ThreadLauncher.cpp (original)
+++ lldb/trunk/source/Host/common/ThreadLauncher.cpp Tue Jul  9 11:41:31 2019
@@ -16,7 +16,7 @@
 #include "lldb/Host/windows/windows.h"
 #endif
 
-#include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/WindowsError.h"
 
 using namespace lldb;
 using namespace lldb_private;


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


[Lldb-commits] [PATCH] D64434: [lldb] Quick Fix: IRExecutionUnit check pointer before access it

2019-07-09 Thread Wanyi Ye via Phabricator via lldb-commits
kusmour created this revision.
kusmour added reviewers: xiaobai, compnerd.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Move checking pointer code block before accessing the pointer
This caused lldb to crash when testing on Android


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D64434

Files:
  lldb/source/Expression/IRExecutionUnit.cpp


Index: lldb/source/Expression/IRExecutionUnit.cpp
===
--- lldb/source/Expression/IRExecutionUnit.cpp
+++ lldb/source/Expression/IRExecutionUnit.cpp
@@ -285,9 +285,6 @@

   m_execution_engine_up.reset(builder.create(target_machine));

-  m_strip_underscore =
-  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
-
   if (!m_execution_engine_up) {
 error.SetErrorToGenericError();
 error.SetErrorStringWithFormat("Couldn't JIT the function: %s",
@@ -295,6 +292,9 @@
 return;
   }

+  m_strip_underscore =
+  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
+
   class ObjectDumper : public llvm::ObjectCache {
   public:
 void notifyObjectCompiled(const llvm::Module *module,


Index: lldb/source/Expression/IRExecutionUnit.cpp
===
--- lldb/source/Expression/IRExecutionUnit.cpp
+++ lldb/source/Expression/IRExecutionUnit.cpp
@@ -285,9 +285,6 @@

   m_execution_engine_up.reset(builder.create(target_machine));

-  m_strip_underscore =
-  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
-
   if (!m_execution_engine_up) {
 error.SetErrorToGenericError();
 error.SetErrorStringWithFormat("Couldn't JIT the function: %s",
@@ -295,6 +292,9 @@
 return;
   }

+  m_strip_underscore =
+  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
+
   class ObjectDumper : public llvm::ObjectCache {
   public:
 void notifyObjectCompiled(const llvm::Module *module,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64395: [CMake] Avoid libcxxabi dependency when building LLDB from the monorepo on macOS by default

2019-07-09 Thread Louis Dionne via Phabricator via lldb-commits
ldionne added a comment.

In D64395#1575999 , @sgraenitz wrote:

> Thanks for taking a look.
>
> In D64395#1575967 , @ldionne wrote:
>
> > When is `LLDBConfig.cmake` used?
>
>
> Very early in the LLDB config process: 
> https://github.com/llvm/llvm-project/blob/e0a3ee79c5ff/lldb/CMakeLists.txt#L15
>  Globally, I think LLDB is always configured after libc++. Does libc++ make 
> decisions based on these values?


libc++ decides to build or not build `libc++.dylib`/`libc++.a` based on the 
value of `LIBCXX_ENABLE_SHARED` and `LIBCXX_ENABLE_STATIC`, if that's your 
question.

> 
> 
>> Will it influence whether `libc++.dylib` is built in the monorepo whenever 
>> you also happen to build LLDB?
> 
> Yes, I think so. Adding lldb to `LLVM_ENABLE_PROJECTS` will disable 
> `libc++.dylib` globally, ...

In that case, I'm really not a big fan of this approach. I think it's not good 
hygiene for another project to be poking at libc++'s build options like that. 
Those are meant to be set by end-users configuring what they want from libc++ 
only, not set by other projects in the monorepo. To illustrate, I think it's 
highly confusing if adding `-DLLVM_ENABLE_PROJECTS=lldb` suddenly disables the 
building of `libc++.dylib`.

I think your problem might fix itself with https://reviews.llvm.org/D63883. 
What exactly is the problem you're trying to solve?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64395



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


[Lldb-commits] [PATCH] D64373: Don't use PyInt on Python 3

2019-07-09 Thread Christian Biesinger via Phabricator via lldb-commits
cbiesinger added a comment.

Ah, this works because Swig (?) adds compatibility macros to LLDBWrapPython:
#define PyInt_Check(x) PyLong_Check(x)
#define PyInt_AsLong(x) PyLong_AsLong(x)
#define PyInt_FromLong(x) PyLong_FromLong(x)
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
(etc)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64373



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


[Lldb-commits] [PATCH] D64395: [CMake] Avoid libcxxabi dependency when building LLDB from the monorepo on macOS by default

2019-07-09 Thread Stefan Gränitz via Phabricator via lldb-commits
sgraenitz abandoned this revision.
sgraenitz added a comment.

In D64395#1576738 , @ldionne wrote:

> libc++ decides to build or not build `libc++.dylib`/`libc++.a` based on the 
> value of `LIBCXX_ENABLE_SHARED` and `LIBCXX_ENABLE_STATIC`, if that's your 
> question.


Sure. I was wondering whether libc++ makes assumptions based on those flags 
that would break, if we changed them from the outside later on.

>> Yes, I think so. Adding lldb to `LLVM_ENABLE_PROJECTS` will disable 
>> `libc++.dylib` globally, ...
> 
> In that case, I'm really not a big fan of this approach. I think it's not 
> good hygiene for another project to be poking at libc++'s build options like 
> that. Those are meant to be set by end-users configuring what they want from 
> libc++ only, not set by other projects in the monorepo. To illustrate, I 
> think it's highly confusing if adding `-DLLVM_ENABLE_PROJECTS=lldb` suddenly 
> disables the building of `libc++.dylib`.

I think, the condition reduces the potential harm to an acceptable minimum. But 
yes I agree, it's not good hygiene. We should advise everyone to use the right 
flags or caches.

> I think your problem might fix itself with https://reviews.llvm.org/D63883. 
> What exactly is the problem you're trying to solve?

Yes, I think that would work. I'll drop that patch for now and wait for your 
fix.

**For people reading this after the fact, please pre-populate your cache with 
something like 1665dd63466b 
 or pass 
the flags manually.**


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64395



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


[Lldb-commits] [PATCH] D64444: Add Python 3.6 and 3.7 to the version list

2019-07-09 Thread Christian Biesinger via Phabricator via lldb-commits
cbiesinger created this revision.
cbiesinger added a reviewer: clayborg.
Herald added subscribers: lldb-commits, mgorny.
Herald added a project: LLDB.

Python 3.6 and 3.7 have been released.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D6

Files:
  lldb/cmake/modules/LLDBStandalone.cmake


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -87,7 +87,7 @@
   include(CheckAtomic)
 
   if (PYTHON_EXECUTABLE STREQUAL "")
-set(Python_ADDITIONAL_VERSIONS 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
+set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
 include(FindPythonInterp)
 if( NOT PYTHONINTERP_FOUND )
   message(FATAL_ERROR


Index: lldb/cmake/modules/LLDBStandalone.cmake
===
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -87,7 +87,7 @@
   include(CheckAtomic)
 
   if (PYTHON_EXECUTABLE STREQUAL "")
-set(Python_ADDITIONAL_VERSIONS 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
+set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.6 2.5)
 include(FindPythonInterp)
 if( NOT PYTHONINTERP_FOUND )
   message(FATAL_ERROR
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64444: Add Python 3.6 and 3.7 to the version list

2019-07-09 Thread Adrian McCarthy via Phabricator via lldb-commits
amccarth added a comment.

Be aware that Swig 3.0.12 has a compatibility problem with Python 3.7 that 
causes hundreds of LLDB tests to fail an assertion (at least on Windows).

http://lists.llvm.org/pipermail/lldb-dev/2019-June/015086.html

I don't think that should block the patch or whether it even warrants a 
comment, but it seems worth mentioning somewhere for anyone who goes searching 
for the cause of the failure.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D6



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


[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-09 Thread David Tenty via Phabricator via lldb-commits
daltenty updated this revision to Diff 208805.
daltenty added a comment.

- Use subprocess.call instead of importing it
- Create killProcessAndChildrenIsSupported check and rewrite things to use it


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64251

Files:
  libcxx/utils/libcxx/util.py
  lldb/lit/lit.cfg.py
  llvm/utils/lit/lit/LitConfig.py
  llvm/utils/lit/lit/util.py
  llvm/utils/lit/tests/googletest-timeout.py
  llvm/utils/lit/tests/lit.cfg
  llvm/utils/lit/tests/shtest-timeout.py

Index: llvm/utils/lit/tests/shtest-timeout.py
===
--- llvm/utils/lit/tests/shtest-timeout.py
+++ llvm/utils/lit/tests/shtest-timeout.py
@@ -1,4 +1,4 @@
-# REQUIRES: python-psutil
+# REQUIRES: lit-max-individual-test-time
 
 # llvm.org/PR33944
 # UNSUPPORTED: system-windows
Index: llvm/utils/lit/tests/lit.cfg
===
--- llvm/utils/lit/tests/lit.cfg
+++ llvm/utils/lit/tests/lit.cfg
@@ -1,6 +1,7 @@
 # -*- Python -*-
 
 import os
+import platform
 import sys
 
 import lit.formats
@@ -56,10 +57,10 @@
 os.path.dirname(__file__), ".coveragerc")
 
 # Add a feature to detect if psutil is available
-try:
-import psutil
-lit_config.note('Found python psutil module')
-config.available_features.add("python-psutil")
-except ImportError:
-lit_config.warning('Could not import psutil. Some tests will be skipped and'
-   ' the --timeout command line argument will not work.')
+supported, errormsg = lit_config.killProcessAndChildrenIsSupported()
+if supported:
+config.available_features.add("lit-max-individual-test-time")
+else:
+lit_config.warning('Setting a timeout per test not supported. ' + errormsg
+   + ' Some tests will be skipped and the --timeout '
+ ' command line argument will not work.')
Index: llvm/utils/lit/tests/googletest-timeout.py
===
--- llvm/utils/lit/tests/googletest-timeout.py
+++ llvm/utils/lit/tests/googletest-timeout.py
@@ -1,4 +1,4 @@
-# REQUIRES: python-psutil
+# REQUIRES: lit-max-individual-test-time
 
 # Check that the per test timeout is enforced when running GTest tests.
 #
Index: llvm/utils/lit/lit/util.py
===
--- llvm/utils/lit/lit/util.py
+++ llvm/utils/lit/lit/util.py
@@ -433,24 +433,29 @@
 our dependency on it.
 
 """
-import psutil
-try:
-psutilProc = psutil.Process(pid)
-# Handle the different psutil API versions
+import platform
+
+if platform.system() == 'AIX':
+subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), shell=True)
+else:
+import psutil
 try:
-# psutil >= 2.x
-children_iterator = psutilProc.children(recursive=True)
-except AttributeError:
-# psutil 1.x
-children_iterator = psutilProc.get_children(recursive=True)
-for child in children_iterator:
+psutilProc = psutil.Process(pid)
+# Handle the different psutil API versions
 try:
-child.kill()
-except psutil.NoSuchProcess:
-pass
-psutilProc.kill()
-except psutil.NoSuchProcess:
-pass
+# psutil >= 2.x
+children_iterator = psutilProc.children(recursive=True)
+except AttributeError:
+# psutil 1.x
+children_iterator = psutilProc.get_children(recursive=True)
+for child in children_iterator:
+try:
+child.kill()
+except psutil.NoSuchProcess:
+pass
+psutilProc.kill()
+except psutil.NoSuchProcess:
+pass
 
 
 try:
Index: llvm/utils/lit/lit/LitConfig.py
===
--- llvm/utils/lit/lit/LitConfig.py
+++ llvm/utils/lit/lit/LitConfig.py
@@ -1,6 +1,7 @@
 from __future__ import absolute_import
 import inspect
 import os
+import platform
 import sys
 
 import lit.Test
@@ -76,6 +77,27 @@
 """
 return self._maxIndividualTestTime
 
+def killProcessAndChildrenIsSupported(self):
+"""
+Returns a tuple ( , )
+where
+`` is True if `killProcessAndChildren()` is supported on
+the current host, returns False otherwise.
+`` is an empty string if `` is True,
+otherwise is contains a string describing why the function is
+not supported.
+"""
+if platform.system() == 'AIX':
+return (True, "")
+try:
+import psutil  # noqa: F401
+self.note('Found python psutil module')
+return (Tru

[Lldb-commits] [lldb] r365559 - [Docs] Replace SVN revisions with lldb versions

2019-07-09 Thread Dave Lee via lldb-commits
Author: kastiglione
Date: Tue Jul  9 14:21:45 2019
New Revision: 365559

URL: http://llvm.org/viewvc/llvm-project?rev=365559&view=rev
Log:
[Docs] Replace SVN revisions with lldb versions

Summary: Replaces references to svn commits with the lldb version number those 
commits first appeared in. Themotivation is to show that these features are no 
longer that new and can generally be adopted.

Reviewers: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

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

Modified:
lldb/trunk/docs/use/python-reference.rst

Modified: lldb/trunk/docs/use/python-reference.rst
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/use/python-reference.rst?rev=365559&r1=365558&r2=365559&view=diff
==
--- lldb/trunk/docs/use/python-reference.rst (original)
+++ lldb/trunk/docs/use/python-reference.rst Tue Jul  9 14:21:45 2019
@@ -494,10 +494,9 @@ Optionally, you can also provide a Pytho
   """This command takes a lot of options and does many fancy things"""
   # Your code goes here
 
-Starting with SVN revision 218834, LLDB Python commands can also take an
-SBExecutionContext as an argument. This is useful in cases where the command's
-notion of where to act is independent of the currently-selected entities in the
-debugger.
+Since lldb 3.5.2, LLDB Python commands can also take an SBExecutionContext as 
an
+argument. This is useful in cases where the command's notion of where to act is
+independent of the currently-selected entities in the debugger.
 
 This feature is enabled if the command-implementing function can be recognized
 as taking 5 arguments, or a variable number of arguments, and it alters the
@@ -519,7 +518,7 @@ signature as such:
 
+---++--+
 | **exe_ctx**   | **lldb.SBExecutionContext**| An execution context 
object carrying around information on the inferior process' context in which 
the command is expected to act |
 |   || 

 |
-|   || *Optional since SVN 
r218834, unavailable before*
 |
+|   || *Optional since lldb 
3.5.2, unavailable before*  
|
 
+---++--+
 | **result**| **lldb.SBCommandReturnObject** | A return object which 
encapsulates success/failure information for the command and output text
   |
 |   || that needs to be 
printed as a result of the command. The plain Python "print" command also works 
but |
@@ -529,8 +528,8 @@ signature as such:
 |   || and functions.  

 |
 
+---++--+
 
-Starting with SVN revision 232224, Python commands can also be implemented by
-means of a class which should implement the following interface:
+Since lldb 3.7, Python commands can also be implemented by means of a class
+which should implement the following interface:
 
 ::
 


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


[Lldb-commits] [PATCH] D61778: [Docs] Replace SVN revisions with lldb versions

2019-07-09 Thread Dave Lee via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365559: [Docs] Replace SVN revisions with lldb versions 
(authored by kastiglione, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D61778?vs=198985&id=208809#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D61778

Files:
  lldb/trunk/docs/use/python-reference.rst


Index: lldb/trunk/docs/use/python-reference.rst
===
--- lldb/trunk/docs/use/python-reference.rst
+++ lldb/trunk/docs/use/python-reference.rst
@@ -494,10 +494,9 @@
   """This command takes a lot of options and does many fancy things"""
   # Your code goes here
 
-Starting with SVN revision 218834, LLDB Python commands can also take an
-SBExecutionContext as an argument. This is useful in cases where the command's
-notion of where to act is independent of the currently-selected entities in the
-debugger.
+Since lldb 3.5.2, LLDB Python commands can also take an SBExecutionContext as 
an
+argument. This is useful in cases where the command's notion of where to act is
+independent of the currently-selected entities in the debugger.
 
 This feature is enabled if the command-implementing function can be recognized
 as taking 5 arguments, or a variable number of arguments, and it alters the
@@ -519,7 +518,7 @@
 
+---++--+
 | **exe_ctx**   | **lldb.SBExecutionContext**| An execution context 
object carrying around information on the inferior process' context in which 
the command is expected to act |
 |   || 

 |
-|   || *Optional since SVN 
r218834, unavailable before*
 |
+|   || *Optional since lldb 
3.5.2, unavailable before*  
|
 
+---++--+
 | **result**| **lldb.SBCommandReturnObject** | A return object which 
encapsulates success/failure information for the command and output text
   |
 |   || that needs to be 
printed as a result of the command. The plain Python "print" command also works 
but |
@@ -529,8 +528,8 @@
 |   || and functions.  

 |
 
+---++--+
 
-Starting with SVN revision 232224, Python commands can also be implemented by
-means of a class which should implement the following interface:
+Since lldb 3.7, Python commands can also be implemented by means of a class
+which should implement the following interface:
 
 ::
 


Index: lldb/trunk/docs/use/python-reference.rst
===
--- lldb/trunk/docs/use/python-reference.rst
+++ lldb/trunk/docs/use/python-reference.rst
@@ -494,10 +494,9 @@
   """This command takes a lot of options and does many fancy things"""
   # Your code goes here
 
-Starting with SVN revision 218834, LLDB Python commands can also take an
-SBExecutionContext as an argument. This is useful in cases where the command's
-notion of where to act is independent of the currently-selected entities in the
-debugger.
+Since lldb 3.5.2, LLDB Python commands can also take an SBExecutionContext as an
+argument. This is useful in cases where the command's notion of where to act is
+independent of the currently-selected entities in the debugger.
 
 This feature is enabled if the command-implementing function can be recognized
 as taking 5 arguments, or a variable number of arguments, and it alters the
@@ -519,7 +518,7 @@
 +---++--+
 | **exe_ctx**   | **lldb.SBExecutionContext**| An execution context object carrying around information on the inferi

[Lldb-commits] [lldb] r365561 - [lldb_test_suite] Fix lldb test suite targeting remote Android

2019-07-09 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Jul  9 14:35:58 2019
New Revision: 365561

URL: http://llvm.org/viewvc/llvm-project?rev=365561&view=rev
Log:
[lldb_test_suite] Fix lldb test suite targeting remote Android

Summary:
Fixed `Android.rules` for running test suite on remote android
- the build configuration is not compatible with ndk structure, change it to 
link to static libc++
- generally clang should be able to use libc++ and will link against the right 
library, but some libc++ installations require the user manually link libc++abi.
- add flag `-lc++abi` to fix the test binary build failure

Added `skipIfTargetAndroid` `skipUnlessTargetAndroid` for better test support
- the `skipIfPlatform` method will ask `lldbplatformutil.getPlatform()` for 
platform info which is actually the os type, and //Android// is not os type but 
environment
- create this function to handle the android target condition

**To Run Test on Remote Android**
1 start lldb-server on your devices
2 run lldb-dotest with following configuration:
`./lldb-dotest --out-of-tree-debugserver --arch aarch64 --platform-name 
remote-android --platform-url connect://localhost:12345 --platform-working-dir 
/data/local/tmp/ --compiler your/ndk/clang`

Reviewers: xiaobai, labath

Reviewed By: labath

Subscribers: labath, javed.absar, kristof.beyls, srhines, lldb-commits

Tags: #lldb

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

Modified:

lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
lldb/trunk/packages/Python/lldbsuite/test/decorators.py
lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules

Modified: 
lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py?rev=365561&r1=365560&r2=365561&view=diff
==
--- 
lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
 (original)
+++ 
lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
 Tue Jul  9 14:35:58 2019
@@ -16,7 +16,7 @@ class DefaultCacheLineSizeTestCase(TestB
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipUnlessPlatform(['android'])
+@skipUnlessTargetAndroid
 def test_cache_line_size(self):
 self.build(dictionary=self.getBuildFlags())
 exe = self.getBuildArtifact("a.out")

Modified: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/decorators.py?rev=365561&r1=365560&r2=365561&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py Tue Jul  9 14:35:58 
2019
@@ -596,6 +596,10 @@ def skipIfWindows(func):
 """Decorate the item to skip tests that should be skipped on Windows."""
 return skipIfPlatform(["windows"])(func)
 
+def skipIfTargetAndroid(func):
+return unittest2.skipIf(lldbplatformutil.target_is_android(),
+"skip on target Android")(func)
+
 
 def skipUnlessWindows(func):
 """Decorate the item to skip tests that should be skipped on any 
non-Windows platform."""
@@ -606,6 +610,10 @@ def skipUnlessDarwin(func):
 """Decorate the item to skip tests that should be skipped on any non 
Darwin platform."""
 return skipUnlessPlatform(lldbplatformutil.getDarwinOSTriples())(func)
 
+def skipUnlessTargetAndroid(func):
+return unittest2.skipUnless(lldbplatformutil.target_is_android(),
+"requires target to be Android")(func)
+
 
 def skipIfHostIncompatibleWithRemote(func):
 """Decorate the item to skip tests if binaries built on this host are 
incompatible."""

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules?rev=365561&r1=365560&r2=365561&view=diff
==
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules Tue Jul  9 
14:35:58 2019
@@ -90,5 +90,6 @@ else
 
ARCH_LDFLAGS += \
-L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
-   
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+   
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
+   -lc++abi
 endif


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


[Lldb-commits] [PATCH] D64118: [lldb_test_suite] Fix lldb test suite targeting remote Android

2019-07-09 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365561: [lldb_test_suite] Fix lldb test suite targeting 
remote Android (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64118?vs=208465&id=208815#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64118

Files:
  
lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
  lldb/trunk/packages/Python/lldbsuite/test/decorators.py
  lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules


Index: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
@@ -90,5 +90,6 @@
 
ARCH_LDFLAGS += \
-L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
-   
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+   
$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
+   -lc++abi
 endif
Index: 
lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
===
--- 
lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
+++ 
lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
@@ -16,7 +16,7 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipUnlessPlatform(['android'])
+@skipUnlessTargetAndroid
 def test_cache_line_size(self):
 self.build(dictionary=self.getBuildFlags())
 exe = self.getBuildArtifact("a.out")
Index: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py
@@ -596,6 +596,10 @@
 """Decorate the item to skip tests that should be skipped on Windows."""
 return skipIfPlatform(["windows"])(func)
 
+def skipIfTargetAndroid(func):
+return unittest2.skipIf(lldbplatformutil.target_is_android(),
+"skip on target Android")(func)
+
 
 def skipUnlessWindows(func):
 """Decorate the item to skip tests that should be skipped on any 
non-Windows platform."""
@@ -606,6 +610,10 @@
 """Decorate the item to skip tests that should be skipped on any non 
Darwin platform."""
 return skipUnlessPlatform(lldbplatformutil.getDarwinOSTriples())(func)
 
+def skipUnlessTargetAndroid(func):
+return unittest2.skipUnless(lldbplatformutil.target_is_android(),
+"requires target to be Android")(func)
+
 
 def skipIfHostIncompatibleWithRemote(func):
 """Decorate the item to skip tests if binaries built on this host are 
incompatible."""


Index: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
===
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
@@ -90,5 +90,6 @@
 
 	ARCH_LDFLAGS += \
 		-L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
-		$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
+		$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++_static.a \
+		-lc++abi
 endif
Index: lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
+++ lldb/trunk/packages/Python/lldbsuite/test/android/platform/TestDefaultCacheLineSize.py
@@ -16,7 +16,7 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipUnlessPlatform(['android'])
+@skipUnlessTargetAndroid
 def test_cache_line_size(self):
 self.build(dictionary=self.getBuildFlags())
 exe = self.getBuildArtifact("a.out")
Index: lldb/trunk/packages/Python/lldbsuite/test/decorators.py
===
--- lldb/trunk/packages/Python/lldbsuite/test/decorators.py
+++ lldb/trunk/packages/Python/lldbsuite/test/decorators.py
@@ -596,6 +596,10 @@
 """Decorate the item to skip tests that should be skipped on Windows."""
 return skipIfPlatform(["windows"])(func)
 
+def skipIfTargetAndroid(func):
+return unittest2.skipIf(lldbplatformutil.target_is_android(),
+"skip on target Android")(func)
+
 
 def skipUnlessWindows(func):
 """Decorate the item to skip tests that should be skipped on any non-Windows platform."""
@@ -606,6 +610,10 @@
 """De

[Lldb-commits] [lldb] r365567 - [lldb] Quick Fix: IRExecutionUnit check pointer before access it

2019-07-09 Thread Alex Langford via lldb-commits
Author: xiaobai
Date: Tue Jul  9 15:24:54 2019
New Revision: 365567

URL: http://llvm.org/viewvc/llvm-project?rev=365567&view=rev
Log:
[lldb] Quick Fix: IRExecutionUnit check pointer before access it

Summary:
Move checking pointer code block before accessing the pointer
This caused lldb to crash when testing on Android

Patch by Wanyi Ye!

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

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

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=365567&r1=365566&r2=365567&view=diff
==
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Tue Jul  9 15:24:54 2019
@@ -285,9 +285,6 @@ void IRExecutionUnit::GetRunnableInfo(St
 
   m_execution_engine_up.reset(builder.create(target_machine));
 
-  m_strip_underscore =
-  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
-
   if (!m_execution_engine_up) {
 error.SetErrorToGenericError();
 error.SetErrorStringWithFormat("Couldn't JIT the function: %s",
@@ -295,6 +292,9 @@ void IRExecutionUnit::GetRunnableInfo(St
 return;
   }
 
+  m_strip_underscore =
+  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
+
   class ObjectDumper : public llvm::ObjectCache {
   public:
 void notifyObjectCompiled(const llvm::Module *module,


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


[Lldb-commits] [PATCH] D64434: [lldb] Quick Fix: IRExecutionUnit check pointer before access it

2019-07-09 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365567: [lldb] Quick Fix: IRExecutionUnit check pointer 
before access it (authored by xiaobai, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Changed prior to commit:
  https://reviews.llvm.org/D64434?vs=208763&id=208828#toc

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64434

Files:
  lldb/trunk/source/Expression/IRExecutionUnit.cpp


Index: lldb/trunk/source/Expression/IRExecutionUnit.cpp
===
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp
@@ -285,9 +285,6 @@
 
   m_execution_engine_up.reset(builder.create(target_machine));
 
-  m_strip_underscore =
-  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
-
   if (!m_execution_engine_up) {
 error.SetErrorToGenericError();
 error.SetErrorStringWithFormat("Couldn't JIT the function: %s",
@@ -295,6 +292,9 @@
 return;
   }
 
+  m_strip_underscore =
+  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
+
   class ObjectDumper : public llvm::ObjectCache {
   public:
 void notifyObjectCompiled(const llvm::Module *module,


Index: lldb/trunk/source/Expression/IRExecutionUnit.cpp
===
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp
@@ -285,9 +285,6 @@
 
   m_execution_engine_up.reset(builder.create(target_machine));
 
-  m_strip_underscore =
-  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
-
   if (!m_execution_engine_up) {
 error.SetErrorToGenericError();
 error.SetErrorStringWithFormat("Couldn't JIT the function: %s",
@@ -295,6 +292,9 @@
 return;
   }
 
+  m_strip_underscore =
+  (m_execution_engine_up->getDataLayout().getGlobalPrefix() == '_');
+
   class ObjectDumper : public llvm::ObjectCache {
   public:
 void notifyObjectCompiled(const llvm::Module *module,
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D64366: Add lldb type unit support to the release notes

2019-07-09 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL365568: Add lldb type unit support to the release notes 
(authored by labath, committed by ).

Repository:
  rL LLVM

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

https://reviews.llvm.org/D64366

Files:
  llvm/trunk/docs/ReleaseNotes.rst


Index: llvm/trunk/docs/ReleaseNotes.rst
===
--- llvm/trunk/docs/ReleaseNotes.rst
+++ llvm/trunk/docs/ReleaseNotes.rst
@@ -137,6 +137,8 @@
 
 * Backtraces are now color highlighting in the terminal.
 
+* DWARF4 (debug_types) and DWARF5 (debug_info) type units are now supported.
+
 * This release will be the last where ``lldb-mi`` is shipped as part of LLDB.
   The tool will still be available in a `downstream repository on GitHub
   `_.


Index: llvm/trunk/docs/ReleaseNotes.rst
===
--- llvm/trunk/docs/ReleaseNotes.rst
+++ llvm/trunk/docs/ReleaseNotes.rst
@@ -137,6 +137,8 @@
 
 * Backtraces are now color highlighting in the terminal.
 
+* DWARF4 (debug_types) and DWARF5 (debug_info) type units are now supported.
+
 * This release will be the last where ``lldb-mi`` is shipped as part of LLDB.
   The tool will still be available in a `downstream repository on GitHub
   `_.
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D62931: [lldb-server] Add setting to force 'g' packet use

2019-07-09 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade updated this revision to Diff 208838.
guiandrade marked 3 inline comments as done.
guiandrade added a comment.

This rebases the change, rename *try_to_use_g_packet* to *use_g_packet*, 
defaults the setting to true, and modifies the condition of the 
read_all_registers_at_once bool in 
ThreadGDBRemote::CreateRegisterContextForFrame to guarantee the server supports 
'g' packet.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62931

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp

Index: lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
===
--- lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
+++ lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp
@@ -128,6 +128,12 @@
   ASSERT_EQ(0,
 memcmp(buffer_sp->GetBytes(), one_register, sizeof one_register));
 
+  async_result = std::async(std::launch::async,
+[&] { return client.GetgPacketSupported(tid); });
+  Handle_QThreadSuffixSupported(server, true);
+  HandlePacket(server, "g;thread:0047;", all_registers_hex);
+  ASSERT_TRUE(async_result.get());
+
   read_result = std::async(std::launch::async,
[&] { return client.ReadAllRegisters(tid); });
   HandlePacket(server, "g;thread:0047;", all_registers_hex);
Index: lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
===
--- lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
@@ -25,7 +25,7 @@
 
 class ThreadGDBRemote : public Thread {
 public:
-  ThreadGDBRemote(Process &process, lldb::tid_t tid);
+  ThreadGDBRemote(Process &process, lldb::tid_t tid, bool use_g_packet);
 
   ~ThreadGDBRemote() override;
 
@@ -100,6 +100,7 @@
   uint64_t
   m_queue_serial_number; // Queue info from stop reply/stop info for thread
   lldb_private::LazyBool m_associated_with_libdispatch_queue;
+  bool m_use_g_packet;
 
   bool PrivateSetRegisterValue(uint32_t reg, llvm::ArrayRef data);
 
Index: lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
@@ -33,12 +33,14 @@
 
 // Thread Registers
 
-ThreadGDBRemote::ThreadGDBRemote(Process &process, lldb::tid_t tid)
+ThreadGDBRemote::ThreadGDBRemote(Process &process, lldb::tid_t tid,
+ bool use_g_packet)
 : Thread(process, tid), m_thread_name(), m_dispatch_queue_name(),
   m_thread_dispatch_qaddr(LLDB_INVALID_ADDRESS),
   m_dispatch_queue_t(LLDB_INVALID_ADDRESS), m_queue_kind(eQueueKindUnknown),
   m_queue_serial_number(LLDB_INVALID_QUEUE_ID),
-  m_associated_with_libdispatch_queue(eLazyBoolCalculate) {
+  m_associated_with_libdispatch_queue(eLazyBoolCalculate),
+  m_use_g_packet(use_g_packet) {
   Log *log(GetLogIfAnyCategoriesSet(GDBR_LOG_THREAD));
   LLDB_LOG(log, "this = {0}, pid = {1}, tid = {2}", this, process.GetID(),
GetID());
@@ -303,10 +305,13 @@
 if (process_sp) {
   ProcessGDBRemote *gdb_process =
   static_cast(process_sp.get());
-  // read_all_registers_at_once will be true if 'p' packet is not
+  // read_all_registers_at_once will be true if the server supports 'g'
+  // packet and either the flag m_use_g_packet is true or 'p' packet is not
   // supported.
   bool read_all_registers_at_once =
-  !gdb_process->GetGDBRemote().GetpPacketSupported(GetID());
+  gdb_process->GetGDBRemote().GetgPacketSupported(GetID()) &&
+  (m_use_g_packet ||
+   !gdb_process->GetGDBRemote().GetpPacketSupported(GetID()));
   reg_ctx_sp = std::make_shared(
   *this, concrete_frame_idx, gdb_process->m_register_info,
   read_all_registers_at_once);
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -138,12 +138,20 @@
  nullptr,
  {},
  "If true, the libraries-svr4 feature will be used to get a hold of the "
- "process's loaded modules."}};
+ "process's loaded modules."},
+{"use-g-packet",
+ OptionValue::eTypeBoolean,
+ true,
+ 1,
+

[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-09 Thread Dan Liew via Phabricator via lldb-commits
delcypher added inline comments.



Comment at: libcxx/utils/libcxx/util.py:256
 """
-import psutil
-try:
-psutilProc = psutil.Process(pid)
-# Handle the different psutil API versions
+if platform.system() == 'AIX':
+subprocess.call('kill -kill $(ps -o pid= -L{})'.format(pid), 
shell=True)

Wait what... why is this duplicated in `libcxx/utils/libcxx/util.py`?



Comment at: lldb/lit/lit.cfg.py:81
+# lit complains if the value is set but it is not supported.
+if lit_config.killProcessAndChildrenIsSupported:
 lit_config.maxIndividualTestTime = 600

Shouldn't this be

```lang=python
if lit_config.killProcessAndChildrenIsSupported():
```

?



Comment at: llvm/utils/lit/lit/LitConfig.py:80
 
+def killProcessAndChildrenIsSupported(self):
+"""

I'd prefer if this code lived in `llvm/utils/lit/lit/util.py` next to 
`killProcessAndChildren()` given that this function describes if that function 
works.

I realise you need to use `lit_config.killProcessAndChildrenIsSupported()` from 
inside a lit config but I'd suggest you add another level of indirection to 
hide this implementation detail so that the API of `LitConfig` doesn't leak it.

```lang=python
class LitConfig(object):
   ...
   @property
   def maxIndividualTestTimeIsSupported(self):
 """
Returns a tuple ( , )
where
`` is True if `killProcessAndChildren()` is supported on
the current host, returns False otherwise.
`` is an empty string if `` is True,
otherwise is contains a string describing why the function is
not supported.
  """
  return lit.util.killProcessAndChildrenIsSupported()
```

Alternatively you could change the implementation of 
`LitObject.maxIndividualTestTime` setter to throw a custom exception if an 
attempt is made to set the timeout when the platform doesn't support it. This 
custom exception would store the error message so it could be programmatically 
accessed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64251



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


[Lldb-commits] [PATCH] D62931: [lldb-server] Add setting to force 'g' packet use

2019-07-09 Thread Guilherme Andrade via Phabricator via lldb-commits
guiandrade added inline comments.



Comment at: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:194
+const uint32_t idx = ePropertyUseGPacket;
+return m_collection_sp->GetPropertyAtIndexAsBoolean(nullptr, idx, true);
+  }

Should we default to true here as well?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62931



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


[Lldb-commits] [PATCH] D64365: [lldb] Let table gen create command option initializers.

2019-07-09 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.

Thanks Raphael, great job! LGTM


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

https://reviews.llvm.org/D64365



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


[Lldb-commits] [PATCH] D64159: [Core] Generalize ValueObject::MaybeCalculateCompleteType

2019-07-09 Thread Alex Langford via Phabricator via lldb-commits
xiaobai updated this revision to Diff 208841.
xiaobai marked an inline comment as done.
xiaobai added a comment.

Switch to using llvm::Optional for the return type
Rename method from CalculateCompleteType to GetRuntimeType


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

https://reviews.llvm.org/D64159

Files:
  include/lldb/Target/LanguageRuntime.h
  include/lldb/Target/ObjCLanguageRuntime.h
  source/Core/ValueObject.cpp
  source/Target/ObjCLanguageRuntime.cpp

Index: source/Target/ObjCLanguageRuntime.cpp
===
--- source/Target/ObjCLanguageRuntime.cpp
+++ source/Target/ObjCLanguageRuntime.cpp
@@ -398,3 +398,38 @@
 "The ObjC Exception breakpoint doesn't support extra options.");
   return error;
 }
+
+llvm::Optional
+ObjCLanguageRuntime::GetRuntimeType(CompilerType base_type) {
+  CompilerType class_type;
+  bool is_pointer_type = false;
+
+  if (ClangASTContext::IsObjCObjectPointerType(base_type, &class_type))
+is_pointer_type = true;
+  else if (ClangASTContext::IsObjCObjectOrInterfaceType(base_type))
+class_type = base_type;
+  else
+return llvm::None;
+
+  if (!class_type)
+return llvm::None;
+
+  ConstString class_name(class_type.GetConstTypeName());
+  if (!class_name)
+return llvm::None;
+
+  TypeSP complete_objc_class_type_sp = LookupInCompleteClassCache(class_name);
+  if (!complete_objc_class_type_sp)
+return llvm::None;
+
+  CompilerType complete_class(
+  complete_objc_class_type_sp->GetFullCompilerType());
+  if (complete_class.GetCompleteType()) {
+if (is_pointer_type)
+  return complete_class.GetPointerType();
+else
+  return complete_class;
+  }
+
+  return llvm::None;
+}
Index: source/Core/ValueObject.cpp
===
--- source/Core/ValueObject.cpp
+++ source/Core/ValueObject.cpp
@@ -35,7 +35,6 @@
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Language.h"
 #include "lldb/Target/LanguageRuntime.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
@@ -280,51 +279,21 @@
   return compiler_type;
   }
 
-  CompilerType class_type;
-  bool is_pointer_type = false;
-
-  if (ClangASTContext::IsObjCObjectPointerType(compiler_type, &class_type)) {
-is_pointer_type = true;
-  } else if (ClangASTContext::IsObjCObjectOrInterfaceType(compiler_type)) {
-class_type = compiler_type;
-  } else {
-return compiler_type;
-  }
-
   m_did_calculate_complete_objc_class_type = true;
 
-  if (class_type) {
-ConstString class_name(class_type.GetConstTypeName());
-
-if (class_name) {
-  ProcessSP process_sp(
-  GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
-
-  if (process_sp) {
-ObjCLanguageRuntime *objc_language_runtime(
-ObjCLanguageRuntime::Get(*process_sp));
-
-if (objc_language_runtime) {
-  TypeSP complete_objc_class_type_sp =
-  objc_language_runtime->LookupInCompleteClassCache(class_name);
+  ProcessSP process_sp(
+  GetUpdatePoint().GetExecutionContextRef().GetProcessSP());
 
-  if (complete_objc_class_type_sp) {
-CompilerType complete_class(
-complete_objc_class_type_sp->GetFullCompilerType());
-
-if (complete_class.GetCompleteType()) {
-  if (is_pointer_type) {
-m_override_type = complete_class.GetPointerType();
-  } else {
-m_override_type = complete_class;
-  }
+  if (!process_sp)
+return compiler_type;
 
-  if (m_override_type.IsValid())
-return m_override_type;
-}
-  }
-}
-  }
+  if (auto *runtime =
+  process_sp->GetLanguageRuntime(GetObjectRuntimeLanguage())) {
+if (llvm::Optional complete_type =
+runtime->GetRuntimeType(compiler_type)) {
+  m_override_type = complete_type.getValue();
+  if (m_override_type.IsValid())
+return m_override_type;
 }
   }
   return compiler_type;
Index: include/lldb/Target/ObjCLanguageRuntime.h
===
--- include/lldb/Target/ObjCLanguageRuntime.h
+++ include/lldb/Target/ObjCLanguageRuntime.h
@@ -250,6 +250,8 @@
 
   lldb::TypeSP LookupInCompleteClassCache(ConstString &name);
 
+  llvm::Optional GetRuntimeType(CompilerType base_type) override;
+
   virtual UtilityFunction *CreateObjectChecker(const char *) = 0;
 
   virtual ObjCRuntimeVersions GetRuntimeVersion() const {
Index: include/lldb/Target/LanguageRuntime.h
===
--- include/lldb/Target/LanguageRuntime.h
+++ include/lldb/Target/LanguageRuntime.h
@@ -156,6 +156,10 @@
   /// from the user interface.
   virtual bool IsWhitelistedRuntimeValue(ConstString name) { return f

[Lldb-commits] [PATCH] D64159: [Core] Generalize ValueObject::MaybeCalculateCompleteType

2019-07-09 Thread Alex Langford via Phabricator via lldb-commits
xiaobai added inline comments.



Comment at: source/Target/ObjCLanguageRuntime.cpp:403
+CompilerType
+ObjCLanguageRuntime::CalculateCompleteType(CompilerType base_type) {
+  CompilerType type_to_return;

jingham wrote:
> xiaobai wrote:
> > clayborg wrote:
> > > So a main question for ObjC here: do we always want to show the runtime 
> > > type? Should we not check if the class inside of "base_type" is the one 
> > > true definition and skip grabbing the runtime type here and return {}?
> > How do you know which is the "one true definition"?
> The only places you can add ivars to an ObjC class are in the @interface 
> declaration (which is usually in the .h file for the class) and in the 
> @implementation and the "class category" - which has to be in the same source 
> file as the @implementation.  So if you find debug information for the .m 
> file that contains the @implementation you have seen all the ivars of the 
> class.  Clang marks that fact by putting "DW_AT_APPLE_objc_complete_type" 
> with value "true" in the DW_TAG_structure_type die for the class.  If you see 
> a type definition so marked, that it the "one true definition".
This makes sense to me, but I'm not sure if there are any abstractions that 
support this today. I did find a method `CompilerType::IsCompleteType` but I 
don't think that does this. I think that the only way to accomplish this right 
now is to reach into the DWARF directly, which I do not want to have to do 
here. I think preserving existing behavior is okay for now.


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

https://reviews.llvm.org/D64159



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


[Lldb-commits] [PATCH] D64251: Don't depend on psutil on AIX

2019-07-09 Thread Davide Italiano via Phabricator via lldb-commits
davide requested changes to this revision.
davide added a comment.
This revision now requires changes to proceed.

This is adding a fair amount of complexity on something that just works fine on 
basically every platform but AIX.
If AIX has issue with `psutil`, maybe the fix should be submitted to `psutil` 
upstream instead of having this dance here?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64251



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


[Lldb-commits] [lldb] r365592 - Try again to move common functionality from ProcessWindows into ProcessDebugger

2019-07-09 Thread Aaron Smith via lldb-commits
Author: asmith
Date: Tue Jul  9 20:34:57 2019
New Revision: 365592

URL: http://llvm.org/viewvc/llvm-project?rev=365592&view=rev
Log:
Try again to move common functionality from ProcessWindows into ProcessDebugger

This reverts commit ed499a36b67cf46cbf66052cfe374c80a595f1c1 and addresses
a problem causing a Windows build bot to hang.


Added:
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.h
Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/trunk/source/Plugins/Process/Windows/Common/ProcessWindows.h

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp?rev=365592&r1=365591&r2=365592&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp Tue Jul  9 20:34:57 
2019
@@ -180,6 +180,9 @@ unsigned ELFHeader::GetRelocationJumpSlo
   default:
 assert(false && "architecture not supported");
 break;
+  case EM_CASCADE:
+slot = R_CASCADE_JUMP_SLOT;
+break;
   case EM_PPC:
 slot = R_PPC_JMP_SLOT;
 break;

Modified: lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt?rev=365592&r1=365591&r2=365592&view=diff
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt (original)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/CMakeLists.txt Tue Jul  9 
20:34:57 2019
@@ -2,6 +2,7 @@
 add_lldb_library(lldbPluginProcessWindowsCommon PLUGIN
   DebuggerThread.cpp
   LocalDebugDelegate.cpp
+  ProcessDebugger.cpp
   ProcessWindows.cpp
   ProcessWindowsLog.cpp
   RegisterContextWindows.cpp

Added: lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp?rev=365592&view=auto
==
--- lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp (added)
+++ lldb/trunk/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp Tue 
Jul  9 20:34:57 2019
@@ -0,0 +1,582 @@
+//===-- ProcessDebugger.cpp -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ProcessDebugger.h"
+
+// Windows includes
+#include "lldb/Host/windows/windows.h"
+#include 
+
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostNativeProcessBase.h"
+#include "lldb/Host/HostProcess.h"
+#include "lldb/Host/HostThread.h"
+#include "lldb/Host/ProcessLaunchInfo.h"
+#include "lldb/Target/MemoryRegionInfo.h"
+#include "lldb/Target/Process.h"
+#include "llvm/Support/ConvertUTF.h"
+#include "llvm/Support/Error.h"
+
+#include "DebuggerThread.h"
+#include "ExceptionRecord.h"
+#include "ProcessWindowsLog.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+static DWORD ConvertLldbToWinApiProtect(uint32_t protect) {
+  // We also can process a read / write permissions here, but if the debugger
+  // will make later a write into the allocated memory, it will fail. To get
+  // around it is possible inside DoWriteMemory to remember memory permissions,
+  // allow write, write and restore permissions, but for now we process only
+  // the executable permission.
+  //
+  // TODO: Process permissions other than executable
+  if (protect & ePermissionsExecutable)
+return PAGE_EXECUTE_READWRITE;
+
+  return PAGE_READWRITE;
+}
+
+// The Windows page protection bits are NOT independent masks that can be
+// bitwise-ORed together.  For example, PAGE_EXECUTE_READ is not (PAGE_EXECUTE
+// | PAGE_READ).  To test for an access type, it's necessary to test for any of
+// the bits that provide that access type.
+static bool IsPageReadable(uint32_t protect) {
+  return (protect & PAGE_NOACCESS) == 0;
+}
+
+static bool IsPageWritable(uint32_t protect) {
+  return (protect & (PAGE_EXECUTE_READWRITE | PAGE_EXECUTE_WRITECOPY |
+ PAGE_READWRITE | PAGE_WRITECOPY)) != 0;
+}
+
+static bool IsPageExecutable(uint32_t protect) {
+  return (protect & (PAGE_EXECUTE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE 
|
+ PAGE_EXECUTE_WRITECOPY)) != 0;
+}
+
+namespace lldb_private {
+
+lldb::pid_t P

[Lldb-commits] [lldb] r365593 - Revert accidental change to file

2019-07-09 Thread Aaron Smith via lldb-commits
Author: asmith
Date: Tue Jul  9 20:41:34 2019
New Revision: 365593

URL: http://llvm.org/viewvc/llvm-project?rev=365593&view=rev
Log:
Revert accidental change to file

Modified:
lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp

Modified: lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp?rev=365593&r1=365592&r2=365593&view=diff
==
--- lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp (original)
+++ lldb/trunk/source/Plugins/ObjectFile/ELF/ELFHeader.cpp Tue Jul  9 20:41:34 
2019
@@ -180,9 +180,6 @@ unsigned ELFHeader::GetRelocationJumpSlo
   default:
 assert(false && "architecture not supported");
 break;
-  case EM_CASCADE:
-slot = R_CASCADE_JUMP_SLOT;
-break;
   case EM_PPC:
 slot = R_PPC_JMP_SLOT;
 break;


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