1 # Copyright 2019-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/>.
16 # Regression test to ensure that the order of DW_AT_name and
17 # DW_AT_linkage_name does not affect Ada.
21 # This test can only be run on targets which support DWARF-2 and use gas.
22 require dwarf2_support
24 standard_testfile .c -debug.S
26 # Set up the DWARF for the test.
28 set asm_file [standard_output_file $srcfile2]
29 Dwarf::assemble $asm_file {
30 global srcdir subdir srcfile
34 {DW_AT_language @DW_LANG_Ada95}
41 b_l: DW_TAG_base_type {
42 {DW_AT_byte_size 1 DW_FORM_sdata}
43 {DW_AT_encoding @DW_ATE_signed}
46 # Here the name comes first and the linkage name second.
48 {name system__namefirst}
49 {linkage_name __gnat_namefirst}
50 {MACRO_AT_range {first}}
53 # Here the linkage name comes first and the name second.
55 {linkage_name __gnat_namesecond}
56 {name system__namesecond}
57 {MACRO_AT_range {second}}
64 if { [prepare_for_testing "failed to prepare" ${testfile} \
65 [list $srcfile $asm_file] {nodebug}] } {
69 with_test_prefix "first first" {
70 gdb_test_no_output "set language ada"
71 gdb_breakpoint "<__gnat_namefirst>" message
72 gdb_breakpoint "<__gnat_namesecond>" message
75 # Run the test again, but this time check the symbols in the other
76 # order. This ensures we are really testing all the paths --
77 # otherwise if the first symbol is found, it will cause symtab
78 # expansion, which might cause the other symbol to be found.
79 clean_restart ${testfile}
81 with_test_prefix "second first" {
82 gdb_test_no_output "set language ada"
83 gdb_breakpoint "<__gnat_namesecond>" message
84 gdb_breakpoint "<__gnat_namefirst>" message