gdb/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / gdbvars.exp
index 1c29ea6e5d5e2652d0442f47ec4cdcccef7e0b4d..683f7781284d6cfa5073551d7154b43adc8f1995 100644 (file)
@@ -1,4 +1,5 @@
-# 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
@@ -19,25 +20,32 @@ if $tracelevel then {
        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" \
@@ -101,13 +109,23 @@ proc test_value_history {} {
        "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
This page took 0.025572 seconds and 4 git commands to generate.