I'm using CLR profiling API and trying to get arguments info (COR_PRF_FUNCTION_ARGUMENT_INFO) from COR_PRF_ELT_INFO using GetFunctionEnter3Info function.
Below is my code. It seems GetFunctionEnter3Info function is not setting the value for pArgumentInfo. It always has null value. However, the function returns S_OK, which is a success.
I may be missing something. How should I get COR_PRF_FUNCTION_ARGUMENT_INFO from COR_PRF_ELT_INFO ?
PROFILER_STUB EnterStub(FunctionIDOrClientID functionId, COR_PRF_ELT_INFO eltInfo)
{
COR_PRF_FRAME_INFO *pFrameInfo = 0;
ULONG *pcbArgumentInfo = 0;
COR_PRF_FUNCTION_ARGUMENT_INFO *pArgumentInfo = NULL;
corProfilerInfo->GetFunctionEnter3Info(functionId.functionID, eltInfo, pFrameInfo, pcbArgumentInfo, pArgumentInfo);
if(pArgumentInfo) {
//
}
}
It is a little bit tricky,
By msdn doc:
In other words, you have a single
COR_PRF_FUNCTION_ARGUMENT_INFOstructure, which references multipleCOR_PRF_FUNCTION_ARGUMENT_RANGE. First of all, get a number of bytes ofpcbArgumentInfo, after that allocate bytes and pass the pointer toGetFunctionEnter3InfoasCOR_PRF_FUNCTION_ARGUMENT_INFO.Here is an example
To access the second
argument infoblock ofCOR_PRF_FUNCTION_ARGUMENT_RANGEuseThe number of blocks is written in
ptr->numRanges