(Pierre De Boeck)
1/21/2003 10:42:00 PM
I am doing In-Process Debugging from a .NET Profiler that I wrote with
the Profiler API (a COM C++ in-process server).
My profiler intercepts any entry/exit function event for tracing calls
diagram
and it work perfectly fine, even for ASP.NET apps.
When a entry function event occurs, I do a lot of things and among
them I want to know the value of the "this" pointer, if it is an
instance function (not static).
To get that value, I use the unmanaged Debug API (In-Process
Debugging) to get a pointer to the ICorDebugILFrame and then I call
ICorDebugILFrame->GetArgument(0,&pICorDebugValue) to get the
pICorDebugValue for the "this" pointer.
That works perfectly well when the function returns void (like a SUB
or a SET property in VB.NET) but as soon as it returns some value
(FUNCTION or GET property), I receive a CORDBG_E_IL_VAR_NOT_AVAILABLE
error.
So I have 2 questions:
- any explaination to that behaviour?
- is it the best way to find the "this" pointer on a non-static
method? If that value is the raw address of the object, then that
value could change after a GC.
I know that each managed object has an immutable object ID used by the
GC but I don't see how to get easily that value from my entry function
event.