xref: /llvm-project/bolt/test/X86/dwarf4-types.test (revision 11791ae7b0b05b8bd8d806331ff51da618912cf8)
1# REQUIRES: system-linux
2
3# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-types-main.s -o %tmain.o
4# RUN: llvm-mc -dwarf-version=4 -filetype=obj -triple x86_64-unknown-linux %p/Inputs/dwarf4-types-helper.s -o %thelper.o
5# RUN: %clang %cflags %tmain.o %thelper.o -o %t.exe -Wl,-q
6# RUN: llvm-bolt %t.exe -o %t.bolt --update-debug-sections
7# RUN: llvm-dwarfdump --show-form --verbose --debug-info %t.bolt | FileCheck --check-prefix=POSTCHECK %s
8# RUN: llvm-dwarfdump --show-form --verbose --debug-types %t.bolt | FileCheck --check-prefix=POSTCHECKTU %s
9
10## Check BOLT handles DWARF4/5 with fdebug-types.
11
12# POSTCHECK: version = 0x0004
13# POSTCHECK: DW_TAG_compile_unit [6]
14# POSTCHECK: DW_TAG_subprogram [7]
15# POSTCHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x007c => {0x0000007c} "int")
16# POSTCHECK: DW_TAG_formal_parameter [8]
17# POSTCHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x007c => {0x0000007c} "int")
18# POSTCHECK: DW_TAG_formal_parameter [8]
19# POSTCHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0083 => {0x00000083} "char **")
20# POSTCHECK: DW_TAG_variable [9]
21# POSTCHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0094 => {0x00000094} "Foo")
22# POSTCHECK: DW_TAG_base_type [5]
23# POSTCHECK: DW_TAG_pointer_type [4]
24
25# POSTCHECK: version = 0x0004
26# POSTCHECK: DW_TAG_compile_unit [6]
27# POSTCHECK: DW_TAG_subprogram [11]
28# POSTCHECK: DW_TAG_variable [9]
29# POSTCHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x006b => {0x00000112} "Foo2a")
30# POSTCHECK: DW_TAG_variable [9]
31# POSTCHECK: DW_AT_type [DW_FORM_ref4] (cu + 0x0074 => {0x0000011b} "Foo3")
32# POSTCHECK: DW_TAG_base_type [5]
33# POSTCHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]+}}] = "int")
34# POSTCHECK: DW_TAG_structure_type [10]
35# POSTCHECK: DW_AT_signature [DW_FORM_ref_sig8]  (0x104ec427d2ebea6f)
36# POSTCHECK: DW_TAG_structure_type [10]
37# POSTCHECK: DW_AT_signature [DW_FORM_ref_sig8]  (0xb4580bc1535df1e4)
38
39# POSTCHECKTU: version = 0x0004
40# POSTCHECKTU-SAME: type_signature = 0x675d23e4f33235f2
41# POSTCHECKTU-SAME: type_offset = 0x001e
42# POSTCHECKTU: DW_TAG_type_unit [1]
43# POSTCHECKTU: DW_TAG_member [3]
44# POSTCHECKTU: DW_AT_type [DW_FORM_ref4] (cu + 0x004c => {0x0000004c} "char *")
45# POSTCHECKTU: DW_TAG_member [3]
46# POSTCHECKTU: DW_AT_type [DW_FORM_ref4] (cu + 0x004c => {0x0000004c} "char *")
47# POSTCHECKTU: DW_TAG_pointer_type [4]
48# POSTCHECKTU-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0051 => {0x00000051} "char")
49# POSTCHECKTU: DW_TAG_base_type [5]
50# POSTCHECKTU: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]+}}] = "char")
51
52# POSTCHECKTU: version = 0x0004
53# POSTCHECKTU-SAME: type_signature = 0x49dc260088be7e56
54# POSTCHECKTU-SAME: type_offset = 0x001e
55# POSTCHECKTU: DW_TAG_type_unit [1]
56# POSTCHECKTU: DW_TAG_structure_type [2]
57# POSTCHECKTU: DW_TAG_member [3]
58# POSTCHECKTU: DW_AT_type [DW_FORM_ref4] (cu + 0x0040 => {0x00000099} "char *")
59# POSTCHECKTU: DW_TAG_member [3]
60# POSTCHECKTU: DW_AT_type [DW_FORM_ref4] (cu + 0x0040 => {0x00000099} "char *")
61# POSTCHECKTU: DW_TAG_pointer_type [4]
62# POSTCHECKTU-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x0045 => {0x0000009e} "char")
63# POSTCHECKTU: DW_TAG_base_type [5]
64# POSTCHECKTU-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[0x{{[0-9a-f]+}}] = "char")
65