-# Copyright (C) 1992, 1997, 2007, 2008, 2009 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1997, 2007, 2008, 2009, 2010, 2011
+# 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
strace $tracelevel
}
-set prms_id 0
-set bug_id 0
+
+set testfile "gdbvars"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested gdbvars.exp
+ return -1
+}
proc test_convenience_variables {} {
global gdb_prompt
- gdb_test "set \$foo = 101" "" \
+ gdb_test_no_output "set \$foo = 101" \
"Set a new convenience variable"
gdb_test "print \$foo" " = 101" \
"Print contents of new convenience variable"
- gdb_test "set \$foo = 301" "" \
+ gdb_test_no_output "set \$foo = 301" \
"Set convenience variable to a new value"
gdb_test "print \$foo" " = 301" \
"Print new contents of convenience variable"
- gdb_test "set \$_ = 11" "" \
+ gdb_test_no_output "set \$_ = 11" \
"Set convenience variable \$_"
gdb_test "print \$_" " = 11" \
"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"
+ gdb_test "print /x \$prog_var" " = $hex" \
+ "Print contents of new convenience variable of program variable"
+}
+
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
-send_gdb "set print sevenbit-strings\n" ; gdb_expect -re ".*$gdb_prompt $"
+gdb_test_no_output "set print sevenbit-strings"
test_value_history
test_convenience_variables
+test_with_program