import gdb-1999-08-30 snapshot
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.c++ / local.exp
1 # Copyright (C) 1998 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
17 # Please email any bugs, comments, and/or additions to this file to:
18 # bug-gdb@prep.ai.mit.edu
19
20 # tests for local variables
21 # Written by Satish Pai <pai@apollo.hp.com> 1997-07-08
22
23
24 # This file is part of the gdb testsuite
25
26 if $tracelevel then {
27 strace $tracelevel
28 }
29
30 #
31 # test running programs
32 #
33 set prms_id 0
34 set bug_id 0
35
36 set testfile "local"
37 set srcfile ${testfile}.cc
38 set binfile ${objdir}/${subdir}/${testfile}
39
40 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
41 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
42 }
43
44 if [get_compiler_info $binfile "c++"] {
45 return -1
46 }
47
48 gdb_exit
49 gdb_start
50 gdb_reinitialize_dir $srcdir/$subdir
51 gdb_load ${binfile}
52
53
54 #
55 # set it up at a breakpoint so we can play with the variable values
56 #
57 if ![runto_main] then {
58 perror "couldn't run to breakpoint"
59 continue
60 }
61
62 send_gdb "break marker1\n" ; gdb_expect -re ".*$gdb_prompt $"
63
64 send_gdb "cont\n"
65 gdb_expect {
66 -re "Break.* marker1 \\(\\) at .*:$decimal.*$gdb_prompt $" {
67 send_gdb "up\n"
68 gdb_expect {
69 -re ".*$gdb_prompt $" {}
70 timeout { fail "up from marker1" }
71 }
72 }
73 -re "$gdb_prompt $" { fail "continue to marker1" }
74 timeout { fail "(timeout) continue to marker1" }
75 }
76
77 # srikanth, These tests have always been run only with aCC. Now in
78 # the new scheme of things, we run it twice, once with aCC, and once
79 # with g++. Flag these tests as expected failures when run with g++.
80 # as these are failing now and were never known to pass with g++.
81 global gcc_compiled
82 if {$gcc_compiled} then {
83 setup_xfail "*-*-*"
84 }
85
86 send_gdb "ptype Local\n"
87 gdb_expect {
88 -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*.char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:10\\).*$gdb_prompt $" { pass "ptype Local" }
89 -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*.char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype Local (incorrect line number?)" }
90 -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*Local & Local::operator=\\(foobar__Fi___0::Local const &\\);\r\n\[\t \]*Local::Local\\(foobar__Fi___0::Local const &\\);\r\n\[\t \]*Local::Local\\(void\\);\r\n\[\t \]*char Local::loc_foo\\(char\\);\r\n\[\t \]*\}*.*$gdb_prompt $" { pass "ptype Local" }
91 -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*Local & Local const &\\);\r\n\[\t \]*Local const &\\);\r\n\[\t \]*Local\\(void\\);\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\}\[\t \]*.*$gdb_prompt $" { pass "ptype Local" }
92 -re "type = class Local \{\r\n\[\t \]*public:\r\n\[\t \]*int loc1;\r\n\r\n\[\t \]*char loc_foo\\(char\\);\r\n\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\)\r\n\}.*$gdb_prompt $" { pass "ptype Local (aCC)" }
93 -re ".*$gdb_prompt $" { fail "ptype Local" }
94 timeout { fail "(timeout) ptype Local" }
95 }
96
97 # DTS CLLbs14316 and CLLbs17058
98 # coulter - I added a clause for HP's aCC compiler. We print out the type
99 # as xx instead of const unsigned char, but we still have an expected failure
100 # because of two reasons:
101 # There is a number at the end of InnerLocal4 which should not be there,
102 # DTS CLLbs14316
103 # The line number for the class
104 setup_xfail "hppa*-*-*" CLLbs14316
105 send_gdb "ptype InnerLocal\n"
106 gdb_expect {
107 -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal" }
108 -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal" }
109 -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal (incorrect line number?" }
110 -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(const unsigned char &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal (incorrect line number?" }
111 -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*InnerLocal::NestedInnerLocal nest1;\r\n\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:36\\).*$gdb_prompt $" { pass "ptype InnerLocal HP aCC" }
112 -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*NestedInnerLocal nest1;\r\n\r\n\[\t \]*InnerLocal & InnerLocal::operator=\\(main___0::InnerLocal const &\\);\r\n\[\t \]*InnerLocal::InnerLocal\\(main___0::InnerLocal const &\\);\r\n\[\t \]*InnerLocal::InnerLocal\\(void\\);\r\n\[\t \]*int InnerLocal::il_foo\\(unsigned char const &\\);\r\n\*\}\r\n*.*$gdb_prompt $" { pass "ptype InnerLocal" }
113 -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*NestedInnerLocal nest1;\r\n\r\n\[\t \]*InnerLocal & InnerLocal const &\\);\r\n\[\t \]*InnerLocal const &\\);\r\n\[\t \]*InnerLocal\\(void\\);\r\n\[\t \]*.int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\}\[\t \]*.*$gdb_prompt $" { pass "ptype InnerLocal" }
114 -re "type = class InnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*char ilc;\r\n\[\t \]*int \\*ip;\r\n\[\t \]*class InnerLocal4::NestedInnerLocal nest1;\r\n\r\n\[\t \]*int il_foo\\(unsigned char const &\\);\r\n\[\t \]*\\(Local at.*local\.cc:\[0-9\]+\\)\r\n\}.*$gdb_prompt $" { pass "ptype InnerLocal (aCC)" }
115 -re ".*$gdb_prompt $" { fail "ptype InnerLocal" }
116 timeout { fail "(timeout) ptype InnerLocal" }
117 }
118
119 send_gdb "ptype NestedInnerLocal\n"
120 gdb_expect {
121 -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:44\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
122 -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype NestedInnerLocal (incorrect line number?)" }
123 -re "type = class NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*NestedInnerLocal & InnerLocal::NestedInnerLocal::operator=\\(main___1::InnerLocal::NestedInnerLocal const &\\);\r\n\[\t \]*InnerLocal::NestedInnerLocal::NestedInnerLocal\\(main___1::InnerLocal::NestedInnerLocal const &\\);\r\n\[\t \]*InnerLocal::NestedInnerLocal::NestedInnerLocal\\(void\\);\r\n\[\t \]*int InnerLocal::NestedInnerLocal::nil_foo\\(int\\);\r\n\}\r\n*.*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
124 -re "type = class NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*NestedInnerLocal & NestedInnerLocal const &\\);\r\n\[\t \]*NestedInnerLocal const &\\);\r\n\[\t \]*NestedInnerLocal\\(void\\);\r\n\[\t \]*int nil_foo\\(int\\);\r\n\[\t \]*\}\r\n*.*$gdb_prompt $" { pass "ptype NestedInnerLocal" }
125 -re "No symbol.*in current context.*$gdb_prompt $" { pass "ptype NestedInnerLocal (known aCC limitation)" }
126 -re ".*$gdb_prompt $" { fail "ptype NestedInnerLocal" }
127 timeout { fail "(timeout) ptype NestedInnerLocal" }
128 }
129
130 # gdb incorrectly interprets the NestedInnerLocal in
131 # InnerLocal::NestedInnerLocal as field name instead of a type name;
132 # See CLLbs14784.
133 setup_xfail *-*-* CLLbs14784
134 send_gdb "ptype InnerLocal::NestedInnerLocal\n"
135 gdb_expect {
136 -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:44\\).*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal" }
137 -re "type = class InnerLocal::NestedInnerLocal \{\r\n\[\t \]*public:\r\n\[\t \]*int nil;\r\n\r\n\[\t \]*.int nil_foo\\(int\\);\r\n\[\t \]*\}\[\t \]*\\(Local at.*local\\.cc:\[0-9\]*\\).*$gdb_prompt $" { pass "ptype InnerLocal::NestedInnerLocal (incorrect line number?)" }
138 -re ".*$gdb_prompt $" { fail "ptype InnerLocal::NestedInnerLocal" }
139 timeout { fail "(timeout) ptype InnerLocal::NestedInnerLocal" }
140 }
141
142
This page took 0.032925 seconds and 4 git commands to generate.