This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: breakpoints in C++ constructors


There are some simpler problems whose solution would make supporting
C++ constructors a bit easier.

For example, what if we first tried to get this case working:


foo.c:

#include <stdio.h>

int
f1 (int x)
{
#include <body.h>        
}

int
f2 (int x)
{
#include <body.h>
}

int
main (int argc, char *argv)
{
  printf ("%d\n", f2 (f1 (1)));
}


body.h:
return x * 2;


Setting a breakpoint at body.h:1 ought to result in breakpoint hits in
f1 and f2.  Making this work requires addressing:

- symtab issues: decode_all_digits needs to return all the locations.
  etc. 

- user interface issues: How do we list breakpoints with multiple
  address?  How do they appear in MI?

- mechanism issues: we have to get breakpoint insertion and removal
  right.  If the breakpoint is conditional, we need separate parsed
  versions of the condition for each location, since each location's
  expression is (potentially) being evaluated in a different block.
  etc. 

I think getting this working would make breakpoints by source location
in constructors work: it's the same source location appearing in more
than one physical function.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]