[gdb/testsuite] Fix gdb.ada/out_of_line_in_inlined.exp with -m32 and gcc-10
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.ada / bp_c_mixed_case.exp
1 # Copyright 2018-2021 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 if { [skip_ada_tests] } { return -1 }
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"] then {
50 perror "Couldn't run ${testfile}"
51 return
52 }
53
54 # Verify that the current language is Ada.
55 gdb_test "show lang" \
56 "\"auto; currently ada\"\\."
57
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>" \
61 " = void" \
62 "p <MixedCaseFunc>, in Ada"
63
64 gdb_test "p <NoDebugMixedCaseFunc>" \
65 " = {<text variable, no debug info>} $hex <NoDebugMixedCaseFunc>" \
66 "p <NoDebugMixedCaseFunc>, in Ada"
67
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\\."
74
75 # Same, but this time on the function with no debug info.
76 gdb_test "break <NoDebugMixedCaseFunc>" \
77 "Breakpoint $decimal at $hex"
78
79 # Resume the program's execution, verifying that it lands at the expected
80 # location.
81 gdb_test "continue" \
82 "Breakpoint $decimal, MixedCaseFunc \\(\\) at .*bar\\.c:$decimal.*"
83
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"
89
90 gdb_test "p <NoDebugMixedCaseFunc>" \
91 "A syntax error in expression, near `<NoDebugMixedCaseFunc>'\\." \
92 "p <NoDebugMixedCaseFunc>, in C"
93
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
98 }
99 }
100
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
105 }
106 }
This page took 0.055193 seconds and 4 git commands to generate.