OLD | NEW |
1 # Copyright (C) 2008-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2008-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 is part of the GDB testsuite. It tests Python-based | 16 # This file is part of the GDB testsuite. It tests Python-based |
17 # pretty-printing for the CLI. | 17 # pretty-printing for the CLI. |
18 | 18 |
19 if $tracelevel then { | |
20 strace $tracelevel | |
21 } | |
22 | |
23 load_lib gdb-python.exp | 19 load_lib gdb-python.exp |
24 | 20 |
25 set testfile "py-prettyprint" | 21 standard_testfile |
26 set srcfile ${testfile}.c | |
27 set binfile ${objdir}/${subdir}/${testfile} | |
28 | 22 |
29 # Start with a fresh gdb. | 23 # Start with a fresh gdb. |
30 gdb_exit | 24 gdb_exit |
31 gdb_start | 25 gdb_start |
32 | 26 |
33 # Skip all tests if Python scripting is not enabled. | 27 # Skip all tests if Python scripting is not enabled. |
34 if { [skip_python_tests] } { continue } | 28 if { [skip_python_tests] } { continue } |
35 | 29 |
36 proc run_lang_tests {exefile lang} { | 30 proc run_lang_tests {exefile lang} { |
37 global srcdir subdir srcfile testfile hex | 31 global srcdir subdir srcfile testfile hex |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 gdb_exit | 116 gdb_exit |
123 gdb_start | 117 gdb_start |
124 gdb_reinitialize_dir $srcdir/$subdir | 118 gdb_reinitialize_dir $srcdir/$subdir |
125 gdb_load ${binfile} | 119 gdb_load ${binfile} |
126 | 120 |
127 if ![runto_main ] then { | 121 if ![runto_main ] then { |
128 perror "couldn't run to breakpoint" | 122 perror "couldn't run to breakpoint" |
129 return | 123 return |
130 } | 124 } |
131 | 125 |
| 126 set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py] |
| 127 |
| 128 gdb_test_no_output "python execfile ('${remote_python_file}')" |
| 129 |
| 130 gdb_breakpoint [gdb_get_line_number "eval-break"] |
| 131 gdb_continue_to_breakpoint "eval-break" ".* eval-break .*" |
| 132 |
| 133 gdb_test "info locals" "eval9 = eval=<123456789>" |
| 134 |
132 gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \ | 135 gdb_test "b [gdb_get_line_number {break to inspect} ${testfile}.c ]" \ |
133 ".*Breakpoint.*" | 136 ".*Breakpoint.*" |
134 gdb_test "continue" ".*Breakpoint.*" | 137 gdb_test "continue" ".*Breakpoint.*" |
135 | 138 |
136 set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py] | |
137 | |
138 gdb_test_no_output "python execfile ('${remote_python_file}')" | |
139 | |
140 gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>" \ | 139 gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>" \ |
141 "print ss enabled #1" | 140 "print ss enabled #1" |
142 | 141 |
143 gdb_test_no_output "python disable_lookup_function ()" | 142 gdb_test_no_output "python disable_lookup_function ()" |
144 | 143 |
145 gdb_test "print ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}" \ | 144 gdb_test "print ss" " = {a = {a = 1, b = $hex}, b = {a = 2, b = $hex}}" \ |
146 "print ss disabled" | 145 "print ss disabled" |
147 | 146 |
148 gdb_test_no_output "python enable_lookup_function ()" | 147 gdb_test_no_output "python enable_lookup_function ()" |
149 | 148 |
150 gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>" \ | 149 gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>" \ |
151 "print ss enabled #2" | 150 "print ss enabled #2" |
152 | 151 |
153 remote_file host delete ${remote_python_file} | 152 remote_file host delete ${remote_python_file} |
OLD | NEW |