| OLD | NEW |
| 1 # Copyright 1999-2005, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 1999-2005, 2007-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 # Test essential Machine interface (MI) operations | 16 # Test essential Machine interface (MI) operations |
| 17 # | 17 # |
| 18 # Verify that, using the MI, we can create, update, delete variables. | 18 # Verify that, using the MI, we can create, update, delete variables. |
| 19 # | 19 # |
| 20 | 20 |
| 21 | 21 |
| 22 load_lib mi-support.exp | 22 load_lib mi-support.exp |
| 23 set MIFLAGS "-i=mi" | 23 set MIFLAGS "-i=mi" |
| 24 | 24 |
| 25 gdb_exit | 25 gdb_exit |
| 26 if [mi_gdb_start] { | 26 if [mi_gdb_start] { |
| 27 continue | 27 continue |
| 28 } | 28 } |
| 29 | 29 |
| 30 set testfile "var-cmd" | 30 standard_testfile var-cmd.c |
| 31 set srcfile ${testfile}.c | 31 |
| 32 set binfile ${objdir}/${subdir}/mi-var-display | 32 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug}] != "" } { |
| 33 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
ug additional_flags=-DFAKEARGV}] != "" } { | |
| 34 untested mi-var-display.exp | 33 untested mi-var-display.exp |
| 35 return -1 | 34 return -1 |
| 36 } | 35 } |
| 37 | 36 |
| 38 mi_delete_breakpoints | 37 mi_delete_breakpoints |
| 39 mi_gdb_reinitialize_dir $srcdir/$subdir | 38 mi_gdb_reinitialize_dir $srcdir/$subdir |
| 40 mi_gdb_load ${binfile} | 39 mi_gdb_load ${binfile} |
| 41 | 40 |
| 42 set line_dct_end [gdb_get_line_number "{int a = 0;}"] | 41 set line_dct_end [gdb_get_line_number "{int a = 0;}"] |
| 43 | 42 |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 278 |
| 280 mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ | 279 mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \ |
| 281 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ | 280 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
| 282 "set format variable weird.func_ptr" | 281 "set format variable weird.func_ptr" |
| 283 | 282 |
| 284 mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ | 283 mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \ |
| 285 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ | 284 "\\^done,format=\"hexadecimal\",value=\"$hex\"" \ |
| 286 "set format variable weird.func_ptr_struct" | 285 "set format variable weird.func_ptr_struct" |
| 287 | 286 |
| 288 mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ | 287 mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \ |
| 289 » "\\^done,format=\"natural\",value=\"0\"" \ | 288 » "\\^done,format=\"natural\",value=\"0x0\"" \ |
| 290 "set format variable weird.func_ptr_ptr" | 289 "set format variable weird.func_ptr_ptr" |
| 291 | 290 |
| 292 mi_gdb_test "-var-set-format weird.u1 natural" \ | 291 mi_gdb_test "-var-set-format weird.u1 natural" \ |
| 293 "\\^done,format=\"natural\",value=\"\{...\}\"" \ | 292 "\\^done,format=\"natural\",value=\"\{...\}\"" \ |
| 294 "set format variable weird.u1" | 293 "set format variable weird.u1" |
| 295 | 294 |
| 296 mi_gdb_test "-var-set-format weird.s2 natural" \ | 295 mi_gdb_test "-var-set-format weird.s2 natural" \ |
| 297 "\\^done,format=\"natural\",value=\"\{...\}\"" \ | 296 "\\^done,format=\"natural\",value=\"\{...\}\"" \ |
| 298 "set format variable weird.s2" | 297 "set format variable weird.s2" |
| 299 | 298 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 } | 606 } |
| 608 | 607 |
| 609 mi_continue_to "incr_a" | 608 mi_continue_to "incr_a" |
| 610 | 609 |
| 611 # Test: c_variable-7.81 | 610 # Test: c_variable-7.81 |
| 612 # Desc: Create variables in different scopes | 611 # Desc: Create variables in different scopes |
| 613 mi_gdb_test "-var-create a1 * a" \ | 612 mi_gdb_test "-var-create a1 * a" \ |
| 614 "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \ | 613 "\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \ |
| 615 "create local variable a1" | 614 "create local variable a1" |
| 616 | 615 |
| 617 mi_gdb_test "-var-create a2 $fp a" \ | 616 if { [info exists fp] } { |
| 617 mi_gdb_test "-var-create a2 $fp a" \ |
| 618 "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \ | 618 "\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \ |
| 619 "create variable a2 in different scope" | 619 "create variable a2 in different scope" |
| 620 } else { |
| 621 untested "create variable a2 in different scope" |
| 622 } |
| 620 | 623 |
| 621 #gdbtk_test c_variable-7.81 {create variables in different scopes} { | 624 #gdbtk_test c_variable-7.81 {create variables in different scopes} { |
| 622 # set a1 [gdb_variable create -expr a] | 625 # set a1 [gdb_variable create -expr a] |
| 623 # set a2 [gdb_variable create -expr a -frame $fp] | 626 # set a2 [gdb_variable create -expr a -frame $fp] |
| 624 | 627 |
| 625 # set vals {} | 628 # set vals {} |
| 626 # lappend vals [$a1 value] | 629 # lappend vals [$a1 value] |
| 627 # lappend vals [$a2 value] | 630 # lappend vals [$a2 value] |
| 628 # set vals | 631 # set vals |
| 629 #} {2 1} | 632 #} {2 1} |
| 630 | 633 |
| 631 | 634 |
| 632 mi_gdb_exit | 635 mi_gdb_exit |
| 633 return 0 | 636 return 0 |
| OLD | NEW |