global gdb_prompt
gdb_test_no_output "set \$foo = 101" \
- "Set a new convenience variable"
+ "set a new convenience variable"
gdb_test "print \$foo" " = 101" \
- "Print contents of new convenience variable"
+ "print contents of new convenience variable"
gdb_test_no_output "set \$foo = 301" \
- "Set convenience variable to a new value"
+ "set convenience variable to a new value"
gdb_test "print \$foo" " = 301" \
- "Print new contents of convenience variable"
+ "print new contents of convenience variable"
gdb_test_no_output "set \$_ = 11" \
- "Set convenience variable \$_"
+ "set convenience variable \$_"
gdb_test "print \$_" " = 11" \
- "Print contents of convenience variable \$_"
+ "print contents of convenience variable \$_"
gdb_test "print \$foo + 10" " = 311" \
- "Use convenience variable in arithmetic expression"
+ "use convenience variable in arithmetic expression"
gdb_test "print (\$foo = 32) + 4" " = 36" \
- "Use convenience variable assignment in arithmetic expression"
+ "use convenience variable assignment in arithmetic expression"
gdb_test "print \$bar" " = void" \
- "Print contents of uninitialized convenience variable"
+ "print contents of uninitialized convenience variable"
gdb_test "print \$str = \"some string\"" \
" = \"some string\"" \
- "Set convenience variable to string value"
+ "set convenience variable to string value"
gdb_test "print \$str = \"some other string\"" \
" = \"some other string\"" \
- "Change convenience variable to different string value"
+ "change convenience variable to different string value"
gdb_test "print \$arr = {1, 2, 3}" \
" = \\{1, 2, 3\\}" \
- "Set convenience variable to array value"
+ "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"
+ "set convenience variable to different array value"
gdb_test "print \$ptr = (void *) 7" \
" = \\(void \\*\\) 0x7" \
proc test_convenience_functions {} {
gdb_test "print \$_isvoid" " = <internal function _isvoid>" \
- "Print internal function \$_isvoid"
+ "print internal function \$_isvoid"
gdb_test "print \$isvoid_foo" " = void" \
- "Print void convenience variable"
+ "print void convenience variable"
gdb_test "print \$_isvoid (\$isvoid_foo)" " = 1" \
- "Check whether void convenience variable is void"
+ "check whether void convenience variable is void"
gdb_test_no_output "set \$isvoid_foo = 1" \
- "Set void convenience variable to 1"
+ "set void convenience variable to 1"
gdb_test "print \$_isvoid (\$isvoid_foo)" " = 0" \
- "Check whether non-void convenience variable is void"
+ "check whether non-void convenience variable is void"
# For the next test, we need the inferior to be running.
if { ![runto_main] } {
}
gdb_test "print \$_isvoid (foo_void ())" " = 1" \
- "Check whether void function is void"
+ "check whether void function is void"
gdb_test "print \$_isvoid (foo_int ())" " = 0" \
- "Check whether non-void function is void"
+ "check whether non-void function is void"
}
proc test_value_history {} {
global gdb_prompt
gdb_test "print 101" "\\\$1 = 101" \
- "Set value-history\[1\] using \$1"
+ "set value-history\[1\] using \$1"
gdb_test "print 102" "\\\$2 = 102" \
- "Set value-history\[2\] using \$2"
+ "set value-history\[2\] using \$2"
gdb_test "print 103" "\\\$3 = 103" \
- "Set value-history\[3\] using \$3"
+ "set value-history\[3\] using \$3"
gdb_test "print \$\$" "\\\$4 = 102" \
- "Print value-history\[MAX-1\] using inplicit index \$\$"
+ "print value-history\[MAX-1\] using inplicit index \$\$"
gdb_test "print \$\$" "\\\$5 = 103" \
- "Print value-history\[MAX-1\] again using implicit index \$\$"
+ "print value-history\[MAX-1\] again using implicit index \$\$"
gdb_test "print \$" "\\\$6 = 103" \
- "Print value-history\[MAX\] using implicit index \$"
+ "print value-history\[MAX\] using implicit index \$"
gdb_test "print \$\$2" "\\\$7 = 102" \
- "Print value-history\[MAX-2\] using explicit index \$\$2"
+ "print value-history\[MAX-2\] using explicit index \$\$2"
gdb_test "print \$0" "\\\$8 = 102" \
- "Print value-history\[MAX\] using explicit index \$0"
+ "print value-history\[MAX\] using explicit index \$0"
gdb_test "print 108" "\\\$9 = 108"
gdb_test "print \$\$0" "\\\$10 = 108" \
- "Print value-history\[MAX\] using explicit index \$\$0"
+ "print value-history\[MAX\] using explicit index \$\$0"
gdb_test "print \$1" "\\\$11 = 101" \
- "Print value-history\[1\] using explicit index \$1"
+ "print value-history\[1\] using explicit index \$1"
gdb_test "print \$2" "\\\$12 = 102" \
- "Print value-history\[2\] using explicit index \$2"
+ "print value-history\[2\] using explicit index \$2"
gdb_test "print \$3" "\\\$13 = 103" \
- "Print value-history\[3\] using explicit index \$3"
+ "print value-history\[3\] using explicit index \$3"
gdb_test "print \$-3" "\\\$14 = 100" \
- "Print (value-history\[MAX\] - 3) using implicit index \$"
+ "print (value-history\[MAX\] - 3) using implicit index \$"
gdb_test "print \$1 + 3" "\\\$15 = 104" \
- "Use value-history element in arithmetic expression"
+ "use value-history element in arithmetic expression"
}
proc test_with_program {} {
global hex
gdb_test_no_output "set \$prog_var = p" \
- "Set a new convenience variable to a program variable"
+ "set a new convenience variable to a program variable"
gdb_test "print /x \$prog_var" " = $hex" \
- "Print contents of new convenience variable of program variable"
+ "print contents of new convenience variable of program variable"
# Test $_thread/$_inferior convenience variables in various commands.
gdb_test "info threads \$_thread" "\\* 1 .* main.*"