Skip to content

Commit 3a5637b

Browse files
committed
[lldb] Have crashlog warn when remapped paths are inaccessible.
It can be tricky to troubleshoot why the crashlog script can't show inline sources. The two most common causes are that we couldn't find the dSYM or, if we find the dSYM, that the path remapping included in the dSYMForUUID output isn't accessible. The former is already easy to diagnose, but the latter is harder because you'd have to manually invoke dsymForUUID on the UUID and check the remapped path. This patch automates that process and prints a warning if the remapped path doesn't exist or is not accessible. Differential revision: https://reviews.llvm.org/D152886 (cherry picked from commit 7371ec7)
1 parent a467c38 commit 3a5637b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lldb/examples/python/crashlog.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,8 @@ def locate_module_and_debug_symbols(self):
305305
if self.show_symbol_progress():
306306
with print_lock:
307307
print("Getting symbols for %s %s..." % (uuid_str, self.path))
308+
# Keep track of unresolved source paths.
309+
unavailable_source_paths = set()
308310
if os.path.exists(self.dsymForUUIDBinary):
309311
dsym_for_uuid_command = "%s %s" % (self.dsymForUUIDBinary, uuid_str)
310312
s = subprocess.check_output(dsym_for_uuid_command, shell=True)
@@ -334,6 +336,12 @@ def locate_module_and_debug_symbols(self):
334336
plist["DBGSymbolRichExecutable"]
335337
)
336338
self.resolved_path = self.path
339+
if "DBGSourcePathRemapping" in plist:
340+
path_remapping = plist["DBGSourcePathRemapping"]
341+
for _, value in path_remapping.items():
342+
source_path = os.path.expanduser(value)
343+
if not os.path.exists(source_path):
344+
unavailable_source_paths.add(source_path)
337345
if not self.resolved_path and os.path.exists(self.path):
338346
if not self.find_matching_slice():
339347
return False
@@ -372,6 +380,12 @@ def locate_module_and_debug_symbols(self):
372380
):
373381
with print_lock:
374382
print("Resolved symbols for %s %s..." % (uuid_str, self.path))
383+
if len(unavailable_source_paths):
384+
for source_path in unavailable_source_paths:
385+
print(
386+
"Could not access remapped source path for %s %s"
387+
% (uuid_str, source_path)
388+
)
375389
return True
376390
else:
377391
self.unavailable = True

0 commit comments

Comments
 (0)