]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - 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
1 # Copyright (C) 2023-2024 Free Software Foundation, Inc.
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
19 load_lib gdb-python.exp
20
21 require allow_python_tests
22
23 standard_testfile .cc py-prettyprint-stub-2.cc
24
25 set srcfiles [list $srcfile $srcfile2]
26
27 if { [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.
36 clean_restart $testfile
37
38 if {![runto_main]} {
39 return
40 }
41
42 set remote_python_file [gdb_remote_download host \
43 ${srcdir}/${subdir}/${testfile}.py]
44
45 gdb_breakpoint [gdb_get_line_number "Break here."]
46 gdb_continue_to_breakpoint "Break here" ".*Break here.*"
47
48 # First test without pretty printer.
49 gdb_test "print s" " = <incomplete type>"
50 gdb_test "print s2" " = {m_s = <incomplete type>, m_l = 20}"
51
52 # Load pretty printer.
53 gdb_test_no_output "source ${remote_python_file}" "load python file"
54
55 # Test with pretty printer.
56 with_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 }