1 # Copyright
2014-2022 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
/>.
16 # Test that GDB determines the frame
's language based on the comp
17 # unit's language
, even
if the file has an unknown file extension
,
22 # This test can only be run
on targets which support DWARF
-2 and use
24 if {![dwarf2_support
]} {
28 standard_testfile .c .S
30 # Assemble the DWARF using CU_LANG as compilation unit
's language.
31 # Run to a function in that compilation unit and check that GDB
32 # figures out that the language is GDB_LANG.
34 proc do_test {cu_lang gdb_lang} {
35 global testfile srcfile srcfile2
37 # Make some DWARF for the test.
38 set asm_file [standard_output_file $srcfile2]
39 Dwarf::assemble $asm_file {
42 # Creating a CU with 4-byte addresses lets this test link on
43 # both 32- and 64-bit machines.
48 {MACRO_AT_range {func}}
52 {MACRO_AT_func {func}}
59 if { [prepare_for_testing "failed to prepare" ${testfile} \
60 [list $srcfile $asm_file] {nodebug}] } {
68 gdb_test "show language" "\"auto; currently $gdb_lang\".*"
71 proc do_test_with_prefix {cu_lang gdb_lang} {
72 with_test_prefix $gdb_lang {
73 do_test $cu_lang $gdb_lang
77 # Some paths in the debugger fall back to C. Check C++ as well to
78 # make sure the test doesn't happen to work because of such a
80 do_test_with_prefix DW_LANG_C
"c"
81 do_test_with_prefix DW_LANG_C_plus_plus
"c\\+\\+"