Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: David Lecomber <david@allinea.com>
To: Michael Stout <stout@evolution.com>
Cc: gdb <gdb@sources.redhat.com>
Subject: Re: Re. How to setup a breakpoint on constructor
Date: Wed, 09 Mar 2005 22:55:00 -0000	[thread overview]
Message-ID: <1110409385.8084.24.camel@cpc2-oxfd5-5-0-cust103.oxfd.cable.ntl.com> (raw)
In-Reply-To: <422F7A0B.6080807@evolution.com>

Hi Michael,

I tried the same -- and am happily using a GDB with working constructors
- and (bonus) working breakpoints for compilers that generate different
versions of the same function in the same executable - eg. Intel's
compiler which has specific optimizations depending on what's under the
hood.

http://sources.redhat.com/ml/gdb-patches/2004-10/msg00241.html

The general consensus back then to my solution was "ok, it works, but it
ain't how we'd like to fix it".  Looks like we've both come up with
broadly the same.  

We're still waiting for the "Right Thing" [TM] to appear... sigh.. not
sure who's thinking about this one at the moment.

d.



On Wed, 2005-03-09 at 14:34 -0800, Michael Stout wrote:
> I've hacked my gdb sources to get breakpoints to work on constructors.  
> Well it seems to work.
> see
> 
> http://sources.redhat.com/ml/gdb/2004-07/msg00162.html
> 
> and
> 
> http://sources.redhat.com/ml/gdb/2004-07/msg00163.html
> 
> which explains  the issue with multiple copies of the constructor
> 
> Here is my analysis from someone who is completely unfamiliar with gdb:
> There are two essential problems
> 
> 1) gdb assumes there is a one-to-one mapping between a 
> file-linenumber-symbol-table and file:linenumber entered by
> the user. 
> 
> a) find_line_common in symtab.c currently only returns one index into 
> the linnumber-symbol-table where it should
> be able to return multiple line numbers.
> b) the same is true for find_line_symtab
> c) decode_all_digits in linespec.c calls fine_line_symtab needs to 
> handle the multiple values returned by find_line_symtab
> 
> 2) gdb assumes a one-to-one mapping between a breakpoint number and a 
> breakpoint address.  I hacked my fix by
> using the breakpoint::releated_breakpoint but I don't think this is not 
> a good fix.
> 
> 
> To fix this requires a load of changes.  I'm willing to start submitting 
> patches to get this to work, but I need to have someone
> look over my shoulder.  The first step would be to modify modify 
> find_line_common to return multiple indexes.
> 
> Here is a simple sample program that illustrates the problem
> 
> class gobo
> {
> public:
>     gobo();
>     int i;
> };
> 
> gobo ::gobo()
> {
>     i = 4;
> }
> 
> int main(int argc,int **argv)
> {
>     gobo flagger;
> }
> 
> g++ -g -o foo foo.cpp (g++ 3.3.5 debian)
> gdb foo
> break foo.cpp:10
> run
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
-- 
David Lecomber <david@allinea.com>


  reply	other threads:[~2005-03-09 22:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-09 22:35 Michael Stout
2005-03-09 22:55 ` David Lecomber [this message]
2005-03-09 23:45   ` Michael Stout

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=1110409385.8084.24.camel@cpc2-oxfd5-5-0-cust103.oxfd.cable.ntl.com \
    --to=david@allinea.com \
    --cc=gdb@sources.redhat.com \
    --cc=stout@evolution.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