Switch the license of all .exp files to GPLv3.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / scope.exp
index 708bc42ea1afb07d09f78e62dd65b26aecfa51b2..71285c7a6280667e74059ee88a90ddbacced2d70 100644 (file)
@@ -1,18 +1,18 @@
-# Copyright (C) 1992, 1994, 1997, 1998 Free Software Foundation, Inc.
+# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004,
+# 2007 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
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
 # (at your option) any later version.
-# 
+#
 # This program is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-# 
+#
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Please email any bugs, comments, and/or additions to this file to:
 # bug-gdb@prep.ai.mit.edu
@@ -31,15 +31,18 @@ set binfile ${objdir}/${subdir}/${testfile}
 
 
 if  { [gdb_compile "${srcdir}/${subdir}/scope0.c" "${binfile}0.o" object {debug}] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+     untested scope.exp
+     return -1
 }
 
 if  { [gdb_compile "${srcdir}/${subdir}/scope1.c" "${binfile}1.o" object {debug}] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+     untested scope.exp
+     return -1
 }
 
 if  { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } {
-     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+     untested scope.exp
+     return -1
 }
 
 # Create and source the file that provides information about the compiler
@@ -58,15 +61,14 @@ proc test_at_main {} {
     global det_file
     global srcdir
     global subdir
-    global gcc_compiled
     global hp_cc_compiler
 
-    # skip past init.  There may be a call to __main at the start of
-    # main, so the first next may only get us to the init0 call.
-    if [gdb_test "next" "$decimal.*foo \\(\\);" "next over init0() in main"  "$decimal.*init0 \\(\\);" "next"] { 
-      gdb_suppress_tests ; 
-    }
-
+    # skip past init0.
+    # This used to do an extra "next" if the first one didn't get us
+    # over the call to init0, to handle calls to __main in the
+    # prologue, etc.  But if a breakpoint at main doesn't leave us on
+    # the first line of real code in the function, that's a GDB bug.
+    gdb_test "next" "$decimal.*foo \\(\\);" "next over init0() in main"
 
     # Print scope0.c::filelocal, which is 1
 
@@ -94,16 +96,14 @@ proc test_at_main {} {
 
     # Print scope0.c::filelocal_ro, which is 201
 
-    # No clue why the powerpc fails this test.
-    setup_xfail "powerpc-*-*"
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    # No clue why the rs6000 fails this test.
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main" ] { 
       gdb_suppress_tests ; 
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    setup_xfail "powerpc-*-*"
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro"  "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] { 
       gdb_suppress_tests ; 
     }
@@ -111,9 +111,7 @@ proc test_at_main {} {
 
     # Print scope1.c::filelocal, which is 2
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    #DTS 11747CLLbs
-    if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"}
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] { 
       gdb_suppress_tests ; 
     }
@@ -121,9 +119,7 @@ proc test_at_main {} {
 
     # Print scope1.c::filelocal_bss, which is 102
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    #DTS 11747CLLbs
-    if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"}
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"] { 
       gdb_suppress_tests ; 
     }
@@ -131,9 +127,8 @@ proc test_at_main {} {
 
     # Print scope1.c::filelocal_ro, which is 202
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    #DTS 11747CLLbs
-    if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*"}
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
+    if {$hp_cc_compiler} then { setup_xfail "hppa2.0w-*-*" 11747CLLbs}
     if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] { 
       gdb_suppress_tests ; 
     }
@@ -146,7 +141,7 @@ proc test_at_main {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] { 
       gdb_suppress_tests ; 
     }
@@ -159,7 +154,7 @@ proc test_at_main {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] { 
       gdb_suppress_tests ; 
     }
@@ -172,7 +167,7 @@ proc test_at_main {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] { 
       gdb_suppress_tests ; 
     }
@@ -186,7 +181,6 @@ proc test_at_foo {} {
     global det_file
     global srcdir
     global subdir
-    global gcc_compiled
 
     if [gdb_test "next" ".*bar \\(\\);" "" ] { 
       gdb_suppress_tests ; 
@@ -209,8 +203,7 @@ proc test_at_foo {} {
 
     # Print scope0.c::filelocal_ro, which is 201
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    setup_xfail "powerpc-*-*"
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro"  "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] { 
       gdb_suppress_tests ; 
     }
@@ -220,7 +213,7 @@ proc test_at_foo {} {
 
     # Print scope1.c::filelocal, which is 2
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at foo"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] { 
       gdb_suppress_tests ; 
     }
@@ -229,14 +222,14 @@ proc test_at_foo {} {
     gdb_test "print filelocal_bss" "\\\$$decimal = 102" \
        "print filelocal_bss at foo"
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at foo"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"
 
 
     gdb_test "print filelocal_ro" "\\\$$decimal = 202" \
        "print filelocal_ro at foo"
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at foo"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"
 
 
@@ -247,7 +240,7 @@ proc test_at_foo {} {
     gdb_test "print foo::funclocal" "\\\$$decimal = 3" \
        "print foo::funclocal at foo"
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at foo"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"
 
 
@@ -259,7 +252,7 @@ proc test_at_foo {} {
     gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \
        "print foo::funclocal_bss at foo"
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at foo"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"
 
 
@@ -271,7 +264,7 @@ proc test_at_foo {} {
     gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \
        "print foo::funclocal_ro at foo"
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at foo"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"
 
 
@@ -280,7 +273,7 @@ proc test_at_foo {} {
     gdb_test "print bar::funclocal" "\\\$$decimal = 4" \
        "print bar::funclocal at foo"
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at foo"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"
     gdb_stop_suppressing_tests;
 
@@ -292,7 +285,6 @@ proc test_at_bar {} {
     global det_file
     global srcdir
     global subdir
-    global gcc_compiled
 
     if [gdb_test "next" ".*" "" ] { 
       gdb_suppress_tests ; 
@@ -315,8 +307,7 @@ proc test_at_bar {} {
 
    # Print scope0.c::filelocal_ro, which is 201
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
-    setup_xfail "powerpc-*-*"
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope0.c'::filelocal_ro" "\\\$$decimal = 201" "print 'scope0.c'::filelocal_ro at bar"  "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_ro"] { 
       gdb_suppress_tests ; 
     }
@@ -329,7 +320,7 @@ proc test_at_bar {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::filelocal" "\\\$$decimal = 2" "print 'scope1.c'::filelocal at bar"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal"] { 
       gdb_suppress_tests ; 
     }
@@ -342,7 +333,7 @@ proc test_at_bar {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::filelocal_bss" "\\\$$decimal = 102" "print 'scope1.c'::filelocal_bss at bar"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_bss"] { 
       gdb_suppress_tests ; 
     }
@@ -355,7 +346,7 @@ proc test_at_bar {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::filelocal_ro" "\\\$$decimal = 202" "print 'scope1.c'::filelocal_ro at bar"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::filelocal_ro"] { 
       gdb_suppress_tests ; 
     }
@@ -368,7 +359,7 @@ proc test_at_bar {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::foo::funclocal" "\\\$$decimal = 3" "print 'scope1.c'::foo::funclocal at bar"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] { 
       gdb_suppress_tests ; 
     }
@@ -381,7 +372,7 @@ proc test_at_bar {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::foo::funclocal_bss" "\\\$$decimal = 103" "print 'scope1.c'::foo::funclocal_bss at bar"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_bss"] { 
       gdb_suppress_tests ; 
     }
@@ -394,7 +385,7 @@ proc test_at_bar {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::foo::funclocal_ro" "\\\$$decimal = 203" "print 'scope1.c'::foo::funclocal_ro at bar"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal_ro"] { 
       gdb_suppress_tests ; 
     }
@@ -412,7 +403,7 @@ proc test_at_bar {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::bar::funclocal" "\\\$$decimal = 4" "print 'scope1.c'::bar::funclocal at bar"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] { 
       gdb_suppress_tests ; 
     }
@@ -430,7 +421,7 @@ proc test_at_bar {} {
     }
 
 
-    if {$gcc_compiled} then { setup_xfail "rs6000-*-*" }
+    if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
     if [gdb_test "print 'scope1.c'::bar::funclocal_bss" "\\\$$decimal = 104" "print 'scope1.c'::bar::funclocal_bss at bar"  "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal_bss"] { 
       gdb_suppress_tests ; 
     }
@@ -455,7 +446,7 @@ proc test_at_autovars {} {
        gdb_suppress_tests;
     }
 
-    if [gdb_test "up" ".*" "" ] { 
+    if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] { 
        gdb_suppress_tests ; 
     }
 
@@ -487,7 +478,7 @@ proc test_at_localscopes {} {
     if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to marker2"] {
        gdb_suppress_tests;
     }
-    if [gdb_test "up" ".*" "" ] { 
+    if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] { 
        gdb_suppress_tests ; 
     }
 
@@ -502,7 +493,9 @@ proc test_at_localscopes {} {
 
     if [gdb_test "cont" "Break.* marker3 \\(\\) at .*:$decimal.*" \
        "continue to marker3 in scope.exp"] then { gdb_suppress_tests }
-    if [gdb_test "up" "" "up from marker3 in scope.exp"] then { gdb_suppress_tests }
+    if [gdb_test "up" ".*localscopes.*" "up from marker3 in scope.exp"] { 
+       gdb_suppress_tests 
+    }
 
     # Should be at next (first nested) scope.  Check values.
 
@@ -515,10 +508,11 @@ proc test_at_localscopes {} {
 
     # This test will only fail if the file was compiled by gcc, but
     # there's no way to check that.
-    setup_xfail "a29k-*-udi" 2423
     if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \
        "continue to marker4 in scope.exp"] then { gdb_suppress_tests }
-    if [gdb_test "up" "" "up from marker4 in scope.exp"] then { gdb_suppress_tests }
+    if [gdb_test "up" ".*localscopes.*" "up from marker4 in scope.exp"] {
+       gdb_suppress_tests 
+    }
 
     gdb_test "print localval" " = 30" "print localval, innermost scope"
     gdb_test "print localval1" " = 11" "print localval1, innermost scope"
@@ -544,7 +538,6 @@ if [istarget "*-*-vxworks*"] {
 
 # AIX--sections get mapped to the same address so we can't get the right one.
 setup_xfail "rs6000-*-*"
-setup_xfail "powerpc-*-*"
 
 gdb_test "print 'scope0.c'::filelocal_ro" "= 201"
 
@@ -557,7 +550,7 @@ gdb_test "print 'scope0.c'::filelocal_ro" "= 201"
 # is responsible for clearing bss and that hasnt' happened yet.
 #
 # This is a problem for all non-native targets. -- manson
-if ![isnative] {
+if [is_remote target] {
     unsupported "print 'scope0.c'::filelocal_bss before run"
 } else {
     gdb_test "print 'scope0.c'::filelocal_bss" "= 0" \
This page took 0.029817 seconds and 4 git commands to generate.