Access violation (in _d_invariant)

Lionello Lunesu lio at lunesu.remove.com
Tue May 23 10:53:23 PDT 2006


I've recompiled phobos/dmgc with -g -debug and got some more debug info.

void _d_invariant(Object o)
004057A0  enter       8,0
004057A4  push        ebx
004057A5  push        esi
004057A6  mov         dword ptr [ebp-8],eax
{   ClassInfo c;
004057A9  mov         dword ptr [c],0

     //printf("__d_invariant(%p)\n", o);

     // BUG: needs to be filename/line of caller, not library routine
     assert(o !is null);	// just do null check, not invariant check
004057B0  cmp         dword ptr [o],0
004057B4  jne         +20h (4057C0h)
004057B6  mov         eax,0Eh
004057BB  call        _assert_9invariant (4057F0h)

     c = o.classinfo;
004057C0  mov         ecx,dword ptr [o]
004057C3  mov         edx,dword ptr [ecx]
 >>>004057C5  mov         ebx,dword ptr [edx]


EAX = 01C64AC0 EBX = 00439214 ECX = 01C64AC0 EDX = 00000000
ESI = 00402124 EDI = 01C33A30 EIP = 004057C5
ESP = 0781F740 EBP = 0781F750 EFL = 00010206


void _d_invariant(Object o)
{   ClassInfo c;

     //printf("__d_invariant(%p)\n", o);

     // BUG: needs to be filename/line of caller, not library routine
     assert(o !is null);	// just do null check, not invariant check

 >>>    c = o.classinfo;
     do
     {
	if (c.classInvariant)
	{
	    (*c.classInvariant)(o);
	}
	c = c.base;
     } while (c);
}

'o' is set, but its vptr is null; also o.monitor is null.

Lio.

By the way, I had to tweak quite a lot in win32.mak to get it to work :S



More information about the Digitalmars-d-bugs mailing list