From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30515 invoked by alias); 28 Nov 2002 12:40:32 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 30508 invoked from network); 28 Nov 2002 12:40:31 -0000 Received: from unknown (HELO waldorf.webpack.hosteurope.de) (217.115.142.71) by sources.redhat.com with SMTP; 28 Nov 2002 12:40:31 -0000 Received: from SOL (pD9E33FD5.dip.t-dialin.net [217.227.63.213]) (authenticated) by waldorf.webpack.hosteurope.de (8.11.6/8.11.6) with ESMTP id gASCeoK32551; Thu, 28 Nov 2002 13:40:50 +0100 From: "Heiko Gerdau" To: Subject: RE: gdb and Dll Date: Thu, 28 Nov 2002 04:40:00 -0000 Message-ID: <000401c296db$49e39110$fe78a8c0@SOL> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-Reply-To: <20021128030836.GC28113@redhat.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2002-11/txt/msg00411.txt.bz2 > >>>There is one long-standing "gotcha" in debugging dlls > however. Currently > >>>you can only set breakpoints on line numbers not on symbol > names if the > >>>dll is not loaded. That is you can't do: > >>> > >>> dll-symbols foo.dll > >>> bp foo > >>> > >>>You have to, instead do: > >>> > >>> dll-symbols foo.dll > >>> list foo > >>> bp eather case does not work for me. I tried with GNU gdb 2002-07-19-cvs (cygwin-special) that comes with the cygwin distribution and with gdb-5.2.1 from mingw. I'm new to gdb so maybe I miss something else. Here is what I'm doing (with the cygwin version): First try: ----------- gdb -nw myproc.exe GNU gdb 2002-07-19-cvs (cygwin-special)...... (gdb) directory /cygdrive/d/test Source directories searched: /cygdrive/d/test:$cdir:$cwd (gdb) break main Breakpoint 1 at 0x6314da: file main.cpp, line 133. (gdb) run Starting program: /cygdrive/d/test/bin/myproc.exe Breakpoint 1, main (argc=1, argv=0x37da990) at risk.cpp:133 133 int lReturn = 0 ; (gdb) dll-symbols mydll.dll (gdb) list Data2String No line number known for Data2String. (gdb) break subs.cpp:182 Breakpoint 2 at 0x100268cf: file subs.cpp, line 182. (gdb) c Continuing. warning: Cannot insert breakpoint 2: Cannot access memory at address 0x100268cf -------------------------------------------------- Second Try: ------------ gdb -nw mydll.dll GNU gdb 2002-07-19-cvs (cygwin-special).... (gdb) directory /cygdrive/d/test Source directories searched: /cygdrive/d/test:$cdir:$cwd (gdb) list Data2String 176 // 177 // 178 //////////////////////////////////////////////////////////////////////// /////// 179 char* 180 Data2String( COLDATATYPE cdt, double dVal, const char* pszVal, char* pszData, long len ) 181 { 182 if ( NULL == pszData || 0 == len ) 183 return 0 ; 184 185 // set the string to empty (will be checked later) (gdb) break 182 Breakpoint 1 at 0x100268cf: file subs.cpp, line 182. (gdb) exec-file myproc.exe (gdb) run Starting program: /cygdrive/d/test/bin/myproc.exe warning: Cannot insert breakpoint 1: Cannot access memory at address 0x100268cf ----------------------------------------------------- I also tried to set a breakpoint into DllMain with a different result: this time gdb did not complain about accessing memory but on the other hand did not break. > The GNATS id is 780 and the patch enclosed therein seems to work ok. Before I learn how to build it myself, could you send me the gdb.exe containing those patches so that I can try that version? Thank you Greetings Heiko