X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.c%2B%2B%2Ftemplates.exp;h=638743eca41c579a850c600a43085878d6e96503;hb=49e790b035044a3a9916a34b478fcf273345a81e;hp=5b8875eb8e7431783878ad50c860a6fadaa77b1a;hpb=72ec28b8afa357cdde70c612b4e0e9f37a34f8e4;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.c++/templates.exp b/gdb/testsuite/gdb.c++/templates.exp index 5b8875eb8e..638743eca4 100644 --- a/gdb/testsuite/gdb.c++/templates.exp +++ b/gdb/testsuite/gdb.c++/templates.exp @@ -1,4 +1,5 @@ -# Copyright (C) 1992, 1996, 1997, 1999 Free Software Foundation, Inc. +# Copyright 1992, 1994, 1995, 1996, 1997, 1999, 2000 +# Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -105,14 +106,15 @@ proc test_template_breakpoints {} { gdb_expect { -re "0. cancel.*\[\r\n\]*.1. all.*\[\r\n\]*.2. T5::T5\\(int\\) at .*\[\r\n\]*.3. T5::T5\\(T5 const &\\) at .*\[\r\n\]*> $" { gdb_test "0" \ - "cancelled" \ + "canceled" \ "constructor breakpoint (obsolete format!)" } -re ".0. cancel\[\r\n\]*.1. all\[\r\n\]*.2. T5::T5\\(T5 const &\\) at .*templates.cc:.*\[\r\n\]*.3. T5::T5\\(int\\) at .*templates.cc:.*\[\r\n\]*> $" { gdb_test "0" \ - "cancelled" \ + "canceled" \ "constructor breakpoint" } + -re ".*\n> $" { fail "constructor breakpoint" } -re ".*$gdb_prompt $" { fail "constructor breakpoint" } default { fail "constructor breakpoint (timeout)" } } @@ -209,7 +211,6 @@ proc do_tests {} { do_tests -if {!$hp_aCC_compiler} {continue} # More tests for different kinds of template parameters, # templates with partial specializations, nested templates, etc. @@ -217,7 +218,21 @@ if {!$hp_aCC_compiler} {continue} # work with other compilers because of differences in mangling # schemes. # Added by Satish Pai 1997-09-25 +# As of 2000-06-03, C++ support has been improved to the point that g++ can +# pass all of theses, excluding what appears to be one that exposes a stabs bug. - djb +# I don't know how HP could be passing these tests without this. They +# weren't breakpointing past a point where the below expressions were +# initialized in the actual source. - djb + +send_gdb "b 770\n" +gdb_expect { + -re ".*$gdb_prompt $" +} +send_gdb "c\n" +gdb_expect { + -re ".*$gdb_prompt $" +} send_gdb "print fint\n" gdb_expect { -re "\\$\[0-9\]* = \\{x = 0, t = 0\\}\r\n$gdb_prompt $" { pass "print fint" } @@ -235,6 +250,9 @@ gdb_expect { # Template Foo setup_xfail hppa2.0w-*-* CLLbs16092 +# g++ can't do the template instantiation in debug info trick, so we +# fail this because it's not a real type. +if {!$hp_aCC_compiler} { setup_xfail *-*-* } send_gdb "ptype Foo\n" gdb_expect { -re "type = template <(class |)T> (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Foo\r\n\[ \t\]*(class |)Foo\r\n\[ \t\]*(class |)Foo\r\n$gdb_prompt $" { pass "ptype Foo" } @@ -247,7 +265,7 @@ gdb_expect { send_gdb "ptype fint\n" gdb_expect { - -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fint" } + -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int foo\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fint" } -re "$gdb_prompt $" { fail "ptype fint" } timeout { fail "(timeout) ptype fint" } } @@ -256,7 +274,7 @@ gdb_expect { send_gdb "ptype fchar\n" gdb_expect { - -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char foo\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fchar" } + -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*.*char foo\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fchar" } -re "$gdb_prompt $" { fail "ptype fchar" } timeout { fail "(timeout) ptype fchar" } } @@ -265,7 +283,7 @@ gdb_expect { send_gdb "ptype fvpchar\n" gdb_expect { - -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*volatile char \\*t;\r\n\r\n\[ \t\]*volatile char \\* foo\\(int, volatile char \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fvpchar" } + -re "type = (class |)Foo \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*char.*\\*t;\r\n\r\n\[ \t\]*.*char \\* foo\\(int,.*char.*\\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype fvpchar" } -re "$gdb_prompt $" { fail "ptype fvpchar" } timeout { fail "(timeout) ptype fvpchar" } } @@ -274,7 +292,7 @@ gdb_expect { send_gdb "print Foo::foo\n" gdb_expect { - -re "\\$\[0-9\]* = \\{volatile char \\*\\((class |)Foo \\*, int, volatile char \\*\\)\\} $hex ::foo\\(int, volatile char \\*\\)>\r\n$gdb_prompt $" { pass "print Foo::foo" } + -re "\\$\[0-9\]* = \\{.*char \\*\\((class |)Foo \\*, int, .*char \\*\\)\\} $hex ::foo\\(int, .*char.*\\*\\)>\r\n$gdb_prompt $" { pass "print Foo::foo" } -re "$gdb_prompt $" { fail "print Foo::foo" } timeout { fail "(timeout) print Foo::foo" } } @@ -282,6 +300,8 @@ gdb_expect { # Template Bar setup_xfail hppa2.0w-*-* CLLbs16092 +# same as Foo for g++ +if {!$hp_aCC_compiler} { setup_xfail *-*-* } send_gdb "ptype Bar\n" gdb_expect { -re "type = template <(class |)T, (class |)sz> (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Bar\r\n\[ \t\]*(class |)Bar\r\n$gdb_prompt $" { pass "ptype Bar" } @@ -292,10 +312,14 @@ gdb_expect { # ptype Bar - +# stabs screws this test royally. +# It thinks it has a badly mangled name. +# I blame stabs, the other formats get it right. -djb +get_debug_format +setup_xfail_format "stabs" send_gdb "ptype bint\n" gdb_expect { - -re "type = (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint" } + -re "type = (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint" } -re "$gdb_prompt $" { fail "ptype bint" } timeout { fail "(timeout) ptype bint" } } @@ -304,7 +328,7 @@ gdb_expect { send_gdb "ptype bint2\n" gdb_expect { - -re "type = (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint2" } + -re "type = (class |)Bar \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int bar\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bint2" } -re "$gdb_prompt $" { fail "ptype bint2" } timeout { fail "(timeout) ptype bint2" } } @@ -312,6 +336,8 @@ gdb_expect { # Template Baz setup_xfail hppa2.0w-*-* CLLbs16092 +# Same as Foo, for g++ +if {!$hp_aCC_compiler} { setup_xfail *-*-* } send_gdb "ptype Baz\n" gdb_expect { -re "type = template <(class |)T, (class |)sz> (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Baz\r\n\[ \t\]*(class |)Baz\r\n$gdb_prompt $" { pass "ptype Baz" } @@ -325,7 +351,7 @@ gdb_expect { send_gdb "ptype bazint\n" gdb_expect { - -re "type = (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int baz\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint" } + -re "type = (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int baz\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint" } -re "$gdb_prompt $" { fail "ptype bazint" } timeout { fail "(timeout) ptype bazint" } } @@ -334,13 +360,14 @@ gdb_expect { send_gdb "ptype bazint2\n" gdb_expect { - -re "type = (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*char baz\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint2" } + -re "type = (class |)Baz \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*char t;\r\n\r\n\[ \t\]*.*char baz\\(int, char\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype bazint2" } -re "$gdb_prompt $" { fail "ptype bazint2" } timeout { fail "(timeout) ptype bazint2" } } # Template Qux - +# Same as Foo for g++ +if {!$hp_aCC_compiler} {setup_xfail *-*-*} send_gdb "ptype Qux\n" gdb_expect { -re "type = template <(class |)T, (class |)sz> (class |)Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*T t;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Qux\r\n\[ \t\]*(class |)Qux\r\n$gdb_prompt $" { pass "ptype Qux" } @@ -353,7 +380,7 @@ gdb_expect { send_gdb "ptype quxint\n" gdb_expect { - -re "type = class Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" } + -re "type = class Qux \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int qux\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype quxint" } -re "$gdb_prompt $" { fail "ptype quxint" } timeout { fail "(timeout) ptype quxint" } } @@ -372,6 +399,8 @@ gdb_expect { # Template Spec setup_xfail hppa2.0w-*-* CLLbs16092 +# Same as Foo for g++ +if {!$hp_aCC_compiler} { setup_xfail *-*-* } send_gdb "ptype Spec\n" gdb_expect { -re "type = template <(class |)T1, (class |)T2> (class |)Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\\}\r\ntemplate instantiations:\r\n\[ \t\]*(class |)Spec\r\n\[ \t\]*(class |)Spec\r\n$gdb_prompt $" { pass "ptype Spec" } @@ -384,7 +413,7 @@ gdb_expect { send_gdb "ptype siip\n" gdb_expect { - -re "type = class Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*int spec\\(int \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype siip" } + -re "type = class Spec \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\r\n\[ \t\]*.*int spec\\(int \\*\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype siip" } -re "$gdb_prompt $" { fail "ptype siip" } timeout { fail "(timeout) ptype siip" } } @@ -393,7 +422,7 @@ gdb_expect { send_gdb "ptype Garply\n" gdb_expect { - -re "type = class Garply \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*int garply\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply" } + -re "type = class Garply \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*int t;\r\n\r\n\[ \t\]*.*int garply\\(int, int\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply" } -re "$gdb_prompt $" { fail "ptype Garply" } timeout { fail "(timeout) ptype Garply" } } @@ -402,7 +431,7 @@ gdb_expect { send_gdb "ptype Garply >\n" gdb_expect { - -re "type = (class |)Garply > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*(class |)Garply t;\r\n\r\n\[ \t\]*(class |)Garply garply\\(int, (class |)Garply\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply >" } + -re "type = (class |)Garply > \\{\r\n\[ \t\]*public:\r\n\[ \t\]*int x;\r\n\[ \t\]*.*(class |)Garply t;\r\n\r\n\[ \t\]*.*(class |)Garply garply\\(int, (class |)Garply\\);\r\n\\}\r\n$gdb_prompt $" { pass "ptype Garply >" } -re "$gdb_prompt $" { fail "ptype Garply >" } timeout { fail "(timeout) ptype Garply >" } } @@ -411,16 +440,16 @@ gdb_expect { send_gdb "print Garply >::garply\n" gdb_expect { - -re "\\$\[0-9\]* = \\{(class |)Garply \\((class |)Garply > \\*, int, (class |)Garply\\)\\} $hex >::garply\\(int, (class |)Garply\\)>\r\n$gdb_prompt $" { pass "print Garply >::garply" } + -re "\\$\[0-9\]* = \\{(class |)Garply \\((class |)Garply > \\*, int, (class |)Garply\\)\\} $hex \[ \t\]*>::garply\\(int, (class |)Garply\\)>\r\n$gdb_prompt $" { pass "print Garply >::garply" } -re ".*$gdb_prompt $" { fail "print Garply >::garply" } timeout { fail "print Garply >::garply (timeout)" } } -# UNFORTUNATELY, "break Garply >::garply" doesn't yet work. - -#send_gdb "break Garply >::garply -#gdb_expect { -# -re "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*\r\n$gdb_prompt $" { pass "break Garply >::garply" } -# -re ".*$gdb_prompt $" { fail "break Garply >::garply" } -# timeout { fail "break Garply >::garply (timeout)" } -#} +# djb - 06-03-2000 +# Now should work fine +send_gdb "break Garply >::garply\n" +gdb_expect { + -re "Breakpoint \[0-9\]* at $hex: file .*templates.cc, line.*\r\n$gdb_prompt $" { pass "break Garply >::garply" } + -re ".*$gdb_prompt $" { fail "break Garply >::garply" } + timeout { fail "break Garply >::garply (timeout)" } +}