public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Bats Mélanie" <melanie.bats@enix.org>
To: gdb@sourceware.org
Subject: Attach VC++ application to debug DLL compiled with Gcc
Date: Wed, 09 Jan 2008 13:49:00 -0000	[thread overview]
Message-ID: <20080109144832.yz2ss53a8go0g80o@the-doors.enix.org> (raw)

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.

             reply	other threads:[~2008-01-09 13:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-09 13:49 Bats Mélanie [this message]
2008-01-10  1:11 ` Pedro Alves
2008-01-10 11:12   ` Bats Mélanie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080109144832.yz2ss53a8go0g80o@the-doors.enix.org \
    --to=melanie.bats@enix.org \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).