From 0ded2c1d1297bb2d7e23912f67e456ce7fb10559 Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Thu, 8 Nov 2018 12:29:10 -0800 Subject: [PATCH] Fix "LTTng-UST: Error (-17) while registering..." error when debugging (20874) Fixes issue dotnet/coreclr#20205. This has been happening in more and more scenarios: 1) SOS when the coreclr hosting the SOS managed code is a different version that the one being debugged 2) Lee ran into it with ClrMD for Linux 3) The dotnet-diagnostictests repo with the current arcade build changes because the coreclr version hosting mdbg is different than the version running the debuggees. This fix is simple: only link the tracepointprovider.cpp code that loads libcoreclrtraceptprovider.so into libcoreclr.so and not in any other module that uses the PAL library (libdbgshim.so, libmscordaccore.so, etc.). Create a new "tracepointprovider" library with the tracepointprovider.cpp source file in it and remove it from the "coreclrpal". Link this new lib into libcoreclr.so. Commit migrated from https://github.com/dotnet/coreclr/commit/c60869f3768f4495cb1d54179db2c41eed921d50 --- src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt | 1 + src/coreclr/src/pal/src/CMakeLists.txt | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt index 8b727a0efa002..1917ad39c7300 100644 --- a/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -121,6 +121,7 @@ else() list(APPEND CORECLR_LIBRARIES ${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available coreclrpal + tracepointprovider ${END_WHOLE_ARCHIVE} mscorrc_debug palrt diff --git a/src/coreclr/src/pal/src/CMakeLists.txt b/src/coreclr/src/pal/src/CMakeLists.txt index 9659ffdc120d8..445949ba7b25f 100644 --- a/src/coreclr/src/pal/src/CMakeLists.txt +++ b/src/coreclr/src/pal/src/CMakeLists.txt @@ -230,7 +230,6 @@ set(SOURCES misc/strutil.cpp misc/sysinfo.cpp misc/time.cpp - misc/tracepointprovider.cpp misc/utils.cpp numa/numa.cpp objmgr/palobjbase.cpp @@ -295,6 +294,11 @@ add_library(coreclrpal ${LIBUNWIND_OBJECTS} ) +add_library(tracepointprovider + STATIC + misc/tracepointprovider.cpp +) + if(CMAKE_SYSTEM_NAME STREQUAL Darwin) find_library(COREFOUNDATION CoreFoundation) find_library(CORESERVICES CoreServices)