Skip to content

Commit fc0d766

Browse files
[CMake] Align debugserver with lldb-server on Darwin
Summary: 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. Reviewers: xiaobai, JDevlieghere, davide Reviewed By: xiaobai, JDevlieghere Subscribers: mgorny, lldb-commits, #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D64994 llvm-svn: 366631
1 parent 6a38205 commit fc0d766

File tree

5 files changed

+17
-10
lines changed

5 files changed

+17
-10
lines changed

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -373,17 +373,17 @@ list(APPEND system_libs ${CMAKE_DL_LIBS})
373373
# Figure out if lldb could use lldb-server. If so, then we'll
374374
# ensure we build lldb-server when an lldb target is being built.
375375
if (CMAKE_SYSTEM_NAME MATCHES "Android|Darwin|FreeBSD|Linux|NetBSD")
376-
set(LLDB_CAN_USE_LLDB_SERVER 1)
376+
set(LLDB_CAN_USE_LLDB_SERVER ON)
377377
else()
378-
set(LLDB_CAN_USE_LLDB_SERVER 0)
378+
set(LLDB_CAN_USE_LLDB_SERVER OFF)
379379
endif()
380380

381381
# Figure out if lldb could use debugserver. If so, then we'll
382382
# ensure we build debugserver when we build lldb.
383-
if ( CMAKE_SYSTEM_NAME MATCHES "Darwin" )
384-
set(LLDB_CAN_USE_DEBUGSERVER 1)
383+
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
384+
set(LLDB_CAN_USE_DEBUGSERVER ON)
385385
else()
386-
set(LLDB_CAN_USE_DEBUGSERVER 0)
386+
set(LLDB_CAN_USE_DEBUGSERVER OFF)
387387
endif()
388388

389389
if (NOT LLDB_DISABLE_CURSES)

lldb/test/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,18 @@ if(CMAKE_HOST_APPLE)
101101
lldb_find_system_debugserver(system_debugserver_path)
102102
message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
103103
list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
104-
else()
104+
elseif(TARGET debugserver)
105105
set(debugserver_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/debugserver)
106106
message(STATUS "LLDB Tests use just-built debugserver: ${debugserver_path}")
107107
list(APPEND LLDB_TEST_COMMON_ARGS --server ${debugserver_path})
108108
add_dependencies(lldb-test-deps debugserver)
109+
elseif(TARGET lldb-server)
110+
set(lldb_server_path ${LLVM_RUNTIME_OUTPUT_INTDIR}/lldb-server)
111+
message(STATUS "LLDB Tests use just-built lldb-server: ${lldb_server_path}")
112+
list(APPEND LLDB_TEST_COMMON_ARGS --server ${lldb_server_path})
113+
add_dependencies(lldb-test-deps lldb-server)
114+
else()
115+
message(WARNING "LLDB Tests enabled, but no server available")
109116
endif()
110117
endif()
111118

lldb/tools/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ add_lldb_tool_subdirectory(lldb-instr)
1111
add_lldb_tool_subdirectory(lldb-vscode)
1212

1313
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
14-
add_subdirectory(darwin-debug)
15-
add_subdirectory(debugserver)
14+
add_lldb_tool_subdirectory(darwin-debug)
15+
add_lldb_tool_subdirectory(debugserver)
1616
endif()
1717

1818
if (LLDB_CAN_USE_LLDB_SERVER)

lldb/unittests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,6 @@ add_subdirectory(tools)
7878
add_subdirectory(UnwindAssembly)
7979
add_subdirectory(Utility)
8080

81-
if(LLDB_CAN_USE_DEBUGSERVER AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
81+
if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
8282
add_subdirectory(debugserver)
8383
endif()

lldb/unittests/tools/lldb-server/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ endfunction()
1313
add_lldb_test_executable(thread_inferior inferior/thread_inferior.cpp)
1414
add_lldb_test_executable(environment_check inferior/environment_check.cpp)
1515

16-
if(LLDB_CAN_USE_DEBUGSERVER)
16+
if(LLDB_CAN_USE_DEBUGSERVER AND LLDB_TOOL_DEBUGSERVER_BUILD)
1717
if(LLDB_USE_SYSTEM_DEBUGSERVER)
1818
lldb_find_system_debugserver(debugserver_path)
1919
else()

0 commit comments

Comments
 (0)