1 REQUIRES: system-darwin
3 RUN: dsymutil --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
4 RUN: | llvm-dwarfdump -v - \
7 RUN: dsymutil --accelerator=Pub --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
8 RUN: | llvm-dwarfdump -v - \
9 RUN: | FileCheck --check-prefix=PUB %s
11 RUN: dsymutil --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
12 RUN: | llvm-dwarfdump -v - \
13 RUN: | FileCheck --check-prefix=NOHIDDEN %s
15 RUN: dsymutil --symbol-map %p/../Inputs/obfuscated.2.map %p/../Inputs/obfuscated.2.arm64 -f -o - \
16 RUN: | llvm-dwarfdump -v - \
17 RUN: | FileCheck --check-prefix=NOHIDDEN %s
19 // Run with plist and make sure dsymutil finds it.
20 RUN: mkdir -p %t.dSYM/Contents/Resources/DWARF/
21 RUN: mkdir -p %t.mapdir
22 RUN: cp %p/../Inputs/obfuscated.arm64 %t.dSYM/Contents/Resources/DWARF/
23 RUN: cp %p/../Inputs/E828A486-8433-3A5E-B6DB-A6294D28133D.plist %t.dSYM/Contents/Resources/
24 RUN: cp %p/../Inputs/obfuscated.map %t.mapdir/506AA50A-6B26-3B37-86D2-DC6EBD57B720.bcsymbolmap
25 RUN: dsymutil --symbol-map %t.mapdir %t.dSYM 2>&1 | FileCheck --check-prefix=OBFUSCATING %s
27 // Run without plist and make sure dsymutil doesn't crash.
28 RUN: rm %t.dSYM/Contents/Resources/E828A486-8433-3A5E-B6DB-A6294D28133D.plist
29 RUN: dsymutil --symbol-map %t.mapdir %t.dSYM 2>&1 | FileCheck --check-prefix=NOTOBFUSCATING %s
31 // ----------------------------------------
32 // Repeat the same steps for --linker llvm.
33 RUN: dsymutil --linker llvm --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
34 RUN: | llvm-dwarfdump -v - \
37 RUN: dsymutil --linker llvm --accelerator=Pub --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
38 RUN: | llvm-dwarfdump -v - \
39 RUN: | FileCheck --check-prefix=PUB %s
41 RUN: dsymutil --linker llvm --symbol-map %p/../Inputs/obfuscated.map %p/../Inputs/obfuscated.arm64 -f -o - \
42 RUN: | llvm-dwarfdump -v - \
43 RUN: | FileCheck --check-prefix=NOHIDDEN %s
45 RUN: dsymutil --linker llvm --symbol-map %p/../Inputs/obfuscated.2.map %p/../Inputs/obfuscated.2.arm64 -f -o - \
46 RUN: | llvm-dwarfdump -v - \
47 RUN: | FileCheck --check-prefix=NOHIDDEN %s
49 // Run with plist and make sure dsymutil finds it.
50 RUN: mkdir -p %t.dSYM/Contents/Resources/DWARF/
51 RUN: mkdir -p %t.mapdir
52 RUN: cp %p/../Inputs/obfuscated.arm64 %t.dSYM/Contents/Resources/DWARF/
53 RUN: cp %p/../Inputs/E828A486-8433-3A5E-B6DB-A6294D28133D.plist %t.dSYM/Contents/Resources/
54 RUN: cp %p/../Inputs/obfuscated.map %t.mapdir/506AA50A-6B26-3B37-86D2-DC6EBD57B720.bcsymbolmap
55 RUN: dsymutil --linker llvm --symbol-map %t.mapdir %t.dSYM 2>&1 | FileCheck --check-prefix=OBFUSCATING %s
57 // Run without plist and make sure dsymutil doesn't crash.
58 RUN: rm %t.dSYM/Contents/Resources/E828A486-8433-3A5E-B6DB-A6294D28133D.plist
59 RUN: dsymutil --linker llvm --symbol-map %t.mapdir %t.dSYM 2>&1 | FileCheck --check-prefix=NOTOBFUSCATING %s
61 OBFUSCATING-NOT: not unobfuscating
63 NOTOBFUSCATING: not unobfuscating
65 NOHIDDEN-NOT: __hidden#
67 CHECK: .debug_info contents:
69 CHECK: DW_TAG_compile_unit [1] *
70 CHECK: DW_AT_producer [DW_FORM_strp] ( {{.*}} "Apple LLVM version 7.0.0 (clang-700.2.38.2)")
71 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "main.c")
72 CHECK: DW_AT_comp_dir [DW_FORM_strp] ( {{.*}} "/Users/steven/dev/alpena/tests/src")
73 CHECK: DW_TAG_subprogram [2]
74 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "main")
76 CHECK: DW_TAG_compile_unit [1] *
77 CHECK: DW_AT_producer [DW_FORM_strp] ( {{.*}} "Apple LLVM version 7.0.0 (clang-700.2.38.2)")
78 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "one.c")
79 CHECK: DW_AT_comp_dir [DW_FORM_strp] ( {{.*}} "/Users/steven/dev/alpena/tests/src")
80 CHECK: DW_TAG_subprogram [2]
81 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "one")
83 CHECK: DW_TAG_compile_unit [1] *
84 CHECK: DW_AT_producer [DW_FORM_strp] ( {{.*}} "Apple LLVM version 7.0.0 (clang-700.2.38.2)")
85 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "two.c")
86 CHECK: DW_AT_comp_dir [DW_FORM_strp] ( {{.*}} "/Users/steven/dev/alpena/tests/src")
87 CHECK: DW_TAG_subprogram [2]
88 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "two")
90 CHECK: DW_TAG_compile_unit [1] *
91 CHECK: DW_AT_producer [DW_FORM_strp] ( {{.*}} "Apple LLVM version 7.0.0 (clang-700.2.38.2)")
92 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "three.c")
93 CHECK: DW_AT_comp_dir [DW_FORM_strp] ( {{.*}} "/Users/steven/dev/alpena/tests/src")
94 CHECK: DW_TAG_subprogram [2]
95 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "three")
97 CHECK: DW_TAG_compile_unit [1] *
98 CHECK: DW_AT_producer [DW_FORM_strp] ( {{.*}} "Apple LLVM version 7.0.0 (clang-700.2.38.2)")
99 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "four.c")
100 CHECK: DW_AT_stmt_list [DW_FORM_data4] (0x0000011e)
101 CHECK: DW_AT_comp_dir [DW_FORM_strp] ( {{.*}} "/Users/steven/dev/alpena/tests/src")
102 CHECK: DW_TAG_subprogram [2]
103 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "four")
105 CHECK: DW_TAG_compile_unit [1] *
106 CHECK: DW_AT_producer [DW_FORM_strp] ( {{.*}} "Apple LLVM version 7.0.0 (clang-700.2.38.2)")
107 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "five.c")
108 CHECK: DW_AT_comp_dir [DW_FORM_strp] ( {{.*}} "/Users/steven/dev/alpena/tests/src")
109 CHECK: DW_TAG_subprogram [2]
110 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "five")
112 CHECK: DW_TAG_compile_unit [1] *
113 CHECK: DW_AT_producer [DW_FORM_strp] ( {{.*}} "Apple LLVM version 7.0.0 (clang-700.2.38.2)")
114 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "six.c")
115 CHECK: DW_AT_comp_dir [DW_FORM_strp] ( {{.*}} "/Users/steven/dev/alpena/tests/src")
116 CHECK: DW_TAG_subprogram [2]
117 CHECK: DW_AT_name [DW_FORM_strp] ( {{.*}} "six")
119 CHECK: .debug_line contents:
120 CHECK: file_names[ 1]:
121 CHECK: name: "main.c"
123 CHECK: mod_time: 0x00000000
124 CHECK: file_names[ 1]:
127 CHECK: mod_time: 0x00000000
128 CHECK: length: 0x00000000
129 CHECK: file_names[ 1]:
132 CHECK: mod_time: 0x00000000
133 CHECK: length: 0x00000000
134 CHECK: file_names[ 1]:
135 CHECK: name: "three.c"
137 CHECK: mod_time: 0x00000000
138 CHECK: length: 0x00000000
139 CHECK: file_names[ 1]:
140 CHECK: name: "four.c"
142 CHECK: mod_time: 0x00000000
143 CHECK: length: 0x00000000
144 CHECK: file_names[ 1]:
145 CHECK: name: "five.c"
147 CHECK: mod_time: 0x00000000
148 CHECK: length: 0x00000000
149 CHECK: file_names[ 1]:
152 CHECK: mod_time: 0x00000000
153 CHECK: length: 0x00000000
155 PUB: .debug_pubnames contents:
156 PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000000, unit_size = 0x00000044
157 PUB: 0x0000002e "main"
158 PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000044, unit_size = 0x00000044
159 PUB: 0x0000002e "one"
160 PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000088, unit_size = 0x00000044
161 PUB: 0x0000002e "two"
162 PUB: length = 0x00000018, format = DWARF32, version = 0x0002, unit_offset = 0x000000cc, unit_size = 0x00000044
163 PUB: 0x0000002e "three"
164 PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000110, unit_size = 0x00000044
165 PUB: 0x0000002e "four"
166 PUB: length = 0x00000017, format = DWARF32, version = 0x0002, unit_offset = 0x00000154, unit_size = 0x00000044
167 PUB: 0x0000002e "five"
168 PUB: length = 0x00000016, format = DWARF32, version = 0x0002, unit_offset = 0x00000198, unit_size = 0x00000044
169 PUB: 0x0000002e "six"
171 CHECK: .apple_names contents:
173 CHECK: String: 0x00000091 "five"
175 CHECK-NEXT: Atom[0]: 0x00000182
177 CHECK: String: 0x0000009c "six"
179 CHECK-NEXT: Atom[0]: 0x000001c6
181 CHECK: String: 0x00000078 "three"
183 CHECK-NEXT: Atom[0]: 0x000000fa
185 CHECK: String: 0x0000006c "two"
187 CHECK-NEXT: Atom[0]: 0x000000b6
189 CHECK: String: 0x00000057 "main"
191 CHECK-NEXT: Atom[0]: 0x0000002e
193 CHECK: String: 0x00000085 "four"
195 CHECK-NEXT: Atom[0]: 0x0000013e
197 CHECK: String: 0x00000062 "one"
199 CHECK-NEXT: Atom[0]: 0x00000072