Skip to content

Commit 4c53f70

Browse files
authored
Merge pull request #3233 from apple/🍒/FBI/4da5a446f818cd979868d830eced9770a886a5b6
[lldb] Update crashlog.py to accept multiple results from mdfind
2 parents 0e70703 + e764347 commit 4c53f70

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lldb/examples/python/crashlog.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -293,18 +293,24 @@ def locate_module_and_debug_symbols(self):
293293
return False
294294
if not self.resolved_path and not os.path.exists(self.path):
295295
try:
296-
dsym = subprocess.check_output(
296+
mdfind_results = subprocess.check_output(
297297
["/usr/bin/mdfind",
298-
"com_apple_xcode_dsym_uuids == %s"%uuid_str]).decode("utf-8")[:-1]
299-
if dsym and os.path.exists(dsym):
300-
print(('falling back to binary inside "%s"'%dsym))
301-
self.symfile = dsym
298+
"com_apple_xcode_dsym_uuids == %s" % uuid_str]).decode("utf-8").splitlines()
299+
found_matching_slice = False
300+
for dsym in mdfind_results:
302301
dwarf_dir = os.path.join(dsym, 'Contents/Resources/DWARF')
302+
if not os.path.exists(dwarf_dir):
303+
# Not a dSYM bundle, probably an Xcode archive.
304+
continue
305+
print('falling back to binary inside "%s"' % dsym)
306+
self.symfile = dsym
303307
for filename in os.listdir(dwarf_dir):
304-
self.path = os.path.join(dwarf_dir, filename)
305-
if not self.find_matching_slice():
306-
return False
307-
break
308+
self.path = os.path.join(dwarf_dir, filename)
309+
if self.find_matching_slice():
310+
found_matching_slice = True
311+
break
312+
if found_matching_slice:
313+
break
308314
except:
309315
pass
310316
if (self.resolved_path and os.path.exists(self.resolved_path)) or (

0 commit comments

Comments
 (0)