0

I've created a .NET Profiling DLL that implements the ICorProfilerCallback3 interface.

I'm using the profiling to trace the functions called during Runtime, however, I'm looking to trace application specific functions, not the standard .NET framework functions.

I successfully used the SetEnterLeaveFunctionHook method and supply it with callback functions.

Then while I'm in the callback functions, I get the function information and assembly information using the GetFunctionInfo and GetModuleInfo2 functions.

The issue I'm running into is this obviously gets called for EVERY function and I'm looking for a way to distinguish between a .Net framework DLL and not a standard DLL.

For instance the majority of calls when the application starts goes to the mscorlib.dll which I'm not interested in tracing.

Any thoughts or ideas? I've tried call this function but pdwImplFlags doesn't appear to populate with anything useful.

https://docs.microsoft.com/en-us/dotnet/framework/unmanaged-api/metadata/imetadataimport-getmethodprops-method

4

1 回答 1

1

您可以使用SetFunctionIDMapper2来指定一个映射器,该映射器检查该函数是否感兴趣,pbHookFunction如果不是,则返回 false。那么你应该只为你返回 true 的方法获取回调pbHookFunction

于 2021-07-13T01:30:20.880 回答