Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Ticket #1738 (closed defect: fixed)

Opened 15 years ago

Last modified 15 years ago

Stacktrace crashes on Vista

Reported by: torhu Assigned to: h3r3tic
Priority: major Milestone: 0.99.9
Component: Tango Version: trunk
Keywords: Cc: torhu@yahoo.com

Description

I'm using tango trunk r4498, which is from right after 0.99.8, just when the stack tracing was added.

From a static ctor in WinStackTrace?.d, starting with line 1843:

    SYMBOL_INFO sym;
    extern(C) void function(char[]) initTrace;
    if (SymFromName(GetCurrentProcess(), "__initLGPLHostExecutableDebugInfo", &sym)) {
        initTrace = cast(typeof(initTrace))sym.Address;
        //Stdout.formatln("Initializing the TangoTrace LGPL stuff");
        initTrace(modName);
    } else {
        Stdout.formatln("Can't initialize the TangoTrace LGPL stuff");
    }

From looking at it in the msvc debugger (unfortunately without symbols) it looks like the initTrace function pointer is null, causing an access violation when trying to call it.

Here's the corresponding assembly output, I've marked the spot with XXXX.

tango@core@stacktrace@WinStackTrace@_staticCtor4:
0042D58C  sub         esp,26Ch
0042D592  push        esi
0042D593  push        edi
0042D594  call        tango@core@stacktrace@WinStackTrace@loadWinAPIFunctions (42C1F0h)
0042D599  xor         eax,eax
0042D59B  mov         dword ptr [tango@core@stacktrace@WinStackTrace@fiberRunFuncLength (7BF9FCh)],eax
0042D5A0  cmp         eax,100h
0042D5A5  jae         tango@core@stacktrace@WinStackTrace@_staticCtor4+4Ah (42D5D6h)
0042D5A7  push        1
0042D5A9  mov         ecx,dword ptr [tango@core@stacktrace@WinStackTrace@fiberRunFuncLength (7BF9FCh)]
0042D5AF  lea         esi,tango@core@Thread@Fiber@run (618B38h)[ecx]
0042D5B5  push        esi
0042D5B6  call        _IsBadReadPtr@8 (63CD14h)
0042D5BB  test        eax,eax
0042D5BD  jne         tango@core@stacktrace@WinStackTrace@_staticCtor4+4Ah (42D5D6h)
0042D5BF  cmp         byte ptr [esi],0C3h
0042D5C2  je          tango@core@stacktrace@WinStackTrace@_staticCtor4+4Ah (42D5D6h)
0042D5C4  inc         dword ptr [tango@core@stacktrace@WinStackTrace@fiberRunFuncLength (7BF9FCh)]
0042D5CA  cmp         dword ptr [tango@core@stacktrace@WinStackTrace@fiberRunFuncLength (7BF9FCh)],100h
0042D5D4  jb          tango@core@stacktrace@WinStackTrace@_staticCtor4+1Bh (42D5A7h)
0042D5D6  mov         ecx,80h
0042D5DB  xor         eax,eax
0042D5DD  lea         edi,[esp+8]
0042D5E1  rep stos    dword ptr es:[edi]
0042D5E3  push        1FFh
0042D5E8  lea         edx,[esp+0Ch]
0042D5EC  push        edx
0042D5ED  push        eax
0042D5EE  call        _GetCurrentProcess@0 (63CD1Ah)
0042D5F3  push        eax
0042D5F4  call        dword ptr [_GetModuleFileNameExA (7BFD7Ch)]
0042D5FA  lea         ecx,[esp+8]
0042D5FE  mov         dword ptr [esp+208h],eax
0042D605  mov         dword ptr [esp+20Ch],ecx
0042D60C  push        4
0042D60E  call        dword ptr [_SymSetOptions (7BFD6Ch)]
0042D614  push        0
0042D616  push        0
0042D618  call        _GetCurrentProcess@0 (63CD1Ah)
0042D61D  push        eax
0042D61E  call        dword ptr [_SymInitialize (7BFD64h)]
0042D624  push        0
0042D626  push        0
0042D628  push        0
0042D62A  push        0
0042D62C  push        dword ptr [esp+21Ch]
0042D633  push        0
0042D635  call        _GetCurrentProcess@0 (63CD1Ah)
0042D63A  push        eax
0042D63B  call        dword ptr [_SymLoadModule64 (7BFD60h)]
0042D641  test        eax,eax
0042D643  jne         tango@core@stacktrace@WinStackTrace@_staticCtor4+102h (42D68Eh)
0042D645  call        _GetLastError@0 (63CDF8h)
0042D64A  test        eax,eax
0042D64C  je          tango@core@stacktrace@WinStackTrace@_staticCtor4+102h (42D68Eh)
0042D64E  push        offset Exception@__Class (700C70h)
0042D653  call        __d_newclass (61BB4Ch)
0042D658  add         esp,4
0042D65B  mov         esi,eax
0042D65D  call        tango@sys@Common@SysError@lastMsg (42E760h)
0042D662  push        edx
0042D663  push        eax
0042D664  push        dword ptr [tango@core@stacktrace@WinStackTrace@OMFSourceFile@__init+30h (678ADCh)]
0042D66A  push        dword ptr [tango@core@stacktrace@WinStackTrace@OMFSourceFile@__init+2Ch (678AD8h)]
0042D670  push        offset TypeInfo_Aa@__init (701508h)
0042D675  call        __d_arraycatT (61C6ACh)
0042D67A  add         esp,14h
0042D67D  push        edx
0042D67E  push        eax
0042D67F  push        0
0042D681  mov         eax,esi
0042D683  call        object@Exception@_ctor (61A0ECh)
0042D688  push        eax
0042D689  call        __d_throw@4 (61AC47h)
0042D68E  mov         esi,offset tango@core@stacktrace@WinStackTrace@SYMBOL_INFO@__init (6784E0h)
0042D693  lea         edi,[esp+218h]
0042D69A  mov         ecx,16h
0042D69F  rep movs    dword ptr es:[edi],dword ptr [esi]
0042D6A1  lea         edx,[esp+218h]
0042D6A8  push        edx
0042D6A9  push        offset tango@core@stacktrace@WinStackTrace@OMFSourceFile@__init+6Ch (678B18h)
0042D6AE  call        _GetCurrentProcess@0 (63CD1Ah)
0042D6B3  push        eax
0042D6B4  call        dword ptr [_SymFromName (7BFD5Ch)]
0042D6BA  test        eax,eax
0042D6BC  je          tango@core@stacktrace@WinStackTrace@_staticCtor4+14Ch (42D6D8h)
0042D6BE  push        dword ptr [esp+20Ch]
0042D6C5  push        dword ptr [esp+20Ch]
0042D6CC  call        dword ptr [esp+258h]  XXXX value is zero
0042D6D3  add         esp,8
0042D6D6  jmp         tango@core@stacktrace@WinStackTrace@_staticCtor4+16Bh (42D6F7h)
0042D6D8  push        dword ptr [tango@core@stacktrace@WinStackTrace@OMFSourceFile@__init+68h (678B14h)]
0042D6DE  push        dword ptr [tango@core@stacktrace@WinStackTrace@OMFSourceFile@__init+64h (678B10h)]
0042D6E4  push        offset TypeInfo_B0@__init (63EB20h)
0042D6E9  push        dword ptr [tango@io@Stdout@Stdout (7C0410h)]
0042D6EF  call        _D5tango2io6stream6Format20__T12Format (428184h)
0042D6F4  add         esp,10h
0042D6F7  pop         edi
0042D6F8  pop         esi
0042D6F9  add         esp,26Ch
0042D6FF  ret

Let me know if you need more info, and I'll run it in the debugger again.

Change History

09/15/09 12:10:14 changed by fawzi

mmh I guess that is simply that Vista needs a non null environment... You can easily fix that, not sure if it should be fixed in tango, as having nil as default was somehow found "better" as default, maybe that should be reconsidered

09/15/09 12:13:09 changed by fawzi

mmh ok I had mixed up with another ticket, but maybe the issue is similar also here...

09/17/09 23:26:30 changed by h3r3tic

  • status changed from new to closed.
  • resolution set to fixed.

(In [4940]) Closes #1738. Tested on Win7, but should work on Vista as well.

09/22/09 20:14:12 changed by torhu

Thanks, I recompiled r4498 with this fix included, and it works fine on Vista now.