[Lldb-commits] [lldb] 7371ec7 - [lldb] Have crashlog warn when remapped paths are inaccessible.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Jun 14 17:25:39 PDT 2023


Author: Jonas Devlieghere
Date: 2023-06-14T17:15:28-07:00
New Revision: 7371ec76299df6922911233bd6ee07d7629d09b6

URL: https://github.com/llvm/llvm-project/commit/7371ec76299df6922911233bd6ee07d7629d09b6
DIFF: https://github.com/llvm/llvm-project/commit/7371ec76299df6922911233bd6ee07d7629d09b6.diff

LOG: [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

Added: 
    

Modified: 
    lldb/examples/python/crashlog.py

Removed: 
    


################################################################################
diff  --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index 6f69ef5bff7fc..709dda714eb34 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -306,6 +306,8 @@ def locate_module_and_debug_symbols(self):
             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 @@ def locate_module_and_debug_symbols(self):
                                     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 @@ def locate_module_and_debug_symbols(self):
             ):
                 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


        


More information about the lldb-commits mailing list