Getting class objects using ICoreprofiler


hi, 

i trying parent class object of called function using icoreprofilercallback/icoreprofilerinfo2 apis.

what want is, 'this' pointer of following class when member function called. can inspect state. in following class, need class instance profiling, type cast type can read properties.

public class testmanagedclass{

public int somevalue;

public seconddotnetclass cls;

......

public void myfunction(some args);

}

i using icoreprofiler , getting call when the function 'myfunction' being called functionid,clientdata,frameinfo , argument info.

once here, call getfunctioninfo2 , class id. want information , pass on manged layer , pass kind of pointer there can this.

intptr p = (intptr)ptr;
        gchandle handle2 = (gchandle)p;
        testmanagedclass objofinterest= (handle2.target testmanagedclass);

i looking at getboxclasslayout or getclasslayout kind of methods can extract gchandle or similar it, can managed object back. of these sound reasonable ? or have hook other call can map class id gchandle? 

thank in advance advice!


gp


if want access properties or call unmanaged code in profiler, need managed code rather make call callback , means instrumenting appropriate method.

you insert il @ beginning of form.show() call managed properties , collect whatever information want, pass information native method in profiler.



.NET Framework  >  Common Language Runtime Internals and Architecture



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'