1 | // Licensed to the .NET Foundation under one or more agreements. |
2 | // The .NET Foundation licenses this file to you under the MIT license. |
3 | // See the LICENSE file in the project root for more information. |
4 | // |
5 | // FILE: ProfToEEInterfaceImpl.h |
6 | // |
7 | // Declaration of class that implements the ICorProfilerInfo* interfaces, which allow the |
8 | // Profiler to communicate with the EE. This allows the Profiler DLL to get |
9 | // access to private EE data structures and other things that should never be exported |
10 | // outside of the EE. |
11 | // |
12 | |
13 | // |
14 | |
15 | // ====================================================================================== |
16 | |
17 | |
18 | #ifndef __PROFTOEEINTERFACEIMPL_H__ |
19 | #define __PROFTOEEINTERFACEIMPL_H__ |
20 | |
21 | #ifdef PROFILING_SUPPORTED |
22 | |
23 | #include "eeprofinterfaces.h" |
24 | #include "vars.hpp" |
25 | #include "threads.h" |
26 | #include "codeman.h" |
27 | #include "cor.h" |
28 | #include "callingconvention.h" |
29 | |
30 | |
31 | #include "profilinghelper.h" |
32 | |
33 | |
34 | class ProfilerFunctionEnum; |
35 | |
36 | // |
37 | // Helper routines. |
38 | // |
39 | extern MethodDesc *FunctionIdToMethodDesc(FunctionID functionID); |
40 | extern ClassID TypeHandleToClassID(TypeHandle th); |
41 | |
42 | |
43 | // |
44 | // Function declarations for those functions that are platform specific. |
45 | // |
46 | extern UINT_PTR ProfileGetIPFromPlatformSpecificHandle(void * handle); |
47 | |
48 | extern void ProfileSetFunctionIDInPlatformSpecificHandle(void * pPlatformSpecificHandle, FunctionID functionID); |
49 | |
50 | // |
51 | // The following class is implemented differently on each platform, using |
52 | // the PlatformSpecificHandle to initialize an ArgIterator. |
53 | // |
54 | class ProfileArgIterator |
55 | { |
56 | private: |
57 | void *m_handle; |
58 | ArgIterator m_argIterator; |
59 | |
60 | public: |
61 | ProfileArgIterator(MetaSig * pMetaSig, void* platformSpecificHandle); |
62 | |
63 | ~ProfileArgIterator(); |
64 | |
65 | // |
66 | // Returns number of arguments returned by GetNextArgAddr |
67 | // |
68 | UINT GetNumArgs() |
69 | { |
70 | LIMITED_METHOD_CONTRACT; |
71 | return m_argIterator.NumFixedArgs(); |
72 | } |
73 | |
74 | // |
75 | // After initialization, this method is called repeatedly until it |
76 | // returns NULL to get the address of each arg. |
77 | // |
78 | // Note: this address could be anywhere on the stack. |
79 | // |
80 | LPVOID GetNextArgAddr(); |
81 | |
82 | // |
83 | // Returns argument size |
84 | // |
85 | UINT GetArgSize() |
86 | { |
87 | LIMITED_METHOD_CONTRACT; |
88 | return m_argIterator.GetArgSize(); |
89 | } |
90 | |
91 | // |
92 | // Called after initialization, any number of times, to retrieve any |
93 | // hidden argument, so that resolution for Generics can be done. |
94 | // |
95 | LPVOID GetHiddenArgValue(void); |
96 | |
97 | // |
98 | // Called after initialization, any number of times, to retrieve the |
99 | // value of 'this'. |
100 | // |
101 | LPVOID GetThis(void); |
102 | |
103 | // |
104 | // Called after initialization, any number of times, to retrieve the |
105 | // address of the return buffer, if there is one. NULL indicates no |
106 | // return buffer. |
107 | // |
108 | LPVOID GetReturnBufferAddr(void); |
109 | }; |
110 | |
111 | //--------------------------------------------------------------------------------------- |
112 | // This helper class wraps a loader heap which can be used to allocate |
113 | // memory for IL after the current module. |
114 | |
115 | class ModuleILHeap : public IMethodMalloc |
116 | { |
117 | public: |
118 | // IUnknown |
119 | virtual ULONG STDMETHODCALLTYPE AddRef(); |
120 | virtual ULONG STDMETHODCALLTYPE Release(); |
121 | virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void ** pp); |
122 | |
123 | // IMethodMalloc |
124 | virtual void *STDMETHODCALLTYPE Alloc(ULONG cb); |
125 | |
126 | static ModuleILHeap s_Heap; |
127 | }; |
128 | |
129 | typedef struct _PROFILER_STACK_WALK_DATA PROFILER_STACK_WALK_DATA; |
130 | |
131 | //--------------------------------------------------------------------------------------- |
132 | // One of these is allocated per EE instance. A pointer is cached to this |
133 | // from the profiler implementation. The profiler will call back on the v-table |
134 | // to get at EE internals as required. |
135 | |
136 | class ProfToEEInterfaceImpl : public ICorProfilerInfo9 |
137 | { |
138 | public: |
139 | |
140 | // Internal Housekeeping |
141 | |
142 | static void MethodTableCallback(void* context, void* methodTable); |
143 | static void ObjectRefCallback(void* context, void* objectRefUNSAFE); |
144 | |
145 | ProfToEEInterfaceImpl(); |
146 | virtual ~ProfToEEInterfaceImpl(); |
147 | HRESULT Init(); |
148 | |
149 | // IUnknown |
150 | ULONG STDMETHODCALLTYPE AddRef(); |
151 | ULONG STDMETHODCALLTYPE Release(); |
152 | COM_METHOD QueryInterface(REFIID id, void ** pInterface); |
153 | |
154 | // ICorProfilerInfo2 |
155 | |
156 | COM_METHOD GetEventMask(DWORD * pdwEvents); |
157 | COM_METHOD SetEventMask(DWORD dwEventMask); |
158 | |
159 | COM_METHOD GetHandleFromThread(ThreadID threadId, HANDLE * phThread); |
160 | |
161 | COM_METHOD GetObjectSize(ObjectID objectId, ULONG * pcSize); |
162 | |
163 | COM_METHOD GetObjectSize2(ObjectID objectId, SIZE_T * pcSize); |
164 | |
165 | COM_METHOD IsArrayClass( |
166 | /* [in] */ ClassID classId, |
167 | /* [out] */ CorElementType * pBaseElemType, |
168 | /* [out] */ ClassID * pBaseClassId, |
169 | /* [out] */ ULONG * pcRank); |
170 | |
171 | COM_METHOD GetThreadInfo(ThreadID threadId, DWORD * pdwWin32ThreadId); |
172 | |
173 | COM_METHOD GetCurrentThreadID(ThreadID * pThreadId); |
174 | |
175 | COM_METHOD GetFunctionFromIP(LPCBYTE ip, FunctionID * pFunctionId); |
176 | |
177 | COM_METHOD GetTokenAndMetaDataFromFunction( |
178 | FunctionID functionId, |
179 | REFIID riid, |
180 | IUnknown ** ppOut, |
181 | mdToken * pToken); |
182 | |
183 | COM_METHOD GetCodeInfo(FunctionID functionId, LPCBYTE * pStart, ULONG * pcSize); |
184 | |
185 | COM_METHOD GetModuleInfo( |
186 | ModuleID moduleId, |
187 | LPCBYTE * ppBaseLoadAddress, |
188 | ULONG cchName, |
189 | ULONG * pcchName, |
190 | __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[], |
191 | AssemblyID * pAssemblyId); |
192 | |
193 | COM_METHOD GetModuleMetaData( |
194 | ModuleID moduleId, |
195 | DWORD dwOpenFlags, |
196 | REFIID riid, |
197 | IUnknown ** ppOut); |
198 | |
199 | COM_METHOD GetILFunctionBody( |
200 | ModuleID moduleId, |
201 | mdMethodDef methodid, |
202 | LPCBYTE * , |
203 | ULONG * pcbMethodSize); |
204 | |
205 | COM_METHOD GetILFunctionBodyAllocator( |
206 | ModuleID moduleId, |
207 | IMethodMalloc ** ppMalloc); |
208 | |
209 | COM_METHOD SetILFunctionBody( |
210 | ModuleID moduleId, |
211 | mdMethodDef methodid, |
212 | LPCBYTE ); |
213 | |
214 | COM_METHOD SetILInstrumentedCodeMap( |
215 | FunctionID functionId, |
216 | BOOL fStartJit, |
217 | ULONG cILMapEntries, |
218 | COR_IL_MAP rgILMapEntries[]); |
219 | |
220 | COM_METHOD ForceGC(); |
221 | |
222 | COM_METHOD GetClassIDInfo( |
223 | ClassID classId, |
224 | ModuleID * pModuleId, |
225 | mdTypeDef * pTypeDefToken); |
226 | |
227 | COM_METHOD GetFunctionInfo( |
228 | FunctionID functionId, |
229 | ClassID * pClassId, |
230 | ModuleID * pModuleId, |
231 | mdToken * pToken); |
232 | |
233 | COM_METHOD GetClassFromObject( |
234 | ObjectID objectId, |
235 | ClassID * pClassId); |
236 | |
237 | COM_METHOD GetClassFromToken( |
238 | ModuleID moduleId, |
239 | mdTypeDef typeDef, |
240 | ClassID * pClassId); |
241 | |
242 | COM_METHOD GetFunctionFromToken( |
243 | ModuleID moduleId, |
244 | mdToken typeDef, |
245 | FunctionID * pFunctionId); |
246 | |
247 | COM_METHOD GetAppDomainInfo( |
248 | AppDomainID appDomainId, |
249 | ULONG cchName, |
250 | ULONG * pcchName, |
251 | __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[], |
252 | ProcessID * pProcessId); |
253 | |
254 | COM_METHOD GetAssemblyInfo( |
255 | AssemblyID assemblyId, |
256 | ULONG cchName, |
257 | ULONG * pcchName, |
258 | __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[], |
259 | AppDomainID * pAppDomainId, |
260 | ModuleID * pModuleId); |
261 | |
262 | COM_METHOD SetEnterLeaveFunctionHooks( |
263 | FunctionEnter * pFuncEnter, |
264 | FunctionLeave * pFuncLeave, |
265 | FunctionTailcall * pFuncTailcall); |
266 | |
267 | COM_METHOD SetEnterLeaveFunctionHooks2( |
268 | FunctionEnter2 * pFuncEnter, |
269 | FunctionLeave2 * pFuncLeave, |
270 | FunctionTailcall2 * pFuncTailcall); |
271 | |
272 | COM_METHOD SetFunctionIDMapper( |
273 | FunctionIDMapper * pFunc); |
274 | |
275 | COM_METHOD GetThreadContext( |
276 | ThreadID threadId, |
277 | ContextID * pContextId); |
278 | |
279 | COM_METHOD GetILToNativeMapping( |
280 | /* [in] */ FunctionID functionId, |
281 | /* [in] */ ULONG32 cMap, |
282 | /* [out] */ ULONG32 * pcMap, |
283 | /* [out, size_is(cMap), length_is(*pcMap)] */ |
284 | COR_DEBUG_IL_TO_NATIVE_MAP map[]); |
285 | |
286 | COM_METHOD GetFunctionInfo2( |
287 | /* in */ FunctionID funcId, |
288 | /* in */ COR_PRF_FRAME_INFO frameInfo, |
289 | /* out */ ClassID * pClassId, |
290 | /* out */ ModuleID * pModuleId, |
291 | /* out */ mdToken * pToken, |
292 | /* in */ ULONG32 cTypeArgs, |
293 | /* out */ ULONG32 * pcTypeArgs, |
294 | /* out */ ClassID typeArgs[]); |
295 | |
296 | COM_METHOD GetStringLayout( |
297 | /* out */ ULONG * pBufferLengthOffset, |
298 | /* out */ ULONG * pStringLengthOffset, |
299 | /* out */ ULONG * pBufferOffset); |
300 | |
301 | COM_METHOD GetClassLayout( |
302 | /* in */ ClassID classID, |
303 | /* in.out*/ COR_FIELD_OFFSET rFieldOffset[], |
304 | /* in */ ULONG cFieldOffset, |
305 | /* out */ ULONG * pcFieldOffset, |
306 | /* out */ ULONG * pulClassSize); |
307 | |
308 | COM_METHOD DoStackSnapshot( |
309 | ThreadID thread, |
310 | StackSnapshotCallback *callback, |
311 | ULONG32 infoFlags, |
312 | void * clientData, |
313 | BYTE * pctx, |
314 | ULONG32 contextSize); |
315 | |
316 | COM_METHOD GetCodeInfo2(FunctionID functionId, |
317 | ULONG32 cCodeInfos, |
318 | ULONG32 * pcCodeInfos, |
319 | COR_PRF_CODE_INFO codeInfos[]); |
320 | |
321 | COM_METHOD GetArrayObjectInfo(ObjectID objectId, |
322 | ULONG32 cDimensionSizes, |
323 | ULONG32 pDimensionSizes[], |
324 | int pDimensionLowerBounds[], |
325 | BYTE ** ppData); |
326 | |
327 | COM_METHOD GetBoxClassLayout(ClassID classId, |
328 | ULONG32 * pBufferOffset); |
329 | |
330 | COM_METHOD GetClassIDInfo2(ClassID classId, |
331 | ModuleID * pModuleId, |
332 | mdTypeDef * pTypeDefToken, |
333 | ClassID * pParentClassId, |
334 | ULONG32 cNumTypeArgs, |
335 | ULONG32 * pcNumTypeArgs, |
336 | ClassID typeArgs[]); |
337 | |
338 | COM_METHOD GetThreadAppDomain(ThreadID threadId, |
339 | AppDomainID * pAppDomainId); |
340 | |
341 | COM_METHOD GetRVAStaticAddress(ClassID classId, |
342 | mdFieldDef fieldToken, |
343 | void ** ppAddress); |
344 | |
345 | COM_METHOD GetAppDomainStaticAddress(ClassID classId, |
346 | mdFieldDef fieldToken, |
347 | AppDomainID appDomainId, |
348 | void ** ppAddress); |
349 | |
350 | COM_METHOD GetThreadStaticAddress(ClassID classId, |
351 | mdFieldDef fieldToken, |
352 | ThreadID threadId, |
353 | void ** ppAddress); |
354 | |
355 | COM_METHOD GetContextStaticAddress(ClassID classId, |
356 | mdFieldDef fieldToken, |
357 | ContextID contextId, |
358 | void ** ppAddress); |
359 | |
360 | COM_METHOD GetStaticFieldInfo(ClassID classId, |
361 | mdFieldDef fieldToken, |
362 | COR_PRF_STATIC_TYPE * pFieldInfo); |
363 | |
364 | COM_METHOD GetClassFromTokenAndTypeArgs(ModuleID moduleID, |
365 | mdTypeDef typeDef, |
366 | ULONG32 cTypeArgs, |
367 | ClassID typeArgs[], |
368 | ClassID* pClassID); |
369 | |
370 | COM_METHOD EnumModuleFrozenObjects(ModuleID moduleID, |
371 | ICorProfilerObjectEnum** ppEnum); |
372 | |
373 | |
374 | |
375 | COM_METHOD GetFunctionFromTokenAndTypeArgs(ModuleID moduleID, |
376 | mdMethodDef funcDef, |
377 | ClassID classId, |
378 | ULONG32 cTypeArgs, |
379 | ClassID typeArgs[], |
380 | FunctionID* pFunctionID); |
381 | |
382 | COM_METHOD GetGenerationBounds(ULONG cObjectRanges, |
383 | ULONG * pcObjectRanges, |
384 | COR_PRF_GC_GENERATION_RANGE ranges[]); |
385 | |
386 | COM_METHOD GetObjectGeneration(ObjectID objectId, |
387 | COR_PRF_GC_GENERATION_RANGE *range); |
388 | |
389 | COM_METHOD GetNotifiedExceptionClauseInfo(COR_PRF_EX_CLAUSE_INFO * pinfo); |
390 | |
391 | COM_METHOD SetFunctionReJIT(FunctionID); |
392 | COM_METHOD GetInprocInspectionInterface(IUnknown **); |
393 | COM_METHOD GetInprocInspectionIThisThread(IUnknown **); |
394 | COM_METHOD BeginInprocDebugging(BOOL,DWORD *); |
395 | COM_METHOD EndInprocDebugging(DWORD); |
396 | |
397 | // ICorProfilerInfo3 |
398 | |
399 | COM_METHOD EnumJITedFunctions(ICorProfilerFunctionEnum** ppEnum); |
400 | COM_METHOD EnumModules(ICorProfilerModuleEnum ** ppEnum); |
401 | |
402 | COM_METHOD RequestProfilerDetach( |
403 | /* in */ DWORD dwExpectedCompletionMilliseconds); |
404 | |
405 | COM_METHOD SetFunctionIDMapper2( |
406 | FunctionIDMapper2 * pFunc, // in |
407 | void * clientData); // in |
408 | |
409 | COM_METHOD SetEnterLeaveFunctionHooks3( |
410 | FunctionEnter3 * pFuncEnter3, // in |
411 | FunctionLeave3 * pFuncLeave3, // in |
412 | FunctionTailcall3 * pFuncTailcall3); // in |
413 | |
414 | COM_METHOD SetEnterLeaveFunctionHooks3WithInfo( |
415 | FunctionEnter3WithInfo * pFuncEnter3WithInfo, // in |
416 | FunctionLeave3WithInfo * pFuncLeave3WithInfo, // in |
417 | FunctionTailcall3WithInfo * pFuncTailcall3WithInfo); // in |
418 | |
419 | COM_METHOD GetFunctionEnter3Info( |
420 | FunctionID functionId, // in |
421 | COR_PRF_ELT_INFO eltInfo, // in |
422 | COR_PRF_FRAME_INFO * pFrameInfo, // out |
423 | ULONG * pcbArgumentInfo, // in, out |
424 | COR_PRF_FUNCTION_ARGUMENT_INFO * pArgumentInfo); // out |
425 | |
426 | COM_METHOD GetFunctionLeave3Info( |
427 | FunctionID functionId, // in |
428 | COR_PRF_ELT_INFO eltInfo, // in |
429 | COR_PRF_FRAME_INFO * pFrameInfo, // out |
430 | COR_PRF_FUNCTION_ARGUMENT_RANGE * pRetvalRange); // out |
431 | |
432 | COM_METHOD GetFunctionTailcall3Info( |
433 | FunctionID functionId, // in |
434 | COR_PRF_ELT_INFO pFrameInfo, // in |
435 | COR_PRF_FRAME_INFO * pFunc); // out |
436 | |
437 | COM_METHOD GetStringLayout2( |
438 | /* out */ ULONG * pStringLengthOffset, |
439 | /* out */ ULONG * pBufferOffset); |
440 | |
441 | COM_METHOD GetRuntimeInformation(USHORT * pClrInstanceId, // out |
442 | COR_PRF_RUNTIME_TYPE * pRuntimeType, // out |
443 | USHORT * pMajorVersion, // out |
444 | USHORT * pMinorVersion, // out |
445 | USHORT * pBuildNumber, // out |
446 | USHORT * pQFEVersion, // out |
447 | ULONG cchVersionString, // in |
448 | ULONG * pcchVersionString, // out |
449 | __out_ecount_part_opt(cchVersionString, *pcchVersionString) WCHAR szVersionString[]); // out |
450 | |
451 | COM_METHOD GetThreadStaticAddress2(ClassID classId, // in |
452 | mdFieldDef fieldToken, // in |
453 | AppDomainID appDomainId, // in |
454 | ThreadID threadId, // in |
455 | void ** ppAddress); // out |
456 | |
457 | COM_METHOD GetAppDomainsContainingModule(ModuleID moduleId, // in |
458 | ULONG32 cAppDomainIds, // in |
459 | ULONG32 *pcAppDomainIds, // out |
460 | AppDomainID appDomainIds[]); // out |
461 | |
462 | COM_METHOD GetModuleInfo2( |
463 | ModuleID moduleId, |
464 | LPCBYTE * ppBaseLoadAddress, |
465 | ULONG cchName, |
466 | ULONG * pcchName, |
467 | __out_ecount_part_opt(cchName, *pcchName) WCHAR szName[], |
468 | AssemblyID * pAssemblyId, |
469 | DWORD * pdwModuleFlags); |
470 | |
471 | // end ICorProfilerInfo3 |
472 | |
473 | // ICorProfilerInfo4 |
474 | |
475 | COM_METHOD EnumThreads( |
476 | /* out */ ICorProfilerThreadEnum ** ppEnum); |
477 | |
478 | COM_METHOD InitializeCurrentThread(); |
479 | |
480 | // end ICorProfilerInfo4 |
481 | |
482 | COM_METHOD RequestReJIT(ULONG cFunctions, // in |
483 | ModuleID moduleIds[], // in |
484 | mdMethodDef methodIds[]); // in |
485 | |
486 | COM_METHOD RequestRevert(ULONG cFunctions, // in |
487 | ModuleID moduleIds[], // in |
488 | mdMethodDef methodIds[], // in |
489 | HRESULT status[]); // out |
490 | |
491 | COM_METHOD GetCodeInfo3(FunctionID functionID, // in |
492 | ReJITID reJitId, // in |
493 | ULONG32 cCodeInfos, // in |
494 | ULONG32 * pcCodeInfos, // out |
495 | COR_PRF_CODE_INFO codeInfos[]); // out |
496 | |
497 | COM_METHOD GetFunctionFromIP2(LPCBYTE ip, // in |
498 | FunctionID * pFunctionId, // out |
499 | ReJITID * pReJitId); // out |
500 | |
501 | COM_METHOD GetReJITIDs(FunctionID functionId, // in |
502 | ULONG cReJitIds, // in |
503 | ULONG * pcReJitIds, // out |
504 | ReJITID reJitIds[]); // out |
505 | |
506 | COM_METHOD GetILToNativeMapping2( |
507 | FunctionID functionId, // in |
508 | ReJITID reJitId, // in |
509 | ULONG32 cMap, // in |
510 | ULONG32 * pcMap, // out |
511 | COR_DEBUG_IL_TO_NATIVE_MAP map[]); // out |
512 | |
513 | COM_METHOD EnumJITedFunctions2(ICorProfilerFunctionEnum** ppEnum); |
514 | |
515 | // end ICorProfilerInfo4 |
516 | |
517 | |
518 | // begin ICorProfilerInfo5 |
519 | |
520 | COM_METHOD SetEventMask2( |
521 | DWORD dwEventsLow, |
522 | DWORD dwEventsHigh); |
523 | |
524 | COM_METHOD GetEventMask2(DWORD *pdwEventsLow, DWORD *pdwEventsHigh); |
525 | |
526 | // end ICorProfilerInfo5 |
527 | |
528 | // begin ICorProfilerInfo6 |
529 | |
530 | COM_METHOD EnumNgenModuleMethodsInliningThisMethod( |
531 | ModuleID inlinersModuleId, |
532 | ModuleID inlineeModuleId, |
533 | mdMethodDef inlineeMethodId, |
534 | BOOL *incompleteData, |
535 | ICorProfilerMethodEnum** ppEnum); |
536 | |
537 | |
538 | // end ICorProfilerInfo6 |
539 | |
540 | // begin ICorProfilerInfo7 |
541 | |
542 | COM_METHOD ApplyMetaData( |
543 | ModuleID moduleId); |
544 | |
545 | COM_METHOD GetInMemorySymbolsLength( |
546 | ModuleID moduleId, |
547 | DWORD* pCountSymbolBytes); |
548 | |
549 | COM_METHOD ReadInMemorySymbols( |
550 | ModuleID moduleId, |
551 | DWORD symbolsReadOffset, |
552 | BYTE* pSymbolBytes, |
553 | DWORD countSymbolBytes, |
554 | DWORD* pCountSymbolBytesRead); |
555 | |
556 | // end ICorProfilerInfo7 |
557 | |
558 | // begin ICorProfilerInfo8 |
559 | |
560 | COM_METHOD IsFunctionDynamic( |
561 | FunctionID functionId, |
562 | BOOL *isDynamic); |
563 | |
564 | COM_METHOD GetFunctionFromIP3( |
565 | LPCBYTE ip, // in |
566 | FunctionID * pFunctionId, // out |
567 | ReJITID * pReJitId); // out |
568 | |
569 | COM_METHOD GetDynamicFunctionInfo( |
570 | FunctionID functionId, |
571 | ModuleID* moduleId, |
572 | PCCOR_SIGNATURE* ppvSig, |
573 | ULONG* pbSig, |
574 | ULONG cchName, |
575 | ULONG *pcchName, |
576 | WCHAR wszName[]); |
577 | |
578 | // end ICorProfilerInfo8 |
579 | |
580 | // beging ICorProfilerInfo9 |
581 | |
582 | COM_METHOD GetNativeCodeStartAddresses( |
583 | FunctionID functionID, |
584 | ReJITID reJitId, |
585 | ULONG32 cCodeStartAddresses, |
586 | ULONG32 *pcCodeStartAddresses, |
587 | UINT_PTR codeStartAddresses[]); |
588 | |
589 | COM_METHOD GetILToNativeMapping3( |
590 | UINT_PTR pNativeCodeStartAddress, |
591 | ULONG32 cMap, |
592 | ULONG32 *pcMap, |
593 | COR_DEBUG_IL_TO_NATIVE_MAP map[]); |
594 | |
595 | COM_METHOD GetCodeInfo4( |
596 | UINT_PTR pNativeCodeStartAddress, |
597 | ULONG32 cCodeInfos, |
598 | ULONG32* pcCodeInfos, |
599 | COR_PRF_CODE_INFO codeInfos[]); |
600 | |
601 | // end ICorProfilerInfo9 |
602 | |
603 | protected: |
604 | |
605 | // Internal Helper Functions |
606 | |
607 | HRESULT GetCodeInfoHelper(FunctionID functionId, |
608 | ReJITID reJitId, |
609 | ULONG32 cCodeInfos, |
610 | ULONG32 * pcCodeInfos, |
611 | COR_PRF_CODE_INFO codeInfos[]); |
612 | |
613 | HRESULT GetStringLayoutHelper(ULONG * pBufferLengthOffset, |
614 | ULONG * pStringLengthOffset, |
615 | ULONG * pBufferOffset); |
616 | |
617 | HRESULT GetArrayObjectInfoHelper(Object * pObj, |
618 | ULONG32 cDimensionSizes, |
619 | __out_ecount(cDimensionSizes) ULONG32 pDimensionSizes[], |
620 | __out_ecount(cDimensionSizes) int pDimensionLowerBounds[], |
621 | BYTE ** ppData); |
622 | |
623 | DWORD GetModuleFlags(Module * pModule); |
624 | |
625 | HRESULT DoStackSnapshotHelper(Thread * pThreadToSnapshot, |
626 | PROFILER_STACK_WALK_DATA * pData, |
627 | unsigned flags, |
628 | LPCONTEXT pctxSeed); |
629 | |
630 | HRESULT ProfilerStackWalkFramesWrapper(Thread * pThreadToSnapshot, PROFILER_STACK_WALK_DATA * pData, unsigned flags); |
631 | |
632 | HRESULT EnumJITedFunctionsHelper(ProfilerFunctionEnum ** ppEnum, IJitManager ** ppJitMgr); |
633 | |
634 | #ifdef _TARGET_X86_ |
635 | HRESULT ProfilerEbpWalker(Thread * pThreadToSnapshot, LPCONTEXT pctxSeed, StackSnapshotCallback * callback, void * clientData); |
636 | #endif //_TARGET_X86_ |
637 | }; |
638 | |
639 | #endif // PROFILING_SUPPORTED |
640 | |
641 | //--------------------------------------------------------------------------------------- |
642 | // This provides the implementations for FCALLs in managed code related to profiling |
643 | |
644 | class ProfilingFCallHelper |
645 | { |
646 | public: |
647 | // This is a high-efficiency way for managed profiler code to determine if |
648 | // profiling of remoting is active. |
649 | static FCDECL0(FC_BOOL_RET, FC_TrackRemoting); |
650 | |
651 | // This is a high-efficiency way for managed profiler code to determine if |
652 | // profiling of remoting with RPC cookie IDs is active. |
653 | static FCDECL0(FC_BOOL_RET, FC_TrackRemotingCookie); |
654 | |
655 | // This is a high-efficiency way for managed profiler code to determine if |
656 | // profiling of asynchronous remote calls is profiled |
657 | static FCDECL0(FC_BOOL_RET, FC_TrackRemotingAsync); |
658 | |
659 | // This will let the profiler know that the client side is sending a message to |
660 | // the server-side. |
661 | static FCDECL2(void, FC_RemotingClientSendingMessage, GUID * pId, CLR_BOOL fIsAsync); |
662 | |
663 | // For __cdecl calling convention both arguments end up on |
664 | // the stack but the order in which the jit puts them there needs to be reversed |
665 | // For __fastcall calling convention the reversal has no effect because the GUID doesn't |
666 | // fit in a register. On IA64 the macro is different. |
667 | |
668 | // This will let the profiler know that the client side is receiving a reply |
669 | // to a message that it sent |
670 | static FCDECL2_VI(void, FC_RemotingClientReceivingReply, GUID id, CLR_BOOL fIsAsync); |
671 | |
672 | // This will let the profiler know that the server side is receiving a message |
673 | // from a client |
674 | static FCDECL2_VI(void, FC_RemotingServerReceivingMessage, GUID id, CLR_BOOL fIsAsync); |
675 | |
676 | // This will let the profiler know that the server side is sending a reply to |
677 | // a received message. |
678 | static FCDECL2(void, FC_RemotingServerSendingReply, GUID * pId, CLR_BOOL fIsAsync); |
679 | }; |
680 | |
681 | #endif // __PROFTOEEINTERFACEIMPL_H__ |
682 | |
683 | |
684 | |