[Lldb-commits] [lldb] r325068 - [cmake] Darwin: Copy in the system debugserver if needed

Vedant Kumar via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 13 15:05:46 PST 2018


Author: vedantk
Date: Tue Feb 13 15:05:46 2018
New Revision: 325068

URL: http://llvm.org/viewvc/llvm-project?rev=325068&view=rev
Log:
[cmake] Darwin: Copy in the system debugserver if needed

This makes the built debugger functional on Darwin when compiling
without code signing (as documented in docs/code-signing.txt).

Modified:
    lldb/trunk/CMakeLists.txt
    lldb/trunk/test/CMakeLists.txt
    lldb/trunk/tools/debugserver/source/CMakeLists.txt
    lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt

Modified: lldb/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=325068&r1=325067&r2=325068&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Tue Feb 13 15:05:46 2018
@@ -56,6 +56,22 @@ if (NOT LLDB_DISABLE_PYTHON)
 
   add_subdirectory(scripts)
 endif ()
+
+if(CMAKE_HOST_APPLE)
+  if(LLDB_CODESIGN_IDENTITY)
+    set(DEBUGSERVER_PATH $<TARGET_FILE:debugserver>)
+  else()
+    execute_process(
+      COMMAND xcode-select -p
+      OUTPUT_VARIABLE XCODE_DEV_DIR)
+    string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR)
+    set(DEBUGSERVER_PATH
+      "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver")
+    set(SKIP_DEBUGSERVER True)
+  endif()
+  message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}")
+endif()
+
 add_subdirectory(source)
 add_subdirectory(tools)
 

Modified: lldb/trunk/test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/CMakeLists.txt?rev=325068&r1=325067&r2=325068&view=diff
==============================================================================
--- lldb/trunk/test/CMakeLists.txt (original)
+++ lldb/trunk/test/CMakeLists.txt Tue Feb 13 15:05:46 2018
@@ -110,17 +110,6 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Wi
 endif()
 
 if(CMAKE_HOST_APPLE)
-  if(LLDB_CODESIGN_IDENTITY)
-    set(DEBUGSERVER_PATH $<TARGET_FILE:debugserver>)
-  else()
-    execute_process(
-      COMMAND xcode-select -p
-      OUTPUT_VARIABLE XCODE_DEV_DIR)
-    string(STRIP ${XCODE_DEV_DIR} XCODE_DEV_DIR)
-    set(DEBUGSERVER_PATH
-      "${XCODE_DEV_DIR}/../SharedFrameworks/LLDB.framework/Resources/debugserver")
-  endif()
-  message(STATUS "Path to the lldb debugserver: ${DEBUGSERVER_PATH}")
   list(APPEND LLDB_TEST_COMMON_ARGS --server ${DEBUGSERVER_PATH})
 endif()
 

Modified: lldb/trunk/tools/debugserver/source/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/CMakeLists.txt?rev=325068&r1=325067&r2=325068&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/CMakeLists.txt (original)
+++ lldb/trunk/tools/debugserver/source/CMakeLists.txt Tue Feb 13 15:05:46 2018
@@ -195,7 +195,15 @@ if("${LLDB_CODESIGN_IDENTITY}" STREQUAL
 endif()
 option(LLDB_USE_ENTITLEMENTS "Use entitlements when codesigning (Defaults Off when using lldb_codesign identity, otherwise On)" ${LLDB_USE_ENTITLEMENTS_Default})
 
-if (NOT ("${LLDB_CODESIGN_IDENTITY}" STREQUAL ""))
+if ("${LLDB_CODESIGN_IDENTITY}" STREQUAL "")
+  if (CMAKE_HOST_APPLE)
+    # If we haven't built a signed debugserver, copy the one from the system.
+    add_custom_target(debugserver
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEBUGSERVER_PATH} ${CMAKE_BINARY_DIR}/bin
+      VERBATIM
+      COMMENT "Copying the system debugserver to LLDB's binaries directory.")
+  endif()
+else()
   if(LLDB_USE_ENTITLEMENTS)
     set(entitlements_flags --entitlements ${entitlements_xml})
   endif()

Modified: lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt?rev=325068&r1=325067&r2=325068&view=diff
==============================================================================
--- lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt (original)
+++ lldb/trunk/unittests/tools/lldb-server/CMakeLists.txt Tue Feb 13 15:05:46 2018
@@ -13,7 +13,7 @@ add_lldb_test_executable(thread_inferior
 add_lldb_test_executable(environment_check inferior/environment_check.cpp)
 
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
-  add_definitions(-DLLDB_SERVER="$<TARGET_FILE:debugserver>" -DLLDB_SERVER_IS_DEBUGSERVER=1)
+  add_definitions(-DLLDB_SERVER="${DEBUGSERVER_PATH}" -DLLDB_SERVER_IS_DEBUGSERVER=1)
 else()
   add_definitions(-DLLDB_SERVER="$<TARGET_FILE:lldb-server>" -DLLDB_SERVER_IS_DEBUGSERVER=0)
 endif()




More information about the lldb-commits mailing list