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