OSDN Git Service

modified: utilsrc/src/Admin/Makefile
[eos/others.git] / utilsrc / srcX86MAC64 / Admin / gdb-7.7.1 / gdb / testsuite / gdb.cp / exceptprint.exp
1 # Copyright 2013-2014 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 3 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, see <http://www.gnu.org/licenses/>.
15
16 standard_testfile .cc
17
18 if {[skip_cplus_tests]} {
19     return -1
20 }
21
22 if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} {
23     return -1
24 }
25
26 if {![runto_main]} {
27     return -1
28 }
29
30 if {![skip_libstdcxx_probe_tests]} {
31     untested "could not find libstdc++ stap probe"
32     return -1
33 }
34
35 proc do_continue_to_catchpoint {name} {
36     global gdb_prompt
37
38     gdb_test_multiple "continue" $name {
39         -re "Continuing.*Catchpoint \[0-9\].*\r\n$gdb_prompt $" {
40             pass $name
41         }
42     }
43 }
44
45 proc do_exceptprint_tests {prefix output} {
46     with_test_prefix $prefix {
47         do_continue_to_catchpoint "continue to throw"
48         gdb_test "print \$_exception" " = $output" \
49             "print exception value at throw"
50
51         do_continue_to_catchpoint "continue to catch"
52         gdb_test "print \$_exception" " = $output" \
53             "print exception value at catch"
54         
55         do_continue_to_catchpoint "continue to rethrow"
56         gdb_test "print \$_exception" " = $output" \
57             "print exception value at rethrow"
58
59         do_continue_to_catchpoint "continue to final catch"
60     }
61 }
62
63 gdb_test "catch catch" "Catchpoint \[0-9\]+ \\(catch\\)" \
64     "catch catch"
65 gdb_test "catch throw" "Catchpoint \[0-9\]+ \\(throw\\)" \
66     "catch throw"
67 gdb_test "catch rethrow" "Catchpoint \[0-9\]+ \\(rethrow\\)" \
68     "catch rethrow"
69
70 do_exceptprint_tests string "$hex \"hi bob\""
71 do_exceptprint_tests int 23
72 do_exceptprint_tests struct "{mv = 77}"
73 do_exceptprint_tests "reference to struct" "{mv = 77}"
74
75
76 delete_breakpoints
77
78 if {![runto_main]} {
79     return -1
80 }
81
82 gdb_test "catch catch int if \$_exception == 23" \
83     "Catchpoint \[0-9\]+ \\(catch\\)" \
84     "catch catch"
85 gdb_test "catch throw int if \$_exception == 23" \
86     "Catchpoint \[0-9\]+ \\(throw\\)" \
87     "catch throw"
88 gdb_test "catch rethrow int if \$_exception == 23" \
89     "Catchpoint \[0-9\]+ \\(rethrow\\)" \
90     "catch rethrow"
91
92 # This tests both the case where the regular expression does not
93 # match, and the case where it does.
94 do_exceptprint_tests int 23