xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/dwarf5-line-str.test (revision f1fdfe6888f93b9f6dfb4689e1f3206de584ff5b)
1## Test that DWARFv5 DW_FORM_line_strp and corresponding .debug_line_str
2## table are correctly recognized 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 --no-garbage-collection %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 --build-accelerator=DWARF %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 %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 --linker parallel --no-garbage-collection %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_info
33#CHECK: DW_TAG_compile_unit
34#CHECK: DW_TAG_subprogram
35#CHECK: DW_AT_name [DW_FORM_line_strp]  ( .debug_line_str[0x00000000] = "foo1")
36#CHECK: .debug_line
37#CHECK: include_directories[  0] =  .debug_line_str[0x00000000] = "foo1"
38#CHECK: include_directories[  1] =  .debug_line_str[0x00000000] = "foo1"
39#CHECK: file_names[  0]:
40#CHECK:            name:  .debug_line_str[0x00000000] = "foo1"
41#CHECK: file_names[  1]:
42#CHECK:            name:  .debug_line_str[0x00000000] = "foo1"
43#CHECK: .debug_line_str
44#CHECK: "foo1"
45
46--- !ELF
47FileHeader:
48  Class:    ELFCLASS64
49  Data:     ELFDATA2LSB
50  Type:     ET_REL
51  Machine:  EM_X86_64
52Sections:
53  - Name:            .text
54    Type:            SHT_PROGBITS
55    Flags:           [ SHF_ALLOC, SHF_EXECINSTR ]
56    Address:         0x1130
57    Size:            0x60
58  - Name:            .debug_line_str
59    Type:            SHT_PROGBITS
60    Flags:           [  ]
61    Content:         "666f6f3100"
62  - Name:            .debug_line
63    Type:            SHT_PROGBITS
64    Flags:           [  ]
65    Content:         "2a00000005000801220000000102030405050102030401011f02000000000000000001011f020000000000000000"
66DWARF:
67  debug_abbrev:
68    - Table:
69      - Tag:      DW_TAG_compile_unit
70        Children: DW_CHILDREN_yes
71        Attributes:
72          - Attribute: DW_AT_producer
73            Form:      DW_FORM_string
74          - Attribute: DW_AT_language
75            Form:      DW_FORM_data2
76          - Attribute: DW_AT_name
77            Form:      DW_FORM_string
78          - Attribute: DW_AT_low_pc
79            Form:      DW_FORM_addrx
80          - Attribute: DW_AT_high_pc
81            Form:      DW_FORM_data8
82          - Attribute: DW_AT_addr_base
83            Form:      DW_FORM_sec_offset
84          - Attribute: DW_AT_stmt_list
85            Form:      DW_FORM_sec_offset
86      - Tag:      DW_TAG_subprogram
87        Children: DW_CHILDREN_yes
88        Attributes:
89          - Attribute: DW_AT_name
90            Form:      DW_FORM_line_strp
91          - Attribute: DW_AT_low_pc
92            Form:      DW_FORM_addrx
93          - Attribute: DW_AT_high_pc
94            Form:      DW_FORM_data8
95          - Attribute: DW_AT_type
96            Form:      DW_FORM_ref4
97      - Tag:      DW_TAG_base_type
98        Children: DW_CHILDREN_no
99        Attributes:
100          - Attribute: DW_AT_name
101            Form:      DW_FORM_string
102      - Tag:      DW_TAG_variable
103        Children: DW_CHILDREN_no
104        Attributes:
105          - Attribute: DW_AT_name
106            Form:      DW_FORM_string
107          - Attribute: DW_AT_const_value
108            Form:      DW_FORM_implicit_const
109            Value:     33
110          - Attribute: DW_AT_type
111            Form:      DW_FORM_ref4
112  debug_info:
113    - Version: 5
114      UnitType:   DW_UT_compile
115      Entries:
116        - AbbrCode: 1
117          Values:
118            - CStr: by_hand
119            - Value:  0x04
120            - CStr: CU1
121            - Value:  0x0
122            - Value:  0x10
123            - Value:  0x8
124            - Value:  0x0
125        - AbbrCode: 2
126          Values:
127            - Value: 0x0
128            - Value: 0x0
129            - Value: 0x10
130            - Value: 0x3f
131        - AbbrCode: 0
132        - AbbrCode: 3
133          Values:
134            - CStr: int
135        - AbbrCode: 0
136  debug_addr:
137    - Version: 5
138      AddressSize: 0x08
139      Entries:
140        - Address: 0x1130
141...
142