1 ; This test checks to that DWARF v5 debug info can be correctly linked
2 ; into a dSYM bundle by dsymutil, with the correct section names and DWARF v5
3 ; headers for the different sections.
5 ; 1.o was produced with the source file:
8 ; __attribute__((section("1,__text_foo"))) void foo() {}
17 ; clang -g -c -O1 a.cpp -Xclang -gdwarf-5 -o 1.o
20 RUN: rm -rf %t.dir && mkdir -p %t.dir
21 RUN: dsymutil -y %p/dummy-debug-map-amr64.map -oso-prepend-path=%p/../Inputs/DWARF5 -o %t.dir/dwarf5-macho.dSYM
22 RUN: llvm-dwarfdump %t.dir/dwarf5-macho.dSYM -a --verbose | FileCheck %s
24 RUN: rm -rf %t.dir && mkdir -p %t.dir
25 RUN: dsymutil --linker parallel --no-odr -y %p/dummy-debug-map-amr64.map \
26 RUN: -oso-prepend-path=%p/../Inputs/DWARF5 -o %t.dir/dwarf5-macho.dSYM
27 RUN: llvm-dwarfdump %t.dir/dwarf5-macho.dSYM -a --verbose | FileCheck %s
29 ### Uncomment following when llvm-dwarfdump will print resolved address ranges
30 ### for the case mutiplue compile units.
31 COM: rm -rf %t.dir && mkdir -p %t.dir
32 COM: dsymutil --linker parallel -y %p/dummy-debug-map-amr64.map \
33 COM: -oso-prepend-path=%p/../Inputs/DWARF5 -o %t.dir/dwarf5-macho.dSYM
34 COM: llvm-dwarfdump %t.dir/dwarf5-macho.dSYM -a --verbose | FileCheck %s \
35 COM: --check-prefixes=CHECK,CHECK-LLVM
38 CHECK:.debug_abbrev contents:
39 CHECK-NEXT: Abbrev table for offset: 0x00000000
41 CHECK: .debug_info contents:
42 CHECK-LLVM: Compile Unit: length = 0x0000001f, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = {{.*}}, addr_size = 0x08
43 CHECK-LLVM: DW_TAG_compile_unit
44 CHECK-LLVM: DW_TAG_base_type
45 CHECK: Compile Unit: length = 0x0000004a, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = {{.*}}, addr_size = 0x08
46 CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x[[RANGELIST_OFFSET:[0-9a-f]+]]
47 CHECK-NEXT: [0x[[RANGELIST_OFFSET_START:[0-9a-f]+]], 0x[[RANGELIST_OFFSET_END:[0-9a-f]+]]))
48 CHECK-NEXT: DW_AT_addr_base [DW_FORM_sec_offset] (0x00000008)
49 CHECK: DW_TAG_subprogram
50 CHECK-NEXT: DW_AT_low_pc [DW_FORM_addrx] (indexed (00000000) address = 0x[[#%.16x,LOCLIST_LOWPC:]])
51 CHECK: DW_TAG_formal_parameter
52 CHECK-NEXT: DW_AT_location [DW_FORM_sec_offset] (0x[[LOC_OFFSET:[0-9a-f]+]]:
53 CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START:]], 0x[[#%.16x,LOCLIST_PAIR_END:]]): [[LOCLIST_EXPR:.*]]
54 CHECK-NEXT: [0x[[#%.16x,LOCLIST_PAIR_START2:]], 0x[[#%.16x,LOCLIST_PAIR_END2:]]): [[LOCLIST_EXPR2:.*]])
56 CHECK: .debug_loclists contents:
57 CHECK-NEXT: 0x00000000: locations list header: length = 0x00000018, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
58 CHECK-NEXT: 0x[[LOC_OFFSET]]:
59 CHECK-NEXT: DW_LLE_base_addressx (0x0000000000000000)
60 CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END,LOCLIST_LOWPC)]])
61 CHECK-NEXT: DW_LLE_offset_pair (0x[[#sub(LOCLIST_PAIR_START2,LOCLIST_LOWPC)]], 0x[[#sub(LOCLIST_PAIR_END2,LOCLIST_LOWPC)]])
62 CHECK-NEXT: DW_LLE_end_of_list ()
64 CHECK: .debug_line contents:
65 CHECK-NEXT: debug_line[0x00000000]
66 CHECK-NEXT: Line table prologue:
67 CHECK-NEXT: total_length: 0x0000005a
68 CHECK-NEXT: format: DWARF32
69 CHECK-NEXT: version: 5
70 CHECK-NEXT: address_size: 8
71 CHECK-NEXT: seg_select_size: 0
72 CHECK-NEXT: prologue_length: 0x00000037
73 CHECK-NEXT: min_inst_length: 1
74 CHECK-NEXT: max_ops_per_inst: 1
75 CHECK-NEXT: default_is_stmt: 1
76 CHECK-NEXT: line_base: -5
77 CHECK-NEXT: line_range: 14
78 CHECK-NEXT: opcode_base: 13
79 CHECK-NEXT: standard_opcode_lengths[DW_LNS_copy] = 0
80 CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_pc] = 1
81 CHECK-NEXT: standard_opcode_lengths[DW_LNS_advance_line] = 1
82 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_file] = 1
83 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_column] = 1
84 CHECK-NEXT: standard_opcode_lengths[DW_LNS_negate_stmt] = 0
85 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_basic_block] = 0
86 CHECK-NEXT: standard_opcode_lengths[DW_LNS_const_add_pc] = 0
87 CHECK-NEXT: standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1
88 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_prologue_end] = 0
89 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0
90 CHECK-NEXT: standard_opcode_lengths[DW_LNS_set_isa] = 1
91 CHECK-NEXT: include_directories[ 0] = .debug_line_str[0x00000000] = "/Users/shubham/Development/test109275485"
92 CHECK-NEXT: file_names[ 0]:
93 CHECK-NEXT: name: .debug_line_str[0x00000029] = "a.cpp"
94 CHECK-NEXT: dir_index: 0
95 CHECK-NEXT: md5_checksum: 2675ab7ce3623b564cfd8a2906a462e5
98 CHECK: .debug_str contents:
100 CHECK: .debug_line_str contents:
101 CHECK-NEXT: 0x00000000: "/Users/shubham/Development/test109275485"
102 CHECK-NEXT: 0x00000029: "a.cpp"
104 CHECK: .debug_rnglists contents:
105 CHECK-NEXT: 0x00000000: range list header: length = 0x0000000e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
107 CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_base_addressx]: 0x0000000000000000
108 CHECK-NEXT: 0x0000000e: [DW_RLE_offset_pair ]: {{.*}}[0x[[RANGELIST_OFFSET_START]], 0x[[RANGELIST_OFFSET_END]])
109 CHECK-NEXT: 0x00000011: [DW_RLE_end_of_list ]
111 CHECK: .debug_names contents:
112 CHECK-NEXT: Name Index @ 0x0 {
115 CHECK-NEXT: Format: DWARF32
116 CHECK-NEXT: Version: 5
117 CHECK-NEXT: CU count: 1
118 CHECK-NEXT: Local TU count: 0
119 CHECK-NEXT: Foreign TU count: 0
120 CHECK-NEXT: Bucket count: 3
121 CHECK-NEXT: Name count: 3
122 CHECK-NEXT: Abbreviations table size:
123 CHECK-NEXT: Augmentation: 'LLVM0700'