xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-attributes.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
1## Test that DWARFv5 DW_FORM_implicit_const is correctly recognized
2## and copied into the result.
3
4# RUN: yaml2obj %s -o %t.o
5
6# RUN: llvm-dwarfutil %t.o %t1
7# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s --check-prefix VERIFY-CHECK
8# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s
9
10# RUN: llvm-dwarfutil --linker parallel %t.o %t1
11# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s --check-prefix VERIFY-CHECK
12# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s
13
14# RUN: llvm-dwarfutil --no-garbage-collection %t.o %t1
15# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s --check-prefix VERIFY-CHECK
16# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s
17
18# RUN: llvm-dwarfutil --linker parallel --no-garbage-collection %t.o %t1
19# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s --check-prefix VERIFY-CHECK
20# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s
21
22# RUN: llvm-dwarfutil --no-garbage-collection --build-accelerator=DWARF %t.o %t1
23# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s --check-prefix VERIFY-CHECK
24# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s
25
26# RUN: llvm-dwarfutil --linker parallel --no-garbage-collection --build-accelerator=DWARF %t.o %t1
27# RUN: llvm-dwarfdump -verify %t1 | FileCheck %s --check-prefix VERIFY-CHECK
28# RUN: llvm-dwarfdump -a --verbose %t1 | FileCheck %s
29
30#VERIFY-CHECK: No errors.
31
32#CHECK: .debug_abbrev
33#CHECK: DW_TAG_compile_unit
34#CHECK: DW_TAG_subprogram
35#CHECK: DW_TAG_base_type
36#CHECK: DW_TAG_variable
37#CHECK: DW_AT_name
38#CHECK: DW_AT_const_value       DW_FORM_implicit_const  33
39#CHECK: DW_AT_type
40#CHECK: DW_TAG_compile_unit
41#CHECK:   DW_AT_name {{.*}}"CU1"
42#CHECK:   DW_AT_low_pc
43#CHECK:   DW_AT_high_pc
44#CHECK:   DW_TAG_subprogram
45#CHECK:     DW_AT_name {{.*}}"foo1"
46#CHECK:     DW_AT_low_pc
47#CHECK:     DW_AT_high_pc
48#CHECK:  DW_TAG_variable
49#CHECK:     DW_AT_name {{.*}}"var1"
50#CHECK:     DW_AT_const_value [DW_FORM_implicit_const]      (33)
51#CHECK:     DW_AT_type {{.*}}"int"
52
53--- !ELF
54FileHeader:
55  Class:    ELFCLASS64
56  Data:     ELFDATA2LSB
57  Type:     ET_REL
58  Machine:  EM_X86_64
59Sections:
60  - Name:            .text
61    Type:            SHT_PROGBITS
62    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
63    Address:         0x1130
64    Size:            0x60
65DWARF:
66  debug_abbrev:
67    - Table:
68      - Tag:      DW_TAG_compile_unit
69        Children: DW_CHILDREN_yes
70        Attributes:
71          - Attribute: DW_AT_producer
72            Form:      DW_FORM_string
73          - Attribute: DW_AT_language
74            Form:      DW_FORM_data2
75          - Attribute: DW_AT_name
76            Form:      DW_FORM_string
77          - Attribute: DW_AT_low_pc
78            Form:      DW_FORM_addrx
79          - Attribute: DW_AT_high_pc
80            Form:      DW_FORM_data8
81          - Attribute: DW_AT_addr_base
82            Form:      DW_FORM_sec_offset
83      - Tag:      DW_TAG_subprogram
84        Children: DW_CHILDREN_yes
85        Attributes:
86          - Attribute: DW_AT_name
87            Form:      DW_FORM_string
88          - Attribute: DW_AT_low_pc
89            Form:      DW_FORM_addrx
90          - Attribute: DW_AT_high_pc
91            Form:      DW_FORM_data8
92          - Attribute: DW_AT_type
93            Form:      DW_FORM_ref4
94      - Tag:      DW_TAG_base_type
95        Children: DW_CHILDREN_no
96        Attributes:
97          - Attribute: DW_AT_name
98            Form:      DW_FORM_string
99      - Tag:      DW_TAG_variable
100        Children: DW_CHILDREN_no
101        Attributes:
102          - Attribute: DW_AT_name
103            Form:      DW_FORM_string
104          - Attribute: DW_AT_const_value
105            Form:      DW_FORM_implicit_const
106            Value:     33
107          - Attribute: DW_AT_type
108            Form:      DW_FORM_ref4
109  debug_info:
110    - Version: 5
111      UnitType:   DW_UT_compile
112      Entries:
113        - AbbrCode: 1
114          Values:
115            - CStr: by_hand
116            - Value:  0x04
117            - CStr: CU1
118            - Value:  0x0
119            - Value:  0x10
120            - Value:  0x8
121        - AbbrCode: 2
122          Values:
123            - CStr: foo1
124            - Value: 0x0
125            - Value: 0x10
126            - Value: 0x3c
127        - AbbrCode: 0
128        - AbbrCode: 3
129          Values:
130            - CStr: int
131        - AbbrCode: 4
132          Values:
133            - CStr: var1
134            - Value:  0x00000000
135            - Value:  0x0000003c
136        - AbbrCode: 0
137  debug_addr:
138    - Version: 5
139      AddressSize: 0x08
140      Entries:
141        - Address: 0x1130
142...
143