binutils-gdb/gdb/testsuite/gdb.guile/scm-progspace.exp

93 lines
3.1 KiB
Plaintext
Raw Normal View History

# Copyright (C) 2010-2017 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/>.
# This file is part of the GDB testsuite.
# It tests the program space support in Guile.
load_lib gdb-guile.exp
standard_testfile
if {[build_executable $testfile.exp $testfile $srcfile debug] == -1} {
return -1
}
# Start with a fresh gdb.
gdb_exit
gdb_start
gdb_reinitialize_dir $srcdir/$subdir
# Skip all tests if Guile scripting is not enabled.
if { [skip_guile_tests] } { continue }
gdb_install_guile_utils
gdb_install_guile_module
proc print_current_progspace { filename_regexp smob_filename_regexp } {
gdb_test "gu (print (progspace-filename (current-progspace)))" \
"= $filename_regexp" "current progspace filename"
gdb_test "gu (print (progspaces))" \
"= \\(#<gdb:progspace $smob_filename_regexp>\\)"
}
gdb_test "gu (print (progspace? 42))" "= #f"
gdb_test "gu (print (progspace? (current-progspace)))" "= #t"
with_test_prefix "at start" {
print_current_progspace "#f" "{no symfile}"
}
gdb_load ${binfile}
with_test_prefix "program loaded" {
print_current_progspace ".*$testfile" ".*$testfile"
gdb_test_no_output "gu (define progspace (current-progspace))"
gdb_test "gu (print (progspace-valid? progspace))" "= #t"
gdb_test "gu (print (progspace-filename progspace))" "= .*$testfile"
gdb_test "gu (print (list? (progspace-objfiles progspace)))" "= #t"
}
# Verify we keep the same progspace when the program is unloaded.
gdb_unload
with_test_prefix "program unloaded" {
print_current_progspace "#f" "{no symfile}"
gdb_test "gu (print (eq? progspace (current-progspace)))" "= #t"
}
# Verify the progspace is garbage collected ok.
# Note that when a program is unloaded, the associated progspace doesn't get
# deleted. We need to, for example, delete an inferior to get the progspace
# to go away.
Fix test names starting with uppercase using gdb_test on a single line. Changes in v3: Fixed incorrect substitutions. This fixes offender testcases that have test names starting with uppercase when using gdb_test in a single line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.arch/i386-mpx-simple_segv.exp * gdb.arch/i386-mpx.exp * gdb.arch/i386-permbkpt.exp * gdb.arch/pa-nullify.exp * gdb.arch/powerpc-d128-regs.exp * gdb.arch/vsx-regs.exp * gdb.base/bfp-test.exp * gdb.base/break.exp * gdb.base/breakpoint-shadow.exp * gdb.base/callfuncs.exp * gdb.base/charset.exp * gdb.base/commands.exp * gdb.base/completion.exp * gdb.base/dfp-test.exp * gdb.base/echo.exp * gdb.base/ending-run.exp * gdb.base/eval.exp * gdb.base/expand-psymtabs.exp * gdb.base/float128.exp * gdb.base/floatn.exp * gdb.base/foll-exec-mode.exp * gdb.base/gdb1056.exp * gdb.base/gdb11531.exp * gdb.base/kill-after-signal.exp * gdb.base/multi-forks.exp * gdb.base/overlays.exp * gdb.base/pending.exp * gdb.base/sepdebug.exp * gdb.base/testenv.exp * gdb.base/valgrind-db-attach.exp * gdb.base/watch_thread_num.exp * gdb.base/watchpoint-cond-gone.exp * gdb.base/watchpoint.exp * gdb.base/watchpoints.exp * gdb.cp/arg-reference.exp * gdb.cp/baseenum.exp * gdb.cp/operator.exp * gdb.cp/shadow.exp * gdb.dwarf2/dw2-op-out-param.exp * gdb.dwarf2/dw2-reg-undefined.exp * gdb.go/chan.exp * gdb.go/hello.exp * gdb.go/integers.exp * gdb.go/methods.exp * gdb.go/package.exp * gdb.guile/scm-parameter.exp * gdb.guile/scm-progspace.exp * gdb.guile/scm-value.exp * gdb.mi/mi-pending.exp * gdb.mi/user-selected-context-sync.exp * gdb.multi/multi-attach.exp * gdb.multi/tids.exp * gdb.opt/clobbered-registers-O2.exp * gdb.pascal/floats.exp * gdb.pascal/integers.exp * gdb.python/py-block.exp * gdb.python/py-events.exp * gdb.python/py-parameter.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-type.exp * gdb.python/py-value.exp * gdb.python/py-xmethods.exp * gdb.python/python.exp * gdb.reverse/break-precsave.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/step-precsave.exp * gdb.reverse/until-precsave.exp * gdb.reverse/watch-precsave.exp * gdb.server/ext-attach.exp * gdb.server/ext-restart.exp * gdb.server/ext-run.exp * gdb.server/ext-wrapper.exp * gdb.stabs/gdb11479.exp * gdb.stabs/weird.exp * gdb.threads/attach-many-short-lived-threads.exp * gdb.threads/kill.exp * gdb.threads/watchpoint-fork.exp
2016-12-01 21:41:23 +01:00
gdb_test "add-inferior" "Added inferior 2" "create new inferior"
gdb_test "inferior 2" ".*" "switch to new inferior"
Fix test names starting with uppercase using gdb_test_no_output This fixes offender testcases that have test names starting with uppercase when using gdb_test_no_output in a single-line construct. gdb/testsuite/ChangeLog 2016-12-01 Luis Machado <lgustavo@codesourcery.com> Fix test names starting with uppercase throughout the files. * gdb.base/charset.exp * gdb.base/eval.exp * gdb.base/multi-forks.exp * gdb.guile/scm-progspace.exp * gdb.opencl/datatypes.exp * gdb.python/py-block.exp * gdb.python/py-function.exp * gdb.python/py-symbol.exp * gdb.python/py-symtab.exp * gdb.python/py-xmethods.exp * gdb.reverse/break-precsave.exp * gdb.reverse/break-reverse.exp * gdb.reverse/consecutive-precsave.exp * gdb.reverse/consecutive-reverse.exp * gdb.reverse/finish-precsave.exp * gdb.reverse/finish-reverse-bkpt.exp * gdb.reverse/finish-reverse.exp * gdb.reverse/fstatat-reverse.exp * gdb.reverse/getresuid-reverse.exp * gdb.reverse/i386-precsave.exp * gdb.reverse/i386-reverse.exp * gdb.reverse/i386-sse-reverse.exp * gdb.reverse/i387-stack-reverse.exp * gdb.reverse/insn-reverse.exp * gdb.reverse/machinestate-precsave.exp * gdb.reverse/machinestate.exp * gdb.reverse/next-reverse-bkpt-over-sr.exp * gdb.reverse/pipe-reverse.exp * gdb.reverse/readv-reverse.exp * gdb.reverse/recvmsg-reverse.exp * gdb.reverse/rerun-prec.exp * gdb.reverse/s390-mvcle.exp * gdb.reverse/sigall-precsave.exp * gdb.reverse/sigall-reverse.exp * gdb.reverse/solib-precsave.exp * gdb.reverse/solib-reverse.exp * gdb.reverse/step-precsave.exp * gdb.reverse/step-reverse.exp * gdb.reverse/time-reverse.exp * gdb.reverse/until-precsave.exp * gdb.reverse/until-reverse.exp * gdb.reverse/waitpid-reverse.exp * gdb.reverse/watch-precsave.exp * gdb.reverse/watch-reverse.exp
2016-12-01 21:42:48 +01:00
gdb_test_no_output "remove-inferiors 1" "remove first inferior"
with_test_prefix "inferior removed" {
gdb_test "gu (print (progspace-valid? progspace))" "= #f"
gdb_test "gu (print (progspace-filename progspace))" \
"ERROR:.*Invalid object.*"
gdb_test "gu (print (progspace-objfiles progspace))" \
"ERROR:.*Invalid object.*"
print_current_progspace "#f" "{no symfile}"
}
# garbage-collects can trigger segvs if we've messed up somewhere.
gdb_test_no_output "gu (gc)"
gdb_test "gu (print progspace)" "= #<gdb:progspace {invalid}>"