JDevlieghere created this revision.
JDevlieghere added reviewers: mib, aprantl.
Herald added a project: All.
JDevlieghere requested review of this revision.

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 correct. The former is relatively easy to diagnose thanks to the messages 
printed by the crashlog script. The latter is harder, because you have to 
figure out the remapped source path. This patch tries to make it easier to 
diagnose the second issue by including whether the path in the source remapping 
is accessible. If at least one of the paths exists, we consider the image to 
have sources, and include that in the symbol resolution output.

Example output:

  Resolved symbols and sources for 11111111-2222-3333-4444-555555555555 
/path/to/foo
  Resolved symbols s for 66666666-7777-8888-9999-AAAAAAAAAAAA /path/to/bar




https://reviews.llvm.org/D152886

Files:
  lldb/examples/python/crashlog.py
  lldb/examples/python/symbolication.py


Index: lldb/examples/python/symbolication.py
===================================================================
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -257,6 +257,7 @@
         self.resolved_path = None
         self.resolve = False
         self.resolved = False
+        self.resolved_source = False
         self.unavailable = False
         self.uuid = uuid
         self.section_infos = list()
Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -335,6 +335,15 @@
                                     plist["DBGSymbolRichExecutable"]
                                 )
                                 self.resolved_path = self.path
+                            if "DBGSourcePathRemapping" in plist:
+                                path_remapping = 
plist["DBGSourcePathRemapping"]
+                                for key in path_remapping:
+                                    source_path = os.path.expanduser(
+                                        path_remapping[key]
+                                    )
+                                    if os.path.exists(source_path):
+                                        self.resolved_source = True
+
             if not self.resolved_path and os.path.exists(self.path):
                 if not self.find_matching_slice():
                     return False
@@ -372,7 +381,11 @@
                 self.path and os.path.exists(self.path)
             ):
                 with print_lock:
-                    print("Resolved symbols for %s %s..." % (uuid_str, 
self.path))
+                    source_resolved = "and sources " if self.resolved_source 
else ""
+                    print(
+                        "Resolved symbols %sfor %s %s..."
+                        % (source_resolved, uuid_str, self.path)
+                    )
                 return True
             else:
                 self.unavailable = True


Index: lldb/examples/python/symbolication.py
===================================================================
--- lldb/examples/python/symbolication.py
+++ lldb/examples/python/symbolication.py
@@ -257,6 +257,7 @@
         self.resolved_path = None
         self.resolve = False
         self.resolved = False
+        self.resolved_source = False
         self.unavailable = False
         self.uuid = uuid
         self.section_infos = list()
Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -335,6 +335,15 @@
                                     plist["DBGSymbolRichExecutable"]
                                 )
                                 self.resolved_path = self.path
+                            if "DBGSourcePathRemapping" in plist:
+                                path_remapping = plist["DBGSourcePathRemapping"]
+                                for key in path_remapping:
+                                    source_path = os.path.expanduser(
+                                        path_remapping[key]
+                                    )
+                                    if os.path.exists(source_path):
+                                        self.resolved_source = True
+
             if not self.resolved_path and os.path.exists(self.path):
                 if not self.find_matching_slice():
                     return False
@@ -372,7 +381,11 @@
                 self.path and os.path.exists(self.path)
             ):
                 with print_lock:
-                    print("Resolved symbols for %s %s..." % (uuid_str, self.path))
+                    source_resolved = "and sources " if self.resolved_source else ""
+                    print(
+                        "Resolved symbols %sfor %s %s..."
+                        % (source_resolved, uuid_str, self.path)
+                    )
                 return True
             else:
                 self.unavailable = True
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to