Debugging mingw applications using wine

Bryce McKinlay mckinlay at redhat.com
Sat Jan 1 16:53:46 CST 2005


I'm trying to debug a windows .exe built with mingw using wine, but 
winedbg seems to have problems reading stabs from the mingw-built 
binary. My goal is to be able to debug a cross-compiled, native Java 
(GCJ) application, but even a simple C "hello world" seems to cause 
problems.

My cross-build environment consists of:

- mingw-runtime-3.5 and w32api-3.1from mingw.org - I just used the 
pre-built binaries
- stock binutils 2.15, configured with --target=mingw32
- CVS head gcc 4.0, configured with --target=mingw32

WINE is wine-0.20040914-1.rhfc2.nr from newrpms.sunsite.dk

$ mingw32-gcc hello.c -o hello-mingw.exe -g

$ wine ./hello-mingw.exe
Hello World

$ winedbg --gdb ./hello-mingw.exe
0000000a:0000000b: create process 'D:\tests\hello-mingw.exe'/0x77bd003c 
@00401220 (0<0>)
wine: Unhandled exception (thread 0009), starting debugger...
WineDbg starting on pid 0x8
Unhandled exception: page fault on read access to 0xb6e4d174 in 32-bit 
code (0x657997a3).
In 32 bit mode.
Register dump:
 CS:0073 SS:007b DS:007b ES:007b FS:003b GS:0033
 EIP:657997a3 ESP:5b56bc7c EBP:5b56ed78 EFLAGS:00210246(   - 00      -RIZP1)
 EAX:b6e4d174 EBX:151409b8 ECX:00000000 EDX:261955dc
 ESI:00000000 EDI:b6e4d174
Stack dump:
0x5b56bc7c:  15135de8 b6e4d174 00000002 00010000
0x5b56bc8c:  00000000 00000000 00000000 00000000
0x5b56bc9c:  00000000 00000000 00000000 5b56cd6c
0x5b56bcac:  00000001 00000000 00000000 00000000
0x5b56bcbc:  ffffffff ffffffff 00000000 7fc07000
0x5b56bccc:  7fc06000 00010000 7f980078 000000d5
Backtrace:
=>1 0x657997a3 (0x5b56ed78)
  2 0x15132ec0 (0x5b56edc8)
  3 0x1513371c pe_load_debug_info+0x16c in dbghelp (0x5b56ee04)
  4 0x1513391a pe_load_module+0x1ba in dbghelp (0x5b56ef54)
  5 0x1512d93e SymLoadModule+0x9e in dbghelp (0x5b56ef94)
  6 0x15129fd3 (0x5b56f4d8)
  7 0x1512a129 SymInitialize+0x119 in dbghelp (0x5b56f518)
  8 0x6101906a (0x5b56f650)
  9 0x6101cfba (0x5b56f8e4)
  10 0x6101d39a (0x5b56f970)
  11 0x6101d422 gdb_remote+0x32 in winedbg (0x5b56fe44)
  12 0x610279ec main+0x11c in winedbg (0x5b56fe90)
  13 0x610122f1 (0x5b56ff20)
  14 0x4824e0e2 (0x5b56fff4)
  15 0x43940f31 (0x00000000)
....

I've attached the mingw-compiled C binary. Is it worth trying again with 
a newwer WINE? Thanks!

Bryce

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-mingw.exe.gz
Type: application/x-gzip
Size: 8244 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20050101/7f2b30b1/hello-mingw.exe.bin


More information about the wine-devel mailing list