debugging wine itself with GDB

Eric Pouech eric.pouech at
Wed Apr 13 14:08:50 CDT 2011

Le 12/04/2011 22:50, joedude at a écrit :
> I was taking a look at
> to see how to debug wine with gdb,
> and there was reference to starting up gdb using wine-pthread, but I see no
> such executable now.
> I can attach gdb after it starts to run, but then do not get all the symbol
> information.
> There is wine-preloader but it seems to want an ELF file as an argument.
there several ways to do it (assuming you've compiled yourself the 
sourcing and running from the source tree)

1/ using the gdb proxy from winedbg. you'll the a gdb front end, using 
winedbg's builtin gdb proxy
wine winedbg --gdb winemine

2/ attach to a running process
from shell prompt> wine winemine
/// get unix pid of wine, says 1234 (ps)
from shell prompt> gdb loader/wine
from gdb prompt> attach 1234

(some latest unix distro forbids attaching to a running process unless 
you're root or you've turned off this feature. refer to your distro doc 
if this happens)

3/ start process from gdb
from shell prompt> gdb loader/wine
     /// you may want here to set up some breakpoints first (gdb doesn't 
break at program startup routine, which winedbg does)
     /// don't use main as the break address target, you'll get the 
loader's one, not wine's exec which is bad
     /// WinMain is fine (unless your apps is CUI)
from gdb prompt> run winemine
from gdb prompt> exec-file loader/wine
     (say yes)
from gdb prompt> sharedlibrary
     /// you should be all set

which method to use ? up to you <g>
method 2 doesn't allow to debug program startup, but is a bit easier 
than 3/ to use
method 2 or 3 gives you full gdb features, but you have to also 
understand some wine's internal (shared lib vs DLL)
method 1/ allows you to get access to some of the wine internals (see 
docs) from gdb


Eric Pouech
"The problem with designing something completely foolproof is to underestimate the ingenuity of a complete idiot." (Douglas Adams)

More information about the wine-devel mailing list