]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.python/py-prettyprint-stub.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-prettyprint-stub.exp
CommitLineData
1d506c26 1# Copyright (C) 2023-2024 Free Software Foundation, Inc.
7543c960
HD
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16# This file is part of the GDB testsuite.
17# It tests Python-based pretty-printing of stubs.
18
19load_lib gdb-python.exp
20
21require allow_python_tests
22
23standard_testfile .cc py-prettyprint-stub-2.cc
24
25set srcfiles [list $srcfile $srcfile2]
26
27if { [build_executable_from_specs \
28 "failed to prepare" \
29 $testfile {c++} \
30 $srcfile {c++ debug} \
31 $srcfile2 {c++}] == -1 } {
32 return -1
33}
34
35# Start with a fresh gdb.
36clean_restart $testfile
37
38if {![runto_main]} {
39 return
40}
41
42set remote_python_file [gdb_remote_download host \
43 ${srcdir}/${subdir}/${testfile}.py]
44
45gdb_breakpoint [gdb_get_line_number "Break here."]
46gdb_continue_to_breakpoint "Break here" ".*Break here.*"
47
48# First test without pretty printer.
49gdb_test "print s" " = <incomplete type>"
50gdb_test "print s2" " = {m_s = <incomplete type>, m_l = 20}"
51
52# Load pretty printer.
53gdb_test_no_output "source ${remote_python_file}" "load python file"
54
55# Test with pretty printer.
56with_test_prefix pp {
57 gdb_test "print s" " = {pp m_i = 5}"
58 gdb_test "print s2" " = {m_s = {pp m_i = 10}, m_l = 20}"
59}