Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2018-2020 Free Software Foundation, Inc. |
2228ef77 XR |
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 | load_lib "ada.exp" | |
17 | ||
18 | standard_ada_testfile bla | |
19 | set cfile "foo" | |
20 | set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c | |
21 | set cobject [standard_output_file ${cfile}.o] | |
22 | ||
23 | gdb_compile "${csrcfile}" "${cobject}" object [list debug] | |
2228ef77 | 24 | |
dac2fef7 TT |
25 | # Note we don't test the "none" (no -fgnat-encodings option) scenario |
26 | # here, because "all" and "minimal" cover the cases, and this way we | |
27 | # don't have to update the test when gnat changes its default. | |
28 | foreach_with_prefix scenario {all minimal} { | |
29 | set flags [list debug additional_flags=-largs \ | |
30 | additional_flags=${cobject} \ | |
31 | additional_flags=-margs \ | |
32 | additional_flags=-fgnat-encodings=$scenario] | |
33 | ||
34 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $flags] != ""} { | |
35 | return -1 | |
36 | } | |
2228ef77 | 37 | |
dac2fef7 | 38 | clean_restart ${testfile} |
2228ef77 | 39 | |
dac2fef7 TT |
40 | set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.c] |
41 | runto "foo.c:$bp_location" | |
2228ef77 | 42 | |
dac2fef7 | 43 | gdb_test_no_output "set print frame-arguments all" |
2228ef77 | 44 | |
dac2fef7 TT |
45 | # Here is the scenario: |
46 | # - Once stopped in a C function, with language_mode set to auto, print | |
47 | # backtrace, we should see the Ada frame arguments printed using Ada | |
48 | # syntax. | |
49 | # - Set language to C, then check that printing backtrace shows the Ada | |
50 | # frame arguments using C syntax. | |
51 | # - Set language back to auto, check language mode value, then print | |
52 | # backtrace, we should see Ada frame arguments printed using Ada C | |
53 | # syntax. | |
2228ef77 | 54 | |
dac2fef7 TT |
55 | gdb_test "show lang" \ |
56 | "The current source language is \"auto; currently c\"." \ | |
57 | "show language when set to 'auto; c'" | |
2228ef77 | 58 | |
dac2fef7 TT |
59 | gdb_test "bt" \ |
60 | "#1 $hex in pck\\.call_me \\(s=\"test\"\\).*" \ | |
61 | "backtrace with auto: c" | |
2228ef77 | 62 | |
dac2fef7 TT |
63 | gdb_test_no_output "set language c" \ |
64 | "Set current source language to \"manual; currently c\"." | |
2228ef77 | 65 | |
dac2fef7 TT |
66 | gdb_test "show lang" \ |
67 | "The current source language is \"c\"." \ | |
68 | "show language when set to 'c'" | |
2228ef77 | 69 | |
dac2fef7 TT |
70 | # With -fgnat-encodings=minimal, this works properly in C as well. |
71 | if {$scenario == "minimal"} { | |
72 | set expected "\"test\"" | |
73 | } else { | |
74 | set expected "{P_ARRAY = $hex, P_BOUNDS = $hex}" | |
75 | } | |
76 | gdb_test "bt" \ | |
77 | "#1 $hex in pck\\.call_me \\(s=$expected\\).*" \ | |
78 | "backtrace with language forced to 'c'" | |
2228ef77 | 79 | |
dac2fef7 TT |
80 | gdb_test_no_output "set language auto" \ |
81 | "Set current source language to \"auto; currently c\"." | |
2228ef77 | 82 | |
dac2fef7 TT |
83 | gdb_test "show lang" \ |
84 | "The current source language is \"auto; currently c\"." \ | |
85 | "show language when set back to 'auto; c'" | |
86 | ||
87 | gdb_test "bt" \ | |
88 | "#1 $hex in pck\\.call_me \\(s=\"test\"\\).*" \ | |
89 | "backtrace with language back to 'auto; c'" | |
90 | } |