public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Attach VC++ application to debug DLL compiled with Gcc
@ 2008-01-09 13:49 Bats Mélanie
  2008-01-10  1:11 ` Pedro Alves
  0 siblings, 1 reply; 3+ messages in thread
From: Bats Mélanie @ 2008-01-09 13:49 UTC (permalink / raw)
  To: gdb

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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Attach VC++ application to debug DLL compiled with Gcc
  2008-01-09 13:49 Attach VC++ application to debug DLL compiled with Gcc Bats Mélanie
@ 2008-01-10  1:11 ` Pedro Alves
  2008-01-10 11:12   ` Bats Mélanie
  0 siblings, 1 reply; 3+ messages in thread
From: Pedro Alves @ 2008-01-10  1:11 UTC (permalink / raw)
  To: Bats Mélanie; +Cc: gdb

Bats Mélanie wrote:

> Attaching to program `/cygdrive/c/MyExe.exe', process 3632
> 
> [2]+  Stopped                 gdb MyExe 3632
> 

It seems gdb got suspended.  As a workaround, enter "fg" (without
quotes) to restore it, and it it should be ok.  I believe
this was fixed after the cygwin gdb package release you're
using.  Please try a recent release or snapshot.

-- 
Pedro Alves

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Attach VC++ application to debug DLL compiled with Gcc
  2008-01-10  1:11 ` Pedro Alves
@ 2008-01-10 11:12   ` Bats Mélanie
  0 siblings, 0 replies; 3+ messages in thread
From: Bats Mélanie @ 2008-01-10 11:12 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb

Hello,

Quoting Pedro Alves <pedro_alves@portugalmail.pt>:

> It seems gdb got suspended.  As a workaround, enter "fg" (without
> quotes) to restore it, and it it should be ok.  I believe
> this was fixed after the cygwin gdb package release you're
> using.  Please try a recent release or snapshot.

That was the problem. I try with gdb 6.7 and it works fine.

Thank you for your help,
Mélanie


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-10 11:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-09 13:49 Attach VC++ application to debug DLL compiled with Gcc Bats Mélanie
2008-01-10  1:11 ` Pedro Alves
2008-01-10 11:12   ` Bats Mélanie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).