Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Heiko Gerdau" <hg@technosis.de>
To: <gdb@sources.redhat.com>
Subject: RE: gdb and Dll
Date: Thu, 28 Nov 2002 04:40:00 -0000	[thread overview]
Message-ID: <000401c296db$49e39110$fe78a8c0@SOL> (raw)
In-Reply-To: <20021128030836.GC28113@redhat.com>

> >>>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




  reply	other threads:[~2002-11-28 12:40 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-27  1:13 Heiko Gerdau
2002-11-27  8:11 ` Joel Brobecker
2002-11-27 16:52 ` Christopher Faylor
2002-11-27 16:57   ` Andrew Cagney
2002-11-27 17:11     ` Christopher Faylor
2002-11-27 19:08       ` Christopher Faylor
2002-11-28  4:40         ` Heiko Gerdau [this message]
2002-11-28 18:15           ` Christopher Faylor
2002-11-29  4:27             ` Heiko Gerdau
2002-11-28 14:31       ` Andrew Cagney

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='000401c296db$49e39110$fe78a8c0@SOL' \
    --to=hg@technosis.de \
    --cc=gdb@sources.redhat.com \
    /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