1 # Copyright 2018-2020 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 # 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
23 if { [skip_ada_tests] } { return -1 }
25 standard_ada_testfile foo_h731_021
28 set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c
29 set cobject [standard_output_file ${cfile}.o]
32 set csrcfile2 ${srcdir}/${subdir}/${testdir}/${cfile2}.c
33 set cobject2 [standard_output_file ${cfile2}.o]
35 gdb_compile "${csrcfile}" "${cobject}" object [list debug]
36 gdb_compile "${csrcfile2}" "${cobject2}" object ""
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] != "" } {
47 clean_restart ${testfile}
49 if ![runto "foo_h731_021"] then {
50 perror "Couldn't run ${testfile}"
54 # Verify that the current language is Ada.
55 gdb_test "show lang" \
56 "\"auto; currently ada\"\\."
58 # Before running to the C function (and thus switching out of Ada
59 # mode), try printing the function using the "<...>" notation.
60 gdb_test "p <MixedCaseFunc>" \
62 "p <MixedCaseFunc>, in Ada"
64 gdb_test "p <NoDebugMixedCaseFunc>" \
65 " = {<text variable, no debug info>} $hex <NoDebugMixedCaseFunc>" \
66 "p <NoDebugMixedCaseFunc>, in Ada"
68 # Try inserting a breakpoint inside a C function. Because the function's
69 # name has some uppercase letters, we need to use the "<...>" notation.
70 # The purpose of this testcase is to verify that we can in fact do so
71 # and that it inserts the breakpoint at the expected location.
72 gdb_test "break <MixedCaseFunc>" \
73 "Breakpoint $decimal at $hex: file .*bar.c, line $decimal\\."
75 # Same, but this time on the function with no debug info.
76 gdb_test "break <NoDebugMixedCaseFunc>" \
77 "Breakpoint $decimal at $hex"
79 # Resume the program's execution, verifying that it lands at the expected
82 "Breakpoint $decimal, MixedCaseFunc \\(\\) at .*bar\\.c:$decimal.*"
84 # Try printing again using the "<...>" notation. This shouldn't work
85 # now, since the current frame is a C function.
86 gdb_test "p <MixedCaseFunc>" \
87 "A syntax error in expression, near `<MixedCaseFunc>'\\." \
88 "p <MixedCaseFunc>, in C"
90 gdb_test "p <NoDebugMixedCaseFunc>" \
91 "A syntax error in expression, near `<NoDebugMixedCaseFunc>'\\." \
92 "p <NoDebugMixedCaseFunc>, in C"
94 set test "break <MixedCaseFunc>, in C"
95 gdb_test_multiple "break <MixedCaseFunc>" $test {
96 -re "Function \"<MixedCaseFunc>\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
97 gdb_test_no_output "n" $test
101 set test "break <NoDebugMixedCaseFunc>, in C"
102 gdb_test_multiple "break <NoDebugMixedCaseFunc>" $test {
103 -re "Function \"<NoDebugMixedCaseFunc>\" not defined\..*Make breakpoint pending on future shared library load.*y or .n.. $" {
104 gdb_test_no_output "n" $test