From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 963 invoked by alias); 9 Jan 2008 13:49:11 -0000 Received: (qmail 946 invoked by uid 22791); 9 Jan 2008 13:49:10 -0000 X-Spam-Check-By: sourceware.org Received: from ns6.enix.org (HELO the-doors.enix.org) (193.19.211.1) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Jan 2008 13:48:35 +0000 Received: by the-doors.enix.org (Postfix, from userid 33) id 8C87A91DEB; Wed, 9 Jan 2008 14:48:32 +0100 (CET) Received: from proxy17.netz.sbs.de (proxy17.netz.sbs.de [192.35.17.29]) by the-doors.enix.org (Horde MIME library) with HTTP; Wed, 09 Jan 2008 14:48:32 +0100 Message-ID: <20080109144832.yz2ss53a8go0g80o@the-doors.enix.org> Date: Wed, 09 Jan 2008 13:49:00 -0000 From: Bats =?utf-8?b?TcOpbGFuaWU=?= To: gdb@sourceware.org Subject: Attach VC++ application to debug DLL compiled with Gcc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable User-Agent: Internet Messaging Program (IMP) H3 (4.1.3) X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-01/txt/msg00057.txt.bz2 Hello, My purpose is to use GDB to load and execute a VC++ application and=20=20 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=20=20 developped a shared library compiled with gcc. The shared library is loaded dynamically by the executable. The=20=20 program is running correctly when I launch it from cygwin. Now, I am trying to use gdb to debug the shared library compiled with=20=20 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=20=20 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=20=20 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 to continue, or q 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=20=20 /cygdrive/c/WINDOWS/WinSxS/x86_Microsoft.VC80.MFC_1fc8b3b9a1e 18e3b_8.0.50727.762_x-ww_3bf8fa05/mfc80u.dll Loaded symbols for=20=20 /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=20=20 /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=20=20 /cygdrive/c/WINDOWS/WinSxS/x86_Microsoft.Windows.Common-Contr ols_6595b64144ccf1df_6.0.2600.2982_x-ww_ac3f9c03/comctl32.dll Loaded symbols for=20=20 /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=20=20 in this case and not when I try to attach the process normally? Thanks for any help, M=C3=A9lanie ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.