Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / bp_c_mixed_case.exp
CommitLineData
88b9d363 1# Copyright 2018-2022 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
7a82e903
PA
23if { [skip_ada_tests] } { return -1 }
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
49if ![runto "foo_h731_021"] then {
50 perror "Couldn't run ${testfile}"
51 return
52}
53
54# Verify that the current language is Ada.
55gdb_test "show lang" \
56 "\"auto; currently ada\"\\."
57
c63d3e8d
PA
58# Before running to the C function (and thus switching out of Ada
59# mode), try printing the function using the "<...>" notation.
60gdb_test "p <MixedCaseFunc>" \
61 " = void" \
62 "p <MixedCaseFunc>, in Ada"
63
64gdb_test "p <NoDebugMixedCaseFunc>" \
65 " = {<text variable, no debug info>} $hex <NoDebugMixedCaseFunc>" \
66 "p <NoDebugMixedCaseFunc>, in Ada"
67
289483b6
JB
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
c63d3e8d 71# and that it inserts the breakpoint at the expected location.
289483b6
JB
72gdb_test "break <MixedCaseFunc>" \
73 "Breakpoint $decimal at $hex: file .*bar.c, line $decimal\\."
74
c63d3e8d
PA
75# Same, but this time on the function with no debug info.
76gdb_test "break <NoDebugMixedCaseFunc>" \
77 "Breakpoint $decimal at $hex"
78
289483b6
JB
79# Resume the program's execution, verifying that it lands at the expected
80# location.
289483b6
JB
81gdb_test "continue" \
82 "Breakpoint $decimal, MixedCaseFunc \\(\\) at .*bar\\.c:$decimal.*"
c63d3e8d
PA
83
84# Try printing again using the "<...>" notation. This shouldn't work
85# now, since the current frame is a C function.
86gdb_test "p <MixedCaseFunc>" \
87 "A syntax error in expression, near `<MixedCaseFunc>'\\." \
88 "p <MixedCaseFunc>, in C"
89
90gdb_test "p <NoDebugMixedCaseFunc>" \
91 "A syntax error in expression, near `<NoDebugMixedCaseFunc>'\\." \
92 "p <NoDebugMixedCaseFunc>, in C"
93
94set test "break <MixedCaseFunc>, in C"
95gdb_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
98 }
99}
100
101set test "break <NoDebugMixedCaseFunc>, in C"
102gdb_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
105 }
106}
This page took 0.625129 seconds and 4 git commands to generate.