📄 scope.exp
字号:
# Copyright 1992, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004,# 2007, 2008 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 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, see <http://www.gnu.org/licenses/>.# Please email any bugs, comments, and/or additions to this file to:# bug-gdb@prep.ai.mit.edu# This file was written by Fred Fish. (fnf@cygnus.com)if $tracelevel then { strace $tracelevel}set prms_id 0set bug_id 0set testfile "scope"set binfile ${objdir}/${subdir}/${testfile}if { [gdb_compile "${srcdir}/${subdir}/scope0.c" "${binfile}0.o" object {debug}] != "" } { untested scope.exp return -1}if { [gdb_compile "${srcdir}/${subdir}/scope1.c" "${binfile}1.o" object {debug}] != "" } { untested scope.exp return -1}if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } { untested scope.exp return -1}# Create and source the file that provides information about the compiler# used to compile the test case.if [get_compiler_info ${binfile}] { return -1;}# Test locating various things when stopped just inside main, after# running init0(). To prevent cascading of errors, we report the# first one and quit. If all pass, then we print the pass results.proc test_at_main {} { global gdb_prompt global decimal global det_file global srcdir global subdir global hp_cc_compiler # 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 if [gdb_test "print filelocal" "\\\$$decimal = 1" "print filelocal" ] { gdb_suppress_tests ; } if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at main" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal"] { gdb_suppress_tests ; } # Print scope0.c::filelocal_bss, which is 101 if [gdb_test "print filelocal_bss" "\\\$$decimal = 101" "print filelocal_bss" ] { gdb_suppress_tests ; } if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_main" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] { gdb_suppress_tests ; } # Print scope0.c::filelocal_ro, which is 201 # 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 { [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 ; } # Print scope1.c::filelocal, which is 2 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 ; } # Print scope1.c::filelocal_bss, which is 102 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 ; } # Print scope1.c::filelocal_ro, which is 202 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 ; } # Print scope1.c::foo::funclocal, which is 3 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal" ] { gdb_suppress_tests ; } 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 ; } # Print scope1.c::foo::funclocal_ro, which is 203 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro" ] { gdb_suppress_tests ; } 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 ; } # Print scope1.c::bar::funclocal, which is 4 if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal" ] { gdb_suppress_tests ; } 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 ; } gdb_stop_suppressing_tests;}proc test_at_foo {} { global gdb_prompt global decimal global det_file global srcdir global subdir if [gdb_test "next" ".*bar \\(\\);" "" ] { gdb_suppress_tests ; } # Print scope0.c::filelocal, which is 1 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at foo" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal"] { gdb_suppress_tests ; } # Print scope0.c::filelocal_bss, which is 101 if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_foo" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] { gdb_suppress_tests ; } # Print scope0.c::filelocal_ro, which is 201 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 ; } gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo" # Print scope1.c::filelocal, which is 2 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 ; } gdb_test "print filelocal_bss" "\\\$$decimal = 102" \ "print filelocal_bss at foo" 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 { [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" # Print scope1.c::foo::funclocal, which is 3 gdb_test "print funclocal" "\\\$$decimal = 3" "print funclocal at foo" gdb_test "print foo::funclocal" "\\\$$decimal = 3" \ "print foo::funclocal at foo" 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" # Print scope1.c::foo::funclocal_bss, which is 103 gdb_test "print funclocal_bss" "\\\$$decimal = 103" \ "print funclocal_bss at foo" gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" \ "print foo::funclocal_bss at foo" 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" # Print scope1.c::foo::funclocal_ro, which is 203 gdb_test "print funclocal_ro" "\\\$$decimal = 203" \ "print funclocal_ro at foo" gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" \ "print foo::funclocal_ro at foo" 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" # Print scope1.c::bar::funclocal, which is 4 gdb_test "print bar::funclocal" "\\\$$decimal = 4" \ "print bar::funclocal at foo" 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;}proc test_at_bar {} { global gdb_prompt global decimal global det_file global srcdir global subdir if [gdb_test "next" ".*" "" ] { gdb_suppress_tests ; } # Print scope0.c::filelocal, which is 1 if [gdb_test "print 'scope0.c'::filelocal" "\\\$$decimal = 1" "print 'scope0.c'::filelocal at bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal"] { gdb_suppress_tests ; } # Print scope0.c::filelocal_bss, which is 101
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -