This is the mail archive of the gdb@sourceware.cygnus.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]

Breakpoints in C++ template functions?


Hello,

I have an annoying problem with setting breakpoints inside C++ functions
that are declared as templates,
for example:

template<class CL>
void func(CL *poin)
    {
    ....
    interesting_statement;
    ....
    }
template
void func(Classtype1 *poin);
template
void func(Classtype2 *poin);

I know I can set a breakpoint at the *beginning* of each of the
instantiated functions either
with rbreak or by specifying the complete mangled function name. BUT: I
can't seem
to set a breakpoint somewhere inside the function. I've tried

rbreak func:<linenum>                 this has no effect
break +<line_offset>                    this sets the breakpoint only in
one of the instances

Two workarounds, both of which are rather cumbersome:

Juggling the instantiation in the source file so that gdb automatically
chooses just the one I happen to
want to debug.

Set the breakpoint at the actual address. This is a pain.

So the question: is there some smarter way of doing this that I haven't
thought of?

If not, wouldn't this be a nifty feature to have?

TIA for any help.

Thomas


--
-------------------------------------------------------------------------
Thomas Huld
European Commission - Joint Research Centre - Ispra Site(IT)
T.P.723
I-21020 Ispra                | Insofar as my employer has coherent
Italy                        | opinions they are unlikely to be mine
tel. +39 0332 785273         | (That said, see http://eu.conecta.it)
e-mail: thomas.huld@jrc.it

-------------------------------------------------------------------------




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