-
Notifications
You must be signed in to change notification settings - Fork 133
/
interop.cpp
115 lines (94 loc) · 3.91 KB
/
interop.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
//---------------------------------------------------------------------------------------
// Exports that managed code from Datadog.Trace.dll will
// P/Invoke into
//
// NOTE: Must keep these signatures in sync with the DllImports in
// NativeMethods.cs!
//---------------------------------------------------------------------------------------
#include "cor_profiler.h"
#ifndef _WIN32
#include <dlfcn.h>
#undef EXTERN_C
#define EXTERN_C extern "C" __attribute__((visibility("default")))
#endif
EXTERN_C BOOL STDAPICALLTYPE IsProfilerAttached()
{
return trace::profiler != nullptr && trace::profiler->IsAttached();
}
EXTERN_C VOID STDAPICALLTYPE GetAssemblyAndSymbolsBytes(BYTE** pAssemblyArray, int* assemblySize, BYTE** pSymbolsArray,
int* symbolsSize)
{
return trace::profiler->GetAssemblyAndSymbolsBytes(pAssemblyArray, assemblySize, pSymbolsArray, symbolsSize);
}
EXTERN_C VOID STDAPICALLTYPE InitializeProfiler(WCHAR* id, trace::CallTargetDefinition* items, int size)
{
return trace::profiler->InitializeProfiler(id, items, size);
}
EXTERN_C VOID STDAPICALLTYPE RemoveCallTargetDefinitions(WCHAR* id, trace::CallTargetDefinition* items, int size)
{
return trace::profiler->RemoveCallTargetDefinitions(id, items, size);
}
EXTERN_C VOID STDAPICALLTYPE EnableByRefInstrumentation()
{
return trace::profiler->EnableByRefInstrumentation();
}
EXTERN_C VOID STDAPICALLTYPE EnableCallTargetStateByRef()
{
return trace::profiler->EnableCallTargetStateByRef();
}
EXTERN_C VOID STDAPICALLTYPE AddDerivedInstrumentations(WCHAR* id, trace::CallTargetDefinition* items, int size)
{
return trace::profiler->AddDerivedInstrumentations(id, items, size);
}
EXTERN_C VOID STDAPICALLTYPE AddInterfaceInstrumentations(WCHAR* id, trace::CallTargetDefinition* items, int size)
{
return trace::profiler->AddInterfaceInstrumentations(id, items, size);
}
EXTERN_C VOID STDAPICALLTYPE AddTraceAttributeInstrumentation(WCHAR* id, WCHAR* integration_assembly_name_ptr,
WCHAR* integration_type_name_ptr)
{
return trace::profiler->AddTraceAttributeInstrumentation(id, integration_assembly_name_ptr,
integration_type_name_ptr);
}
EXTERN_C VOID STDAPICALLTYPE InitializeTraceMethods(WCHAR* id, WCHAR* integration_assembly_name_ptr,
WCHAR* integration_type_name_ptr, WCHAR* configuration_string_ptr)
{
return trace::profiler->InitializeTraceMethods(id, integration_assembly_name_ptr, integration_type_name_ptr,
configuration_string_ptr);
}
EXTERN_C VOID STDAPICALLTYPE InstrumentProbes(
debugger::DebuggerMethodProbeDefinition* methodProbes,
int methodProbesLength,
debugger::DebuggerLineProbeDefinition* lineProbes,
int lineProbesLength,
debugger::DebuggerRemoveProbesDefinition* revertProbes,
int revertProbesLength)
{
return trace::profiler->InstrumentProbes(methodProbes, methodProbesLength, lineProbes, lineProbesLength, revertProbes, revertProbesLength);
}
EXTERN_C int STDAPICALLTYPE GetProbesStatuses(WCHAR** probeIds, int probeIdsLength, debugger::DebuggerProbeStatus* probeStatuses)
{
return trace::profiler->GetProbesStatuses(probeIds, probeIdsLength, probeStatuses);
}
EXTERN_C VOID STDAPICALLTYPE DisableTracerCLRProfiler()
{
return trace::profiler->DisableTracerCLRProfiler();
}
EXTERN_C VOID STDAPICALLTYPE RegisterIastAspects(WCHAR** aspects, int aspectsLength)
{
return trace::profiler->RegisterIastAspects(aspects, aspectsLength);
}
#ifndef _WIN32
EXTERN_C void *dddlopen (const char *__file, int __mode)
{
return dlopen(__file, __mode);
}
EXTERN_C char *dddlerror (void)
{
return dlerror();
}
EXTERN_C void *dddlsym (void *__restrict __handle, const char *__restrict __name)
{
return dlsym(__handle, __name);
}
#endif