Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: gdb@sources.redhat.com
Subject: breakpoints in C++ constructors
Date: Tue, 14 Sep 2004 16:07:00 -0000	[thread overview]
Message-ID: <vt2fz5k6dic.fsf@zenia.home> (raw)


I've been spending some time looking into getting breakpoints in C++
constructors to work right, but I don't have much to say about it yet.
But if there are other people who have thoughts about this, let's talk
about it.

The essential problem is that a single source construct --- a
constructor body for some class C --- gets split into two separate
machine-language functions: one to be used when constructing a direct
instance of class C (the "in charge" constructor), and one to be used
when constructing an instance of some class derived from C (the "not
in charge" constructor), to initialize the portion of the object that
corresponds to the C subclass.

In the following thread, Daniel Jacobowitz and Michael Chastain talked
about the user interface implications of constructing distinct names
for the two instances of the constructor:

   http://sources.redhat.com/ml/gdb/2004-07/msg00161.html

Daniel has done some work on the breakpoint code to separate the
structures that track machine-level breakpoints (either hardware
support or patched instructions) from user-level breakpoints.  The
original intention was to extend this to allow a single user
breakpoint to cover multiple machine-code locations, but that change
hasn't been made yet: the code still assumes a one-to-one
relationship.  Completing this would be the natural way to support
constructor breakpoints.  The MI format for breakpoints would need to
change to report the addresses as a list, and the test cases adapted
accordingly.

The symbol table code would need to be adapted to return multiple
addresses for a given source location.  Since a given source line can
be split into many runs of machine code, a source line may, in
general, appear any number of times in the line tables; we currently
just return the first entry we find, and hope that's appropriate.  To
accomodate constructors, we might consider returning a sal for the
first line table entry for a given source location in each machine-
level function: if a given source line appears nine times in three
separate machine-level functions, we could return a list of three
sals reporting the first occurrence of the line in each function.


             reply	other threads:[~2004-09-14 16:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-14 16:07 Jim Blandy [this message]
2004-09-14 16:15 ` Daniel Jacobowitz
2004-09-14 19:16 ` Andrew Cagney
2004-09-15  0:06   ` Paul Koning
2004-09-16 19:17     ` Jim Blandy
2004-09-14 19:38 ` Paul Gilliam

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=vt2fz5k6dic.fsf@zenia.home \
    --to=jimb@redhat.com \
    --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