Hel debugging windows app with wine(dbg) + gdb

Leo champen at terra.es
Sat Jan 31 03:24:20 CST 2004


Eric Pouech wrote:

>> Hello, thanks for your reply.
>>
>> Do you successfully debug windows apps with wine + gdb ?
>
> yes

Great! Please don't go! :)


>
>> 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:
>
> there are several unrelated errors/issues you need to fix first.
>
>> METHOD 1:
>> ==========
>>
>> ==First xterm:
>> err:wineconsole:WINECON_Fatal Couldn't find a decent font, aborting
>
> that's the first issue. Your a.exe app is a CUI app. You first need to 
> set wineconsole to make it work (basically it doesn't find a fixed 
> font with decent size). It's been a while since we hadn't gotten this 
> error...
> and the rest of the debugging session fails because your debuggee 
> needs the console up & running (and dies prematurely)
> this should work ok even without the --no-start flag


Ok, that's fixed (no console problem), but then another error happens 
(see the log bellow).


>
>> METHOD 2:
>> ==========
>> gdb a.exe
>
> gdb doesn't know nothing about windows application. You should run it 
> with gdb wine-pthread (as I assume your system is -pthread) 


Yes, I tried that too (gdb wine, and gdb wine-pthread), but I don't get 
debug info for my program (just the wine exec).


>
> However, if your a.exe has been compiled with a win32 compiler, you 
> won't get any symbol from it (except if the compiler is mingw)


Yes, my compiler is mingw, and I've tried -gstabs and -ggdb debug formats.



Logs with the WINECONSOLE set:


METHOD1:
=========

== First xterm:

[leo at LeoLux 2]$ export WINECONSOLE=/usr/bin/wineconsole
[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:34369
0000002e:0000002f: create process 'F:\tmp\2\a.exe'/0x4063003c @00401000 
(0<0>)
0000002e:0000002f: create thread I @00401000
0000002e:0000002f: loads DLL C:\WINDOWS\SYSTEM\ntdll.dll @400a0000 (0<0>)
0000002e:0000002f: loads DLL C:\WINDOWS\SYSTEM\kernel32.dll @40330000 (0<0>)
0000002e:0000002f: loads DLL C:\WINDOWS\SYSTEM\msvcrt.dll @40860000 (0<0>)
Unknown option '--use-event=8'

Wine 20040121

Usage: wine [options] [--] program_name [arguments]
The -- has to be used if you specify arguments (of the program)

Options:
   --debugmsg name  Turn debugging-messages on or off
   --dll name       This option is no longer supported
   --help,-h        Show this help message
   --version,-v     Display the Wine version



The program winedbg does not exit at this point, just stays there.



== Second xterm:

[leo at LeoLux 2]$ export WINELOADER=/usr/bin/wine-pthread
[leo at LeoLux 2]$ export WINECONSOLE=/usr/bin/wineconsole
[leo at LeoLux 2]$ gdb /usr/bin/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"...
(no debugging symbols found)...
(gdb) target remote localhost:34369
Remote debugging using localhost:34369
Ignoring packet error, continuing...
Ignoring packet error, continuing...

Ignoring packet error, continuing...
Couldn't establish connection to remote target
Malformed response to offset query, timeout
(gdb)
(gdb) c
The program is not being run.
(gdb) q
[leo at LeoLux 2]$




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

== First xterm:

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

==Second xterm:

[leo at LeoLux 2]$ export WINECONSOLE=/usr/bin/wineconsole
[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"...
(no debugging symbols found)...
(gdb) attach 2573
Attaching to program: /usr/bin/wine-pthread, process 2573
Reading symbols from /usr/lib/wine/libwine.so.1...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/wine/libwine.so.1
Reading symbols from /lib/tls/libpthread.so.0...(no debugging symbols 
found)...
done.
[New Thread 1074271616 (LWP 2573)]
Loaded symbols for /lib/tls/libpthread.so.0
Reading symbols from /lib/tls/libc.so.6...(no debugging symbols 
found)...done.
Loaded symbols for /lib/tls/libc.so.6
Reading symbols from /lib/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/tls/libm.so.6...(no debugging symbols 
found)...done.
Loaded symbols for /lib/tls/libm.so.6
Reading symbols from /lib/ld-linux.so.2...(no debugging symbols 
found)...done.
Loaded symbols for /lib/ld-linux.so.2
Reading symbols from /usr/lib/wine/wine/ntdll.dll.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/wine/wine/ntdll.dll.so
Reading symbols from /usr/lib/wine/libwine_unicode.so.1...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/wine/libwine_unicode.so.1
Reading symbols from /lib/libnss_files.so.2...(no debugging symbols 
found)...
done.
Loaded symbols for /lib/libnss_files.so.2
Reading symbols from /usr/lib/wine/wine/kernel32.dll.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/wine/wine/kernel32.dll.so
Reading symbols from /usr/lib/wine/wine/msvcrt.dll.so...
(no debugging symbols found)...done.
Loaded symbols for /usr/lib/wine/wine/msvcrt.dll.so
0xffffe002 in ?? ()
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1074271616 (LWP 2573)]
0x0040130b in ?? ()
(gdb) bt
#0  0x0040130b in ?? ()
#1  0x00401347 in ?? ()
#2  0x00401182 in ?? ()
#3  0x00401018 in ?? ()
#4  0x4038e077 in SetThreadExecutionState ()
   from /usr/lib/wine/wine/kernel32.dll.so
(gdb)


See, in this backtrace I get debug info for the wine executable.
If I run gdb ./a.exe instead of gdb /usr/bin/wine-pthread, I do get 
(wrong) debug info:


[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 2579
Attaching to program: /home/leo/tmp/2/a.exe, process 2579
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)



I think method 2 seems best (I get debug info), but wrong line numbers.

What am I doing wrong?

Also, I've tried tu run the tests above with WINELOADER=/usr/bin/wine, 
and run wine instead of wine-pthread but same thing happens.


Thanks.












More information about the wine-devel mailing list