Skip to content

Commit 7371ec7

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
1 parent 048204d commit 7371ec7

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
@@ -306,6 +306,8 @@ def locate_module_and_debug_symbols(self):
306306
if self.show_symbol_progress():
307307
with print_lock:
308308
print("Getting symbols for %s %s..." % (uuid_str, self.path))
309+
# Keep track of unresolved source paths.
310+
unavailable_source_paths = set()
309311
if os.path.exists(self.dsymForUUIDBinary):
310312
dsym_for_uuid_command = "%s %s" % (self.dsymForUUIDBinary, uuid_str)
311313
s = subprocess.check_output(dsym_for_uuid_command, shell=True)
@@ -335,6 +337,12 @@ def locate_module_and_debug_symbols(self):
335337
plist["DBGSymbolRichExecutable"]
336338
)
337339
self.resolved_path = self.path
340+
if "DBGSourcePathRemapping" in plist:
341+
path_remapping = plist["DBGSourcePathRemapping"]
342+
for _, value in path_remapping.items():
343+
source_path = os.path.expanduser(value)
344+
if not os.path.exists(source_path):
345+
unavailable_source_paths.add(source_path)
338346
if not self.resolved_path and os.path.exists(self.path):
339347
if not self.find_matching_slice():
340348
return False
@@ -373,6 +381,12 @@ def locate_module_and_debug_symbols(self):
373381
):
374382
with print_lock:
375383
print("Resolved symbols for %s %s..." % (uuid_str, self.path))
384+
if len(unavailable_source_paths):
385+
for source_path in unavailable_source_paths:
386+
print(
387+
"Could not access remapped source path for %s %s"
388+
% (uuid_str, source_path)
389+
)
376390
return True
377391
else:
378392
self.unavailable = True

0 commit comments

Comments
 (0)