mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-12 12:16:04 +08:00
42a4f53d2b
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
85 lines
2.7 KiB
Plaintext
85 lines
2.7 KiB
Plaintext
# Copyright (C) 2010-2019 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 Python.
|
|
|
|
load_lib gdb-python.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 Python scripting is not enabled.
|
|
if { [skip_python_tests] } { continue }
|
|
|
|
gdb_test "python print (gdb.current_progspace().filename)" "None" \
|
|
"current progspace filename (None)"
|
|
gdb_test "python print (gdb.progspaces())" "\\\[<gdb.Progspace object at $hex>\\\]"
|
|
|
|
gdb_test_no_output "python dir(gdb.current_progspace())"
|
|
|
|
gdb_load ${binfile}
|
|
|
|
gdb_py_test_silent_cmd "python progspace = gdb.current_progspace()" \
|
|
"Get current progspace" 1
|
|
|
|
gdb_test "python print (progspace.filename)" "py-progspace" \
|
|
"current progspace filename (py-progspace)"
|
|
|
|
gdb_py_test_silent_cmd "python progspace.random_attribute = 42" \
|
|
"Set random attribute in progspace" 1
|
|
gdb_test "python print (progspace.random_attribute)" "42" \
|
|
"Verify set of random attribute in progspace"
|
|
|
|
if {![runto_main]} {
|
|
fail "can't run to main"
|
|
return
|
|
}
|
|
|
|
# With a single inferior, progspace.objfiles () and gdb.objfiles () should
|
|
# be identical.
|
|
gdb_test "python print (progspace.objfiles () == gdb.objfiles ())" "True"
|
|
|
|
gdb_test "add-inferior"
|
|
gdb_test "inferior 2"
|
|
|
|
gdb_load ${binfile}
|
|
|
|
# With a second (non-started) inferior, we should have a single objfile - the
|
|
# main one.
|
|
gdb_test "python print (len (gdb.objfiles ())) == 1"
|
|
|
|
# And the gdb.objfiles() list should now be different from the objfiles of the
|
|
# prog space of inferior 1.
|
|
gdb_test "python print (progspace.objfiles () != gdb.objfiles ())" "True"
|
|
|
|
# Delete inferior 2 (and therefore the second progspace), check that the Python
|
|
# object reacts sensibly.
|
|
gdb_py_test_silent_cmd "python progspace2 = gdb.current_progspace()" \
|
|
"save progspace 2" 1
|
|
gdb_test "inferior 1" "Switching to inferior 1.*"
|
|
gdb_test_no_output "remove-inferiors 2"
|
|
gdb_test "python print (progspace2.objfiles ())" \
|
|
"RuntimeError: Program space no longer exists.*"
|