Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | # Copyright 2019-2020 Free Software Foundation, Inc. |
10d06d82 TT |
2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
16 | # Regression test to ensure that the order of DW_AT_name and | |
17 | # DW_AT_linkage_name does not affect Ada. | |
18 | ||
19 | load_lib dwarf.exp | |
20 | ||
21 | # This test can only be run on targets which support DWARF-2 and use gas. | |
22 | if {![dwarf2_support]} { | |
23 | return 0 | |
24 | } | |
25 | ||
26 | standard_testfile ada-linkage-name.c ada-linkage-name-debug.S | |
27 | ||
28 | # Set up the DWARF for the test. | |
29 | ||
30 | set asm_file [standard_output_file $srcfile2] | |
31 | Dwarf::assemble $asm_file { | |
32 | global srcdir subdir srcfile | |
33 | ||
34 | lassign [function_range first ${srcdir}/${subdir}/${srcfile}] \ | |
35 | first_start first_length | |
36 | ||
37 | lassign [function_range second ${srcdir}/${subdir}/${srcfile}] \ | |
38 | second_start second_length | |
39 | ||
40 | cu {} { | |
41 | DW_TAG_compile_unit { | |
42 | {DW_AT_language @DW_LANG_Ada95} | |
43 | {DW_AT_name ada-linkage-name.c} | |
44 | {DW_AT_comp_dir /tmp} | |
45 | ||
46 | } { | |
47 | declare_labels b_l | |
48 | ||
49 | b_l: DW_TAG_base_type { | |
50 | {DW_AT_byte_size 1 DW_FORM_sdata} | |
51 | {DW_AT_encoding @DW_ATE_signed} | |
52 | {DW_AT_name bool} | |
53 | } | |
54 | # Here the name comes first and the linkage name second. | |
55 | DW_TAG_subprogram { | |
56 | {name system__namefirst} | |
57 | {linkage_name __gnat_namefirst} | |
58 | {low_pc $first_start addr} | |
59 | {high_pc "$first_start + $first_length" addr} | |
60 | {type :$b_l} | |
61 | } | |
62 | # Here the linkage name comes first and the name second. | |
63 | DW_TAG_subprogram { | |
64 | {linkage_name __gnat_namesecond} | |
65 | {name system__namesecond} | |
66 | {low_pc $second_start addr} | |
67 | {high_pc "$second_start + $second_length" addr} | |
68 | {type :$b_l} | |
69 | } | |
70 | } | |
71 | } | |
72 | } | |
73 | ||
74 | if { [prepare_for_testing "failed to prepare" ${testfile} \ | |
75 | [list $srcfile $asm_file] {nodebug}] } { | |
76 | return -1 | |
77 | } | |
78 | ||
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 | |
83 | } | |
84 | ||
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} | |
90 | ||
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 | |
95 | } |