GDB 5.0 does not seem to be able to set breakpoints in template functions
correctly.  For example, if we compile the following program with gcc-2.95.3
#include <iostream>
template<class T>
void f(T x) {
  std::cout << x << endl;
}

int main() {
  f(4);
  f(5.6);
}

and then step through the program until it calls f and then set a breakpoint,
the next time we run the program it does not stop at the breakpoint.  Sourcing
the following script demonstrates this:
break main
run
s
break
c
disable 1
run

I am using RedHat Linux 6.0 on a Pentium II with gcc-2.95.2 and gcc-2.95.3.
The command used to compile the program was 
eg++-latest -g gdbtemp.cc -o gdbtemp

(eg++-latest points to gcc-2.95.3's g++ binary.  The same results
occur for gcc-2.95.2)

I do not know what compiler I used to compile gdb.  It was almost certainly 
gcc-2.95.2, since it was compiled on 26 Sep 2000 and that was the
release version of gcc out at the time.

The output from gdb when using the above script is:
(gdb) source gdbtemp.gdb
Breakpoint 1 at 0x804a546: file gdbtemp.cc, line 8.

Breakpoint 1, main () at gdbtemp.cc:8
8         f(4);
void f<int> (x=4) at gdbtemp.cc:4
4         std::cout << x << endl;
Breakpoint 2 at 0x805113a: file gdbtemp.cc, line 4.
4
5.6

Program exited normally.
4
5.6

Program exited normally.


_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to