Re: Windows: How to debug a gtk library function when app built with MSVC ?

Tor Lillqvist wrote:
Is it possible to use MinGW GDB when stepping into the
libgtk-win32 DLL (from an MSVC compiled app) ?

Yes, it should be possible. Attaching to an already running process
might be the easiest way, so that the mingw-built DLLs are already
present. (Otherwise, you would have to set a so-called "pending"
breakpoint in gdb before you start the program, and I am not entirely
sure that actually works in gdb on Windows.)

After attaching, you should be able to set breakpoints in the
mingw-built bits. However, to be really useful you need them to be
built with -g, of course. The prebuilt binarires on are

However, if you have a look at the cross-compiled stuff in the
openSUSE Build Service
) you will find separate "debug" packages that contain the debugging
information (i.e. the debug information sections from the executables
split out into separate files with objcopy, with just a so-called
"gbu-debuglink" section left behind pointing to the separate file with
debugging information. Gdb supports this just fine.)

(Those packages in the openSUSE Build Service are for now available
only in RPM format; However for an experienced hacker it is farily
trivial to use rpm2cpio etc to pick out the subtree with the Windows
stuff from such "noarch" RPMs and copy it over to a Windows box. You
can even install the corresponding src.rpm packages and unpack with
rpmbuild -bp and then set up a Samba share so that you on the Windows
box have a c:\usr\src\packages folder that is a symlink to the
unpacked sources on a Linux box, or something like that. Then you will
in gdb on the Windows box also see the sources from which the binaries
were actually compiled.)

Do I need to build the GTK DLL with MSVC so I can use the MSVC debugger?

Unfortunately, yes. It would be very nice if Microsoft would add some
basic support for stabs and dwarf debugging information into the
Visual Studio debugger. I am not asking for 100% functionality; just
basic setting of breakpoints, single stepping and printing and
assigning C variables would be nice. (I.e., I would not expect any
complex C++ crack to even be attempted.) But I am not holding my


Thanks for the quick detailed reply ....

I'm running Linux in a VM on my Windows box; some directories shared from Windows are mounted in the Linux VM. It sounds like I ought to be able to do something like the above just by doing the unpacking to a shared directory on my Linux system.

There's aways something new to learn ....   :)

Bill Meier

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]