-# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
+# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009
# Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
set testfile "var-cmd"
set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+set binfile ${objdir}/${subdir}/mi2-var-display
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
untested mi2-var-display.exp
return -1
set line_dct_end [gdb_get_line_number "{int a = 0;}"]
-mi_gdb_test "200-break-insert $srcfile:$line_dct_end" \
- "200\\^done,bkpt=\{number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_children_tests\",file=\".*var-cmd.c\",line=\"$line_dct_end\",times=\"0\"\}" \
- "break-insert operation"
+mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \
+ "break-insert operation"
mi_run_cmd
-mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" $line_dct_end "" "run to main"
+mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
+ $line_dct_end { "" "disp=\"keep\"" } "run to main"
##### #####
# #
"\\^done,value=\"3\"" \
"eval variable foo"
+# Test: c_variable-6.19
+# Desc: check optional format parameter of var-evaluate-expression
+# and check that current format is not changed
+mi_gdb_test "-var-evaluate-expression -f hex foo" \
+ "\\^done,value=\"0x3\"" \
+ "eval variable foo in hex"
+
+mi_gdb_test "-var-show-format foo" \
+ "\\^done,format=\"decimal\"" \
+ "show format variable foo after eval in hex"
+
+mi_gdb_test "-var-evaluate-expression -f octal foo" \
+ "\\^done,value=\"03\"" \
+ "eval variable foo in octal"
+
+mi_gdb_test "-var-show-format foo" \
+ "\\^done,format=\"decimal\"" \
+ "show format variable foo after eval in octal"
+
+mi_gdb_test "-var-evaluate-expression -f decimal foo" \
+ "\\^done,value=\"3\"" \
+ "eval variable foo in decimal"
+
+mi_gdb_test "-var-show-format foo" \
+ "\\^done,format=\"decimal\"" \
+ "show format variable foo after eval in decimal"
+
+mi_gdb_test "-var-evaluate-expression -f nat foo" \
+ "\\^done,value=\"0x3\"" \
+ "eval variable foo in natural"
+
+mi_gdb_test "-var-show-format foo" \
+ "\\^done,format=\"decimal\"" \
+ "show format variable foo after eval in natural"
+
+mi_gdb_test "-var-evaluate-expression -f bin foo" \
+ "\\^done,value=\"11\"" \
+ "eval variable foo in binary"
+
+mi_gdb_test "-var-show-format foo" \
+ "\\^done,format=\"decimal\"" \
+ "show format variable foo after eval in binary"
+
mi_gdb_test "-var-delete foo" \
"\\^done,ndeleted=\"1\"" \
"delete var foo"
"set format variable weird.integer"
mi_gdb_test "-var-set-format weird.character natural" \
- "\\^done,format=\"natural\",value=\"0 '\\\\\\\\0'\"" \
+ "\\^done,format=\"natural\",value=\"0 '\\\\\\\\000'\"" \
"set format variable weird.character"
mi_gdb_test "-var-set-format weird.char_ptr natural" \
set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
-mi_gdb_test "200-break-insert $line_dst_incr_a_2" \
- "200\\^done,bkpt=\{number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"$hex\",func=\"do_special_tests\",file=\".*var-cmd.c\",line=\"$line_dst_incr_a_2\",times=\"0\"\}" \
- "break-insert operation"
+mi_create_breakpoint "$line_dst_incr_a_2" 2 keep do_special_tests ".*var-cmd.c" $line_dst_incr_a_2 $hex \
+ "break-insert operation 2"
-mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" ".*var-cmd.c" $line_dst_incr_a_2 "" \
+mi_execute_to "exec-continue" "breakpoint-hit" "do_special_tests" "" \
+ ".*var-cmd.c" $line_dst_incr_a_2 { "" "disp=\"keep\"" } \
"continue to do_special_tests"
# Test: c_variable-7.10
# Test: c_variable-7.55
# Desc: children of e
mi_gdb_test "-var-list-children e" \
- "\\^done,numchild=\"0\"" \
+ "\\^done,numchild=\"0\",has_more=\"0\"" \
"get children of e"
# Test: c_variable-7.60
# Test: c_variable-7.75
# Desc: children of anone
mi_gdb_test "-var-list-children anone" \
- "\\^done,numchild=\"0\"" \
+ "\\^done,numchild=\"0\",has_more=\"0\"" \
"get children of anone"