Debugging 64-bit Wine Apps with winedbg

Tom Grubbe tgrubbe at esri.com
Thu Sep 23 15:09:17 CDT 2010


It's good to know someone else is also seeing these problems.  In fact here's my tiny test app that should produce a backtrace but does not with winedbg 64-bit:

% cat Crash.cpp 
#include <stdio.h>

extern "C" void crash_func()
{
  char* p = 0;
  *p = 'x';
}

extern "C" int main()
{
  crash_func();
  return 0;
}

% wine64 /hex1/test/Crash/x64/Debug/Crash.exe 
fixme:heap:HeapSetInformation 0x2ad170690000 0 0x2ad17068fcb0 4
wine: Unhandled page fault on write access to 0x00000000 at address 0x140001046 (thread 0009), starting debugger...
Unhandled exception: page fault on write access to 0x00000000 in 64-bit code (0x0000000140001046).
Register dump:
 rip:0000000140001046 rsp:00002ad17068fca0 rbp:0000000140001220 eflags:00010206 (  R- --  I   - -P- )
 rax:0000000000000000 rbx:00002ad16cab9000 rcx:0000000000000000 rdx:00002ad170691230
 rsi:0000000000000000 rdi:00002ad17068fcb0  r8:00002ad1706919f0  r9:0000000000000004 r10:00002ad170691290
 r11:0000000010341ff0 r12:0000000000000000 r13:00002ad16cc72860 r14:00000001400000f0 r15:00002ad16cabc000
Stack dump:
0x00002ad17068fca0:  0000000000000000 cccccccccccccccc
0x00002ad17068fcb0:  00002ad17068fce0 000000014000107f
0x00002ad17068fcc0:  cccccccccccccccc cccccccccccccccc
0x00002ad17068fcd0:  cccccccccccccccc cccccccccccccccc
0x00002ad17068fce0:  00002ad16cfa5320 00000001400013d2
0x00002ad17068fcf0:  0000000100000001 0000000140006220
0x00002ad17068fd00:  00002ad16cab9000 00000001400018f5
0x00002ad17068fd10:  0000000000000000 0000000000000000
0x00002ad17068fd20:  0000000000000000 00002ad170690000
0x00002ad17068fd30:  0000000000000000 00005b5ac0000005
0x00002ad17068fd40:  00002ad17068e9e8 0000000000000000
0x00002ad17068fd50:  0000000000000000 000000014000122e
Backtrace:
0x0000000140001046: movb        $0x78,(%rax)
Modules:
Module  Address                                 Debug info      Name (14 modules)
PE              10200000-        1034f000       Deferred        msvcr90d
PE              40000000-        4000e000       Deferred        crash
ELF             7be00000-        7c102000       Deferred        <wine-loader>
ELF           3bdc200000-      3bdc41d000       Deferred        ld-linux-x86-64.so.2
ELF           3bdc600000-      3bdc957000       Deferred        libc.so.6
ELF           3bdca00000-      3bdcc83000       Deferred        libm.so.6
ELF           3bdce00000-      3bdd004000       Deferred        libdl.so.2
ELF           3bdd200000-      3bdd41b000       Deferred        libpthread.so.0
ELF           3be1200000-      3be140e000       Deferred        libgcc_s.so.1
ELF         2ad16c07d000-    2ad16c3ad000       Deferred        libwine.so.1
ELF         2ad16c3d4000-    2ad16c6b9000       Deferred        ntdll<elf>
  \-PE      2ad16c3f0000-    2ad16c6b9000       \               ntdll
ELF         2ad16cc05000-    2ad16cfa6000       Deferred        kernel32<elf>
  \-PE      2ad16cc20000-    2ad16cfa6000       \               kernel32
Threads:
process  tid      prio (all id:s are in hex)
00000008 (D) Z:\hex1\test\Crash\x64\Debug\Crash.exe
        00000009    0 <==
0000000e services.exe
        00000016    0
        00000015    0
        00000014    0
        00000010    0
        0000000f    0
00000011 winedevice.exe
        00000017    0
        00000013    0
        00000012    0
00000018 explorer.exe
        00000019    0
Backtrace:
err:seh:setup_exception nested exception on signal stack in thread 0009 eip 0000003bdd20bc05 esp 00002ad16cabef68 stack 0x2ad170592000-0x2ad170690000


--Tom Grubbe x2609


-----Original Message-----
From: Peter Urbanec [mailto:winehq.org at urbanec.net] 
Sent: Thursday, September 23, 2010 10:05 AM
To: wine-devel at winehq.org
Subject: Re: Debugging 64-bit Wine Apps with winedbg


  On 23/09/10 06:51, Tom Grubbe wrote:
> problem seems to be getting any kind of stack trace information from 
> the 64-bit winedbg.  This used to work with the 32-bit version of winedbg.

I can confirm that wine64 winedbg can not produce valid backtraces for 
multi-threaded programs (.exe + .pdb) generated by the VS2005 64-bit 
compiler.

I get something like the following:

Backtracing for thread 001a in process 0008 (Z:\amd64\MultipleThreads.exe):
Backtrace:
=>0 0x00007f68d08925ab __libc_read+0x2b() in libpthread.so.0 
(0x00007f68ceb3c7a0)

Backtracing for thread 0019 in process 0008 (Z:\amd64\MultipleThreads.exe):
Backtrace:
=>0 0x00007f68d08925ab __libc_read+0x2b() in libpthread.so.0 
(0x00007f68cec4c7a0)

Backtracing for thread 0018 in process 0008 (Z:\amd64\MultipleThreads.exe):
Backtrace:
=>0 0x00007f68d08925ab __libc_read+0x2b() in libpthread.so.0 
(0x00007f68ced5c320)

Backtracing for thread 0009 in process 0008 (Z:\amd64\MultipleThreads.exe):
Backtrace:
=>0 0x00007f68d08925ab __libc_read+0x2b() in libpthread.so.0 
(0x00007f68cef7deb0)
0x00007f0d2737b5ab __libc_read+0x2b in libpthread.so.0: syscall

Testing on Gentoo x86_64, with wine 1.3.2. Identical source code 
compiled with VS2005 32-bit compiler running under wine32 produces valid 
backtraces, although they suffer from bug #20617


> * Setting WINEDEBUG to several debug channels has helped some but is 
> difficult to sift through all the noise

I don't get much joy from WINEDEBUG output because the crash I encounter 
appears to be in a DLL initialisation routine called / calling code from 
Microsoft.VC80.CRT redist code. I can't use the wine msvcrt/msvcp 
implementations because they are missing implementations for several 
functions.

> So any info on strategies to debug 64-bit Wine applications is welcome


I would also like to hear any tips for debugging under wine64. I'm 
finding that even the minidump files produced by wine64 are not much use 
in VS2005 or VS2008. At least the minidumps from wine32 can provide a 
little bit of info when loaded into VS2008 debugger.

I'm happy to provide test source code, 64-bit and 32-bit binaries and 
matching PDB files, if anyone is interested in looking at the issue.

Cheers,

     Peter Urbanec




More information about the wine-devel mailing list