1 # Copyright 2018-2024 Free Software Foundation, Inc.
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.
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.
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/>.
18 require allow_ada_tests
20 standard_ada_testfile bla
22 set csrcfile ${srcdir}/${subdir}/${testdir}/${cfile}.c
23 set cobject [standard_output_file ${cfile}.o]
25 gdb_compile "${csrcfile}" "${cobject}" object [list debug]
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_gnat_encoding scenario flags {all minimal} {
31 lappend flags debug additional_flags=-largs \
32 additional_flags=${cobject} \
33 additional_flags=-margs
35 if {[gdb_compile_ada "${srcfile}" "${binfile}-${scenario}" executable $flags] != ""} {
39 clean_restart ${testfile}-${scenario}
41 set bp_location [gdb_get_line_number "STOP" ${testdir}/foo.c]
42 runto "foo.c:$bp_location"
44 gdb_test_no_output "set print frame-arguments all"
46 # Here is the scenario:
47 # - Once stopped in a C function, with language_mode set to auto, print
48 # backtrace, we should see the Ada frame arguments printed using Ada
50 # - Set language to C, then check that printing backtrace shows the Ada
51 # frame arguments using C syntax.
52 # - Set language back to auto, check language mode value, then print
53 # backtrace, we should see Ada frame arguments printed using Ada C
56 gdb_test "show lang" \
57 "The current source language is \"auto; currently c\"." \
58 "show language when set to 'auto; c'"
61 "#1 $hex in pck\\.call_me \\(s=\"test\"\\).*" \
62 "backtrace with auto: c"
64 gdb_test_no_output "set language c" \
65 "Set current source language to \"manual; currently c\"."
67 gdb_test "show lang" \
68 "The current source language is \"c\"." \
69 "show language when set to 'c'"
72 "#1 $hex in pck\\.call_me \\(s={P_ARRAY = $hex, P_BOUNDS = $hex}\\).*" \
73 "backtrace with language forced to 'c'"
75 gdb_test_no_output "set language auto" \
76 "Set current source language to \"auto; currently c\"."
78 gdb_test "show lang" \
79 "The current source language is \"auto; currently c\"." \
80 "show language when set back to 'auto; c'"
83 "#1 $hex in pck\\.call_me \\(s=\"test\"\\).*" \
84 "backtrace with language back to 'auto; c'"