]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.fortran/string-types.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.fortran / string-types.exp
CommitLineData
1d506c26 1# Copyright 2022-2024 Free Software Foundation, Inc.
1c01b236
AB
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# Test print the value, and type, of Fortran string variables declared in
17# different ways in the test program.
18
19standard_testfile .f90
20load_lib fortran.exp
21
57b7402d 22require allow_fortran_tests
1c01b236
AB
23
24if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
25 {debug f90 quiet}]} {
26 return -1
27}
28
29if { ![fortran_runto_main] } {
1c01b236
AB
30 return
31}
32
33gdb_breakpoint [gdb_get_line_number "First breakpoint"]
34gdb_breakpoint [gdb_get_line_number "Second breakpoint"]
35gdb_breakpoint [gdb_get_line_number "Third breakpoint"]
36
37with_test_prefix "first breakpoint" {
38 # Continue to the first breakpoint.
39 gdb_continue_to_breakpoint "continue"
40 gdb_test "print s" " = 'foo'"
41 gdb_test "ptype s" "type = character\\*3"
42}
43
44with_test_prefix "second breakpoint" {
45 # Continue to the second breakpoint.
46 gdb_continue_to_breakpoint "continue"
47 gdb_test "print s" " = 'foo'"
48 gdb_test "ptype s" "type = character\\*3"
49}
50
51with_test_prefix "third breakpoint, first time" {
52 # Continue to the third breakpoint.
53 gdb_continue_to_breakpoint "continue"
54 gdb_test "print s" " = 'foo'"
55 gdb_test "ptype s" "type = character \\(3\\)"
56}
57
58with_test_prefix "third breakpoint, second time" {
59 # Continue to the third breakpoint again. The string we print
60 # this time includes some embedded special characters (newline,
61 # tab, carriage-return, and an embedded null byte). Currently GDB
62 # prints these as C style backslash sequences, which isn't valid
63 # Fortran code, but is more compact than the Fortran way of doing
64 # it (see the test source for details), and is likely understood
65 # by most users, so seems good enough.
66 gdb_continue_to_breakpoint "continue"
67 gdb_test "print s" " = 'foo\\\\n\\\\t\\\\r\\\\000bar'"
68 gdb_test "ptype s" "type = character \\(10\\)"
69}