Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* breakpoints in C++ constructors
@ 2004-09-14 16:07 Jim Blandy
  2004-09-14 16:15 ` Daniel Jacobowitz
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jim Blandy @ 2004-09-14 16:07 UTC (permalink / raw)
  To: gdb


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.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-09-16 19:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-14 16:07 breakpoints in C++ constructors Jim Blandy
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox