]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.mi/mi-var-display.exp
Set print symbol off in mi-var-display.exp
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-var-display.exp
index 22ad34d73fbe078d9578a2776913920c24eb7032..02c22129ecfdbd48ad99956d4f4c8184ce3bb8a7 100644 (file)
@@ -1,5 +1,4 @@
-# Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
-# 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
@@ -28,10 +27,9 @@ if [mi_gdb_start] {
     continue
 }
 
-set testfile "var-cmd"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-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
 }
@@ -42,12 +40,17 @@ mi_gdb_load ${binfile}
 
 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" \
+    "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 "" "run to main"
+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"
 
 #####       #####
 #               #
@@ -81,7 +84,7 @@ mi_gdb_test "-var-evaluate-expression bar" \
 # 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
@@ -97,7 +100,7 @@ mi_gdb_test "-var-assign bar 3" \
 
 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\"" \
@@ -121,29 +124,29 @@ mi_gdb_test "-var-info-type foo" \
 # 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
@@ -153,13 +156,13 @@ mi_gdb_test "-var-assign foo 3" \
 
 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
@@ -175,7 +178,7 @@ mi_gdb_test "-var-show-format foo" \
 
 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\"" \
@@ -183,7 +186,7 @@ mi_gdb_test "-var-show-format foo" \
 
 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\"" \
@@ -191,7 +194,7 @@ mi_gdb_test "-var-show-format foo" \
 
 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\"" \
@@ -217,14 +220,14 @@ mi_list_varobj_children weird {
         {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"
@@ -234,7 +237,7 @@ mi_list_varobj_children 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\"" \
@@ -242,7 +245,7 @@ mi_gdb_test "-var-show-format weird.func_ptr" \
 
 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\"" \
@@ -259,7 +262,7 @@ mi_gdb_test "-var-set-format weird.integer natural" \
        "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" \
@@ -280,15 +283,15 @@ mi_gdb_test "-var-set-format weird.long_array natural" \
 
 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=\"\{...\}\"" \
@@ -370,11 +373,13 @@ mi_gdb_test "-var-delete weird" \
 
 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" \
+    "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 "" \
+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
@@ -445,7 +450,7 @@ mi_gdb_test "-var-info-num-children anonu" \
 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
@@ -522,20 +527,18 @@ mi_gdb_test "-var-info-num-children anons" \
 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
@@ -558,7 +561,7 @@ mi_gdb_test "-var-info-num-children e" \
 # 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
@@ -600,20 +603,13 @@ mi_gdb_test "-var-info-num-children anone" \
 # 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"
 
 
 # Record fp
-
-send_gdb "p/x \$fp\n"
-gdb_expect {
-    -re ".*($hex).*\\^done\r\n$mi_gdb_prompt$" { 
-       pass "print FP register"
-       set fp $expect_out(1,string) 
-    }
-#    -re ".*" { fail "print FP register"}
-    timeout { fail "print FP register (timeout)"}
+if ![mi_gdb_test "p/x \$fp" ".*($hex).*\\^done" "print FP register"] {
+    set fp $expect_out(3,string) 
 }
 
 mi_continue_to "incr_a"
@@ -624,9 +620,13 @@ mi_gdb_test "-var-create a1 * 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]