962e270a594e259f94874d1f4929b41734f920a6
[oota-llvm.git] / test / tools / llvm-dwp / X86 / simple.test
1 RUN: llvm-dwp %p/../Inputs/simple/a.dwo %p/../Inputs/simple/b.dwo -o %t
2 RUN: llvm-dwarfdump %t | FileCheck --check-prefix=CHECK --check-prefix=NOTYP %s
3 RUN: llvm-objdump -h %t | FileCheck --check-prefix=NOTYPOBJ %s
4 RUN: llvm-dwp %p/../Inputs/type_units/a.dwo %p/../Inputs/type_units/b.dwo -o %t
5 RUN: llvm-dwarfdump %t | FileCheck --check-prefix=CHECK --check-prefix=TYPES %s
6
7 FIXME: For some reason, piping straight from llvm-dwp to llvm-dwarfdump doesn't behave well - looks like dwarfdump is reading/closes before dwp has finished.
8
9 DWP from non-type-unit debug info for these two translation units:
10 a.cpp:
11   struct foo { };
12   foo a;
13
14 b.cpp:
15   struct bar { };
16   void b(bar) {
17   }
18
19 CHECK-LABEL: .debug_abbrev.dwo contents:
20 CHECK-LABEL: Abbrev table for offset:
21 CHECK: 0x0000[[AAOFF:.*]]
22 CHECK: DW_TAG_compile_unit
23 CHECK: DW_TAG_variable
24 CHECK: DW_TAG_structure_type
25 CHECK-LABEL: Abbrev table for offset:
26 CHECK: 0x0000[[BAOFF:.*]]
27 CHECK: DW_TAG_compile_unit
28 CHECK: DW_TAG_structure_type
29 CHECK: DW_TAG_subprogram
30 CHECK: DW_TAG_formal_parameter
31
32 CHECK: .debug_info.dwo contents:
33 CHECK: [[AOFF:0x[0-9a-f]*]]:
34 CHECK-LABEL: Compile Unit: length = {{.*}} version = 0x0004 abbr_offset =
35 CHECK:         0x[[AAOFF]] addr_size = 0x08 (next unit at [[BOFF:.*]])
36 CHECK: DW_TAG_compile_unit
37 CHECK:   DW_AT_name {{.*}} "a.cpp"
38 CHECK:   DW_AT_GNU_dwo_id {{.*}} ([[DWOA:.*]])
39 CHECK:   DW_TAG_variable
40 CHECK:     DW_AT_name {{.*}} "a"
41 CHECK:   DW_TAG_structure_type
42 NOTYP:     DW_AT_name {{.*}} "foo"
43 TYPES:     DW_AT_signature {{.*}} ([[FOOSIG:.*]])
44
45 CHECK: [[BOFF]]:
46 CHECK-LABEL: Compile Unit: length = {{.*}} version = 0x0004 abbr_offset =
47 CHECK:         0x[[BAOFF]] addr_size = 0x08 (next unit at [[XOFF:.*]])
48 CHECK:   DW_AT_name {{.*}} "b.cpp"
49 CHECK:   DW_AT_GNU_dwo_id {{.*}} ([[DWOB:.*]])
50 CHECK:   DW_TAG_structure_type
51 NOTYP:     DW_AT_name {{.*}} "bar"
52 TYPES:     DW_AT_signature {{.*}} ([[BARSIG:.*]])
53 CHECK:   DW_TAG_subprogram
54 CHECK:     DW_AT_name {{.*}} "b"
55 CHECK:     DW_TAG_formal_parameter
56
57 NOTYP-NOT: .debug_types.dwo contents:
58 TYPES-LABEL: .debug_types.dwo contents:
59 TYPES: [[FOOUOFF:0x[0-9a-f]*]]:
60 TYPES-LABEL: Type Unit: length = 0x00000020 version = 0x0004 abbr_offset =
61 TYPES:         0x[[AAOFF]] addr_size = 0x08 type_signature = [[FOOSIG]] type_offset = 0x[[FOOOFF:.*]] (next unit at [[BARUOFF:.*]])
62 TYPES:             DW_TAG_type_unit
63 TYPES: [[FOOOFF]]:   DW_TAG_structure_type
64 TYPES:                 DW_AT_name {{.*}} "foo"
65 TYPES: [[BARUOFF]]:
66 TYPES-LABEL: Type Unit: length = 0x00000020 version = 0x0004 abbr_offset =
67 TYPES:         0x[[BAOFF]] addr_size = 0x08 type_signature = [[BARSIG]] type_offset = 0x001e (next unit at [[XUOFF:.*]])
68 TYPES:             DW_TAG_type_unit
69 TYPES: 0x00000042:   DW_TAG_structure_type
70 TYPES:                 DW_AT_name {{.*}} "bar"
71
72 CHECK-LABEL: .debug_cu_index contents:
73 CHECK: Index Signature INFO                      ABBREV                             LINE                     STR_OFFSETS
74 TYPES:     1 [[DWOA]]  {{\[}}[[AOFF]], [[BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x0000001a) [0x00000000, 0x00000010)
75 TYPES:     3 [[DWOB]]  {{\[}}[[BOFF]], [[XOFF]]) [0x0000[[BAOFF]], 0x00000099)      [0x0000001a, 0x00000034) [0x00000010, 0x00000024)
76 NOTYP:     3 [[DWOA]]  {{\[}}[[AOFF]], [[BOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x00000011) [0x00000000, 0x00000010)
77 NOTYP:     4 [[DWOB]]  {{\[}}[[BOFF]], [[XOFF]]) [0x0000[[BAOFF]], 0x00000075)      [0x00000011, 0x00000022) [0x00000010, 0x00000024)
78
79 CHECK-LABEL: .debug_tu_index contents:
80 NOTYP-NOT: Index
81 TYPES: Index Signature  TYPES                           ABBREV                             LINE                     STR_OFFSETS
82 TYPES:     1 [[FOOSIG]] {{\[}}[[FOOUOFF]], [[BARUOFF]]) [0x0000[[AAOFF]], 0x0000[[BAOFF]]) [0x00000000, 0x0000001a) [0x00000000, 0x00000010)
83 TYPES:     4 [[BARSIG]] {{\[}}[[BARUOFF]], [[XUOFF]])   [0x0000[[BAOFF]], 0x00000099)      [0x0000001a, 0x00000034) [0x00000010, 0x00000024)
84
85 Ensure we do not create a debug_tu_index, even an empty or malformed one.
86 NOTYPOBJ-NOT: .debug_tu_index
87
88 CHECK-LABEL: .debug_str.dwo contents:
89 CHECK: "clang version
90 CHECK: 0x[[ACPP:.*]]: "a.cpp"
91 CHECK-NOT: "clang version
92 CHECK: 0x[[BCPP:.*]]: "b.cpp"
93
94 CHECK-LABEL: .debug_str_offsets.dwo contents:
95 CHECK: : 00000000
96 CHECK: : [[ACPP]]
97 CHECK: : 00000000
98 CHECK: : [[BCPP]]