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 llvm --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 llvm -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: 0x00000048
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: 0x00000025
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
97 CHECK: .debug_str contents:
99 CHECK: .debug_line_str contents:
100 CHECK-NEXT: 0x00000000: "/Users/shubham/Development/test109275485"
101 CHECK-NEXT: 0x00000029: "a.cpp"
103 CHECK: .debug_rnglists contents:
104 CHECK-NEXT: 0x00000000: range list header: length = 0x0000000e, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x00000000
106 CHECK-NEXT: [[RANGELIST_OFFSET]]: [DW_RLE_base_addressx]: 0x0000000000000000
107 CHECK-NEXT: 0x0000000e: [DW_RLE_offset_pair ]: {{.*}}[0x[[RANGELIST_OFFSET_START]], 0x[[RANGELIST_OFFSET_END]])
108 CHECK-NEXT: 0x00000011: [DW_RLE_end_of_list ]
110 CHECK: .debug_names contents:
111 CHECK-NEX:T Name Index @ 0x0 {
113 CHECK-NEX:T Length: 0x7C
114 CHECK-NEX:T Format: DWARF32
115 CHECK-NEX:T Version: 5
116 CHECK-NEX:T CU count: 1
117 CHECK-NEX:T Local TU count: 0
118 CHECK-NEX:T Foreign TU count: 0
119 CHECK-NEX:T Bucket count: 3
120 CHECK-NEX:T Name count: 3
121 CHECK-NEX:T Abbreviations table size: 0xD
122 CHECK-NEX:T Augmentation: 'LLVM0700'