OLD | NEW |
1 # Copyright 2003, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2003, 2007-2012 Free Software Foundation, Inc. |
2 | 2 |
3 # This program is free software; you can redistribute it and/or modify | 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 | 4 # it under the terms of the GNU General Public License as published by |
5 # the Free Software Foundation; either version 3 of the License, or | 5 # the Free Software Foundation; either version 3 of the License, or |
6 # (at your option) any later version. | 6 # (at your option) any later version. |
7 # | 7 # |
8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
12 # | 12 # |
13 # You should have received a copy of the GNU General Public License | 13 # You should have received a copy of the GNU General Public License |
14 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
15 | 15 |
16 # Tests for PR gdb/1210. | 16 # Tests for PR gdb/1210. |
17 | 17 |
18 # This file is part of the gdb testsuite. | 18 # This file is part of the gdb testsuite. |
19 | 19 |
20 if $tracelevel then { | |
21 strace $tracelevel | |
22 } | |
23 | |
24 if { [skip_cplus_tests] } { continue } | 20 if { [skip_cplus_tests] } { continue } |
25 | 21 |
26 # | 22 # |
27 # test running programs | 23 # test running programs |
28 # | 24 # |
29 | 25 |
30 set testfile "pr-1210" | 26 standard_testfile .cc |
31 set srcfile ${testfile}.cc | |
32 set binfile ${objdir}/${subdir}/${testfile} | |
33 | 27 |
34 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 28 if [get_compiler_info "c++"] { |
35 untested pr-1210.exp | |
36 return -1 | 29 return -1 |
37 } | 30 } |
38 | 31 |
39 if [get_compiler_info ${binfile} "c++"] { | 32 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
40 return -1 | 33 return -1 |
41 } | 34 } |
42 | 35 |
43 gdb_exit | |
44 gdb_start | |
45 gdb_reinitialize_dir $srcdir/$subdir | |
46 gdb_load ${binfile} | |
47 | |
48 if ![runto_main] then { | 36 if ![runto_main] then { |
49 perror "couldn't run to breakpoint" | 37 perror "couldn't run to breakpoint" |
50 continue | 38 continue |
51 } | 39 } |
52 | 40 |
53 gdb_test "next" ".*return 0;" "step past initialization" | 41 gdb_test "next" ".*return 0;" "step past initialization" |
54 | 42 |
55 gdb_test_multiple "print *obj" "print *obj" { | 43 gdb_test_multiple "print *obj" "print *obj" { |
56 -re "Cannot access memory.*$gdb_prompt $" { | 44 -re "Cannot access memory.*$gdb_prompt $" { |
57 fail "print *obj" | 45 fail "print *obj" |
58 } | 46 } |
59 -re " = {<A> = {<No data fields>}, myB = {<A> = {<No data fields>}.*}}\r\n$gdb
_prompt $" { | 47 -re " = {<A> = {<No data fields>}, myB = {<A> = {<No data fields>}.*}}\r\n$gdb
_prompt $" { |
60 pass "print *obj" | 48 pass "print *obj" |
61 } | 49 } |
62 } | 50 } |
63 | 51 |
64 gdb_test_multiple "print obj->myB" "print obj->myB" { | 52 gdb_test_multiple "print obj->myB" "print obj->myB" { |
65 -re "Cannot access memory.*$gdb_prompt $" { | 53 -re "Cannot access memory.*$gdb_prompt $" { |
66 fail "print obj->myB" | 54 fail "print obj->myB" |
67 } | 55 } |
68 -re " = {<A> = {<No data fields>}.*}\r\n$gdb_prompt $" { | 56 -re " = {<A> = {<No data fields>}.*}\r\n$gdb_prompt $" { |
69 pass "print obj->myB" | 57 pass "print obj->myB" |
70 } | 58 } |
71 } | 59 } |
72 | 60 |
73 gdb_exit | 61 gdb_exit |
74 return 0 | 62 return 0 |
OLD | NEW |