This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
RE: gdb and Dll
- From: "Heiko Gerdau" <hg at technosis dot de>
- To: <gdb at sources dot redhat dot com>
- Date: Thu, 28 Nov 2002 13:39:57 +0100
- Subject: RE: gdb and Dll
> >>>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 <first line of foo>
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