Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d81d773

Browse files
authored
Merge pull request #6278 from Dmitri-Botcharnikov/feature-gdbjit
[Linux] GDB JIT support for source line debug information.
2 parents f30a8de + 27e570d commit d81d773

File tree

7 files changed

+1194
-2
lines changed

7 files changed

+1194
-2
lines changed

src/dlls/mscoree/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
include_directories("../../inc")
22

3+
if(FEATURE_GDBJIT)
4+
add_definitions(-DFEATURE_GDBJIT)
5+
endif(FEATURE_GDBJIT)
6+
37
set(CLR_SOURCES
48
mscoree.cpp
59
unixinterface.cpp

src/dlls/mscoree/unixinterface.cpp

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
#include <utilcode.h>
1616
#include <corhost.h>
1717
#include <configuration.h>
18+
#ifdef FEATURE_GDBJIT
19+
#include "../../vm/gdbjithelpers.h"
20+
#endif // FEATURE_GDBJIT
1821

1922
typedef int (STDMETHODCALLTYPE *HostMain)(
2023
const int argc,
@@ -137,6 +140,11 @@ static void ConvertConfigPropertiesToUnicode(
137140
extern "C" LPCWSTR g_CLRJITPath;
138141
#endif // !defined(FEATURE_MERGE_JIT_AND_ENGINE)
139142

143+
#ifdef FEATURE_GDBJIT
144+
GetInfoForMethodDelegate getInfoForMethodDelegate = NULL;
145+
extern "C" int coreclr_create_delegate(void*, unsigned int, const char*, const char*, const char*, void**);
146+
#endif //FEATURE_GDBJIT
147+
140148
//
141149
// Initialize the CoreCLR. Creates and starts CoreCLR host and creates an app domain
142150
//
@@ -238,8 +246,24 @@ int coreclr_initialize(
238246
{
239247
host.SuppressRelease();
240248
*hostHandle = host;
241-
}
249+
#ifdef FEATURE_GDBJIT
242250

251+
hr = coreclr_create_delegate(*hostHandle,
252+
*domainId,
253+
"System.Diagnostics.Debug.SymbolReader",
254+
"System.Diagnostics.Debug.SymbolReader.SymbolReader",
255+
"GetInfoForMethod",
256+
(void**)&getInfoForMethodDelegate);
257+
258+
if (!SUCCEEDED(hr))
259+
{
260+
fprintf(stderr,
261+
"Can't create delegate for 'System.Diagnostics.Debug.SymbolReader.SymbolReader.GetInfoForMethod' "
262+
"method - status: 0x%08x\n", hr);
263+
}
264+
hr = S_OK; // We don't need to fail if we can't create delegate
265+
#endif
266+
}
243267
return hr;
244268
}
245269

src/vm/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ if(CLR_CMAKE_PLATFORM_UNIX)
2727
add_compile_options(-fPIC)
2828
endif(CLR_CMAKE_PLATFORM_UNIX)
2929

30+
if(FEATURE_GDBJIT)
31+
set(VM_SOURCES_GDBJIT
32+
gdbjit.cpp
33+
)
34+
add_definitions(-DFEATURE_GDBJIT)
35+
endif(FEATURE_GDBJIT)
36+
3037
set(VM_SOURCES_DAC_AND_WKS_COMMON
3138
appdomain.cpp
3239
array.cpp
@@ -109,6 +116,7 @@ set(VM_SOURCES_DAC_AND_WKS_COMMON
109116
virtualcallstub.cpp
110117
win32threadpool.cpp
111118
zapsig.cpp
119+
${VM_SOURCES_GDBJIT}
112120
)
113121

114122
if(FEATURE_READYTORUN)

0 commit comments

Comments
 (0)