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