]>
Commit | Line | Data |
---|---|---|
4a94e368 | 1 | # Copyright 2020-2022 Free Software Foundation, Inc. |
3ee6bb11 TV |
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 | # Set up the DWARF for the test. | |
17 | ||
18 | set main_str_label [Dwarf::_compute_label info_string3] | |
19 | set int_str_label [Dwarf::_compute_label info_string4] | |
20 | set main_die_label [Dwarf::_compute_label main_die_label] | |
21 | set int_die_label [Dwarf::_compute_label int_die_label] | |
22 | ||
23 | set debug_str \ | |
24 | [list \ | |
25 | "$main_str_label:" \ | |
26 | " .asciz \"main\"" \ | |
27 | "$int_str_label:" \ | |
28 | " .asciz \"int\""] | |
29 | ||
30 | set debug_names \ | |
31 | [list \ | |
32 | " .4byte .Ldebug_names_end - .Ldebug_names_start" \ | |
33 | ".Ldebug_names_start:" \ | |
fa0fe749 TV |
34 | " .short 5 /* Header: version */" \ |
35 | " .short 0 /* Header: padding */" \ | |
36 | " .long 1 /* Header: compilation unit count */" \ | |
37 | " .long 0 /* Header: local type unit count */" \ | |
38 | " .long 0 /* Header: foreign type unit count */" \ | |
39 | " .long 2 /* Header: bucket count */" \ | |
40 | " .long 2 /* Header: name count */" \ | |
3ee6bb11 | 41 | " .long .Lnames_abbrev_end0-.Lnames_abbrev_start0 " \ |
fa0fe749 TV |
42 | " /* Header: abbreviation table size */" \ |
43 | " .long 8 /* Header: augmentation string size */" \ | |
44 | " .ascii \"LLVM0700\" /* Header: augmentation string */" \ | |
45 | " .long .Lcu1_begin /* Compilation unit 0 */" \ | |
46 | " .long 1 /* Bucket 0 */" \ | |
47 | " .long 0 /* Bucket 1 */" \ | |
48 | " .long 193495088 /* Hash in Bucket 0 */" \ | |
49 | " .long 2090499946 /* Hash in Bucket 0 */" \ | |
50 | " .long $int_str_label /* String in Bucket 0: int */" \ | |
51 | " .long $main_str_label /* String in Bucket 0: main */" \ | |
52 | " .long .Lnames1-.Lnames_entries0/* Offset in Bucket 0 */" \ | |
53 | " .long .Lnames0-.Lnames_entries0/* Offset in Bucket 0 */" \ | |
3ee6bb11 | 54 | ".Lnames_abbrev_start0:" \ |
fa0fe749 TV |
55 | " .byte 46 /* Abbrev code */" \ |
56 | " .byte 46 /* DW_TAG_subprogram */" \ | |
57 | " .byte 3 /* DW_IDX_die_offset */" \ | |
58 | " .byte 19 /* DW_FORM_ref4 */" \ | |
59 | " .byte 0 /* End of abbrev */" \ | |
60 | " .byte 0 /* End of abbrev */" \ | |
61 | " .byte 36 /* Abbrev code */" \ | |
62 | " .byte 36 /* DW_TAG_base_type */" \ | |
63 | " .byte 3 /* DW_IDX_die_offset */" \ | |
64 | " .byte 19 /* DW_FORM_ref4 */" \ | |
65 | " .byte 0 /* End of abbrev */" \ | |
66 | " .byte 0 /* End of abbrev */" \ | |
67 | " .byte 0 /* End of abbrev list */" \ | |
3ee6bb11 TV |
68 | ".Lnames_abbrev_end0:" \ |
69 | ".Lnames_entries0:" \ | |
70 | ".Lnames1:" \ | |
fa0fe749 TV |
71 | " .byte 36 /* Abbreviation code */" \ |
72 | " .long $int_die_label - .Lcu1_begin/* DW_IDX_die_offset */" \ | |
73 | " .long 0 /* End of list: int */" \ | |
3ee6bb11 | 74 | ".Lnames0:" \ |
fa0fe749 TV |
75 | " .byte 46 /* Abbreviation code */" \ |
76 | " .long $main_die_label - .Lcu1_begin/* DW_IDX_die_offset */" \ | |
77 | " .long 0 /* End of list: main */" \ | |
3ee6bb11 TV |
78 | " .p2align 2" \ |
79 | ".Ldebug_names_end:"] | |
80 | ||
81 | Dwarf::assemble $asm_file { | |
82 | global srcdir subdir srcfile | |
83 | global main_start main_length | |
84 | ||
85 | cu {} { | |
86 | DW_TAG_compile_unit { | |
87 | {DW_AT_language @DW_LANG_C} | |
88 | {DW_AT_name clang-debug-names.c} | |
89 | {DW_AT_comp_dir /tmp} | |
90 | ||
91 | } { | |
92 | global int_die_label | |
93 | global main_die_label | |
94 | ||
95 | define_label $int_die_label | |
96 | base_type { | |
97 | {name "int"} | |
98 | {encoding @DW_ATE_signed} | |
99 | {byte_size 4 DW_FORM_sdata} | |
100 | } | |
101 | ||
102 | define_label $main_die_label | |
103 | subprogram { | |
104 | {name main} | |
105 | {type :$int_die_label} | |
106 | {low_pc $main_start addr} | |
107 | {high_pc "$main_start + $main_length" addr} | |
108 | } | |
109 | } | |
110 | } | |
111 | ||
112 | _defer_output .debug_str { | |
113 | global debug_str | |
114 | _emit [join $debug_str "\n"] | |
115 | } | |
116 | ||
117 | _defer_output .debug_names { | |
118 | global debug_names | |
119 | _emit [join $debug_names "\n"] | |
120 | } | |
121 | } |