Fix dbgshim location for Tizen
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Sat, 25 Aug 2018 20:29:14 +0000 (23:29 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Mon, 27 Aug 2018 14:54:33 +0000 (17:54 +0300)
CMakeLists.txt
README.md
packaging/netcoredbg.spec
src/debug/netcoredbg/CMakeLists.txt
src/debug/netcoredbg/manageddebugger.cpp

index d3127bdeaf3a430d550120d41ba46232d811cce2..3f3151aca444cd4e4b058d3709e2d89ae2138a86 100644 (file)
@@ -4,7 +4,8 @@ project(netcoredbg)
 set(CLR_DIR "${CMAKE_SOURCE_DIR}/../coreclr" CACHE FILEPATH "Path to coreclr directory")
 set(CLR_BIN_DIR "" CACHE FILEPATH "Path to coreclr bin directory")
 set(BUILD_MANAGED ON CACHE BOOL "Build managed part")
-set(DBGSHIM_INSTALL ON CACHE BOOL "Install dbgshim library")
+set(DBGSHIM_DIR "" CACHE FILEPATH "Path to dbgshim library directory")
+
 if (WIN32)
     set(CMAKE_CXX_STANDARD 11)
 else()
index 154e50700e9045b7d6a66fba1cbd870ff73829a6..18a15f982c368e4ca7b08886f1c1f431fe827e0c 100644 (file)
--- a/README.md
+++ b/README.md
@@ -26,8 +26,6 @@ The debugger provides GDB/MI or VSCode debug adapter interface and allows to deb
 
    `-DCLR_BIN_DIR=$HOME/git/coreclr/bin/Product/Linux.x64.Debug` path to coreclr build result directory
 
-   `-DCORECLR_SET_RPATH=/usr/shared/dotnet/Microsoft.NETCore.App/2.0.0` path where `libdbgshim.so` is located
-
 4. The above commands create `./bin` directory with `netcoredbg` binary and additional libraries.
 
    Now running the debugger with `--help` option should look like this:
index c05e4b23ab04641470dc14da4bca61ebb36821a1..3c318412b16810326dfe2d047a2a3883e3059698 100644 (file)
@@ -77,9 +77,8 @@ cmake ../netcoredbg \
     -DCMAKE_INSTALL_PREFIX=%{install_prefix} \
     -DCMAKE_BUILD_TYPE=Release \
     -DCLR_CMAKE_LINUX_ID=tizen \
-    -DCORECLR_SET_RPATH=$NETCOREAPPDIR \
-    -DBUILD_MANAGED=OFF \
-    -DDBGSHIM_INSTALL=OFF
+    -DDBGSHIM_DIR=$NETCOREAPPDIR \
+    -DBUILD_MANAGED=OFF
 make %{?jobs:-j%jobs}
 
 %dotnet_build ../netcoredbg/src/debug/netcoredbg
index 13a8877cfc5e30cd455eb344ea76974aec7cffb7..2f815ab9c2faa488dccc662cedd090e6fcbf76b7 100644 (file)
@@ -2,10 +2,11 @@
 
 set(CORECLR_PRODUCT ${CLR_DIR}/bin/Product/${CORECLR_PLATFORM})
 
-set(DBGSHIM_LOCATION ${CLR_BIN_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}dbgshim${CMAKE_SHARED_LIBRARY_SUFFIX})
-
-add_library(dbgshim SHARED IMPORTED)
-set_target_properties(dbgshim PROPERTIES IMPORTED_LOCATION ${DBGSHIM_LOCATION})
+if (NOT DBGSHIM_DIR STREQUAL "")
+    add_definitions(-DDBGSHIM_DIR="${DBGSHIM_DIR}")
+else()
+    set(DBGSHIM_LOCATION ${CLR_BIN_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}dbgshim${CMAKE_SHARED_LIBRARY_SUFFIX})
+endif()
 
 add_library(corguids STATIC IMPORTED)
 set_target_properties(corguids PROPERTIES IMPORTED_LOCATION ${CLR_BIN_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}corguids${CMAKE_STATIC_LIBRARY_SUFFIX})
@@ -44,19 +45,6 @@ set(netcoredbg_SRC
 
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 
-# Set the RPATH of debugger so that it can find dependencies without needing to set LD_LIBRARY_PATH
-# For more information: http://www.cmake.org/Wiki/CMake_RPATH_handling.
-if (CORECLR_SET_RPATH)
-  set(CMAKE_INSTALL_RPATH "${CORECLR_SET_RPATH}")
-else()
-  set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
-  if(CLR_CMAKE_PLATFORM_DARWIN)
-    set(CMAKE_INSTALL_RPATH "@loader_path")
-  else()
-    set(CMAKE_INSTALL_RPATH "\$ORIGIN")
-  endif()
-endif()
-
 if (NOT WIN32)
     add_definitions(-DPAL_STDCPP_COMPAT)
 endif()
@@ -70,8 +58,8 @@ else()
 endif()
 
 install(TARGETS netcoredbg DESTINATION ${CMAKE_INSTALL_PREFIX})
-if (DBGSHIM_INSTALL)
-  install(FILES ${DBGSHIM_LOCATION} DESTINATION ${CMAKE_INSTALL_PREFIX})
+if (DBGSHIM_LOCATION)
+    install(FILES ${DBGSHIM_LOCATION} DESTINATION ${CMAKE_INSTALL_PREFIX})
 endif()
 
 # SymbolReader
index cbfa3485c1dacaf296bba61af858a1cf5ca917eb..e756e09b8bdf79704999855f635426da465632a7 100644 (file)
@@ -42,11 +42,16 @@ struct dbgshim_t
         CreateDebuggingInterfaceFromVersionEx(nullptr),
         m_module(nullptr)
     {
+#ifdef DBGSHIM_DIR
+        std::string libName(DBGSHIM_DIR);
+        libName += DIRECTORY_SEPARATOR_STR_A;
+#else
         std::string exe = GetExeAbsPath();
         std::size_t dirSepIndex = exe.rfind(DIRECTORY_SEPARATOR_STR_A);
         if (dirSepIndex == std::string::npos)
             return;
         std::string libName = exe.substr(0, dirSepIndex + 1);
+#endif
 
 #ifdef WIN32
         libName += "dbgshim.dll";