| OLD | NEW |
| 1 # Copyright (C) 2008-2012 Free Software Foundation, Inc. | 1 # Copyright (C) 2008-2013 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. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 35 mi_gdb_reinitialize_dir $srcdir/$subdir | 35 mi_gdb_reinitialize_dir $srcdir/$subdir |
| 36 mi_gdb_load ${binfile} | 36 mi_gdb_load ${binfile} |
| 37 | 37 |
| 38 if {[lsearch -exact [mi_get_features] python] < 0} { | 38 if {[lsearch -exact [mi_get_features] python] < 0} { |
| 39 unsupported "python support is disabled" | 39 unsupported "python support is disabled" |
| 40 return -1 | 40 return -1 |
| 41 } | 41 } |
| 42 | 42 |
| 43 mi_runto main | 43 mi_runto main |
| 44 | 44 |
| 45 set remote_python_file [remote_download host ${srcdir}/${subdir}/${pyfile}] | 45 set remote_python_file [gdb_remote_download host ${srcdir}/${subdir}/${pyfile}] |
| 46 | 46 |
| 47 mi_gdb_test "python execfile ('${remote_python_file}')" "" | 47 mi_gdb_test "python exec (open ('${remote_python_file}').read ())" "" |
| 48 | 48 |
| 49 mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${srcfile}] \ | 49 mi_continue_to_line [gdb_get_line_number {MI breakpoint here} ${srcfile}] \ |
| 50 "step to breakpoint" | 50 "step to breakpoint" |
| 51 | 51 |
| 52 mi_create_dynamic_varobj container c \ | 52 mi_create_floating_varobj container c \ |
| 53 "create container varobj, no pretty-printing" | 53 "create container varobj, no pretty-printing" |
| 54 | 54 |
| 55 mi_list_varobj_children container { | 55 mi_list_varobj_children container { |
| 56 { container.name name 1 string } | 56 { container.name name 1 string } |
| 57 { container.len len 0 int } | 57 { container.len len 0 int } |
| 58 { container.elements elements 1 "int ." } | 58 { container.elements elements 1 "int ." } |
| 59 } "examine container children=0, no pretty-printing" | 59 } "examine container children=0, no pretty-printing" |
| 60 | 60 |
| 61 mi_delete_varobj container "delete varobj" | 61 mi_delete_varobj container "delete varobj" |
| 62 | 62 |
| 63 mi_create_dynamic_varobj nscont nstype \ | 63 mi_create_floating_varobj nscont nstype \ |
| 64 "create nscont varobj, no pretty-printing" | 64 "create nscont varobj, no pretty-printing" |
| 65 | 65 |
| 66 mi_list_varobj_children nscont { | 66 mi_list_varobj_children nscont { |
| 67 { nscont.len len 0 int } | 67 { nscont.len len 0 int } |
| 68 { nscont.elements elements 1 "int ." } | 68 { nscont.elements elements 1 "int ." } |
| 69 } "examine nscont children=0, no pretty-printing" | 69 } "examine nscont children=0, no pretty-printing" |
| 70 | 70 |
| 71 mi_delete_varobj nscont "delete varobj" | 71 mi_delete_varobj nscont "delete varobj" |
| 72 | 72 |
| 73 mi_gdb_test "-enable-pretty-printing" "" | 73 mi_gdb_test "-enable-pretty-printing" "" |
| 74 | 74 |
| 75 mi_create_varobj_checked string string_1 \ | 75 mi_create_varobj_checked string string_1 \ |
| 76 "struct string_repr" \ | 76 "struct string_repr" \ |
| 77 "create string_1 varobj" | 77 "create string_1 varobj" |
| 78 | 78 |
| 79 mi_create_varobj_checked lstring estring \ | 79 mi_create_varobj_checked lstring estring \ |
| 80 "struct lazystring" \ | 80 "struct lazystring" \ |
| 81 "create estring varobj" | 81 "create estring varobj" |
| 82 | 82 |
| 83 mi_gdb_test "-data-evaluate-expression \"string_1 = string_2\"" ".*" \ | 83 mi_gdb_test "-data-evaluate-expression \"string_1 = string_2\"" ".*" \ |
| 84 "assign string_1 from string_2" | 84 "assign string_1 from string_2" |
| 85 | 85 |
| 86 mi_gdb_test "-var-update string" \ | 86 mi_gdb_test "-var-update string" \ |
| 87 "\\^done,changelist=\\\[{name=\"string\",in_scope=\"true\",type_changed=\"fa
lse\",dynamic=\"1\",has_more=\"0\"}\\\]" \ | 87 "\\^done,changelist=\\\[{name=\"string\",in_scope=\"true\",type_changed=\"fa
lse\",dynamic=\"1\",has_more=\"0\"}\\\]" \ |
| 88 "update string varobj after assignment" | 88 "update string varobj after assignment" |
| 89 | 89 |
| 90 mi_create_dynamic_varobj container c \ | 90 # The "elements" field of "c" is still empty, so the attribute |
| 91 # "has_more" is expected to be zero. |
| 92 mi_create_dynamic_varobj container c 0 \ |
| 91 "create container varobj" | 93 "create container varobj" |
| 92 | 94 |
| 93 mi_list_varobj_children container { | 95 mi_list_varobj_children container { |
| 94 } "examine container children=0" | 96 } "examine container children=0" |
| 95 | 97 |
| 96 mi_next "next over update 1" | 98 mi_next "next over update 1" |
| 97 | 99 |
| 98 mi_varobj_update_dynamic container "varobj update 1" { | 100 mi_varobj_update_dynamic container "varobj update 1" { |
| 99 type_changed false new_num_children 1 dynamic 1 has_more 0 | 101 type_changed false new_num_children 1 dynamic 1 has_more 0 |
| 100 } { | 102 } { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } "list children after listing selected range" | 177 } "list children after listing selected range" |
| 176 | 178 |
| 177 mi_next "next over update 4" | 179 mi_next "next over update 4" |
| 178 | 180 |
| 179 # This should only show the first child, because the update range has | 181 # This should only show the first child, because the update range has |
| 180 # been set. | 182 # been set. |
| 181 mi_varobj_update_dynamic container \ | 183 mi_varobj_update_dynamic container \ |
| 182 "update after next with restricted range" { | 184 "update after next with restricted range" { |
| 183 type_changed false new_num_children 1 dynamic 1 has_more 1 | 185 type_changed false new_num_children 1 dynamic 1 has_more 1 |
| 184 } { | 186 } { |
| 185 { name {container.\[0\]} in_scope true type_changed false dynamic 1 has_mo
re 0 } | 187 { name {container.\[0\]} in_scope true type_changed false has_more 0 } |
| 186 } { | 188 } { |
| 187 } | 189 } |
| 188 | 190 |
| 189 mi_gdb_test "-var-set-update-range container 3 4" \ | 191 mi_gdb_test "-var-set-update-range container 3 4" \ |
| 190 "\\^done" \ | 192 "\\^done" \ |
| 191 "set update range with non-zero start" | 193 "set update range with non-zero start" |
| 192 | 194 |
| 193 # Elements were updated but should not be reported. | 195 # Elements were updated but should not be reported. |
| 194 mi_varobj_update_dynamic container \ | 196 mi_varobj_update_dynamic container \ |
| 195 "update varobj with change outside selected range" { | 197 "update varobj with change outside selected range" { |
| 196 type_changed false new_num_children 3 dynamic 1 has_more 0 | 198 type_changed false new_num_children 3 dynamic 1 has_more 0 |
| 197 } { | 199 } { |
| 198 } { | 200 } { |
| 199 } | 201 } |
| 200 | 202 |
| 201 mi_next "next over update 5" | 203 mi_next "next over update 5" |
| 202 | 204 |
| 203 # Regression test: examine an object that has no children, then update | 205 # Regression test: examine an object that has no children, then update |
| 204 # it to ensure that we don't print the children. | 206 # it to ensure that we don't print the children. |
| 205 mi_create_dynamic_varobj container2 c2 \ | 207 mi_create_dynamic_varobj container2 c2 0 \ |
| 206 "create second container varobj" | 208 "create second container varobj" |
| 207 | 209 |
| 208 mi_gdb_test "-var-update container2" \ | 210 mi_gdb_test "-var-update container2" \ |
| 209 "\\^done,changelist=.." \ | 211 "\\^done,changelist=.." \ |
| 210 "update varobj, no children requested" | 212 "update varobj, no children requested" |
| 211 | 213 |
| 212 mi_next "next over update 6" | 214 mi_next "next over update 6" |
| 213 | 215 |
| 214 # Now container2 has an element -- and an update should mention that | 216 # Now container2 has an element -- and an update should mention that |
| 215 # it has_more. But, because we did not request children, we still | 217 # it has_more. But, because we did not request children, we still |
| 216 # should not actually see them. | 218 # should not actually see them. |
| 217 mi_varobj_update_dynamic container2 \ | 219 mi_varobj_update_dynamic container2 \ |
| 218 "update varobj 2, no children requested" { | 220 "update varobj 2, no children requested" { |
| 219 type_changed false dynamic 1 has_more 1 | 221 type_changed false dynamic 1 has_more 1 |
| 220 } {} {} | 222 } {} {} |
| 221 | 223 |
| 222 mi_continue_to_line \ | 224 mi_continue_to_line \ |
| 223 [gdb_get_line_number {MI outer breakpoint here} ${srcfile}] \ | 225 [gdb_get_line_number {MI outer breakpoint here} ${srcfile}] \ |
| 224 "step to outer breakpoint" | 226 "step to outer breakpoint" |
| 225 | 227 |
| 226 mi_create_dynamic_varobj outer outer \ | 228 mi_create_dynamic_varobj outer outer 1 \ |
| 227 "create outer varobj" | 229 "create outer varobj" |
| 228 | 230 |
| 229 mi_list_varobj_children outer { | 231 mi_list_varobj_children outer { |
| 230 { outer.s s 2 "struct substruct" } | 232 { outer.s s 2 "struct substruct" } |
| 231 { outer.x x 0 "int" } | 233 { outer.x x 0 "int" } |
| 232 } "list children of outer" | 234 } "list children of outer" |
| 233 | 235 |
| 234 mi_list_varobj_children outer.s { | 236 mi_list_varobj_children outer.s { |
| 235 { outer.s.a a 0 int } | 237 { outer.s.a a 0 int } |
| 236 { outer.s.b b 0 int } | 238 { outer.s.b b 0 int } |
| 237 } "list children of outer.s" | 239 } "list children of outer.s" |
| 238 | 240 |
| 239 mi_next "next over outer update" | 241 mi_next "next over outer update" |
| 240 | 242 |
| 241 mi_gdb_test "-var-update outer" \ | 243 mi_gdb_test "-var-update outer" \ |
| 242 ".done,changelist=.{name=\"outer.s.a\",in_scope=\"true\",type_changed=\"false\
",dynamic=\"1\",has_more=\"0\"}." \ | 244 ".done,changelist=.{name=\"outer.s.a\",in_scope=\"true\",type_changed=\"false\
",has_more=\"0\"}." \ |
| 243 "update after updating element of outer" | 245 "update after updating element of outer" |
| 244 | 246 |
| 245 mi_continue_to_line \ | 247 mi_continue_to_line \ |
| 246 [gdb_get_line_number {Another MI breakpoint} ${srcfile}] \ | 248 [gdb_get_line_number {Another MI breakpoint} ${srcfile}] \ |
| 247 "step to second breakpoint" | 249 "step to second breakpoint" |
| 248 | 250 |
| 249 mi_varobj_update_with_type_change container int 0 "update after type change" | 251 mi_varobj_update_with_type_change container int 0 "update after type change" |
| 250 | 252 |
| 251 | 253 |
| 252 mi_continue_to_line \ | 254 mi_continue_to_line \ |
| 253 [gdb_get_line_number {break to inspect struct and union} ${srcfile}] \ | 255 [gdb_get_line_number {break to inspect struct and union} ${srcfile}] \ |
| 254 "step to outer breakpoint" | 256 "step to outer breakpoint" |
| 255 | 257 |
| 256 mi_create_dynamic_varobj nscont nstype \ | 258 mi_create_dynamic_varobj nscont nstype 1 \ |
| 257 "create nstype varobj" | 259 "create nstype varobj" |
| 258 | 260 |
| 259 mi_list_varobj_children nscont { | 261 mi_list_varobj_children nscont { |
| 260 { {nscont.\[0\]} {\[0\]} 0 int } | 262 { {nscont.\[0\]} {\[0\]} 0 int } |
| 261 { {nscont.\[1\]} {\[1\]} 0 int } | 263 { {nscont.\[1\]} {\[1\]} 0 int } |
| 262 } "list children after setting update range" | 264 } "list children after setting update range" |
| 263 | 265 |
| 264 mi_gdb_test "-var-set-visualizer nscont None" \ | 266 mi_gdb_test "-var-set-visualizer nscont None" \ |
| 265 "\\^done" \ | 267 "\\^done" \ |
| 266 "clear visualizer" | 268 "clear visualizer" |
| 267 | 269 |
| 268 mi_gdb_test "-var-update nscont" \ | 270 mi_gdb_test "-var-update nscont" \ |
| 269 "\\^done,changelist=\\\[\\\]" \ | 271 "\\^done,changelist=\\\[\\\]" \ |
| 270 "varobj update after clearing" | 272 "varobj update after clearing" |
| 271 | 273 |
| 272 mi_gdb_test "-var-set-visualizer nscont gdb.default_visualizer" \ | 274 mi_gdb_test "-var-set-visualizer nscont gdb.default_visualizer" \ |
| 273 "\\^done" \ | 275 "\\^done" \ |
| 274 "choose default visualizer" | 276 "choose default visualizer" |
| 275 | 277 |
| 276 mi_gdb_test "python exception_flag = True" "" | 278 mi_gdb_test "python exception_flag = True" "" |
| 277 | 279 |
| 278 mi_create_dynamic_varobj nstype2 nstype2 \ | 280 mi_create_dynamic_varobj nstype2 nstype2 1 \ |
| 279 "create nstype2 varobj" | 281 "create nstype2 varobj" |
| 280 | 282 |
| 281 mi_list_varobj_children nstype2 { | 283 mi_list_varobj_children nstype2 { |
| 282 { {nstype2.<error at 0>} {<error at 0>} 6 {char \[6\]} } | 284 { {nstype2.<error at 0>} {<error at 0>} 6 {char \[6\]} } |
| 283 } "list children after setting exception flag" | 285 } "list children after setting exception flag" |
| 284 | 286 |
| 285 mi_create_varobj me me \ | 287 mi_create_varobj me me \ |
| 286 "create me varobj" | 288 "create me varobj" |
| 287 | 289 |
| 288 mi_gdb_test "-var-evaluate-expression me" \ | 290 mi_gdb_test "-var-evaluate-expression me" \ |
| 289 "\\^done,value=\"<error reading variable: Cannot access memory.>.*\"" \ | 291 "\\^done,value=\"<error reading variable: Cannot access memory.>.*\"" \ |
| 290 "evaluate me varobj" | 292 "evaluate me varobj" |
| 291 | 293 |
| 292 # Regression test for python/14836. | 294 # Regression test for python/14836. |
| 293 mi_create_dynamic_varobj children_as_list children_as_list \ | 295 mi_create_dynamic_varobj children_as_list children_as_list 1 \ |
| 294 "printer whose children are returned as a list" | 296 "printer whose children are returned as a list" |
| 295 | 297 |
| 298 # Regression test for bug 14741. |
| 299 mi_continue_to_line \ |
| 300 [gdb_get_line_number {breakpoint bug 14741} ${srcfile}] \ |
| 301 "step to breakpoint for bug 14741" |
| 302 |
| 303 mi_create_dynamic_varobj c c 1 \ |
| 304 "create varobj for c" |
| 305 |
| 306 mi_gdb_test "-var-set-visualizer c ArrayPrinter" \ |
| 307 "\\^done" \ |
| 308 "choose array visualizer for c" |
| 309 |
| 310 mi_list_varobj_children c { |
| 311 { {c.\[0\]} {\[0\]} 0 int } |
| 312 } "list children of c" |
| 313 |
| 314 mi_next "next over change of array element" |
| 315 |
| 316 mi_gdb_test "-var-update c" \ |
| 317 "\\^done,changelist=\\\[{name=\"c.\\\[0\\\]\",in_scope=\"true\",type_changed
=\"false\",has_more=\"0\"}\\\]" \ |
| 318 "update varobj after element change" |
| 319 |
| 296 # C++ MI tests | 320 # C++ MI tests |
| 297 gdb_exit | 321 gdb_exit |
| 298 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" \ | 322 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}-cxx" \ |
| 299 executable {debug c++ additional_flags=-DMI}] != "" } { | 323 executable {debug c++ additional_flags=-DMI}] != "" } { |
| 300 untested "Couldn't compile ${srcfile} in c++ mode" | 324 untested "Couldn't compile ${srcfile} in c++ mode" |
| 301 return -1 | 325 return -1 |
| 302 } | 326 } |
| 303 | 327 |
| 304 if [mi_gdb_start] { | 328 if [mi_gdb_start] { |
| 305 continue | 329 continue |
| (...skipping 21 matching lines...) Expand all Loading... |
| 327 } "list children of fake" | 351 } "list children of fake" |
| 328 | 352 |
| 329 mi_list_varobj_children fake.private { | 353 mi_list_varobj_children fake.private { |
| 330 { fake.private.sname sname 0 int } | 354 { fake.private.sname sname 0 int } |
| 331 } "list children fake.private" | 355 } "list children fake.private" |
| 332 | 356 |
| 333 mi_gdb_test "-var-set-visualizer fake.private gdb.default_visualizer" \ | 357 mi_gdb_test "-var-set-visualizer fake.private gdb.default_visualizer" \ |
| 334 "\\^done" "Install visualizer on a cplus_fake_child" | 358 "\\^done" "Install visualizer on a cplus_fake_child" |
| 335 | 359 |
| 336 remote_file host delete ${remote_python_file} | 360 remote_file host delete ${remote_python_file} |
| OLD | NEW |