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

r366433 broke support for the system debugserver. Although the change was 
well-intended, it (presumably) unintentionally removed the logic to copy over 
the debugserver. As a result, even with LLDB_USE_SYSTEM_DEBUGSERVER enabled, we 
ended up building, signing and using the just-built debugserver. This patch 
partially recovers the old behavior: when LLDB_USE_SYSTEM_DEBUGSERVER is set we 
don't build debugserver and just copy over the system one.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D67991

Files:
  lldb/test/CMakeLists.txt
  lldb/tools/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
@@ -28,7 +28,7 @@
   if(LLDB_CODESIGN_IDENTITY)
     set(${result} ${LLDB_CODESIGN_IDENTITY} PARENT_SCOPE)
     check_certificate(${LLDB_CODESIGN_IDENTITY} available)
-    if(NOT available AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+    if(NOT available)
       message(WARNING "LLDB_CODESIGN_IDENTITY not found: 
'${LLDB_CODESIGN_IDENTITY}' ${not_found_help}")
     endif()
     return()
@@ -41,9 +41,7 @@
     return()
   endif()
 
-  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
-    message(WARNING "Development code sign identiy not found: 'lldb_codesign' 
${not_found_help}")
-  endif()
+  message(WARNING "Development code sign identiy not found: 'lldb_codesign' 
${not_found_help}")
 
   # LLVM pendant: fallback if available
   if(LLVM_CODESIGNING_IDENTITY)
Index: lldb/tools/CMakeLists.txt
===================================================================
--- lldb/tools/CMakeLists.txt
+++ lldb/tools/CMakeLists.txt
@@ -12,7 +12,9 @@
 
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_lldb_tool_subdirectory(darwin-debug)
-  add_lldb_tool_subdirectory(debugserver)
+  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+    add_lldb_tool_subdirectory(debugserver)
+  endif()
 endif()
 
 if (LLDB_CAN_USE_LLDB_SERVER)
Index: lldb/test/CMakeLists.txt
===================================================================
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -97,6 +97,10 @@
 
   if(LLDB_USE_SYSTEM_DEBUGSERVER)
     lldb_find_system_debugserver(system_debugserver_path)
+    add_custom_target(debugserver
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different
+      ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+      COMMENT "Copying the system debugserver to LLDB's binaries directory for 
testing.")
     message(STATUS "LLDB tests use out-of-tree debugserver: 
${system_debugserver_path}")
     list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
   elseif(TARGET debugserver)


Index: lldb/tools/debugserver/source/CMakeLists.txt
===================================================================
--- lldb/tools/debugserver/source/CMakeLists.txt
+++ lldb/tools/debugserver/source/CMakeLists.txt
@@ -28,7 +28,7 @@
   if(LLDB_CODESIGN_IDENTITY)
     set(${result} ${LLDB_CODESIGN_IDENTITY} PARENT_SCOPE)
     check_certificate(${LLDB_CODESIGN_IDENTITY} available)
-    if(NOT available AND NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+    if(NOT available)
       message(WARNING "LLDB_CODESIGN_IDENTITY not found: '${LLDB_CODESIGN_IDENTITY}' ${not_found_help}")
     endif()
     return()
@@ -41,9 +41,7 @@
     return()
   endif()
 
-  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
-    message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
-  endif()
+  message(WARNING "Development code sign identiy not found: 'lldb_codesign' ${not_found_help}")
 
   # LLVM pendant: fallback if available
   if(LLVM_CODESIGNING_IDENTITY)
Index: lldb/tools/CMakeLists.txt
===================================================================
--- lldb/tools/CMakeLists.txt
+++ lldb/tools/CMakeLists.txt
@@ -12,7 +12,9 @@
 
 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
   add_lldb_tool_subdirectory(darwin-debug)
-  add_lldb_tool_subdirectory(debugserver)
+  if(NOT LLDB_USE_SYSTEM_DEBUGSERVER)
+    add_lldb_tool_subdirectory(debugserver)
+  endif()
 endif()
 
 if (LLDB_CAN_USE_LLDB_SERVER)
Index: lldb/test/CMakeLists.txt
===================================================================
--- lldb/test/CMakeLists.txt
+++ lldb/test/CMakeLists.txt
@@ -97,6 +97,10 @@
 
   if(LLDB_USE_SYSTEM_DEBUGSERVER)
     lldb_find_system_debugserver(system_debugserver_path)
+    add_custom_target(debugserver
+      COMMAND ${CMAKE_COMMAND} -E copy_if_different
+      ${system_debugserver_path} ${LLVM_RUNTIME_OUTPUT_INTDIR}
+      COMMENT "Copying the system debugserver to LLDB's binaries directory for testing.")
     message(STATUS "LLDB tests use out-of-tree debugserver: ${system_debugserver_path}")
     list(APPEND LLDB_TEST_COMMON_ARGS --out-of-tree-debugserver)
   elseif(TARGET debugserver)
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to