]>
Commit | Line | Data |
---|---|---|
213516ef | 1 | # Copyright 2022-2023 Free Software Foundation, Inc. |
6acc36f7 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 | # Check that the DWARF reader works when a DW_AT_specification refers | |
17 | # into a type hierarchy that is marked as a declaration. | |
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 main.c -debug.S | |
27 | ||
28 | # Set up the DWARF for the test. | |
29 | set asm_file [standard_output_file $srcfile2] | |
30 | Dwarf::assemble $asm_file { | |
31 | global srcfile | |
32 | ||
33 | cu {} { | |
34 | DW_TAG_compile_unit { | |
35 | {DW_AT_language @DW_LANG_C_plus_plus} | |
36 | {DW_AT_name $srcfile} | |
37 | {DW_AT_comp_dir /tmp} | |
38 | ||
39 | } { | |
40 | declare_labels origin | |
41 | ||
42 | # The new indexer was ignoring types that were marked as | |
43 | # declarations, even if they could contain methods -- | |
44 | # which meant that if a method referred back to them via a | |
45 | # specification, it would get the wrong name. | |
46 | DW_TAG_structure_type { | |
47 | {DW_AT_byte_size 8 DW_FORM_sdata} | |
48 | {DW_AT_encoding @DW_ATE_signed} | |
49 | {DW_AT_name the_type} | |
50 | {DW_AT_declaration 1 DW_FORM_flag_present} | |
51 | } { | |
52 | origin: DW_TAG_subprogram { | |
53 | {DW_AT_name "method"} | |
54 | {DW_AT_declaration 1 DW_FORM_flag_present} | |
55 | } | |
56 | } | |
57 | ||
58 | # The low and high PC are phony: we just need an address | |
59 | # range that is valid in the program, so we use the main | |
60 | # function's range. | |
61 | DW_TAG_subprogram { | |
62 | {DW_AT_specification :$origin} | |
63 | {MACRO_AT_range main} | |
64 | } | |
65 | } | |
66 | } | |
67 | } | |
68 | ||
69 | if {[prepare_for_testing "failed to prepare" ${testfile} \ | |
70 | [list $srcfile $asm_file] {nodebug}]} { | |
71 | return -1 | |
72 | } | |
73 | ||
74 | gdb_breakpoint "the_type::method" message |