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