]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.ada / bp_c_mixed_case.exp
CommitLineData
1d506c26 1# Copyright 2018-2024 Free Software Foundation, Inc.
289483b6
JB
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
c63d3e8d
PA
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
289483b6
JB
21load_lib "ada.exp"
22
74dcf082 23require allow_ada_tests
7a82e903 24
289483b6
JB
25standard_ada_testfile foo_h731_021
26
27set cfile "bar"
28set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c
29set cobject [standard_output_file ${cfile}.o]
30
c63d3e8d
PA
31set cfile2 "qux"
32set csrcfile2 ${srcdir}/${subdir}/${testdir}/${cfile2}.c
33set cobject2 [standard_output_file ${cfile2}.o]
34
289483b6 35gdb_compile "${csrcfile}" "${cobject}" object [list debug]
c63d3e8d
PA
36gdb_compile "${csrcfile2}" "${cobject2}" object ""
37
38set options [list debug \
39 additional_flags=-largs \
40 additional_flags=${cobject} \
41 additional_flags=${cobject2} \
42 additional_flags=-margs]
43if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] != "" } {
289483b6
JB
44 return -1
45}
46
47clean_restart ${testfile}
48
ed7fbdd0 49if {![runto "foo_h731_021"]} {
289483b6
JB
50 return
51}
52
53# Verify that the current language is Ada.
54gdb_test "show lang" \
55 "\"auto; currently ada\"\\."
56
c63d3e8d
PA
57# Before running to the C function (and thus switching out of Ada
58# mode), try printing the function using the "<...>" notation.
59gdb_test "p <MixedCaseFunc>" \
60 " = void" \
61 "p <MixedCaseFunc>, in Ada"
62
63gdb_test "p <NoDebugMixedCaseFunc>" \
64 " = {<text variable, no debug info>} $hex <NoDebugMixedCaseFunc>" \
65 "p <NoDebugMixedCaseFunc>, in Ada"
66
289483b6
JB
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
c63d3e8d 70# and that it inserts the breakpoint at the expected location.
289483b6
JB
71gdb_test "break <MixedCaseFunc>" \
72 "Breakpoint $decimal at $hex: file .*bar.c, line $decimal\\."
73
c63d3e8d
PA
74# Same, but this time on the function with no debug info.
75gdb_test "break <NoDebugMixedCaseFunc>" \
76 "Breakpoint $decimal at $hex"
77
289483b6
JB
78# Resume the program's execution, verifying that it lands at the expected
79# location.
289483b6
JB
80gdb_test "continue" \
81 "Breakpoint $decimal, MixedCaseFunc \\(\\) at .*bar\\.c:$decimal.*"
c63d3e8d
PA
82
83# Try printing again using the "<...>" notation. This shouldn't work
84# now, since the current frame is a C function.
85gdb_test "p <MixedCaseFunc>" \
86 "A syntax error in expression, near `<MixedCaseFunc>'\\." \
87 "p <MixedCaseFunc>, in C"
88
89gdb_test "p <NoDebugMixedCaseFunc>" \
90 "A syntax error in expression, near `<NoDebugMixedCaseFunc>'\\." \
91 "p <NoDebugMixedCaseFunc>, in C"
92
93set test "break <MixedCaseFunc>, in C"
94gdb_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
100set test "break <NoDebugMixedCaseFunc>, in C"
101gdb_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}