Follow up to d0858bffa11, add missing REQUIRES x86
[llvm-project.git] / llvm / test / tools / dsymutil / X86 / dwarf5-addrx.test
blobfd6197bdc5fb421e4d491be46a0890062a05ca2d
1 ## Test that DWARF5 DW_FORM_addrx is correctly recognized
2 ## and converted into the DW_FORM_addr or just preserved
3 ## in case --update.
5 ## $ cat dwarf5-addrx.c
6 ## __attribute__ ((optnone)) int foo1 ( ) {
7 ##   volatile int a = 0x1; return a;
8 ## }
9 ##
10 ## __attribute__ ((optnone)) int foo2 ( ) {
11 ##   volatile int a = 0x2; return a;
12 ## }
14 ## __attribute__ ((optnone)) int foo3 ( ) {
15 ##   volatile int a = 0x3; return a;
16 ## }
18 ## __attribute__ ((optnone)) int foo4 ( ) {
19 ##   volatile int a = 0x4; return a;
20 ## }
22 ## __attribute__ ((optnone)) int foo5 ( ) {
23 ##   volatile int a = 0x5; return a;
24 ## }
26 ## __attribute__ ((optnone)) int foo6 ( ) {
27 ##   volatile int a = 0x6; return a;
28 ## }
30 ## __attribute__ ((optnone)) int foo7 ( ) {
31 ##   volatile int a = 0x7; return a;
32 ## }
34 ## __attribute__ ((optnone)) int foo8 ( ) {
35 ##   volatile int a = 0x8; return a;
36 ## }
38 ## int main ( void ) {
39 ##   return foo1()+foo2()+foo3()+foo4()+foo5()+foo6()+foo7()+foo8();
40 ## }
42 ## $ clang -gdwarf-5 dwarf5-addrx.c -c -o dwarf5-addrx.o
43 ## $ clang dwarf5-addrx.o -o dwarf5-addrx.out
45 RUN: dsymutil -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/dwarf5/dwarf5-addrx.out -o %t.dSYM 2>&1 | FileCheck %s --allow-empty
46 RUN: llvm-dwarfdump --verify %t.dSYM 2>&1 | FileCheck %s
48 RUN: llvm-dwarfdump --verbose %t.dSYM | FileCheck %s --check-prefix DWARF
50 RUN: dsymutil --update -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/dwarf5/dwarf5-addrx.out -o %t.dSYM 2>&1 | FileCheck %s --allow-empty
51 RUN: llvm-dwarfdump --verify %t.dSYM 2>&1 | FileCheck %s
53 RUN: llvm-dwarfdump --verbose %t.dSYM | FileCheck %s --check-prefix UPDATE-DWARF
55 RUN: dsymutil --linker llvm -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/dwarf5/dwarf5-addrx.out -o %t.dSYM 2>&1 | FileCheck %s --allow-empty
56 RUN: llvm-dwarfdump --verify %t.dSYM 2>&1 | FileCheck %s
58 RUN: llvm-dwarfdump --verbose %t.dSYM | FileCheck %s --check-prefix DWARF
60 RUN: dsymutil --linker llvm --update -oso-prepend-path %p/../Inputs %p/../Inputs/private/tmp/dwarf5/dwarf5-addrx.out -o %t.dSYM 2>&1 | FileCheck %s --allow-empty
61 RUN: llvm-dwarfdump --verify %t.dSYM 2>&1 | FileCheck %s
63 RUN: llvm-dwarfdump --verbose %t.dSYM | FileCheck %s --check-prefix UPDATE-DWARF
66 CHECK-NOT: error:
68 DWARF: DW_TAG_compile_unit
69 DWARF:   DW_AT_name [DW_FORM_strx]  {{.*}}     "dwarf5-addrx.c"
70 DWARF:   DW_AT_low_pc [DW_FORM_addrx]      (indexed (00000000) address = 0x0000000100000eb0)
71 DWARF:   DW_AT_high_pc [DW_FORM_data4]   (0x00000103)
72 DWARF:   DW_AT_addr_base [DW_FORM_sec_offset]      (0x00000008)
73 DWARF:   DW_TAG_subprogram
74 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000000) address = 0x0000000100000eb0)
75 DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
76 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo1"
77 DWARF:   DW_TAG_subprogram
78 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000001) address = 0x0000000100000ec0)
79 DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
80 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo2"
81 DWARF:   DW_TAG_subprogram
82 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000002) address = 0x0000000100000ed0)
83 DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
84 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo3"
85 DWARF:   DW_TAG_subprogram
86 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000003) address = 0x0000000100000ee0)
87 DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
88 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo4"
89 DWARF:   DW_TAG_subprogram
90 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000004) address = 0x0000000100000ef0)
91 DWARF:     DW_AT_high_pc  [DW_FORM_data4]  (0x00000010)
92 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo5"
93 DWARF:   DW_TAG_subprogram
94 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000005) address = 0x0000000100000f00)
95 DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
96 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo6"
97 DWARF:   DW_TAG_subprogram
98 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000006) address = 0x0000000100000f10)
99 DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
100 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo7"
101 DWARF:   DW_TAG_subprogram
102 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000007) address = 0x0000000100000f20)
103 DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
104 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo8"
105 DWARF:   DW_TAG_subprogram
106 DWARF:     DW_AT_low_pc [DW_FORM_addrx]    (indexed (00000008) address = 0x0000000100000f30)
107 DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000083)
108 DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "main"
110 UPDATE-DWARF: DW_TAG_compile_unit
111 UPDATE-DWARF:   DW_AT_name [DW_FORM_strx]  {{.*}}     "dwarf5-addrx.c"
112 UPDATE-DWARF:   DW_AT_low_pc [DW_FORM_addrx]  (indexed (00000000) address = 0x0000000000000000)
113 UPDATE-DWARF:   DW_AT_high_pc [DW_FORM_data4]   (0x00000103)
114 UPDATE-DWARF:   DW_TAG_subprogram
115 UPDATE-DWARF:     DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x0000000000000000)
116 UPDATE-DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
117 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo1"
118 UPDATE-DWARF:   DW_TAG_subprogram
119 UPDATE-DWARF:     DW_AT_low_pc [DW_FORM_addrx] (indexed (00000001) address = 0x0000000000000010)
120 UPDATE-DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
121 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo2"
122 UPDATE-DWARF:   DW_TAG_subprogram
123 UPDATE-DWARF:     DW_AT_low_pc [DW_FORM_addrx]  (indexed (00000002) address = 0x0000000000000020)
124 UPDATE-DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
125 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo3"
126 UPDATE-DWARF:   DW_TAG_subprogram
127 UPDATE-DWARF:     DW_AT_low_pc  [DW_FORM_addrx] (indexed (00000003) address = 0x0000000000000030)
128 UPDATE-DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
129 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo4"
130 UPDATE-DWARF:   DW_TAG_subprogram
131 UPDATE-DWARF:     DW_AT_low_pc [DW_FORM_addrx]  (indexed (00000004) address = 0x0000000000000040)
132 UPDATE-DWARF:     DW_AT_high_pc  [DW_FORM_data4]  (0x00000010)
133 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo5"
134 UPDATE-DWARF:   DW_TAG_subprogram
135 UPDATE-DWARF:     DW_AT_low_pc  [DW_FORM_addrx] (indexed (00000005) address = 0x0000000000000050)
136 UPDATE-DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
137 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo6"
138 UPDATE-DWARF:   DW_TAG_subprogram
139 UPDATE-DWARF:     DW_AT_low_pc  [DW_FORM_addrx] (indexed (00000006) address = 0x0000000000000060)
140 UPDATE-DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
141 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo7"
142 UPDATE-DWARF:   DW_TAG_subprogram
143 UPDATE-DWARF:     DW_AT_low_pc  [DW_FORM_addrx] (indexed (00000007) address = 0x0000000000000070)
144 UPDATE-DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000010)
145 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "foo8"
146 UPDATE-DWARF:   DW_TAG_subprogram
147 UPDATE-DWARF:     DW_AT_low_pc  [DW_FORM_addrx] (indexed (00000008) address = 0x0000000000000080)
148 UPDATE-DWARF:     DW_AT_high_pc [DW_FORM_data4]   (0x00000083)
149 UPDATE-DWARF:     DW_AT_name  [DW_FORM_strx] {{.*}}   "main"
150 UPDATE-DWARF:  .debug_addr contents:
151 UPDATE-DWARF:  0x00000000: Address table header: length = 0x0000004c, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00
152 UPDATE-DWARF: Addrs: [
153 UPDATE-DWARF: 0x0000000000000000
154 UPDATE-DWARF: 0x0000000000000010
155 UPDATE-DWARF: 0x0000000000000020
156 UPDATE-DWARF: 0x0000000000000030
157 UPDATE-DWARF: 0x0000000000000040
158 UPDATE-DWARF: 0x0000000000000050
159 UPDATE-DWARF: 0x0000000000000060
160 UPDATE-DWARF: 0x0000000000000070
161 UPDATE-DWARF: 0x0000000000000080
162 UPDATE-DWARF: ]