This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Add new test for breakpoints on templates
- From: Jerome Guitton <guitton at adacore dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 16 Dec 2008 17:25:50 +0100
- Subject: [RFA] Add new test for breakpoints on templates
This is related to:
http://sourceware.org/ml/gdb-patches/2008-12/msg00310.html
Basically, this checks that a breakpoint on a "no-code line" will
be expanded in several locations (one per template instance).
OK to apply ?
2008-12-16 Jerome Guitton <guitton@adacore.com>
* gdb.cp/templates.cpp (GetMax): New template.
(main): Declare two instances of GetMax.
* gdb.cp/templates.exp: Add new test.
Index: gdb.cp/templates.cc
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/templates.cc,v
retrieving revision 1.1
diff -u -p -r1.1 templates.cc
--- gdb.cp/templates.cc 23 Aug 2003 03:55:59 -0000 1.1
+++ gdb.cp/templates.cc 16 Dec 2008 16:20:00 -0000
@@ -492,6 +492,13 @@ int
T5<T>::value()
{ return val; }
+template <class T>
+T GetMax (T a, T b) {
+ T result;
+ result = (a>b)? a : b;
+ // set breakpoint on a line with no real code
+ return (result);
+}
#if ! defined(__GNUC__) || defined(GCC_BUG)
template<class T>
@@ -706,6 +713,7 @@ template<class T> T Garply<T>::garply (i
int main()
{
int i;
+ long l, m, n;
#ifdef usestubs
set_debug_traps();
breakpoint();
@@ -766,6 +774,8 @@ int main()
y = x + fc.x;
+ i=GetMax<int>(x,y);
+ n=GetMax<long>(l,m);
return 0;
Index: gdb.cp/templates.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/templates.exp,v
retrieving revision 1.17
diff -u -p -r1.17 templates.exp
--- gdb.cp/templates.exp 3 Apr 2008 21:42:33 -0000 1.17
+++ gdb.cp/templates.exp 16 Dec 2008 16:20:00 -0000
@@ -157,6 +157,11 @@ proc test_template_breakpoints {} {
"Breakpoint.*at.* file .*${testfile}.cc, line.*" \
"value method breakpoint"
+ set bp_location [gdb_get_line_number \
+ "set breakpoint on a line with no real code"]
+ gdb_test "break ${testfile}.cc:${bp_location}" \
+ "Breakpoint.*at.* file .*${testfile}.cc, line.*(2 locations).*" \
+ "breakpoint on a line with no real code"
delete_breakpoints
}