X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.base%2Fgdbvars.exp;h=a4e5b417ac50f394c08d984884829f92b4654e03;hb=55708e99aca33f2ee9036732d778cd5899d2a2b0;hp=23a6758bcaeca6e1908157fc4c5fc3ec813bcc76;hpb=289f9037cb9f11c5588dd3baf648e253ffc57574;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.base/gdbvars.exp b/gdb/testsuite/gdb.base/gdbvars.exp index 23a6758bca..a4e5b417ac 100644 --- a/gdb/testsuite/gdb.base/gdbvars.exp +++ b/gdb/testsuite/gdb.base/gdbvars.exp @@ -1,4 +1,4 @@ -# Copyright (C) 1992-2013 Free Software Foundation, Inc. +# Copyright (C) 1992-2019 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 @@ -18,8 +18,7 @@ standard_testfile -if {[prepare_for_testing $testfile.exp $testfile $srcfile debug]} { - untested $testfile.exp +if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug]} { return -1 } @@ -52,6 +51,49 @@ proc test_convenience_variables {} { gdb_test "print \$bar" " = void" \ "Print contents of uninitialized convenience variable" + + + gdb_test "print \$str = \"some string\"" \ + " = \"some string\"" \ + "Set convenience variable to string value" + gdb_test "print \$str = \"some other string\"" \ + " = \"some other string\"" \ + "Change convenience variable to different string value" + + gdb_test "print \$arr = {1, 2, 3}" \ + " = \\{1, 2, 3\\}" \ + "Set convenience variable to array value" + gdb_test "print \$arr = {0, 1, 2, 3}" \ + " = \\{0, 1, 2, 3\\}" \ + "Set convenience variable to different array value" +} + +proc test_convenience_functions {} { + gdb_test "print \$_isvoid" " = " \ + "Print internal function \$_isvoid" + + gdb_test "print \$isvoid_foo" " = void" \ + "Print void convenience variable" + + gdb_test "print \$_isvoid (\$isvoid_foo)" " = 1" \ + "Check whether void convenience variable is void" + + gdb_test_no_output "set \$isvoid_foo = 1" \ + "Set void convenience variable to 1" + + gdb_test "print \$_isvoid (\$isvoid_foo)" " = 0" \ + "Check whether non-void convenience variable is void" + + # For the next test, we need the inferior to be running. + if { ![runto_main] } { + return -1 + } + + gdb_test "print \$_isvoid (foo_void ())" " = 1" \ + "Check whether void function is void" + + gdb_test "print \$_isvoid (foo_int ())" " = 0" \ + "Check whether non-void function is void" } proc test_value_history {} { @@ -114,4 +156,5 @@ gdb_test_no_output "set print sevenbit-strings" test_value_history test_convenience_variables +test_convenience_functions test_with_program