| OLD | NEW |
| 1 # Copyright 1998-2004, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 1998-2004, 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 # This file was written by Elena Zannoni (ezannoni@cygnus.com) | 16 # This file was written by Elena Zannoni (ezannoni@cygnus.com) |
| 17 # And rewritten by Michael Chastain <mec.gnu@mindspring.com> | 17 # And rewritten by Michael Chastain <mec.gnu@mindspring.com> |
| 18 | 18 |
| 19 # This file is part of the gdb testsuite | 19 # This file is part of the gdb testsuite |
| 20 | 20 |
| 21 # tests for inheritance, with several derivations types combinations | 21 # tests for inheritance, with several derivations types combinations |
| 22 # (private, public, protected) | 22 # (private, public, protected) |
| 23 # classes have simple members and member functions. | 23 # classes have simple members and member functions. |
| 24 | 24 |
| 25 set ws "\[\r\n\t \]+" | 25 set ws "\[\r\n\t \]+" |
| 26 set nl "\[\r\n\]+" | 26 set nl "\[\r\n\]+" |
| 27 | 27 |
| 28 if $tracelevel then { | |
| 29 strace $tracelevel | |
| 30 } | |
| 31 | |
| 32 # Start program. | 28 # Start program. |
| 33 | 29 |
| 34 | 30 |
| 35 if { [skip_cplus_tests] } { continue } | 31 if { [skip_cplus_tests] } { continue } |
| 36 | 32 |
| 37 load_lib "cp-support.exp" | 33 load_lib "cp-support.exp" |
| 38 | 34 |
| 39 set testfile "derivation" | 35 standard_testfile .cc |
| 40 set srcfile ${testfile}.cc | |
| 41 set binfile ${objdir}/${subdir}/${testfile} | |
| 42 | 36 |
| 43 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 37 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
| 44 untested derivation.exp | 38 return -1 |
| 45 return -1 | |
| 46 } | 39 } |
| 47 | 40 |
| 48 gdb_exit | |
| 49 gdb_start | |
| 50 gdb_reinitialize_dir $srcdir/$subdir | |
| 51 gdb_load ${binfile} | |
| 52 | |
| 53 # Set it up at a breakpoint so we can play with the variable values. | 41 # Set it up at a breakpoint so we can play with the variable values. |
| 54 | 42 |
| 55 if ![runto 'marker1'] then { | 43 if ![runto 'marker1'] then { |
| 56 perror "couldn't run to marker1" | 44 perror "couldn't run to marker1" |
| 57 continue | 45 continue |
| 58 } | 46 } |
| 59 | 47 |
| 60 gdb_test "up" ".*main.*" "up from marker1" | 48 gdb_test "up" ".*main.*" "up from marker1" |
| 61 | 49 |
| 62 # Print class types and values. | 50 # Print class types and values. |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 gdb_test "finish" ".*main.*at .*derivation.cc:.*// marker1-returns-here.
*" \ | 169 gdb_test "finish" ".*main.*at .*derivation.cc:.*// marker1-returns-here.
*" \ |
| 182 "finish call to marker1" | 170 "finish call to marker1" |
| 183 } | 171 } |
| 184 -re "#1 ($hex in )?main.*$gdb_prompt $" { | 172 -re "#1 ($hex in )?main.*$gdb_prompt $" { |
| 185 pass "re-selected 'main' frame after inferior call" | 173 pass "re-selected 'main' frame after inferior call" |
| 186 } | 174 } |
| 187 } | 175 } |
| 188 | 176 |
| 189 gdb_test "print g_instance.bfoo()" "\\$\[0-9\]+ = 2" "print value of g_instance.
bfoo()" | 177 gdb_test "print g_instance.bfoo()" "\\$\[0-9\]+ = 2" "print value of g_instance.
bfoo()" |
| 190 gdb_test "print g_instance.cfoo()" "\\$\[0-9\]+ = 3" "print value of g_instance.
cfoo()" | 178 gdb_test "print g_instance.cfoo()" "\\$\[0-9\]+ = 3" "print value of g_instance.
cfoo()" |
| OLD | NEW |