[Lldb-commits] [PATCH] D64994: [CMake] Align debugserver with lldb-server on Darwin

Stefan Gränitz via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Jul 19 07:29:18 PDT 2019


sgraenitz created this revision.
sgraenitz added reviewers: xiaobai, JDevlieghere, davide.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.

Make debugserver a tool like lldb-server, so it can be included/excluded via `LLDB_TOOL_DEBUGSERVER_BUILD`. This replaces the old `LLDB_NO_DEBUGSERVER` flag. Doing the same for darwin-debug while I am here.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D64994

Files:
  lldb/cmake/modules/LLDBConfig.cmake
  lldb/test/CMakeLists.txt
  lldb/tools/CMakeLists.txt
  lldb/unittests/CMakeLists.txt
  lldb/unittests/tools/lldb-server/CMakeLists.txt


Index: lldb/unittests/tools/lldb-server/CMakeLists.txt
===================================================================
--- lldb/unittests/tools/lldb-server/CMakeLists.txt
+++ lldb/unittests/tools/lldb-server/CMakeLists.txt
@@ -13,7 +13,7 @@
 add_lldb_test_executable(thread_inferior inferior/thread_inferior.cpp)
 add_lldb_test_executable(environment_check inferior/environment_check.cpp)
 
-if(LLDB_CAN_USE_DEBUGSERVER)
+if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD)
   if(LLDB_USE_SYSTEM_DEBUGSERVER)
     lldb_find_system_debugserver(debugserver_path)
   else()
Index: lldb/unittests/CMakeLists.txt
===================================================================
--- lldb/unittests/CMakeLists.txt
+++ lldb/unittests/CMakeLists.txt
@@ -78,6 +78,6 @@
 add_subdirectory(UnwindAssembly)
 add_subdirectory(Utility)
 
-if(LLDB_CAN_USE_DEBUGSERVER AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
   add_subdirectory(debugserver)
 endif()
Index: lldb/tools/CMakeLists.txt
===================================================================
--- lldb/tools/CMakeLists.txt
+++ lldb/tools/CMakeLists.txt
@@ -11,8 +11,8 @@
 add_lldb_tool_subdirectory(lldb-vscode)
 
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
-  add_subdirectory(darwin-debug)
-  add_subdirectory(debugserver)
+  add_lldb_tool_subdirectory(darwin-debug)
+  add_lldb_tool_subdirectory(debugserver)
 endif()
 
 if (LLDB_CAN_USE_LLDB_SERVER)
Index: lldb/test/CMakeLists.txt
===================================================================
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -101,11 +101,18 @@
     lldb_find_system_debugserver(system_debugserver_path)
     message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
     list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
-  else()
+  elseif(TARGET debugserver)
     set(debugserver_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver)
     message(STATUS "LLDB Tests use just-built debugserver: ${debugserver_path}")
     list(APPEND LLDB_TEST_COMMON_ARGS --server ${debugserver_path})
     add_dependencies(lldb-test-deps debugserver)
+  elseif(TARGET lldb-server)
+    set(lldb_server_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-server)
+    message(STATUS "LLDB Tests use just-built lldb-server: ${lldb_server_path}")
+    list(APPEND LLDB_TEST_COMMON_ARGS --server ${lldb_server_path})
+    add_dependencies(lldb-test-deps lldb-server)
+  else()
+    message(WARNING "LLDB Tests enabled, but no server available")
   endif()
 endif()
 
Index: lldb/cmake/modules/LLDBConfig.cmake
===================================================================
--- lldb/cmake/modules/LLDBConfig.cmake
+++ lldb/cmake/modules/LLDBConfig.cmake
@@ -373,17 +373,17 @@
 # Figure out if lldb could use lldb-server.  If so, then we'll
 # ensure we build lldb-server when an lldb target is being built.
 if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
-  set(LLDB_CAN_USE_LLDB_SERVER 1)
+  set(LLDB_CAN_USE_LLDB_SERVER ON)
 else()
-  set(LLDB_CAN_USE_LLDB_SERVER 0)
+  set(LLDB_CAN_USE_LLDB_SERVER OFF)
 endif()
 
 # Figure out if lldb could use debugserver.  If so, then we'll
 # ensure we build debugserver when we build lldb.
-if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
-    set(LLDB_CAN_USE_DEBUGSERVER 1)
+if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
+    set(LLDB_CAN_USE_DEBUGSERVER ON)
 else()
-    set(LLDB_CAN_USE_DEBUGSERVER 0)
+    set(LLDB_CAN_USE_DEBUGSERVER OFF)
 endif()
 
 if (NOT LLDB_DISABLE_CURSES)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64994.210832.patch
Type: text/x-patch
Size: 3583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190719/73e16096/attachment.bin>


More information about the lldb-commits mailing list