From 910b5f1660bd35af228943ba5a7a45144702658a Mon Sep 17 00:00:00 2001 From: Xusheng Date: Tue, 16 Apr 2024 18:52:19 +0800 Subject: [PATCH] Fix crash when using LLDB adapter on Windows in free version. Fix https://github.com/Vector35/debugger/issues/566. --- core/CMakeLists.txt | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 82e1052..9046854 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -175,28 +175,14 @@ else() find_library(lib_lldb NAMES liblldb PATHS ${LLDB_PATH}/lib REQUIRED) target_link_libraries(debuggercore ${lib_lldb}) target_include_directories(debuggercore PRIVATE ${LLDB_PATH}/include) - if(NOT DEMO) - add_custom_command(TARGET debuggercore PRE_LINK - COMMAND ${CMAKE_COMMAND} -E echo "Copying LLDB Libs" - COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBRARY_OUTPUT_DIRECTORY_PATH}/lldb - COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb.exe ${LIBRARY_OUTPUT_DIRECTORY_PATH}/lldb - COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb-server.exe ${LIBRARY_OUTPUT_DIRECTORY_PATH}/lldb - COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb-argdumper.exe ${LIBRARY_OUTPUT_DIRECTORY_PATH}/lldb - COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/liblldb.dll ${LIBRARY_OUTPUT_DIRECTORY_PATH} - ) - else() - # On Windows, there is no rpath, so we must put the liblldb.dll in the same folder as binaryninja.exe. - # This is NOT needed for non-demo builds, because the debuggercore and the liblldb.dll are both in the - # plugins folder. - add_custom_command(TARGET debuggercore PRE_LINK - COMMAND ${CMAKE_COMMAND} -E echo "Copying LLDB Libs" - COMMAND ${CMAKE_COMMAND} -E make_directory ${BN_CORE_OUTPUT_DIR}/lldb - COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb.exe ${BN_CORE_OUTPUT_DIR}/lldb - COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb-server.exe ${BN_BINARY_DIR}/lldb - COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb-argdumper.exe ${BN_CORE_OUTPUT_DIR}/lldb - COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/liblldb.dll ${BN_CORE_OUTPUT_DIR} - ) - endif() + add_custom_command(TARGET debuggercore PRE_LINK + COMMAND ${CMAKE_COMMAND} -E echo "Copying LLDB Libs" + COMMAND ${CMAKE_COMMAND} -E make_directory ${LIBRARY_OUTPUT_DIRECTORY_PATH}/lldb + COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb.exe ${LIBRARY_OUTPUT_DIRECTORY_PATH}/lldb + COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb-server.exe ${LIBRARY_OUTPUT_DIRECTORY_PATH}/lldb + COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/lldb-argdumper.exe ${LIBRARY_OUTPUT_DIRECTORY_PATH}/lldb + COMMAND ${CMAKE_COMMAND} -E copy ${LLDB_PATH}/bin/liblldb.dll ${LIBRARY_OUTPUT_DIRECTORY_PATH} + ) endif() if (WIN32)