xref: /llvm-project/bolt/test/X86/dwarf5-loclist-offset-form.test (revision 6aad62cf5b7f91f4b02266cf72469e2c8e28dbef)
1# REQUIRES: system-linux
2
3# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-loclist-offset-form-main.s -o %tmain.o
4# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-loclist-offset-form-helper.s -o %thelper.o
5# RUN: %clang %cflags -dwarf-5 %tmain.o %thelper.o -o %t.exe -Wl,-q
6# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --debug-thread-count=4 --cu-processing-batch-size=4
7# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.exe | FileCheck --check-prefix=PRECHECK %s
8# RUN: llvm-dwarfdump --show-form --verbose --debug-addr %t.bolt > %t.txt
9# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt >> %t.txt
10# RUN: cat %t.txt | FileCheck --check-prefix=POSTCHECK %s
11
12## Checks we can handle DWARF5 CU with DWARF4 DW_AT_location access pattern.
13
14# PRECHECK: DW_TAG_compile_unit
15# PRECHECK: DW_TAG_variable [5]
16# PRECHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
17# PRECHECK: DW_TAG_variable [5]
18# PRECHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
19# PRECHECK: DW_TAG_compile_unit
20# PRECHECK: DW_TAG_variable [11]
21# PRECHECK-NEXT: DW_AT_location [DW_FORM_sec_offset]
22
23# POSTCHECK: Addrs: [
24# POSTCHECK-NEXT: 0x[[#%.16x,ADDR:]]
25# POSTCHECK-NEXT: 0x[[#%.16x,ADDR1:]]
26# POSTCHECK-NEXT: 0x[[#%.16x,ADDR2:]]
27# POSTCHECK-NEXT: 0x[[#%.16x,ADDR3:]]
28# For second CU.
29# POSTCHECK: Addrs: [
30# POSTCHECK-NEXT: 0x[[#%.16x,ADDR4:]]
31# POSTCHECK-NEXT: 0x[[#%.16x,ADDR5:]]
32# POSTCHECK-NEXT: 0x[[#%.16x,ADDR6:]]
33# POSTCHECK-NEXT: 0x[[#%.16x,ADDR7:]]
34
35# POSTCHECK: DW_TAG_compile_unit
36# POSTCHECK: DW_AT_loclists_base [DW_FORM_sec_offset]  (0x0000000c)
37# POSTCHECK: DW_TAG_variable [5]
38# POSTCHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x0)
39# POSTCHECK-NEXT: [0x[[#ADDR2]]
40# POSTCHECK-SAME: 0x[[#ADDR2 + 0x9]]
41# POSTCHECK-NEXT: [0x[[#ADDR2 + 0x9]]
42# POSTCHECK-SAME: 0x[[#ADDR2 + 0xf]]
43# POSTCHECK: DW_TAG_variable [5]
44# POSTCHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x1)
45# POSTCHECK-NEXT: [0x[[#ADDR3]]
46# POSTCHECK-SAME: 0x[[#ADDR3 + 2]]
47
48# POSTCHECK: DW_TAG_compile_unit
49# POSTCHECK: DW_AT_loclists_base [DW_FORM_sec_offset]  (0x00000045)
50# POSTCHECK: DW_TAG_variable [5]
51# POSTCHECK-NEXT: DW_AT_location [DW_FORM_loclistx] (indexed (0x0)
52# POSTCHECK-NEXT: [0x[[#ADDR7]]
53# POSTCHECK-SAME: 0x[[#ADDR7 + 0x3]]
54# POSTCHECK-NEXT: [0x[[#ADDR7 + 0x3]]
55# POSTCHECK-SAME: 0x[[#ADDR7 + 0x4]]
56