]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
[gdb/build] Cleanup gdb/features/feature_to_c.sh
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.ada / bp_c_mixed_case.exp
1 # Copyright 2018-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 # Test setting breakpoints in C functions with some uppercase letters
17 # in their name, using the "<...>" notation. See gdb/22670. While at
18 # it, also try evaluating expressions involving calls to such
19 # functions.
20
21 load_lib "ada.exp"
22
23 require allow_ada_tests
24
25 standard_ada_testfile foo_h731_021
26
27 set cfile "bar"
28 set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c
29 set cobject [standard_output_file ${cfile}.o]
30
31 set cfile2 "qux"
32 set csrcfile2 ${srcdir}/${subdir}/${testdir}/${cfile2}.c
33 set cobject2 [standard_output_file ${cfile2}.o]
34
35 gdb_compile "${csrcfile}" "${cobject}" object [list debug]
36 gdb_compile "${csrcfile2}" "${cobject2}" object ""
37
38 set options [list debug \
39 additional_flags=-largs \
40 additional_flags=${cobject} \
41 additional_flags=${cobject2} \
42 additional_flags=-margs]
43 if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] != "" } {
44 return -1
45 }
46
47 clean_restart ${testfile}
48
49 if {![runto "foo_h731_021"]} {
50 return
51 }
52
53 # Verify that the current language is Ada.
54 gdb_test "show lang" \
55 "\"auto; currently ada\"\\."
56
57 # Before running to the C function (and thus switching out of Ada
58 # mode), try printing the function using the "<...>" notation.
59 gdb_test "p <MixedCaseFunc>" \
60 " = void" \
61 "p <MixedCaseFunc>, in Ada"
62
63 gdb_test "p <NoDebugMixedCaseFunc>" \
64 " = {<text variable, no debug info>} $hex <NoDebugMixedCaseFunc>" \
65 "p <NoDebugMixedCaseFunc>, in Ada"
66
67 # Try inserting a breakpoint inside a C function. Because the function's
68 # name has some uppercase letters, we need to use the "<...>" notation.
69 # The purpose of this testcase is to verify that we can in fact do so
70 # and that it inserts the breakpoint at the expected location.
71 gdb_test "break <MixedCaseFunc>" \
72 "Breakpoint $decimal at $hex: file .*bar.c, line $decimal\\."
73
74 # Same, but this time on the function with no debug info.
75 gdb_test "break <NoDebugMixedCaseFunc>" \
76 "Breakpoint $decimal at $hex"
77
78 # Resume the program's execution, verifying that it lands at the expected
79 # location.
80 gdb_test "continue" \
81 "Breakpoint $decimal, MixedCaseFunc \\(\\) at .*bar\\.c:$decimal.*"
82
83 # Try printing again using the "<...>" notation. This shouldn't work
84 # now, since the current frame is a C function.
85 gdb_test "p <MixedCaseFunc>" \
86 "A syntax error in expression, near `<MixedCaseFunc>'\\." \
87 "p <MixedCaseFunc>, in C"
88
89 gdb_test "p <NoDebugMixedCaseFunc>" \
90 "A syntax error in expression, near `<NoDebugMixedCaseFunc>'\\." \
91 "p <NoDebugMixedCaseFunc>, in C"
92
93 set test "break <MixedCaseFunc>, in C"
94 gdb_test_multiple "break <MixedCaseFunc>" $test {
95 -re "Function \"<MixedCaseFunc>\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
96 gdb_test_no_output "n" $test
97 }
98 }
99
100 set test "break <NoDebugMixedCaseFunc>, in C"
101 gdb_test_multiple "break <NoDebugMixedCaseFunc>" $test {
102 -re "Function \"<NoDebugMixedCaseFunc>\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
103 gdb_test_no_output "n" $test
104 }
105 }