📄 scope.exp
字号:
if [gdb_test "print 'scope0.c'::filelocal_bss" "\\\$$decimal = 101" "print 'scope0.c'::filelocal_bss in test_at_bar" "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-*-*" } setup_xfail "powerpc-*-*" 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 ; } # Print scope1.c::filelocal, which is 2 if [gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" ] { gdb_suppress_tests ; } 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 ; } # Print scope1.c::filelocal_bss, which is 102 if [gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss at bar" ] { gdb_suppress_tests ; } 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 ; } # Print scope1.c::filelocal_ro, which is 202 if [gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro in test_at_bar" ] { gdb_suppress_tests ; } 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 ; } # Print scope1.c::foo::funclocal, which is 3 if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" ] { 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 at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::foo::funclocal"] { gdb_suppress_tests ; } # Print scope1.c::foo::funclocal_bss, which is 103 if [gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::funclocal_bss at bar" ] { gdb_suppress_tests ; } 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 ; } # Print scope1.c::foo::funclocal_ro, which is 203 if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro at bar" ] { 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 at bar" "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 funclocal" "\\\$$decimal = 4" "print funclocal at bar" ] { gdb_suppress_tests ; } if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal at bar" ] { 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 at bar" "No symbol \"scope1.c\" in current context.*" "print '$srcdir/$subdir/scope1.c'::bar::funclocal"] { gdb_suppress_tests ; } # Print scope1.c::bar::funclocal_bss, which is 104 if [gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss at bar" ] { gdb_suppress_tests ; } if [gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::funclocal_bss at bar" ] { gdb_suppress_tests ; } 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 ; } gdb_stop_suppressing_tests;}# This test has little to do with local scopes, but it is in scope.exp anyway.# That's life.proc test_at_autovars {} { global gdb_prompt global decimal global hex global srcfile # Test symbol table lookup with 100 local (auto) variables. gdb_breakpoint marker1 if [gdb_test "cont" "Break.* marker1 \\(\\) at .*:$decimal.*" "continue to marker1"] { gdb_suppress_tests; } if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] { gdb_suppress_tests ; } set count 0 while {$count < 100} { if [gdb_test "print i$count" ".* = $count" "" ] { gdb_suppress_tests ; } set count [expr $count+1] } clear_xfail "*-*-*" pass "$count auto variables correctly initialized" # Test that block variable sorting is not screwing us. gdb_test "frame" "#.*autovars \\(bcd=5, abc=6\\).*" "args in correct order"}proc test_at_localscopes {} { global gdb_prompt global decimal global hex global srcfile gdb_breakpoint marker2 gdb_breakpoint marker3 gdb_breakpoint marker4 if [gdb_test "cont" "Break.* marker2 \\(\\) at .*:$decimal.*" "continue to marker2"] { gdb_suppress_tests; } if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] { gdb_suppress_tests ; } # Should be at first (outermost) scope. Check values. gdb_test "print localval" " = 10" "print localval, outer scope" gdb_test "print localval1" " = 11" "print localval1, outer scope" gdb_test "print localval2" "No symbol \"localval2\" in current context." \ "print localval2, outer scope" gdb_test "print localval3" "No symbol \"localval3\" in current context." \ "print localval3, outer scope" if [gdb_test "cont" "Break.* marker3 \\(\\) at .*:$decimal.*" \ "continue to 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. gdb_test "print localval" " = 20" \ "print localval, first nested scope" gdb_test "print localval1" " = 11" "print localval1, first nested scope" gdb_test "print localval2" " = 12" "print localval2, first nested scope" gdb_test "print localval3" "No symbol \"localval3\" in current context." \ "print localval3, first nested scope" # This test will only fail if the file was compiled by gcc, but # there's no way to check that. if [gdb_test "cont" "Break.* marker4.*at .*:$decimal.*" \ "continue to 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" gdb_test "print localval2" " = 12" "print localval2, innermost scope" gdb_test "print localval3" " = 13" "print localval3, innermost scope" gdb_stop_suppressing_tests;}# Start with a fresh gdb.gdb_exitgdb_startgdb_reinitialize_dir $srcdir/$subdirgdb_load ${binfile}if [istarget "*-*-vxworks*"] { set timeout 120 verbose "Timeout is now $timeout seconds" 2}# Test that variables in various segments print out correctly before# the program is run. # 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"# gdb currently cannot access bss memory on some targets if the inferior# is not running.## For PA boards using monitor/remote-pa.c, the bss test is going to # randomly fail. We've already put remote-pa on the target stack,# so we actually read memory from the board. Problem is crt0.o# is responsible for clearing bss and that hasnt' happened yet.## This is a problem for all non-native targets. -- mansonif [is_remote target] { unsupported "print 'scope0.c'::filelocal_bss before run"} else { gdb_test "print 'scope0.c'::filelocal_bss" "= 0" \ "print 'scope0.c'::filelocal_bss before run"}gdb_test "print 'scope0.c'::filelocal" "= 1" \ "print 'scope0.c'::filelocal before run"if [runto_main] then { test_at_main }if [istarget "mips-idt-*"] then { # Restart because IDT/SIM runs out of file descriptors. gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile}}if [runto foo] then { test_at_foo }if [istarget "mips-idt-*"] then { # Restart because IDT/SIM runs out of file descriptors. gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile}}if [runto bar] then { test_at_bar }if [istarget "mips-idt-*"] then { # Restart because IDT/SIM runs out of file descriptors. gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile}}if [runto localscopes] then { test_at_localscopes }if [istarget "mips-idt-*"] then { # Restart because IDT/SIM runs out of file descriptors. gdb_exit gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile}}if [runto autovars] then { test_at_autovars }if [istarget "*-*-vxworks*"] { set timeout 120 verbose "Timeout is now $timeout seconds" 2}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -