From 7371ec76299df6922911233bd6ee07d7629d09b6 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 14 Jun 2023 17:15:28 -0700 Subject: [PATCH] [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 --- lldb/examples/python/crashlog.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py index 6f69ef5bff7f..709dda714eb3 100755 --- a/lldb/examples/python/crashlog.py +++ b/lldb/examples/python/crashlog.py @@ -306,6 +306,8 @@ class CrashLog(symbolication.Symbolicator): if self.show_symbol_progress(): with print_lock: print("Getting symbols for %s %s..." % (uuid_str, self.path)) + # Keep track of unresolved source paths. + unavailable_source_paths = set() if os.path.exists(self.dsymForUUIDBinary): dsym_for_uuid_command = "%s %s" % (self.dsymForUUIDBinary, uuid_str) s = subprocess.check_output(dsym_for_uuid_command, shell=True) @@ -335,6 +337,12 @@ class CrashLog(symbolication.Symbolicator): plist["DBGSymbolRichExecutable"] ) self.resolved_path = self.path + if "DBGSourcePathRemapping" in plist: + path_remapping = plist["DBGSourcePathRemapping"] + for _, value in path_remapping.items(): + source_path = os.path.expanduser(value) + if not os.path.exists(source_path): + unavailable_source_paths.add(source_path) if not self.resolved_path and os.path.exists(self.path): if not self.find_matching_slice(): return False @@ -373,6 +381,12 @@ class CrashLog(symbolication.Symbolicator): ): with print_lock: print("Resolved symbols for %s %s..." % (uuid_str, self.path)) + if len(unavailable_source_paths): + for source_path in unavailable_source_paths: + print( + "Could not access remapped source path for %s %s" + % (uuid_str, source_path) + ) return True else: self.unavailable = True -- 2.34.1