OSDN Git Service

Update to HEAD.
[pf3gnuchains/pf3gnuchains3x.git] / gdb / testsuite / gdb.python / python-mi.exp
1 # Copyright (C) 2008, 2009 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 # This file is part of the GDB testsuite.  It tests Python-based
17 # pretty-printing for MI.
18
19 load_lib mi-support.exp
20 set MIFLAGS "-i=mi2"
21
22 gdb_exit
23 if [mi_gdb_start] {
24     continue
25 }
26
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
32     return -1
33 }
34
35 mi_delete_breakpoints
36 mi_gdb_reinitialize_dir $srcdir/$subdir
37 mi_gdb_load ${binfile}
38
39 if {[lsearch -exact [mi_get_features] python] < 0} {
40     unsupported "python support is disabled"
41     return -1
42 }
43
44 mi_runto main
45
46 mi_gdb_test "python execfile ('${srcdir}/${subdir}/${testfile}.py')" ""
47
48 mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${testfile}.c] \
49   "step to breakpoint"
50
51 mi_create_floating_varobj container c "create container varobj"
52
53 mi_list_varobj_children container {
54 } "examine container children=0"
55
56 mi_next "next over update 1"
57
58 mi_varobj_update_dynamic container {
59     { {container.\[0\]} {\[0\]} 0 int }
60 } "varobj update 1"
61
62 mi_next "next over update 2"
63
64 mi_varobj_update_dynamic container {
65     { {container.\[0\]} {\[0\]} 0 int }
66     { {container.\[1\]} {\[1\]} 0 int }
67 } "varobj update 2"
68
69 mi_gdb_test "-var-set-visualizer container None" \
70   "\\^done" \
71   "clear visualizer"
72
73 mi_gdb_test "-var-update container" \
74   "\\^done,changelist=\\\[\\\]" \
75   "varobj update after clearing"
76
77 mi_gdb_test "-var-set-visualizer container gdb.default_visualizer" \
78   "\\^done" \
79   "choose default visualizer"
80
81 mi_varobj_update_dynamic container {
82     { {container.\[0\]} {\[0\]} 0 int }
83     { {container.\[1\]} {\[1\]} 0 int }
84 } "varobj update after choosing default"
85
86 mi_gdb_test "-var-set-visualizer container ContainerPrinter" \
87   "\\^done" \
88   "choose visualizer using expression"
89
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"
94
95 mi_continue_to_line \
96     [gdb_get_line_number {Another MI breakpoint} ${testfile}.c] \
97     "step to second breakpoint"
98
99 mi_varobj_update_with_type_change container int 0 "update after type change"