Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -11,6 +11,12 @@ include(LLDBConfig) include(AddLLDB) +option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON) +if(LLDB_CODESIGN_IDENTITY) + # In the future we may use LLVM_CODESIGNING_IDENTITY directly. + set(LLVM_CODESIGNING_IDENTITY ${LLDB_CODESIGN_IDENTITY}) +endif() + # Define the LLDB_CONFIGURATION_xxx matching the build type if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" ) add_definitions( -DLLDB_CONFIGURATION_DEBUG ) Index: cmake/modules/AddLLDB.cmake =================================================================== --- cmake/modules/AddLLDB.cmake +++ cmake/modules/AddLLDB.cmake @@ -100,13 +100,13 @@ function(add_lldb_executable name) cmake_parse_arguments(ARG "INCLUDE_IN_SUITE;GENERATE_INSTALL" - "" + "ENTITLEMENTS" "LINK_LIBS;LINK_COMPONENTS" ${ARGN} ) list(APPEND LLVM_LINK_COMPONENTS ${ARG_LINK_COMPONENTS}) - add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS}) + add_llvm_executable(${name} ${ARG_UNPARSED_ARGUMENTS} ENTITLEMENTS ${ARG_ENTITLEMENTS}) target_link_libraries(${name} PRIVATE ${ARG_LINK_LIBS}) set_target_properties(${name} PROPERTIES Index: tools/lldb-server/CMakeLists.txt =================================================================== --- tools/lldb-server/CMakeLists.txt +++ tools/lldb-server/CMakeLists.txt @@ -42,6 +42,11 @@ list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF) endif() +if(LLDB_USE_ENTITLEMENTS AND NOT IOS) + # Same entitlements file as used for debugserver + set(entitlements ${LLDB_SOURCE_DIR}/resources/debugserver-macosx-entitlements.plist) +endif() + add_lldb_tool(lldb-server INCLUDE_IN_SUITE Acceptor.cpp lldb-gdbserver.cpp @@ -61,6 +66,9 @@ LINK_COMPONENTS Support + + ENTITLEMENTS + ${entitlements} ) target_link_libraries(lldb-server PRIVATE ${LLDB_SYSTEM_LIBS})