From 3fe8f3b349c62a22a209e7eace236f9d2a2effcb Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Mon, 21 Sep 2009 19:23:22 +0000 Subject: [PATCH] * gdb.cp/classes.exp (do_tests): Add tests to print a constructor and destructor using typedef name of class. * gdb.cp/classes.cc (class Base1): Add a destructor. (base1): New typedef. (use_methods): Instanitate an object of type base1. * gdb.cp/templates.exp (test_template_typedef): New procedure. (do_tests): Call test_template_typedef. * gdb.cp/templates.cc (Baz::~Baz): New method. (intBazOne): New typedef. (main): Instantiate intBazOne. --- gdb/testsuite/ChangeLog | 13 +++++++++++++ gdb/testsuite/gdb.cp/classes.cc | 5 +++++ gdb/testsuite/gdb.cp/classes.exp | 4 ++++ gdb/testsuite/gdb.cp/templates.cc | 5 +++++ gdb/testsuite/gdb.cp/templates.exp | 9 +++++++++ 5 files changed, 36 insertions(+) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 833fdcd486e..72b1e1ca178 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2009-09-21 Keith Seitz + + * gdb.cp/classes.exp (do_tests): Add tests to print a constructor + and destructor using typedef name of class. + * gdb.cp/classes.cc (class Base1): Add a destructor. + (base1): New typedef. + (use_methods): Instanitate an object of type base1. + * gdb.cp/templates.exp (test_template_typedef): New procedure. + (do_tests): Call test_template_typedef. + * gdb.cp/templates.cc (Baz::~Baz): New method. + (intBazOne): New typedef. + (main): Instantiate intBazOne. + 2009-09-21 Phil Muldoon PR python/10633 diff --git a/gdb/testsuite/gdb.cp/classes.cc b/gdb/testsuite/gdb.cp/classes.cc index 927aad3682b..913627fe1b3 100644 --- a/gdb/testsuite/gdb.cp/classes.cc +++ b/gdb/testsuite/gdb.cp/classes.cc @@ -400,8 +400,11 @@ class Base1 { public: int x; Base1(int i) { x = i; } + ~Base1 () { } }; +typedef Base1 base1; + class Foo { public: @@ -564,6 +567,8 @@ void use_methods () i = class_param.Aref_x (g_A); i = class_param.Aval_a (g_A); i = class_param.Aval_x (g_A); + + base1 b (3); } diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp index bd980b25fb9..87e993c7fdd 100644 --- a/gdb/testsuite/gdb.cp/classes.exp +++ b/gdb/testsuite/gdb.cp/classes.exp @@ -632,6 +632,10 @@ proc do_tests {} { fail "calling method for small class" } } + + gdb_test "print base1::Base1" "<.*Base1.*>" "print ctor of typedef class" + gdb_test "print base1::~Base1" "<.*~Base1(\\(\\))?>" \ + "print dtor of typedef class" } do_tests diff --git a/gdb/testsuite/gdb.cp/templates.cc b/gdb/testsuite/gdb.cp/templates.cc index a04d76866fa..dfb6f8ea790 100644 --- a/gdb/testsuite/gdb.cp/templates.cc +++ b/gdb/testsuite/gdb.cp/templates.cc @@ -630,6 +630,7 @@ T Spec::spec (T * tp) template class Baz { public: + ~Baz () { }; int x; T t; T baz (int, T); @@ -643,6 +644,8 @@ template T Baz::baz (int i, T tt) return 0; } +typedef Baz intBazOne; + // Template with char * parameter template class Qux { @@ -777,6 +780,8 @@ int main() i=GetMax(x,y); n=GetMax(l,m); + intBazOne ibo; + z = ibo.baz (2, 21); return 0; } diff --git a/gdb/testsuite/gdb.cp/templates.exp b/gdb/testsuite/gdb.cp/templates.exp index 541bdcb7bf1..487186a8ae0 100644 --- a/gdb/testsuite/gdb.cp/templates.exp +++ b/gdb/testsuite/gdb.cp/templates.exp @@ -195,6 +195,14 @@ proc test_template_calls {} { } } +proc test_template_typedef {} { + + gdb_test "print intBazOne::baz" ".*baz\\(int, int\\)>" \ + "print method of template typedef" + + gdb_test "print intBazOne::~Baz" ".*~Baz(\\(\\))?>" \ + "print destructor of template typedef" +} proc do_tests {} { global prms_id @@ -223,6 +231,7 @@ proc do_tests {} { test_ptype_of_templates test_template_breakpoints + test_template_typedef if [ runto_main] { test_template_calls