-# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# Copyright 1999-2014 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
continue
}
-set testfile "var-cmd"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/mi-var-display
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
+standard_testfile var-cmd.c
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
untested mi-var-display.exp
return -1
}
set line_dct_end [gdb_get_line_number "{int a = 0;}"]
-mi_create_breakpoint "$srcfile:$line_dct_end" 1 keep do_children_tests ".*var-cmd.c" $line_dct_end $hex \
- "break-insert operation"
+mi_create_breakpoint "$srcfile:$line_dct_end" \
+ "break-insert operation" \
+ -number 1 -func do_children_tests -file ".*var-cmd.c" \
+ -line $line_dct_end
mi_run_cmd
mi_expect_stop "breakpoint-hit" "do_children_tests" "" ".*var-cmd.c" \
$line_dct_end { "" "disp=\"keep\"" } "run to main"
+# Prevent symbol on the address being printed.
+mi_gdb_test "-gdb-set print symbol off"
+
##### #####
# #
# Display tests #
# Desc: change format of bar to hex
mi_gdb_test "-var-set-format bar hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"0x849\"" \
- "set format variable bar"
+ "set format variable bar in hex"
# Test: c_variable-6.6
# Desc: value of bar with new format
mi_gdb_test "-var-set-format bar decimal" \
"\\^done,format=\"decimal\",value=\"3\"" \
- "set format variable bar"
+ "set format variable bar in decimal"
mi_gdb_test "-var-evaluate-expression bar" \
"\\^done,value=\"3\"" \
# Desc: format of variable foo
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"natural\"" \
- "show format variable foo"
+ "show format variable foo in natural"
# Test: c_variable-6.14
# Desc: value of variable foo
mi_gdb_test "-var-evaluate-expression foo" \
"\\^done,value=\"$hex\"" \
- "eval variable foo"
+ "eval variable foo in natural"
# Test: c_variable-6.15
# Desc: change format of var to octal
mi_gdb_test "-var-set-format foo octal" \
"\\^done,format=\"octal\",value=\"$octal\"" \
- "set format variable foo"
+ "set format variable foo in octal"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"octal\"" \
- "show format variable foo"
+ "show format variable foo in octal"
# Test: c_variable-6.16
# Desc: value of foo with new format
mi_gdb_test "-var-evaluate-expression foo" \
"\\^done,value=\"\[0-7\]+\"" \
- "eval variable foo"
+ "eval variable foo in octal"
# Test: c_variable-6.17
# Desc: change value of foo
mi_gdb_test "-var-set-format foo decimal" \
"\\^done,format=\"decimal\",value=\"3\"" \
- "set format variable foo"
+ "set format variable foo decimal"
# Test: c_variable-6.18
# Desc: check new value of foo
mi_gdb_test "-var-evaluate-expression foo" \
"\\^done,value=\"3\"" \
- "eval variable foo"
+ "eval variable foo in decimal"
# Test: c_variable-6.19
mi_gdb_test "-var-evaluate-expression -f octal foo" \
"\\^done,value=\"03\"" \
- "eval variable foo in octal"
+ "eval variable -f octal foo"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"decimal\"" \
mi_gdb_test "-var-evaluate-expression -f decimal foo" \
"\\^done,value=\"3\"" \
- "eval variable foo in decimal"
+ "eval variable -f decimal foo"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"decimal\"" \
mi_gdb_test "-var-evaluate-expression -f nat foo" \
"\\^done,value=\"0x3\"" \
- "eval variable foo in natural"
+ "eval variable -f nat foo"
mi_gdb_test "-var-show-format foo" \
"\\^done,format=\"decimal\"" \
{weird.integer integer 0 int}
{weird.character character 0 char}
{weird.char_ptr char_ptr 1 "char \\*"}
- {weird.long_int long_int 0 "long int"}
+ {weird.long_int long_int 0 "long"}
{weird.int_ptr_ptr int_ptr_ptr 1 "int \\*\\*"}
- {weird.long_array long_array 10 "long int \\[10\\]"}
+ {weird.long_array long_array 10 "long \\[10\\]"}
{weird.func_ptr func_ptr 0 "void \\(\\*\\)\\((void)?\\)"}
{weird.func_ptr_struct func_ptr_struct 0 \
- "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long int\\))?"}
+ "struct _struct_decl \\(\\*\\)(\\(int, char \\*, long\\))?"}
{weird.func_ptr_ptr func_ptr_ptr 0 \
- "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long int)?\\)"}
+ "struct _struct_decl \\*\\(\\*\\)\\((int, char \\*, long)?\\)"}
{weird.u1 u1 4 "union \\{\\.\\.\\.\\}"}
{weird.s2 s2 4 "struct \\{\\.\\.\\.\\}"}
} "get children local variable weird"
# Desc: change format of weird.func_ptr and weird.func_ptr_ptr
mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
- "set format variable weird.func_ptr"
+ "set format variable weird.func_ptr in hex (1)"
mi_gdb_test "-var-show-format weird.func_ptr" \
"\\^done,format=\"hexadecimal\"" \
mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
- "set format variable weird.func_ptr_ptr"
+ "set format variable weird.func_ptr_ptr in hex"
mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
"\\^done,format=\"hexadecimal\"" \
mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
- "set format variable weird.func_ptr"
+ "set format variable weird.func_ptr in hex (2)"
mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
"set format variable weird.func_ptr_struct"
mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
- "\\^done,format=\"natural\",value=\"0\"" \
- "set format variable weird.func_ptr_ptr"
+ "\\^done,format=\"natural\",value=\"0x0\"" \
+ "set format variable weird.func_ptr_ptr in natural"
mi_gdb_test "-var-set-format weird.u1 natural" \
"\\^done,format=\"natural\",value=\"\{...\}\"" \
set line_dst_incr_a_2 [gdb_get_line_number "incr_a(2);"]
-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_create_breakpoint "$line_dst_incr_a_2" \
+ "break-insert operation 2" \
+ -number 2 -func do_special_tests -file ".*var-cmd.c" \
+ -line $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\"" } \
mi_list_varobj_children "anonu" {
{anonu.a a 0 int}
{anonu.b b 0 char}
- {anonu.c c 0 "long int"}
+ {anonu.c c 0 "long"}
} "get children of anonu"
# Test: c_variable-7.30
mi_list_varobj_children anons {
{anons.a a 0 int}
{anons.b b 0 char}
- {anons.c c 0 "long int"}
+ {anons.c c 0 "long"}
} "get children of anons"
# Test: c_variable-7.50
# Desc: create enum e
mi_create_varobj e e "create local variable e"
-setup_xfail "*-*-*"
# Test: c_variable-7.51
# Desc: value of e
mi_gdb_test "-var-evaluate-expression e" \
- "\\^done,value=\"FIXME\"" \
+ "\\^done,value=\"bar\"" \
"eval variable e"
-clear_xfail "*-*-*"
# Test: c_variable-7.52
# Desc: type of e
# Record fp
-
-gdb_test_multiple "p/x \$fp" "print FP register" {
- -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" {
- pass "print FP register"
- set fp $expect_out(1,string)
- }
+if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] {
+ set fp $expect_out(3,string)
}
mi_continue_to "incr_a"
"\\^done,name=\"a1\",numchild=\"0\",value=\".*\",type=\"char\".*" \
"create local variable a1"
-mi_gdb_test "-var-create a2 $fp a" \
+if { [info exists fp] } {
+ mi_gdb_test "-var-create a2 $fp a" \
"\\^done,name=\"a2\",numchild=\"0\",value=\".*\",type=\"int\".*" \
"create variable a2 in different scope"
+} else {
+ untested "create variable a2 in different scope"
+}
#gdbtk_test c_variable-7.81 {create variables in different scopes} {
# set a1 [gdb_variable create -expr a]