forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdwarf-debug-line-stmt-list-offset-change.test
113 lines (102 loc) · 5.14 KB
/
dwarf-debug-line-stmt-list-offset-change.test
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# REQUIRES: system-linux
## Check that BOLT updates DW_AT_stmt_list correctly for TUs when both objects are built with DWARF5.
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf5-debug-line-offset-change-after-bolt-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-types-dwarf5-types-helper.s -o %thelper.o
# RUN: %clang %cflags %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --lite=0 --reorder-blocks=reverse
# RUN: llvm-dwarfdump --debug-info -r 0 %t.exe > %tlogOffsetNotEqual.txt
# RUN: llvm-dwarfdump --debug-info -r 0 %t.bolt >> %tlogOffsetNotEqual.txt
# RUN: llvm-dwarfdump --debug-info -r 0 --debug-line %t.bolt > %tlogCheckLineTable.txt
# RUN: cat %tlogOffsetNotEqual.txt | FileCheck --check-prefix=CHECK1 %s
# RUN: cat %tlogCheckLineTable.txt | FileCheck --check-prefix=CHECK2 %s
## Check offset gets modified.
# CHECK1: DW_TAG_compile_unit
# CHECK1: DW_AT_stmt_list
# CHECK1: DW_TAG_type_unit
# CHECK1: DW_AT_stmt_list ([[OFFSET:0x[0-9a-f]*]])
# CHECK1: DW_TAG_type_unit
# CHECK1: DW_AT_stmt_list ([[OFFSET]])
# CHECK1: DW_TAG_compile_unit
# CHECK1: DW_AT_stmt_list ([[OFFSET]])
# CHECK1: DW_TAG_type_unit
# CHECK1-NOT: DW_AT_stmt_list ([[OFFSET]])
# CHECK1: DW_TAG_type_unit
# CHECK1-NOT: DW_AT_stmt_list ([[OFFSET]])
# CHECK1: DW_TAG_compile_unit
# CHECK1: DW_TAG_compile_unit
# CHECK1-NOT: DW_AT_stmt_list ([[OFFSET]])
## Check that offset is correct.
# CHECK2: DW_TAG_type_unit
# CHECK2: DW_AT_stmt_list ([[OFFSET1:0x[0-9a-f]*]])
# CHECK2: DW_TAG_type_unit
# CHECK2: DW_AT_stmt_list ([[OFFSET1]])
# CHECK2: DW_TAG_compile_unit
# CHECK2: DW_AT_stmt_list
# CHECK2: DW_TAG_compile_unit
# CHECK2: DW_AT_stmt_list ([[OFFSET1]])
# CHECK2: debug_line
# CHECK2: debug_line[[[OFFSET1]]]
# CHECK2-NOT: debug_line
## Check that BOLT updates DW_AT_stmt_list correctly for TUs when both objects are built with DWARF4.
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-debug-line-offset-change-after-bolt-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-debug-line-offset-change-after-bolt-helper.s -o %thelper.o
# RUN: %clang %cflags %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --lite=0 --reorder-blocks=reverse
# RUN: llvm-dwarfdump --debug-info --debug-types -r 0 %t.exe > %tlogOffsetNotEqual.txt
# RUN: llvm-dwarfdump --debug-info --debug-types -r 0 %t.bolt >> %tlogOffsetNotEqual.txt
# RUN: llvm-dwarfdump --debug-info --debug-types -r 0 --debug-line %t.bolt > %tlogCheckLineTable.txt
# RUN: cat %tlogOffsetNotEqual.txt | FileCheck --check-prefix=CHECK3 %s
# RUN: cat %tlogCheckLineTable.txt | FileCheck --check-prefix=CHECK4 %s
## Check offset gets modified.
# CHECK3: DW_TAG_compile_unit
# CHECK3: DW_TAG_compile_unit
# CHECK3: DW_AT_stmt_list ([[OFFSET2:0x[0-9a-f]*]])
# CHECK3: DW_TAG_type_unit
# CHECK3: DW_AT_stmt_list ([[OFFSET2]])
# CHECK3: DW_TAG_compile_unit
# CHECK3-NOT: DW_AT_stmt_list ([[OFFSET2]])
# CHECK3: DW_TAG_type_unit
# CHECK3-NOT: DW_AT_stmt_list ([[OFFSET2]])
## Check that offset is correct.
# CHECK4: DW_TAG_compile_unit
# CHECK4: DW_TAG_compile_unit
# CHECK4: DW_TAG_type_unit
# CHECK4: DW_AT_stmt_list ([[OFFSET3:0x[0-9a-f]*]])
# CHECK4: debug_line
# CHECK4: debug_line[[[OFFSET3]]]
# CHECK4-NOT: debug_line
## Check that BOLT updates DW_AT_stmt_list correctly for TUs when objects are built with DWARF4/DWARF5.
# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-debug-line-offset-change-after-bolt-main.s -o %tmain.o
# RUN: llvm-mc -dwarf-version=5 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-types-dwarf5-types-helper.s -o %thelper.o
# RUN: %clang %cflags %tmain.o %thelper.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections --lite=0 --reorder-blocks=reverse
# RUN: llvm-dwarfdump --debug-info --debug-types -r 0 %t.exe > %tlogOffsetNotEqual.txt
# RUN: llvm-dwarfdump --debug-info --debug-types -r 0 %t.bolt >> %tlogOffsetNotEqual.txt
# RUN: llvm-dwarfdump --debug-info --debug-types -r 0 --debug-line %t.bolt > %tlogCheckLineTable.txt
# RUN: cat %tlogOffsetNotEqual.txt | FileCheck --check-prefix=CHECK5 %s
# RUN: cat %tlogCheckLineTable.txt | FileCheck --check-prefix=CHECK6 %s
## Check offset gets modified.
# CHECK5: DW_TAG_compile_unit
# CHECK5: DW_TAG_type_unit
# CHECK5: DW_AT_stmt_list ([[OFFSET4:0x[0-9a-f]*]])
# CHECK5: DW_TAG_type_unit
# CHECK5: DW_AT_stmt_list ([[OFFSET4]])
# CHECK5: DW_TAG_compile_unit
# CHECK5: DW_AT_stmt_list ([[OFFSET4]])
# CHECK5: DW_TAG_type_unit
# CHECK5-NOT: DW_AT_stmt_list ([[OFFSET4]])
# CHECK5: DW_TAG_type_unit
# CHECK5-NOT: DW_AT_stmt_list ([[OFFSET4]])
# CHECK5: DW_TAG_compile_unit
# CHECK5: DW_TAG_compile_unit
# CHECK5-NOT: DW_AT_stmt_list ([[OFFSET4]])
# CHECK6: DW_TAG_type_unit
# CHECK6: DW_AT_stmt_list ([[OFFSET5:0x[0-9a-f]*]])
# CHECK6: DW_TAG_type_unit
# CHECK6: DW_AT_stmt_list ([[OFFSET5]])
# CHECK6: DW_TAG_compile_unit
# CHECK6: DW_TAG_compile_unit
# CHECK6: DW_AT_stmt_list ([[OFFSET5]])
# CHECK6: debug_line
# CHECK6: debug_line[[[OFFSET5]]]
# CHECK6-NOT: debug_line