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