1 # Copyright (C) 2023-2024 Free Software Foundation, Inc.
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.
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.
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/>.
16 # This file is part of the GDB testsuite.
17 # It tests Python-based pretty-printing of stubs.
19 load_lib gdb-python.exp
21 require allow_python_tests
23 standard_testfile .cc py-prettyprint-stub-2.cc
25 set srcfiles [list $srcfile $srcfile2]
27 if { [build_executable_from_specs \
30 $srcfile {c++ debug} \
31 $srcfile2 {c++}] == -1 } {
35 # Start with a fresh gdb.
36 clean_restart $testfile
42 set remote_python_file [gdb_remote_download host \
43 ${srcdir}/${subdir}/${testfile}.py]
45 gdb_breakpoint [gdb_get_line_number "Break here."]
46 gdb_continue_to_breakpoint "Break here" ".*Break here.*"
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}"
52 # Load pretty printer.
53 gdb_test_no_output "source ${remote_python_file}" "load python file"
55 # Test with pretty printer.
57 gdb_test "print s" " = {pp m_i = 5}"
58 gdb_test "print s2" " = {m_s = {pp m_i = 10}, m_l = 20}"