1 # Copyright (C) 2008, 2009 Free Software Foundation, Inc.
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.
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.
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/>.
16 # This file is part of the GDB testsuite. It tests Python-based
17 # pretty-printing for MI.
19 load_lib mi-support.exp
27 set testfile "python-prettyprint"
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
30 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DMI}] != "" } {
31 untested mi2-var-child.exp
36 mi_gdb_reinitialize_dir $srcdir/$subdir
37 mi_gdb_load ${binfile}
39 if {[lsearch -exact [mi_get_features] python] < 0} {
40 unsupported "python support is disabled"
46 mi_gdb_test "python execfile ('${srcdir}/${subdir}/${testfile}.py')" ""
48 mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${testfile}.c] \
51 mi_create_floating_varobj container c "create container varobj"
53 mi_list_varobj_children container {
54 } "examine container children=0"
56 mi_next "next over update 1"
58 mi_varobj_update_dynamic container {
59 { {container.\[0\]} {\[0\]} 0 int }
62 mi_next "next over update 2"
64 mi_varobj_update_dynamic container {
65 { {container.\[0\]} {\[0\]} 0 int }
66 { {container.\[1\]} {\[1\]} 0 int }
69 mi_gdb_test "-var-set-visualizer container None" \
73 mi_gdb_test "-var-update container" \
74 "\\^done,changelist=\\\[\\\]" \
75 "varobj update after clearing"
77 mi_gdb_test "-var-set-visualizer container gdb.default_visualizer" \
79 "choose default visualizer"
81 mi_varobj_update_dynamic container {
82 { {container.\[0\]} {\[0\]} 0 int }
83 { {container.\[1\]} {\[1\]} 0 int }
84 } "varobj update after choosing default"
86 mi_gdb_test "-var-set-visualizer container ContainerPrinter" \
88 "choose visualizer using expression"
90 mi_varobj_update_dynamic container {
91 { {container.\[0\]} {\[0\]} 0 int }
92 { {container.\[1\]} {\[1\]} 0 int }
93 } "varobj update after choosing via expression"
96 [gdb_get_line_number {Another MI breakpoint} ${testfile}.c] \
97 "step to second breakpoint"
99 mi_varobj_update_with_type_change container int 0 "update after type change"