1 # Copyright 2014-2015 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 comp-unit-lang.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.
45 extern func_start func_end
50 {low_pc func_start addr}
51 {high_pc func_end addr}
56 {low_pc func_start addr}
57 {high_pc func_end addr}
64 if { [prepare_for_testing "failed to prepare" ${testfile} \
65 [list $srcfile $asm_file] {nodebug}] } {
73 gdb_test "show language" "\"auto; currently $gdb_lang\".*"
76 # Some paths in the debugger fall back to C. Check C++ as well to
77 # make sure the test doesn't happen to work because of such a
80 do_test DW_LANG_C_plus_plus "c\\+\\+"