Fix zero_ext documentation
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / exprs.exp
index fa3cdb449578313f7822e0e61980bfa2318226de..446f8cca12e70e9ffc9ee5611cc161ff8d73d205 100644 (file)
@@ -1,4 +1,4 @@
-#   Copyright 1988-2013 Free Software Foundation, Inc.
+#   Copyright 1988-2016 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,9 +19,8 @@
 # test running programs
 #
 
-set testfile "exprs"
-set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
+standard_testfile .c
+
 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
      untested exprs.exp
      return -1
@@ -31,10 +30,7 @@ if [get_compiler_info] {
     return -1
 }
 
-gdb_exit
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
+clean_restart ${binfile}
 
 #
 # set it up at a breakpoint so we can play with the variable values
@@ -49,17 +45,17 @@ proc test_expr { args } {
     if { [llength $args] % 2 } {
        warning "an even # of arguments should be passed to test_expr"
     }
-    set last_ent [expr [llength $args] - 1];
-    set testname [lindex $args $last_ent];
+    set last_ent [expr [llength $args] - 1]
+    set testname [lindex $args $last_ent]
     if [gdb_test [lindex $args 0] ".*" "$testname (setup)"] {
-       gdb_suppress_tests;
+       gdb_suppress_tests
     }
     for {set x 1} {$x < $last_ent} {set x [expr $x + 2]} {
        if [gdb_test [lindex $args $x] [lindex $args [expr $x + 1]] "$testname ([lindex $args $x])"] {
-           gdb_suppress_tests;
+           gdb_suppress_tests
        }
     }
-    gdb_stop_suppressing_tests;
+    gdb_stop_suppressing_tests
 }
 #
 # test expressions with "char" types
@@ -204,7 +200,9 @@ test_expr "set variable v_unsigned_long=~0" "print v_unsigned_long > 0" "\\$\[0-
 # Test expressions with casts to a pointer.
 # NB: Some architectures convert a ``NULL'' pointer into
 #     something else. Don't simply test for 0.
-#
+# Prevent symbol on address 0x0 being printed.
+gdb_test_no_output "set print symbol off"
+
 test_expr "set variable v_signed_char = 0" "print (void*)v_signed_char" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_char"
 test_expr "set variable v_signed_short = 0" "print (void*)v_signed_short" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_short"
 test_expr "set variable v_signed_int = 0" "print (void*)v_signed_int" "\\$\[0-9\]* = .void \\*. $hex" "print (void*)v_signed_int"
@@ -273,3 +271,7 @@ gdb_test "print {short} v_short_array" "$decimal = 42"
 # Regression tests for cast to void.
 gdb_test "print (void) v_int_pointer" " = void"
 gdb_test "print & (void) v_char" "value not located in memory."
+
+# Regression test for "&&".
+gdb_test "print null_t_struct && null_t_struct->v_int_member == 0" \
+    " = 0"
This page took 0.029587 seconds and 4 git commands to generate.