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