If you "set COMPlus_JitBreak=DefaultNamespace.Test:.ctor", you will stop in the JIT when this Test constructor gets jited - you will be then able to step through the jitting and execution of the constructor. docs\debugging\sos.html has more detailed example how to use COMPlus_JitBreak and COMPlus_JitHalt.
Also note that there is distinction between constructor being executed and object being allocated. When the constructor is executed, the object has been allocated already. If the optimized allocation helpers emitted by emitCore confuse you, you may try changing the following lines in clr\src\vm\i386\jitinterface.cpp: #ifdef PROFILING_SUPPORTED if (!((CORProfilerTrackAllocationsEnabled()) || (LoggingOn(LF_GCALLOC, LL_INFO10)))) #else if (!LoggingOn(LF_GCALLOC, LL_INFO10)) #endif To if (0) This will disable the optimized allocation helpers - all allocations should go the GCHeap::Alloc. Once you do that you should be able to use breakpoints triggered on count to easily break at the exact GCHeap::Alloc you are interested in. -Jan -----Original Message----- From: Discussion of the Rotor Shared Source CLI implementation [mailto:[EMAIL PROTECTED] On Behalf Of Archana Sent: Saturday, July 10, 2004 6:44 AM To: [EMAIL PROTECTED] Subject: Re: [DOTNET-ROTOR] How does the jit handle an alloc-stmt? Hi, actually i stepped through the code and put breaks at JIT_New.. calls, printfs in compileCEE_NEWOBJ function. referringto the disassembled code below, i get a call to compileCEE_NEWOBJ just before ldstr stmt(marked by an arrow). and that is followed by a series of calls to SlowAllocateString(..) corresponding to ldstr. this i got by the way you (Jan) had explained the other day by call SOS("IP2MD.."). after this the next stop happens at the Alloc call of size 236 which i found to be the Random object constructor. so when and how is the Test constructor executed? it surely is not calling GCHeap::Alloc(), so the only left option is emitCore, and that what i am not able to figure out how? pls help. .method public hidebysig static int32 Main() cil managed { .entrypoint // Code size 22 (0x16) .maxstack 1 .locals init (class DefaultNamespace.Test V_0, int32 V_1) ----> IL_0000: ldstr "first stmt" IL_0005: call void [mscorlib]System.Console::WriteLine(string) IL_000a: newobj instance void DefaultNamespace.Test::.ctor() IL_000f: stloc.0 IL_0010: ldc.i4.0 IL_0011: stloc.1 IL_0012: br.s IL_0014 IL_0014: ldloc.1 IL_0015: ret } // end of method mainclass::Main On Sat, 10 Jul 2004, Jan Kotas wrote: > compileCEE_NEWOBJ is hit for both allocations points for me. Are you > setting your breakpoints before Main is jitted? > > -Jan > > -----Original Message----- > From: Discussion of the Rotor Shared Source CLI implementation > [mailto:[EMAIL PROTECTED] On Behalf Of Archana > Sent: Saturday, July 10, 2004 5:31 AM > To: [EMAIL PROTECTED] > Subject: [DOTNET-ROTOR] How does the jit handle an alloc-stmt? > > Hi, > wrt the following test program, i am trying to find out how exactly the > jit manages alloc-stmts, > > namespace DefaultNamespace { > using System; > public class Test { > int x; > public Test() { > 1-> Random r=new Random(1234); > } > } > public class mainclass { > public static int Main() { > Console.WriteLine("first stmt"); > 2-> Test t=new Test(); > return 0; > } > > referring to allocation point 1, a call to compileCEE_NEWOBJ is made, > which ultimately calls JIT_NewArr1 that can be captured by a break. but > wrt alloc point 2, no such call is > made. but if we disassemble the code, both the allocations have > corresponding newobj opcodes- > IL_000b: newobj instance void [mscorlib]System.Random::.ctor(int32) > and > IL_000a: newobj instance void DefaultNamespace.Test::.ctor() > respectively. > could someone pls explain what happens to the second alloc call, how is > it > handled? is it handled thru emitCore(..)? if yes, how does the control > flow to that function, and can we track it somehow? > > Thanks & regards > archana > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > ASP.NET courses you may be interested in: > > Guerrilla ASP.NET > 15 March 2004, in Boston, MA > 17 May 2004 in Torrance, CA > 7 June 2004, London, UK > > http://www.develop.com/courses/gaspdotnetls > > View archives and manage your subscription(s) at > http://discuss.develop.com > > =================================== > This list is hosted by DevelopMentor(r) http://www.develop.com > ASP.NET courses you may be interested in: > > Guerrilla ASP.NET > 15 March 2004, in Boston, MA > 17 May 2004 in Torrance, CA > 7 June 2004, London, UK > > http://www.develop.com/courses/gaspdotnetls > > View archives and manage your subscription(s) at http://discuss.develop.com > -- Regards, Archana =================================== This list is hosted by DevelopMentor(r) http://www.develop.com ASP.NET courses you may be interested in: Guerrilla ASP.NET 15 March 2004, in Boston, MA 17 May 2004 in Torrance, CA 7 June 2004, London, UK http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com ASP.NET courses you may be interested in: Guerrilla ASP.NET 15 March 2004, in Boston, MA 17 May 2004 in Torrance, CA 7 June 2004, London, UK http://www.develop.com/courses/gaspdotnetls View archives and manage your subscription(s) at http://discuss.develop.com