OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.python/] [py-mi.exp] - Blame information for rev 387

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright (C) 2008, 2009, 2010 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 .
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 "py-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
set remote_python_file [remote_download host ${srcdir}/${subdir}/${testfile}.py]
47
 
48
mi_gdb_test "python execfile ('${remote_python_file}')" ""
49
 
50
mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${testfile}.c] \
51
  "step to breakpoint"
52
 
53
mi_create_dynamic_varobj container c \
54
  "create container varobj, no pretty-printing"
55
 
56
mi_list_varobj_children container {
57
  { container.name name 1 string }
58
  { container.len len 0 int }
59
  { container.elements elements 1 "int ." }
60
} "examine container children=0, no pretty-printing"
61
 
62
mi_delete_varobj container "delete varobj"
63
 
64
mi_gdb_test "-enable-pretty-printing" ""
65
 
66
mi_create_varobj_checked string string_1 \
67
    "struct string_repr" \
68
    "create string_1 varobj"
69
 
70
mi_create_varobj_checked lstring estring \
71
    "struct lazystring" \
72
    "create estring varobj"
73
 
74
mi_gdb_test "-data-evaluate-expression \"string_1 = string_2\"" ".*" \
75
    "assign string_1 from string_2"
76
 
77
mi_gdb_test "-var-update string" \
78
    "\\^done,changelist=\\\[{name=\"string\",in_scope=\"true\",type_changed=\"false\",dynamic=\"1\",has_more=\"0\"}\\\]" \
79
    "update string varobj after assignment"
80
 
81
mi_create_dynamic_varobj container c \
82
  "create container varobj"
83
 
84
mi_list_varobj_children container {
85
} "examine container children=0"
86
 
87
mi_next "next over update 1"
88
 
89
mi_varobj_update_dynamic container "varobj update 1" {
90
    type_changed false new_num_children 1 dynamic 1 has_more 0
91
} {
92
} {
93
    { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 }
94
}
95
 
96
mi_next "next over update 2"
97
 
98
mi_varobj_update_dynamic container "varobj update 2" {
99
    type_changed false new_num_children 2 dynamic 1 has_more 0
100
} {
101
} {
102
    { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 }
103
}
104
 
105
mi_gdb_test "-var-set-visualizer container None" \
106
  "\\^done" \
107
  "clear visualizer"
108
 
109
mi_gdb_test "-var-update container" \
110
  "\\^done,changelist=\\\[\\\]" \
111
  "varobj update after clearing"
112
 
113
mi_gdb_test "-var-set-visualizer container gdb.default_visualizer" \
114
  "\\^done" \
115
  "choose default visualizer"
116
 
117
mi_varobj_update_dynamic container "varobj update after choosing default" {
118
    type_changed false new_num_children 2 dynamic 1 has_more 0
119
} {
120
} {
121
    { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 }
122
    { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 }
123
}
124
 
125
mi_gdb_test "-var-set-visualizer container ContainerPrinter" \
126
  "\\^done" \
127
  "choose visualizer using expression"
128
 
129
mi_varobj_update_dynamic container \
130
  "varobj update after choosing via expression" {
131
      type_changed false new_num_children 2 dynamic 1 has_more 0
132
  } {
133
  } {
134
      { name {container.\[0\]} exp {\[0\]} numchild 0 type int thread-id 1 }
135
      { name {container.\[1\]} exp {\[1\]} numchild 0 type int thread-id 1 }
136
  }
137
 
138
mi_list_varobj_children_range container 1 2 2 {
139
    { {container.\[1\]} {\[1\]} 0 int }
140
} "list varobj children after selecting child range"
141
 
142
mi_list_varobj_children_range container -1 -1 2 {
143
    { {container.\[0\]} {\[0\]} 0 int }
144
    { {container.\[1\]} {\[1\]} 0 int }
145
} "list varobj children after resetting child range"
146
 
147
mi_next "next over update 3"
148
 
149
mi_gdb_test "-var-set-update-range container 0 1" \
150
  "\\^done" \
151
  "set update range"
152
 
153
# This should truncate the list.
154
mi_list_varobj_children container {
155
    { {container.\[0\]} {\[0\]} 0 int }
156
} "list children after setting update range"
157
 
158
# This should return just the items in [1,2).
159
mi_list_varobj_children_range container 1 2 2 {
160
    { {container.\[1\]} {\[1\]} 0 int }
161
} "list selected children after setting range"
162
 
163
# This should not be affected by the previous list-children request.
164
mi_list_varobj_children container {
165
    { {container.\[0\]} {\[0\]} 0 int }
166
} "list children after listing selected range"
167
 
168
mi_next "next over update 4"
169
 
170
# This should only show the first child, because the update range has
171
# been set.
172
mi_varobj_update_dynamic container \
173
  "update after next with restricted range" {
174
      type_changed false new_num_children 1 dynamic 1 has_more 1
175
  } {
176
      { name {container.\[0\]} in_scope true type_changed false dynamic 1 has_more 0 }
177
  } {
178
  }
179
 
180
mi_gdb_test "-var-set-update-range container 3 4" \
181
  "\\^done" \
182
  "set update range with non-zero start"
183
 
184
# Elements were updated but should not be reported.
185
mi_varobj_update_dynamic container \
186
  "update varobj with change outside selected range" {
187
      type_changed false new_num_children 3 dynamic 1 has_more 0
188
  } {
189
  } {
190
  }
191
 
192
mi_next "next over update 5"
193
 
194
# Regression test: examine an object that has no children, then update
195
# it to ensure that we don't print the children.
196
mi_create_dynamic_varobj container2 c2 \
197
  "create second container varobj"
198
 
199
mi_gdb_test "-var-update container2" \
200
  "\\^done,changelist=.." \
201
  "update varobj, no children requested"
202
 
203
mi_next "next over update 6"
204
 
205
# Now container2 has an element -- and an update should mention that
206
# it has_more.  But, because we did not request children, we still
207
# should not actually see them.
208
mi_varobj_update_dynamic container2 \
209
    "update varobj 2, no children requested" {
210
        type_changed false dynamic 1 has_more 1
211
    } {} {}
212
 
213
mi_continue_to_line \
214
    [gdb_get_line_number {MI outer breakpoint here} ${testfile}.c] \
215
    "step to outer breakpoint"
216
 
217
mi_create_dynamic_varobj outer outer \
218
  "create outer varobj"
219
 
220
mi_list_varobj_children outer {
221
  { outer.s s 2 "struct substruct" }
222
  { outer.x x 0 "int" }
223
} "list children of outer"
224
 
225
mi_list_varobj_children outer.s {
226
  { outer.s.a a 0 int }
227
  { outer.s.b b 0 int }
228
} "list children of outer.s"
229
 
230
mi_next "next over outer update"
231
 
232
mi_gdb_test "-var-update outer" \
233
  ".done,changelist=.{name=\"outer.s.a\",in_scope=\"true\",type_changed=\"false\",dynamic=\"1\",has_more=\"0\"}." \
234
  "update after updating element of outer"
235
 
236
mi_continue_to_line \
237
    [gdb_get_line_number {Another MI breakpoint} ${testfile}.c] \
238
    "step to second breakpoint"
239
 
240
mi_varobj_update_with_type_change container int 0 "update after type change"
241
 
242
remote_file host delete ${remote_python_file}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.