This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Attach VC++ application to debug DLL compiled with Gcc


Hello,

My purpose is to use GDB to load and execute a VC++ application and debug DLL built with gcc that are loaded dynamically by the application.

I am using gcc and gdb with cygwin on windows XP:
gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)
GNU gdb 6.5.50.20060706-cvs (cygwin-special)

First, I have an executable compiled with Visual C++, then I developped a shared library compiled with gcc.
The shared library is loaded dynamically by the executable. The program is running correctly when I launch it from cygwin.


Now, I am trying to use gdb to debug the shared library compiled with gcc with -g3 option. The VC++ executable is built in release mode.

I have tried :
1- Launch my executable and launch gdb giving my executable.
$ gdb -q SIL_Test_Enhanced.exe
(no debugging symbols found)

(gdb) run
Starting program: /cygdrive/c/MyExe.exe

[2]+ Stopped gdb MyExe.exe

Gdb stopped directly...

2- Launch my executable and get its PID - 3632. Call gdb giving my executable and its PID.
$ gdb -q MyExe 3632
(no debugging symbols found)


Attaching to program `/cygdrive/c/MyExe.exe', process 3632

[2]+ Stopped gdb MyExe 3632

Same thing...

3- Launch my executable and get its PID - 3632. Launch gdb to debug my gdb and attach the executable.
$ gdb -q gdb
(gdb) run -q -p 3632
Starting program: /usr/bin/gdb.exe -q -p 3632
Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll
Loaded symbols for /usr/bin/cygwin1.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll
Loaded symbols for /usr/bin/cygiconv-2.dll
Loaded symbols for /usr/bin/cygintl-3.dll
Loaded symbols for /usr/bin/cygncurses-8.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/comdlg32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/shlwapi.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/gdi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/user32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/msvcrt.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/comctl32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/shell32.dll
Loaded symbols for /usr/bin/tcl84.dll
Loaded symbols for /usr/bin/tk84.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/imm32.dll
Attaching to process 3632
---Type <return> to continue, or q <return> to quit---
Load new symbol table from "/cygdrive/c/MyExe.exe"? (y or n) y
Reading symbols from /cygdrive/c/MyExe.exe...done.
Loaded symbols for /cygdrive/c/WINDOWS/system32/ntdll.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/kernel32.dll
Loaded symbols for /cygdrive/c/SocketCommDll.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/iphlpapi.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/advapi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/rpcrt4.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/secur32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/msvcrt.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/user32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/gdi32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/ws2_32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/ws2help.dll
Loaded symbols for /cygdrive/c/TestDriver.dll
Loaded symbols for /cygdrive/c/SettingManagerDll.dll
Loaded symbols for /cygdrive/c/WINDOWS/WinSxS/x86_Microsoft.VC80.MFC_1fc8b3b9a1e
18e3b_8.0.50727.762_x-ww_3bf8fa05/mfc80u.dll
Loaded symbols for /cygdrive/c/WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e
18e3b_8.0.50727.762_x-ww_6b128700/msvcr80.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/shlwapi.dll
Loaded symbols for /cygdrive/c/FileBrowser.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/shell32.dll
Loaded symbols for /cygdrive/c/WINDOWS/WinSxS/x86_Microsoft.VC80.CRT_1fc8b3b9a1e
18e3b_8.0.50727.762_x-ww_6b128700/msvcp80.dll
Loaded symbols for /cygdrive/c/BunchLoader.dll
Loaded symbols for /cygdrive/c/HelperThread.dll
Loaded symbols for /cygdrive/c/WINDOWS/WinSxS/x86_Microsoft.Windows.Common-Contr
ols_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03/comctl32.dll
Loaded symbols for /cygdrive/c/WINDOWS/WinSxS/x86_Microsoft.VC80.MFCLOC_1fc8b3b9
a1e18e3b_8.0.50727.762_x-ww_91481303/mfc80FRA.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/MSCTF.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/uxtheme.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/mswsock.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/hnetcfg.dll
Loaded symbols for /cygdrive/c/WINDOWS/System32/wshtcpip.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/dnsapi.dll
Loaded symbols for /cygdrive/c/WINDOWS/System32/winrnr.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/wldap32.dll
Loaded symbols for /cygdrive/c/WINDOWS/system32/rasadhlp.dll
(gdb)
MyGccDll.dll
[Switching to thread 3820.0xd54]
(gdb) break MyDllFile.cpp:60
Breakpoint 1 at 0xd51cec: file ../src/MyDllFile.cpp, line 60.
(gdb) continue
Continuing.
[Switching to thread 3572.0xe58]


Breakpoint 1, MyDllFunction () at ../src/MyDllFile.cpp:60
60              myfile.open ("C:\\log.txt", ios::app);
Current language:  auto; currently c++
(gdb)

So it works I can put breakpoint and gdb will stop on it.

But it is quiet weird ...does someone have an idea? Why it is working in this case and not when I try to attach the process normally?

Thanks for any help,
MÃlanie

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]