This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Using GDB (Cygwin) with MS VC app and GCC modules (DLL)
- From: jim marshall <jim dot marshall at wbemsolutions dot com>
- To: gdb at sourceware dot org
- Date: Fri, 02 Nov 2007 00:57:56 -0400
- Subject: Using GDB (Cygwin) with MS VC app and GCC modules (DLL)
Should I be able to use GDB to load and execute a VC++ application, and
debug DLLs that application loads that where built with gcc?
fwiw:
Windows XP Pro SP2
GNU gdb 6.5.50.20060706-cvs (cygwin-special)
more detail:
I have an application that was compiled with MS Visual C++ 6.0, it is a
"Release" build. This application loads DLLs on demand and executes some
functions in those DLLs. I have built a DLL using gcc (gcc (GCC) 3.4.4
(cygming special, gdc 0.12, using dmd 0.125)) with the debug option (as
well as -mno-cygwin). I would like to use GDB to debug the DLL I developed.
When I run GDB and tell it to start my application ('run' command) it
starts to load the program but eventually GDB 'stops' as it loading
various DLL's
Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll
...
Loaded symbols for /cygdrive/c/Program Files/foo/lib/doo.dll
[1]+ Stopped gdb cwbemserver.exe
and I get bounced down to the xterm shell, if I type 'fg' at the xterm
window GDB will come up:
$ fg
gdb myserver.exe
---Type <return> to continue, or q <return> to quit---
Eventually this will appear to hang:
$ fg
gdb myserver.exe
---Type <return> to continue, or q <return> to quit---q
q
Quit
---Type <return> to continue, or q <return> to quit---
pressing ctrl-c has no affect (pressing <return> just adds an empty line
to the display).
Note that the dll I want to debug has not been loaded at this point.
Please note the application loads and runs fine from a command prompt or
an xterm session in cygwin.
any thoughts?
As an aside, if I start the process and then attach GDB to it, I get a
bit further in that I can set a break point in my DLL but once I hit the
breakpoint things go down hill:
[Switching to thread 5824.0x1f4]
Breakpoint 1, initializeCMPIProvider (dlhandle=0x962114, pProv=0xb75260,
pName=0xb805c0) at ../src/cmpiprovider.c:235
235 if (NULL == (cMIname = createCharFromCIMString(pName))) {
(gdb) n
Warning:
Cannot insert breakpoint -144.
Error accessing memory address 0x61092ded: Input/Output error.
I have 'rwx' permission in the directories that the application is
running in.
Thanks
Jim