[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.sdk

DebuggingAPI -> failure in ICorDebugValueEnum???

joachim

12/17/2002 12:32:00 PM

This is a follow up to my posting from 12.12.2002 "Need help with
DebuggingAPI/ProfilingAPI."

I have build a Inprocess-Profiler according to the MS and MSDN samples.
Within the FUNCTIONENTER callback I activate inprocess debugging to get
access to the function arguments. I'm especially interested in their values.
Unfortunately accessing function arguments and their values is not addressed
in any of the publications mentioned above. But it is obviously possible via
the following steps:

Here is a brief description what I'm doing:

- within the FunctionEnter callback
1) activate inprocess debugging
2) get ICorDebugILFrame interface
3) call ICorDebugILFrame:EnumerateArguments to get the function arguments
4) iterate through the ICorDebugValueEnum by calling
ICorDebugValueEnum:Next - this will/should return an ICorDebugValue
interface for the argument(s)
5) use the ICorDebugValue interface to determine the value of the function
argument

THE PROBLEM IS -> the steps above do work as long as the function has NO
return parameter.
If the function HAS a return parameter something gets wrong with the
ICorDebugValueEnum.
In this case I'm still able to determine the number of arguments via
ICorDebugValueEnum:GetCount and the reported number of arguments is ok.
But in step 4) I always get the HRESULT = CORDBG_E_BAD_REFERENCE_VALUE and
no ICorDebugValue is returned. The comment in CorError.h for this HRESULT
states the following -> "An IL variable is not available at the current
native IP."

To illustrate the difference:

WORKS:
1) public VOID sampleFunc( int i, string j, bool k )
->ICorDebugValueEnum:Next works fine in returning the ICorDebugValues of all
the function arguments

DOESN'T WORK:
2) public INT sampleFunc( int i, string j, bool k )
->ICorDebugValueEnum:Next fails with HRESULT = CORDBG_E_BAD_REFERENCE_VALUE

Any helpfull comment about that?
joachim