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. How to setup a breakpoint on constructor



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















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