1 # Copyright 2019-2020 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 if {![dwarf2_support]} {
26 standard_testfile ada-linkage-name.c ada-linkage-name-debug.S
28 # Set up the DWARF for the test.
30 set asm_file [standard_output_file $srcfile2]
31 Dwarf::assemble $asm_file {
32 global srcdir subdir srcfile
34 lassign [function_range first ${srcdir}/${subdir}/${srcfile}] \
35 first_start first_length
37 lassign [function_range second ${srcdir}/${subdir}/${srcfile}] \
38 second_start second_length
42 {DW_AT_language @DW_LANG_Ada95}
43 {DW_AT_name ada-linkage-name.c}
49 b_l: DW_TAG_base_type {
50 {DW_AT_byte_size 1 DW_FORM_sdata}
51 {DW_AT_encoding @DW_ATE_signed}
54 # Here the name comes first and the linkage name second.
56 {name system__namefirst}
57 {linkage_name __gnat_namefirst}
58 {low_pc $first_start addr}
59 {high_pc "$first_start + $first_length" addr}
62 # Here the linkage name comes first and the name second.
64 {linkage_name __gnat_namesecond}
65 {name system__namesecond}
66 {low_pc $second_start addr}
67 {high_pc "$second_start + $second_length" addr}
74 if { [prepare_for_testing "failed to prepare" ${testfile} \
75 [list $srcfile $asm_file] {nodebug}] } {
79 with_test_prefix "first first" {
80 gdb_test_no_output "set language ada"
81 gdb_breakpoint "<__gnat_namefirst>" message
82 gdb_breakpoint "<__gnat_namesecond>" message
85 # Run the test again, but this time check the symbols in the other
86 # order. This ensures we are really testing all the paths --
87 # otherwise if the first symbol is found, it will cause symtab
88 # expansion, which might cause the other symbol to be found.
89 clean_restart ${testfile}
91 with_test_prefix "second first" {
92 gdb_test_no_output "set language ada"
93 gdb_breakpoint "<__gnat_namesecond>" message
94 gdb_breakpoint "<__gnat_namefirst>" message