237 lines · plain
1; This test checks to ensure that if a DWARF v5 and DWARF v4 object file is used to2; generate a dsym, dsymutil correctly outputs the debug information, by keeping3; the DWARF v5 and DWARF v4 debug info distinct, and that all the section headers4; have the correct format.5 6; 1.o was produced with the source file:7 8; a.cpp9; __attribute__((section("1,__text_foo"))) void foo() {}10;11; int foo2(int a) {12; return a+5;13; }14; int main () {15; return 1;16; }17 18; clang -g -c -O1 a.cpp -Xclang -gdwarf-5 -o 1.o19 20; 2.o was produced with the following source file:21 22; b.cpp23; __attribute__((section("1,__text_foo2"))) void foo2() {}24;25; int bar(int x) {26; int y = x + 2;27; return y;28; }29 30; clang -g -c -O1 b.cpp -gdwarf-4 -o 2.o31 32RUN: rm -rf %t.dir && mkdir -p %t.dir33RUN: dsymutil -y %p/dummy-debug-map-arm64.map -oso-prepend-path=%p/../Inputs/DWARF5-DWARF4-combination -o %t.dir/dwarf5-dwarf4-combination-macho.dSYM34RUN: llvm-dwarfdump %t.dir/dwarf5-dwarf4-combination-macho.dSYM -a --verbose | FileCheck %s --check-prefixes=CHECK,WITH-PARENTS35 36RUN: rm -rf %t.dir && mkdir -p %t.dir37RUN: dsymutil --no-odr --linker parallel -y %p/dummy-debug-map-arm64.map \38RUN: -oso-prepend-path=%p/../Inputs/DWARF5-DWARF4-combination \39RUN: -o %t.dir/dwarf5-dwarf4-combination-macho.dSYM40RUN: llvm-dwarfdump %t.dir/dwarf5-dwarf4-combination-macho.dSYM \41RUN: -a --verbose | FileCheck %s --check-prefixes=CHECK,NO-PARENTS42 43### Uncomment following when llvm-dwarfdump will dump address ranges44### correctly for severall compile units case.45COM: rm -rf %t.dir && mkdir -p %t.dir46COM: dsymutil --linker parallel -y %p/dummy-debug-map-arm64.map \47COM: -oso-prepend-path=%p/../Inputs/DWARF5-DWARF4-combination \48COM: -o %t.dir/dwarf5-dwarf4-combination-macho.dSYM49COM: llvm-dwarfdump %t.dir/dwarf5-dwarf4-combination-macho.dSYM \50COM: -a --verbose | FileCheck %s --check-prefixes=CHECK,CHECK-LLVM51 52 53CHECK:.debug_abbrev contents:54CHECK-NEXT: Abbrev table for offset: 0x0000000055 56CHECK: .debug_info contents:57CHECK-LLVM: Compile Unit: length = 0x0000001f, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = {{.*}}, addr_size = 0x0858CHECK-LLVM: DW_TAG_compile_unit59CHECK-LLVM: DW_TAG_base_type60 61CHECK: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = {{.*}}, addr_size = 0x0862CHECK: DW_AT_producer [DW_FORM_strx] (indexed (00000000) string = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")63CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000001) string = "a.cpp")64CHECK: DW_AT_LLVM_sysroot [DW_FORM_strx] (indexed (00000002) string = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")65CHECK: DW_AT_APPLE_sdk [DW_FORM_strx] (indexed (00000003) string = "MacOSX.sdk")66CHECK: DW_AT_str_offsets_base [DW_FORM_sec_offset] (0x00000008)67CHECK: DW_AT_comp_dir [DW_FORM_strx] (indexed (00000004) string = "/Users/shubham/Development/test109275485")68CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]]69CHECK-NEXT: [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]]))70CHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)71CHECK: DW_TAG_subprogram72CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]])73CHECK: DW_AT_linkage_name [DW_FORM_strx] (indexed (00000005) string = "_Z4foo2i")74CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000006) string = "foo2")75CHECK: DW_TAG_formal_parameter76CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOCLIST_OFFSET:[0-9a-f]+]]:77CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]]78CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]])79CHECK: DW_AT_name [DW_FORM_strx] (indexed (00000007) string = "a")80 81CHECK: Compile Unit: length = 0x00000072, format = DWARF32, version = 0x0004, abbr_offset = {{.*}}, addr_size = 0x0882CHECK: DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000001] = "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")83CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000e0] = "b.cpp")84CHECK: DW_AT_LLVM_sysroot [DW_FORM_strp] ( .debug_str[0x00000039] = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk")85CHECK: DW_AT_APPLE_sdk [DW_FORM_strp] ( .debug_str[0x00000098] = "MacOSX.sdk")86CHECK-NOT: DW_AT_str_offsets_base87CHECK: DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x000000a3] = "/Users/shubham/Development/test109275485")88CHECK: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,RANGE_LOWPC:]])89CHECK-NEXT: DW_AT_ranges [DW_FORM_sec_offset] (0x0000000090CHECK-NEXT: [0x[[#%.16x,RANGE_START:]], 0x[[#%.16x,RANGE_END:]]))91CHECK: DW_TAG_subprogram92CHECK-NEXT: DW_AT_low_pc [DW_FORM_addr] (0x[[#%.16x,LOC_LOWPC:]])93CHECK: DW_AT_linkage_name [DW_FORM_strp] ( .debug_str[0x000000e6] = "_Z3bari")94CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000ee] = "bar")95CHECK: DW_TAG_formal_parameter96CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:97CHECK-NEXT: [0x[[#%.16x,LOC_PAIR_START:]], 0x[[#%.16x,LOC_PAIR_END:]]): [[LOC_EXPR:.*]]98CHECK-NEXT: [0x[[#%.16x,LOC_PAIR_START2:]], 0x[[#%.16x,LOC_PAIR_END2:]]): [[LOC_EXPR2:.*]])99CHECK: DW_AT_name [DW_FORM_strp] ( .debug_str[0x000000f2] = "x")100 101CHECK: .debug_loc contents:102CHECK-NEXT: 0x[[LOC_OFFSET]]:103CHECK-NEXT: (0x[[#sub(LOC_PAIR_START,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR_END,LOC_LOWPC)]]): [[LOC_EXPR:.*]]104CHECK-NEXT: (0x[[#sub(LOC_PAIR_START2,LOC_LOWPC)]], 0x[[#sub(LOC_PAIR_END2,LOC_LOWPC)]]): [[LOC_EXPR2:.*]]105 106CHECK: .debug_loclists contents:107CHECK-NEXT: 0x00000000: locations list header: length = 0x00000018, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000108CHECK-NEXT: 0x[[LOCLIST_OFFSET]]:109CHECK-NEXT: DW_LLE_base_addressx (0x0000000000000000)110CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END,LOCLIST_LOWPC)]])111CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START2,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END2,LOCLIST_LOWPC)]])112CHECK-NEXT: DW_LLE_end_of_list ()113 114CHECK: .debug_line contents:115CHECK-NEXT: debug_line[0x00000000]116CHECK-NEXT: Line table prologue:117CHECK-NEXT: total_length: 0x0000005a118CHECK-NEXT: format: DWARF32119CHECK-NEXT: version: 5120CHECK-NEXT: address_size: 8121CHECK-NEXT: seg_select_size: 0122CHECK-NEXT: prologue_length: 0x00000037123CHECK-NEXT: min_inst_length: 1124CHECK-NEXT: max_ops_per_inst: 1125CHECK-NEXT: default_is_stmt: 1126CHECK-NEXT: line_base: -5127CHECK-NEXT: line_range: 14128CHECK-NEXT: opcode_base: 13129CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0130CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1131CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1132CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1133CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1134CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0135CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0136CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0137CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1138CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0139CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0140CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1141CHECK-NEXT: include_directories[ 0] = .debug_line_str[0x00000000] = "/Users/shubham/Development/test109275485"142CHECK-NEXT: file_names[ 0]:143CHECK-NEXT: name: .debug_line_str[0x00000029] = "a.cpp"144CHECK-NEXT: dir_index: 0145 146CHECK: debug_line[0x0000005e]147CHECK-NEXT: Line table prologue:148CHECK-NEXT: total_length: 0x0000003b149CHECK-NEXT: format: DWARF32150CHECK-NEXT: version: 4151CHECK-NEXT: prologue_length: 0x0000001d152CHECK-NEXT: min_inst_length: 1153CHECK-NEXT: max_ops_per_inst: 1154CHECK-NEXT: default_is_stmt: 1155CHECK-NEXT: line_base: -5156CHECK-NEXT: line_range: 14157CHECK-NEXT: opcode_base: 13158CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0159CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1160CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1161CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1162CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1163CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0164CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0165CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0166CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1167CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0168CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0169CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1170CHECK-NEXT: file_names[ 1]:171CHECK-NEXT: name: "b.cpp"172CHECK-NEXT: dir_index: 0173CHECK-NEXT: mod_time: 0x00000000174CHECK-NEXT: length: 0x00000000175 176CHECK: .debug_str contents:177CHECK-NEXT: 0x00000000: ""178CHECK-NEXT: 0x00000001: "Apple clang version 14.0.3 (clang-1403.0.22.14.1)"179CHECK-NEXT: 0x00000033: "a.cpp"180CHECK-NEXT: 0x00000039: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"181CHECK-NEXT: 0x00000098: "MacOSX.sdk"182CHECK-NEXT: 0x000000a3: "/Users/shubham/Development/test109275485"183CHECK-NEXT: 0x000000cc: "_Z4foo2i"184CHECK-NEXT: 0x000000d5: "foo2"185CHECK-NEXT: 0x000000da: "a"186CHECK-NEXT: 0x000000dc: "int"187CHECK-NEXT: 0x000000e0: "b.cpp"188CHECK-NEXT: 0x000000e6: "_Z3bari"189CHECK-NEXT: 0x000000ee: "bar"190CHECK-NEXT: 0x000000f2: "x"191CHECK-NEXT: 0x000000f4: "y"192 193CHECK: .debug_line_str contents:194CHECK-NEXT: 0x00000000: "/Users/shubham/Development/test109275485"195CHECK-NEXT: 0x00000029: "a.cpp"196 197CHECK: .debug_ranges contents:198CHECK-NEXT: 00000000 [[#sub(RANGE_START,RANGE_LOWPC)]] [[#sub(RANGE_END,RANGE_LOWPC)]]199 200CHECK: .debug_rnglists contents:201CHECK-NEXT: 0x00000000: range list header: length = 0x0000000e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000202CHECK-NEXT: ranges:203CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_base_addressx]: 0x0000000000000000204CHECK-NEXT: 0x0000000e: [DW_RLE_offset_pair ]: {{.*}}[0x[[RANGELIST_OFFSET_START]], 0x[[RANGELIST_OFFSET_END]])205CHECK-NEXT: 0x00000011: [DW_RLE_end_of_list ]206 207CHECK: .debug_str_offsets contents:208CHECK-NEXT: 0x00000000: Contribution size = 40, Format = DWARF32, Version = 5209CHECK-NEXT: 0x00000008: 00000001 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)"210CHECK-NEXT: 0x0000000c: 00000033 "a.cpp"211CHECK-NEXT: 0x00000010: 00000039 "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"212CHECK-NEXT: 0x00000014: 00000098 "MacOSX.sdk"213CHECK-NEXT: 0x00000018: 000000a3 "/Users/shubham/Development/test109275485"214CHECK-NEXT: 0x0000001c: 000000cc "_Z4foo2i"215CHECK-NEXT: 0x00000020: 000000d5 "foo2"216CHECK-NEXT: 0x00000024: 000000da "a"217CHECK-NEXT: 0x00000028: 000000dc "int"218 219CHECK: .debug_names contents:220CHECK-NEXT: Name Index @ 0x0 {221CHECK-NEXT: Header {222; FIXME: when the parallel dwarf linker is able to generate DW_IDX_parent,223; these headers should be the same.224WITH-PARENTS-NEXT: Length: 0xC0225NO-PARENTS-NEXT: Length: 0xBC226CHECK-NEXT: Format: DWARF32227CHECK-NEXT: Version: 5228CHECK-NEXT: CU count: 2229CHECK-NEXT: Local TU count: 0230CHECK-NEXT: Foreign TU count: 0231CHECK-NEXT: Bucket count: 5232CHECK-NEXT: Name count: 5233WITH-PARENTS-NEXT: Abbreviations table size: 0x15234NO-PARENTS-NEXT: Abbreviations table size: 0x11235CHECK-NEXT: Augmentation: 'LLVM0700'236CHECK-NEXT: }237