OLD | NEW |
1 # Copyright 2002-2003, 2005-2012 Free Software Foundation, Inc. | 1 # Copyright 2002-2003, 2005-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 tries to print out methods of classes. | 16 # This tries to print out methods of classes. |
17 | 17 |
18 # 2002-08-16 David Carlton <carlton@math.stanford.edu> | 18 # 2002-08-16 David Carlton <carlton@math.stanford.edu> |
19 | 19 |
20 # This file is part of the gdb testsuite | 20 # This file is part of the gdb testsuite |
21 | 21 |
22 if $tracelevel then { | |
23 strace $tracelevel | |
24 } | |
25 | |
26 if { [skip_cplus_tests] } { continue } | 22 if { [skip_cplus_tests] } { continue } |
27 | 23 |
28 # | 24 # |
29 # test running programs | 25 # test running programs |
30 # | 26 # |
31 | 27 |
32 set testfile "printmethod" | 28 standard_testfile .cc |
33 set srcfile ${testfile}.cc | |
34 set binfile ${objdir}/${subdir}/${testfile} | |
35 | 29 |
36 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug c++}] != "" } { | 30 if [get_compiler_info "c++"] { |
37 untested printmethod.exp | |
38 return -1 | |
39 } | |
40 | |
41 if [get_compiler_info ${binfile} "c++"] { | |
42 return -1 | 31 return -1 |
43 } | 32 } |
44 | 33 |
45 gdb_exit | 34 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
46 gdb_start | 35 return -1 |
47 gdb_reinitialize_dir $srcdir/$subdir | 36 } |
48 gdb_load ${binfile} | |
49 | |
50 | 37 |
51 if ![runto_main] then { | 38 if ![runto_main] then { |
52 perror "couldn't run to breakpoint" | 39 perror "couldn't run to breakpoint" |
53 continue | 40 continue |
54 } | 41 } |
55 | 42 |
56 # First, run to after we've constructed the object: | 43 # First, run to after we've constructed the object: |
57 | 44 |
58 gdb_breakpoint [gdb_get_line_number "constructs-done"] | 45 gdb_breakpoint [gdb_get_line_number "constructs-done"] |
59 gdb_continue_to_breakpoint "end of constructors" | 46 gdb_continue_to_breakpoint "end of constructors" |
60 | 47 |
61 # The first of these is for PR gdb/653. | 48 # The first of these is for PR gdb/653. |
62 | 49 |
63 gdb_test "print theA->virt" \ | 50 gdb_test "print theA->virt" \ |
64 "\\$\[0-9\]* = {void \\(A \\* const\\)} $hex <A::virt\\((void|)\\)>" \ | 51 "\\$\[0-9\]* = {void \\(A \\* const\\)} $hex <A::virt\\((void|)\\)>" \ |
65 "print virtual method." | 52 "print virtual method." |
66 gdb_test "print theA->nonvirt" \ | 53 gdb_test "print theA->nonvirt" \ |
67 "\\$\[0-9\]* = {void \\(A \\* const\\)} $hex <A::nonvirt\\((void|)\\)>" \ | 54 "\\$\[0-9\]* = {void \\(A \\* const\\)} $hex <A::nonvirt\\((void|)\\)>" \ |
68 "print nonvirtual method." | 55 "print nonvirtual method." |
69 | 56 |
70 gdb_exit | 57 gdb_exit |
71 return 0 | 58 return 0 |
OLD | NEW |