2020-01-01 14:20:01 +08:00
# Copyright 1992-2020 Free Software Foundation, Inc.
1999-04-16 09:35:26 +08:00
# 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
2007-08-24 02:14:19 +08:00
# the Free Software Foundation; either version 3 of the License, or
1999-04-16 09:35:26 +08:00
# (at your option) any later version.
2007-08-24 02:14:19 +08:00
#
1999-04-16 09:35:26 +08:00
# 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.
2007-08-24 02:14:19 +08:00
#
1999-04-16 09:35:26 +08:00
# You should have received a copy of the GNU General Public License
2007-08-24 02:14:19 +08:00
# along with this program. If not, see <http://www.gnu.org/licenses/>.
1999-04-16 09:35:26 +08:00
# This file was written by Fred Fish. (fnf@cygnus.com)
test suite update - gdb.base/s*
Convert files gdb.base/s*.exp to use standard_output_file et al.
* gdb.base/save-bp.exp, gdb.base/savedregs.exp,
gdb.base/scope.exp, gdb.base/sep.exp, gdb.base/sepsymtab.exp,
gdb.base/set-lang-auto.exp, gdb.base/setshow.exp,
gdb.base/setvar.exp, gdb.base/shlib-call.exp,
gdb.base/shreloc.exp, gdb.base/sigall.exp,
gdb.base/sigaltstack.exp, gdb.base/sigbpt.exp,
gdb.base/sigchld.exp, gdb.base/siginfo-addr.exp,
gdb.base/siginfo-infcall.exp, gdb.base/siginfo-obj.exp,
gdb.base/siginfo.exp, gdb.base/signals.exp, gdb.base/signest.exp,
gdb.base/signull.exp, gdb.base/sigrepeat.exp,
gdb.base/sigstep.exp, gdb.base/sizeof.exp,
gdb.base/skip-solib.exp, gdb.base/so-impl-ld.exp,
gdb.base/solib-display.exp, gdb.base/solib-nodir.exp,
gdb.base/solib-overlap.exp, gdb.base/solib-symbol.exp,
gdb.base/solib-weak.exp, gdb.base/source.exp,
gdb.base/stack-checking.exp, gdb.base/stale-infcall.exp,
gdb.base/stap-probe.exp, gdb.base/start.exp,
gdb.base/step-break.exp, gdb.base/step-bt.exp,
gdb.base/step-line.exp, gdb.base/step-resume-infcall.exp,
gdb.base/step-test.exp, gdb.base/structs.exp,
gdb.base/structs2.exp, gdb.base/structs3.exp,
gdb.base/symbol-without-target_section.exp: Use standard_testfile,
standard_output_file, prepare_for_testing, clean_restart.
2013-06-28 02:58:28 +08:00
standard_testfile scope0.c scope1.c
1999-04-16 09:35:26 +08:00
Eliminate is_remote check in gdb.base/scope.exp
This commit makes --target_board=native-gdbserver (and in principle
all other is_remote boards) pass all the same gdb.base/scope.exp tests
as native testing.
I first wrote the gdb.base/scope.exp change described in the ChangeLog
below and in the new comments in the patch, knowing that gdb_file_cmd
was the right thing to use here.
However, that revealed that the native-extended-gdbserver board should
be overriding gdb_file_cmd+gdb_reload instead of gdb_load, as is
hinted at by the comments on top of the default implementations in
testsuite/lib/gdb.exp, because otherwise a gdb_run_cmd after
gdb_file_cmd misses setting "set remote exec-file". However, if we do
that and remove gdb_load, then we regress gdb.base/dbx.exp, so for now
keep the gdb_load override as well.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/scope.exp: Use build_executable + clean_restart +
gdb_file_cmd instead of prepare_for_testing and no longer skip
"before run" tests on is_remote target boards. Update comments.
* boards/native-extended-gdbserver.exp
(extended_gdbserver_load_last_file): New, factored out from ...
(gdb_load): ... this. Move further below and add comment.
(extended_gdbserver_gdb_file_cmd, gdb_file_cmd, gdb_reload): New.
2017-10-13 08:27:18 +08:00
if {[build_executable "failed to build" ${testfile} \
test suite update - gdb.base/s*
Convert files gdb.base/s*.exp to use standard_output_file et al.
* gdb.base/save-bp.exp, gdb.base/savedregs.exp,
gdb.base/scope.exp, gdb.base/sep.exp, gdb.base/sepsymtab.exp,
gdb.base/set-lang-auto.exp, gdb.base/setshow.exp,
gdb.base/setvar.exp, gdb.base/shlib-call.exp,
gdb.base/shreloc.exp, gdb.base/sigall.exp,
gdb.base/sigaltstack.exp, gdb.base/sigbpt.exp,
gdb.base/sigchld.exp, gdb.base/siginfo-addr.exp,
gdb.base/siginfo-infcall.exp, gdb.base/siginfo-obj.exp,
gdb.base/siginfo.exp, gdb.base/signals.exp, gdb.base/signest.exp,
gdb.base/signull.exp, gdb.base/sigrepeat.exp,
gdb.base/sigstep.exp, gdb.base/sizeof.exp,
gdb.base/skip-solib.exp, gdb.base/so-impl-ld.exp,
gdb.base/solib-display.exp, gdb.base/solib-nodir.exp,
gdb.base/solib-overlap.exp, gdb.base/solib-symbol.exp,
gdb.base/solib-weak.exp, gdb.base/source.exp,
gdb.base/stack-checking.exp, gdb.base/stale-infcall.exp,
gdb.base/stap-probe.exp, gdb.base/start.exp,
gdb.base/step-break.exp, gdb.base/step-bt.exp,
gdb.base/step-line.exp, gdb.base/step-resume-infcall.exp,
gdb.base/step-test.exp, gdb.base/structs.exp,
gdb.base/structs2.exp, gdb.base/structs3.exp,
gdb.base/symbol-without-target_section.exp: Use standard_testfile,
standard_output_file, prepare_for_testing, clean_restart.
2013-06-28 02:58:28 +08:00
[list $srcfile $srcfile2] {debug}]} {
return -1
1999-04-16 09:35:26 +08:00
}
# Create and source the file that provides information about the compiler
# used to compile the test case.
2012-06-22 04:46:25 +08:00
if [get_compiler_info] {
gdb/testsuite/
* config/monitor.exp (gdb_target_cmd): Remove semicolon after
'return'.
(gdb_target_monitor, gdb_load): Likewise.
* config/sid.exp (gdb_load): Likewise.
* config/slite.exp (gdb_load): Likewise.
* config/vx.exp (gdb_start, spawn_vxgdb): Likewise.
* gdb.ada/arrayidx.exp, gdb.ada/null_array.exp: Likewise.
* gdb.arch/mips-octeon-bbit.exp (single_step): Likewise.
(single_step_until): Likewise.
* gdb.arch/powerpc-d128-regs.exp: Likewise.
* gdb.arch/system-gcore.exp: Likewise.
* gdb.base/bigcore.exp (extract_heap): Likewise.
* gdb.base/break-on-linker-gcd-function.exp: Likewise.
* gdb.base/call-ar-st.exp: Likewise.
* gdb.base/call-rt-st.exp: Likewise.
* gdb.base/call-sc.exp, gdb.base/call-strs.exp: Likewise.
* gdb.base/callfuncs.exp, gdb.base/completion.exp: Likewise.
* gdb.base/condbreak.exp, gdb.base/constvars.exp: Likewise.
* gdb.base/corefile.exp: Likewise.
* gdb.base/dbx.exp (gdb_file_cmd): Likewise.
* gdb.base/exprs.exp, gdb.base/fileio.exp: Likewise.
* gdb.base/fixsection.exp: Likewise.
* gdb.base/funcargs.exp: Likewise.
* gdb.base/gcore-buffer-overflow.exp: Likewise.
* gdb.base/gcore-relro.exp: Likewise.
* gdb.base/gcore.exp, gdb.base/gdb11530.exp: Likewise.
* gdb.base/gdb11531.exp, gdb.base/gnu-ifunc.exp: Likewise.
* gdb.base/info-os.exp, gdb.base/info-proc.exp: Likewise.
* gdb.base/interp.exp, gdb.base/langs.exp:: Likewise.
* gdb.base/list.exp: Likewise.
(set_listsize): Likewise.
* gdb.base/logical.exp, gdb.base/mips_pro.exp: Likewise.
* gdb.base/miscexprs.exp, gdb.base/nodebug.exp: Likewise.
* gdb.base/opaque.exp, gdb.base/pointers.exp: Likewise.
* gdb.base/psymtab.exp, gdb.base/ptype.exp: Likewise.
* gdb.base/relational.exp, gdb.base/scope.exp: Likewise.
* gdb.base/setvar.exp: Likewise.
(test_set): Likewise.
* gdb.base/signals.exp, gdb.base/sizeof.exp: Likewise.
* gdb.base/solib-overlap.exp: Likewise.
* gdb.base/store.exp, gdb.base/structs.exp: Likewise.
* gdb.base/structs2.exp, gdb.base/volatile.exp: Likewise.
* gdb.base/watchpoint.exp (initialize): Likewise.
(test_simple_watchpoint): Likewise.
(test_disabling_watchpoints): Likewise.
(test_watchpoint_triggered_in_syscall): Likewise.
* gdb.base/whatis.exp, gdb.cp/ambiguous.exp: Likewise.
* gdb.cp/casts.exp, gdb.cp/ctti.exp: Likewise.
* gdb.cp/namespace.exp, gdb.cp/nsdecl.exp: Likewise.
* gdb.cp/psmang.exp, gdb.dwarf2/dw2-ranges.exp: Likewise.
* gdb.hp/gdb.aCC/optimize.exp: Likewise.
* gdb.hp/gdb.aCC/watch-cmd.exp: Likewise.
* gdb.hp/gdb.base-hp/callfwmall.exp: Likewise.
* gdb.hp/gdb.base-hp/pxdb.exp: Likewise.
* gdb.hp/gdb.compat/xdb1.exp: Likewise.
* gdb.hp/gdb.compat/xdb2.exp: Likewise.
* gdb.hp/gdb.compat/xdb3.exp: Likewise.
* gdb.hp/gdb.defects/bs14602.exp: Likewise.
* gdb.hp/gdb.defects/solib-d.exp: Likewise.
* gdb.mi/gdb792.exp: Likewise.
* gdb.mi/mi-inheritance-syntax-error.exp: Likewise.
* gdb.mi/mi-logging.exp, gdb.mi/mi-var-cp.exp : Likewise.
* gdb.mi/mi-var-rtti.exp, gdb.python/py-type.exp: Likewise.
* gdb.threads/gcore-thread.exp: Likewise.
(load_core): Likewise.
* gdb.threads/pthreads.exp (all_threads_running): Likewise.
(test_startup, check_control_c): Likewise.
* gdb.threads/sigstep-threads.exp: Likewise.
* gdb.threads/thread_check.exp: Likewise.
* gdb.trace/backtrace.exp, gdb.trace/change-loc.exp: Likewise.
* gdb.trace/circ.exp (run_trace_experiment): Likewise.
(set_a_tracepoint, trace_buffer_normal): Likewise.
(gdb_trace_circular_tests): Likewise.
* gdb.trace/collection.exp: Likewise.
* gdb.trace/disconnected-tracing.exp: Likewise.
* gdb.trace/infotrace.exp: Likewise.
* gdb.trace/mi-traceframe-changed.exp: Likewise.
* gdb.trace/mi-tracepoint-changed.exp: Likewise.
* gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise.
* gdb.trace/packetlen.exp, gdb.trace/passc-dyn.exp: Likewise.
* gdb.trace/pending.exp, gdb.trace/report.exp: Likewise.
* gdb.trace/stap-trace.exp: Likewise.
* gdb.trace/status-stop.exp,gdb.trace/strace.exp: Likewise.
* gdb.trace/tfind.exp, gdb.trace/trace-break.exp: Likewise.
* gdb.trace/trace-buffer-size.exp: Likewise.
* gdb.trace/tspeed.exp, gdb.trace/tsv.exp: Likewise.
* gdb.trace/unavailable.exp: Likewise.
* gdb.trace/while-dyn.exp: Likewise.
* lib/fortran.exp (set_lang_fortran): Likewise.
* lib/gdb.exp (default_gdb_version, gdb_start_cmd): Likewise.
(gdb_breakpoint, gdb_reinitialize_dir): Likewise.
(default_gdb_start, get_compiler_info): Likewise.
(gdb_compile, gdb_compile_objc, gdb_reload, gdb_init): Likewise.
(get_debug_format, setup_xfail_format): Likewise.
(rerun_to_main, gdb_skip_float_test): Likewise.
(build_id_debug_filename_get, get_remotetimeout): Likewise.
* lib/java.exp (set_lang_java): Likewise.
* lib/mi-support.exp (default_mi_gdb_start): Likewise.
(mi_gdb_reinitialize_dir, mi_gdb_target_cmd): Likewise.
(mi_gdb_file_cmd, mi_gdb_test): Likewise.
(mi_run_cmd_full, mi_expect_interrupt): Likewise.
* lib/objc.exp (set_lang_objc): Likewise.
* lib/pascal.exp (set_lang_pascal): Likewise.
* lib/prompt.exp (default_prompt_gdb_start): Likewise.
* lib/trace-support.exp (gdb_trace_setactions, gdb_tfind_test): Likewise.
(gdb_readexpr, gdb_gettpnum, gdb_find_recursion_test_baseline): Likewise.
2013-03-14 21:34:06 +08:00
return -1
1999-04-16 09:35:26 +08:00
}
# 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
2006-02-14 02:11:38 +08:00
# 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"
1999-04-16 09:35:26 +08:00
# Print scope0.c::filelocal, which is 1
2019-11-02 13:55:10 +08:00
if [gdb_test "print filelocal" "\\\$$decimal = 1"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope0.c::filelocal_bss, which is 101
2019-11-02 13:55:10 +08:00
if [gdb_test "print filelocal_bss" "\\\$$decimal = 101"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope0.c::filelocal_ro, which is 201
2005-01-20 00:57:48 +08:00
# No clue why the rs6000 fails this test.
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
if [gdb_test "print filelocal_ro" "\\\$$decimal = 201" "print filelocal_ro in test_at_main" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::filelocal, which is 2
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::filelocal_bss, which is 102
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::filelocal_ro, which is 202
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::foo::funclocal, which is 3
2019-11-02 13:55:10 +08:00
if [gdb_test "print foo::funclocal" "\\\$$decimal = 3"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::foo::funclocal_ro, which is 203
2019-11-02 13:55:10 +08:00
if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::bar::funclocal, which is 4
2019-11-02 13:55:10 +08:00
if [gdb_test "print bar::funclocal" "\\\$$decimal = 4"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2013-06-08 01:31:09 +08:00
gdb_stop_suppressing_tests
1999-04-16 09:35:26 +08:00
}
proc test_at_foo {} {
global gdb_prompt
global decimal
global det_file
global srcdir
global subdir
if [gdb_test "next" ".*bar \\(\\);" "" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# 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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# 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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope0.c::filelocal_ro, which is 201
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at foo"
# Print scope1.c::filelocal, which is 2
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
gdb_test "print filelocal_bss" "\\\$$decimal = 102" \
"print filelocal_bss at foo"
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"
2013-06-08 01:31:09 +08:00
gdb_stop_suppressing_tests
1999-04-16 09:35:26 +08:00
}
proc test_at_bar {} {
global gdb_prompt
global decimal
global det_file
global srcdir
global subdir
if [gdb_test "next" ".*" "" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# 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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# 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_bar" "No symbol \"scope0.c\" in current context.*" "print '$srcdir/$subdir/scope0.c'::filelocal_bss"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope0.c::filelocal_ro, which is 201
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::filelocal, which is 2
if [gdb_test "print filelocal" "\\\$$decimal = 2" "print filelocal at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::filelocal_bss, which is 102
if [gdb_test "print filelocal_bss" "\\\$$decimal = 102" "print filelocal_bss at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::filelocal_ro, which is 202
if [gdb_test "print filelocal_ro" "\\\$$decimal = 202" "print filelocal_ro in test_at_bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::foo::funclocal, which is 3
if [gdb_test "print foo::funclocal" "\\\$$decimal = 3" "print foo::funclocal at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::foo::funclocal_bss, which is 103
if [gdb_test "print foo::funclocal_bss" "\\\$$decimal = 103" "print foo::funclocal_bss at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::foo::funclocal_ro, which is 203
if [gdb_test "print foo::funclocal_ro" "\\\$$decimal = 203" "print foo::funclocal_ro at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::bar::funclocal, which is 4
if [gdb_test "print funclocal" "\\\$$decimal = 4" "print funclocal at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
if [gdb_test "print bar::funclocal" "\\\$$decimal = 4" "print bar::funclocal at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# Print scope1.c::bar::funclocal_bss, which is 104
if [gdb_test "print funclocal_bss" "\\\$$decimal = 104" "print funclocal_bss at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
if [gdb_test "print bar::funclocal_bss" "\\\$$decimal = 104" "print bar::funclocal_bss at bar" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2003-12-06 10:06:22 +08:00
if { [test_compiler_info gcc-*-*] } then { setup_xfail "rs6000-*-*" }
1999-04-16 09:35:26 +08:00
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2013-06-08 01:31:09 +08:00
gdb_stop_suppressing_tests
1999-04-16 09:35:26 +08:00
}
# 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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2000-12-06 07:14:40 +08:00
if [gdb_test "up" ".*autovars.*" "up from marker1 in scope.exp" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
set count 0
while {$count < 100} {
if [gdb_test "print i$count" ".* = $count" "" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
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"] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
2000-12-06 07:14:40 +08:00
if [gdb_test "up" ".*localscopes.*" "up from marker2 in scopes.exp" ] {
2013-06-08 01:31:09 +08:00
gdb_suppress_tests
1999-04-16 09:35:26 +08:00
}
# 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 }
2000-12-06 07:14:40 +08:00
if [gdb_test "up" ".*localscopes.*" "up from marker3 in scope.exp"] {
gdb_suppress_tests
}
1999-04-16 09:35:26 +08:00
# 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 }
2000-12-06 07:14:40 +08:00
if [gdb_test "up" ".*localscopes.*" "up from marker4 in scope.exp"] {
gdb_suppress_tests
}
1999-04-16 09:35:26 +08:00
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"
2013-06-08 01:31:09 +08:00
gdb_stop_suppressing_tests
1999-04-16 09:35:26 +08:00
}
Eliminate is_remote check in gdb.base/scope.exp
This commit makes --target_board=native-gdbserver (and in principle
all other is_remote boards) pass all the same gdb.base/scope.exp tests
as native testing.
I first wrote the gdb.base/scope.exp change described in the ChangeLog
below and in the new comments in the patch, knowing that gdb_file_cmd
was the right thing to use here.
However, that revealed that the native-extended-gdbserver board should
be overriding gdb_file_cmd+gdb_reload instead of gdb_load, as is
hinted at by the comments on top of the default implementations in
testsuite/lib/gdb.exp, because otherwise a gdb_run_cmd after
gdb_file_cmd misses setting "set remote exec-file". However, if we do
that and remove gdb_load, then we regress gdb.base/dbx.exp, so for now
keep the gdb_load override as well.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/scope.exp: Use build_executable + clean_restart +
gdb_file_cmd instead of prepare_for_testing and no longer skip
"before run" tests on is_remote target boards. Update comments.
* boards/native-extended-gdbserver.exp
(extended_gdbserver_load_last_file): New, factored out from ...
(gdb_load): ... this. Move further below and add comment.
(extended_gdbserver_gdb_file_cmd, gdb_file_cmd, gdb_reload): New.
2017-10-13 08:27:18 +08:00
# Note, we don't pass a binfile to clean_restart because we need to
# avoid gdb_load here. With remote targets, gdb_load connects to the
# remote target, and we specificaly want the following tests to run
# before the program is started.
clean_restart
gdb_file_cmd $binfile
1999-04-16 09:35:26 +08:00
# 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-*-*"
gdb_test "print 'scope0.c'::filelocal_ro" "= 201"
Eliminate is_remote check in gdb.base/scope.exp
This commit makes --target_board=native-gdbserver (and in principle
all other is_remote boards) pass all the same gdb.base/scope.exp tests
as native testing.
I first wrote the gdb.base/scope.exp change described in the ChangeLog
below and in the new comments in the patch, knowing that gdb_file_cmd
was the right thing to use here.
However, that revealed that the native-extended-gdbserver board should
be overriding gdb_file_cmd+gdb_reload instead of gdb_load, as is
hinted at by the comments on top of the default implementations in
testsuite/lib/gdb.exp, because otherwise a gdb_run_cmd after
gdb_file_cmd misses setting "set remote exec-file". However, if we do
that and remove gdb_load, then we regress gdb.base/dbx.exp, so for now
keep the gdb_load override as well.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/scope.exp: Use build_executable + clean_restart +
gdb_file_cmd instead of prepare_for_testing and no longer skip
"before run" tests on is_remote target boards. Update comments.
* boards/native-extended-gdbserver.exp
(extended_gdbserver_load_last_file): New, factored out from ...
(gdb_load): ... this. Move further below and add comment.
(extended_gdbserver_gdb_file_cmd, gdb_file_cmd, gdb_reload): New.
2017-10-13 08:27:18 +08:00
# Check that gdb can access bss memory if the inferior is not running.
1999-04-16 09:35:26 +08:00
#
Eliminate is_remote check in gdb.base/scope.exp
This commit makes --target_board=native-gdbserver (and in principle
all other is_remote boards) pass all the same gdb.base/scope.exp tests
as native testing.
I first wrote the gdb.base/scope.exp change described in the ChangeLog
below and in the new comments in the patch, knowing that gdb_file_cmd
was the right thing to use here.
However, that revealed that the native-extended-gdbserver board should
be overriding gdb_file_cmd+gdb_reload instead of gdb_load, as is
hinted at by the comments on top of the default implementations in
testsuite/lib/gdb.exp, because otherwise a gdb_run_cmd after
gdb_file_cmd misses setting "set remote exec-file". However, if we do
that and remove gdb_load, then we regress gdb.base/dbx.exp, so for now
keep the gdb_load override as well.
gdb/testsuite/ChangeLog:
2017-10-13 Pedro Alves <palves@redhat.com>
* gdb.base/scope.exp: Use build_executable + clean_restart +
gdb_file_cmd instead of prepare_for_testing and no longer skip
"before run" tests on is_remote target boards. Update comments.
* boards/native-extended-gdbserver.exp
(extended_gdbserver_load_last_file): New, factored out from ...
(gdb_load): ... this. Move further below and add comment.
(extended_gdbserver_gdb_file_cmd, gdb_file_cmd, gdb_reload): New.
2017-10-13 08:27:18 +08:00
# Note the care above about avoiding gdb_load. Otherwise, for
# embedded stub-like boards, this test would randomly fail. If we'd
# already put target remote on the target stack, we'd read memory from
# the board instead of the program's binary, and we would have
# connected before crt0.o had had a chance to clear bss.
gdb_test "print 'scope0.c'::filelocal_bss" "= 0" \
"print 'scope0.c'::filelocal_bss before run"
1999-04-16 09:35:26 +08:00
gdb_test "print 'scope0.c'::filelocal" "= 1" \
"print 'scope0.c'::filelocal before run"
if [runto_main] then { test_at_main }
if [runto foo] then { test_at_foo }
if [runto bar] then { test_at_bar }
if [runto localscopes] then { test_at_localscopes }
if [runto autovars] then { test_at_autovars }