Hel debugging windows app with wine(dbg) + gdb

Leo champen at terra.es
Fri Jan 30 15:53:18 CST 2004


Eric Pouech wrote:

> Leo a écrit :
>
>>
>>
>> Hi,
>>
>> I don't know if this is the place to ask this, but anyway here it goes:
>>
>> I'm trying to debug a windows application using wine.
>
> set WINELOADER environment variable to point to your wine binary 
> before running winedbg
> A+
>
>



Hello, thanks for your reply.

Do you successfully debug windows apps with wine + gdb ?

I've tried setting that env variable, but it's even worse in method 1 
bellow.

I'm pasting the xterm outputs for my attempts:



METHOD 1:
==========

==First xterm:

[leo at LeoLux 2]$ export WINELOADER=/usr/bin/wine-pthread
[leo at LeoLux 2]$ winedbg -- --gdb --no-start a.exe
Using wine_path: /usr/bin/wine-pthread
target remote localhost:33199
0000000a:0000000b: create process 'F:\tmp\2\a.exe'/0x4063003c @00401000 
(0<0>)
0000000a:0000000b: create thread I @00401000
0000000a:0000000b: loads DLL C:\WINDOWS\SYSTEM\ntdll.dll @400a0000 (0<0>)
0000000a:0000000b: loads DLL C:\WINDOWS\SYSTEM\kernel32.dll @40330000 (0<0>)
0000000a:0000000b: loads DLL C:\WINDOWS\SYSTEM\msvcrt.dll @40860000 (0<0>)
err:wineconsole:WINECON_Fatal Couldn't find a decent font, aborting

0000000a:0000000b: exit process (0)
wine-pthread: gdbproxy.c:1625: packet_query: Assertion `gdbctx->process 
&& gdbctx->process->threads' failed.
wine: Unhandled exception (thread 0009), starting debugger...
WineDbg starting on pid 8
No debug information in ELF '/usr/bin/wine-pthread' ((nil))
Breakpoint 1 at 0x4000cfc0
No debug information in ELF '/usr/lib/wine/libwine.so.1' (0x40034000)
No debug information in ELF '/lib/tls/libpthread.so.0' (0x4004d000)
No debug information in ELF '/lib/libdl.so.2' (0x4005b000)
No debug information in ELF '/lib/tls/libm.so.6' (0x4005f000)
No debug information in ELF '/lib/ld-linux.so.2' (0x40000000)
No debug information in ELF '/usr/lib/wine/wine/ntdll.dll.so' (0x40082000)
No debug information in ELF '/usr/lib/wine/libwine_unicode.so.1' 
(0x400f8000)
No debug information in ELF '/lib/libnss_files.so.2' (0x40018000)
No debug information in ELF '/usr/lib/wine/wine/kernel32.dll.so' 
(0x40300000)
No debug information in ELF '/usr/lib/wine/wine/winedbg.exe.so' (0x40642000)
No debug information in ELF '/usr/lib/wine/wine/advapi32.dll.so' 
(0x407b0000)
No debug information in 32bit DLL 'C:\WINDOWS\SYSTEM\winedbg.exe' 
(0x40650000)
No debug information in 32bit DLL 'C:\WINDOWS\SYSTEM\NTDLL.DLL' (0x400a0000)
No debug information in 32bit DLL 'C:\WINDOWS\SYSTEM\KERNEL32.DLL' 
(0x40330000)
No debug information in 32bit DLL 'C:\WINDOWS\SYSTEM\ADVAPI32.DLL' 
(0x407c0000)
Unhandled exception: assertion failed in 32-bit code (0xffffe002).
In 32-bit mode.
0xffffe002 (NTDLL.DLL.memcpy+0xbdf81a22): *** Invalid address 0xffffe002 
(NTDLL.DLL.memcpy+0xbdf81a22)
-- no code --
Wine-dbg>



== Second xterm:

[leo at LeoLux 2]$ export WINELOADER=/usr/bin/wine-pthread 
[leo at LeoLux 2]$ gdb wine-pthread
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) target remote localhost:33199
Remote debugging using localhost:33199
Ignoring packet error, continuing...
Ignoring packet error, continuing...
Couldn't establish connection to remote target
Malformed response to offset query, timeout
(gdb)




METHOD 2:
==========

==First xterm:

[leo at LeoLux 2]$ export WINELOADER=/usr/bin/wine-pthread
[leo at LeoLux 2]$ wine-pthread a.exe &
[1] 2780
[leo at LeoLux 2]$


==Second xterm:

[leo at LeoLux 2]$ export WINELOADER=/usr/bin/wine-pthread 
[leo at LeoLux 2]$ gdb a.exe
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain 
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...
(gdb) attach 2780
Attaching to program: /home/leo/tmp/2/a.exe, process 2780
0xffffe002 in ?? ()
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x0040130b in f() () at a.cpp:11
11      {
(gdb) bt
#0  0x0040130b in f() () at a.cpp:11
#1  0x00401347 in main () at a.cpp:21
#2  0x00401182 in _image_base__ ()
#3  0x00401018 in _image_base__ ()
#4  0x4038e077 in ?? ()
(gdb)




Backtrace indicates files line numbers for first line in each function.
Obviously line 11 in a.cpp above doesn't have a valid statement.


a.cpp is:



#include <stdlib.h>
// #include <sys/time.h>
// #include <sys/times.h>
// #include <unistd.h>
#include <windows.h>


void f()
{ // this is line 11
        int a=0;
        for (int i=0; i<10; i++)
                a*=2;

        *(char *)0=0;

}

main()
{ // this is line 21
        Sleep(10000);
        f();
}










More information about the wine-devel mailing list