[Lldb-commits] [PATCH] D157044: [lldb/crashlog] Fix sticky image parsing logic

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Sat Aug 12 00:00:36 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG75bed9655a54: [lldb/crashlog] Fix sticky image parsing logic (authored by mib).

Changed prior to commit:
  https://reviews.llvm.org/D157044?vs=547015&id=549579#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157044/new/

https://reviews.llvm.org/D157044

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
@@ -501,7 +501,7 @@
 
 
 class Symbolicator:
-    def __init__(self, debugger=None, target=None, images=list()):
+    def __init__(self, debugger=None, target=None, images=None):
         """A class the represents the information needed to symbolicate
         addresses in a program.
 
@@ -510,7 +510,8 @@
         """
         self.debugger = debugger
         self.target = target
-        self.images = images  # a list of images to be used when symbolicating
+        # a list of images to be used when symbolicating
+        self.images = images if images else list()
         self.addr_mask = 0xFFFFFFFFFFFFFFFF
 
     @classmethod
Index: lldb/examples/python/crashlog.py
===================================================================
--- lldb/examples/python/crashlog.py
+++ lldb/examples/python/crashlog.py
@@ -549,8 +549,6 @@
     def __init__(self, debugger, path, options):
         self.path = os.path.expanduser(path)
         self.options = options
-        # List of DarwinImages sorted by their index.
-        self.images = list()
         self.crashlog = CrashLog(debugger, self.path, self.options.verbose)
 
     @abc.abstractmethod
@@ -645,7 +643,6 @@
                 darwin_image.arch = json_image["arch"]
                 if path == self.crashlog.process_path:
                     self.crashlog.process_arch = darwin_image.arch
-            self.images.append(darwin_image)
             self.crashlog.images.append(darwin_image)
 
     def parse_main_image(self, json_data):
@@ -672,7 +669,7 @@
                 location = 0
                 if "symbolLocation" in json_frame and json_frame["symbolLocation"]:
                     location = int(json_frame["symbolLocation"])
-                image = self.images[image_id]
+                image = self.crashlog.images[image_id]
                 image.symbols[symbol] = {
                     "name": symbol,
                     "type": "code",
@@ -780,7 +777,7 @@
                 if frame_offset:
                     description += " + " + frame_offset
                     frame_offset_value = int(frame_offset, 0)
-                for image in self.images:
+                for image in self.crashlog.images:
                     if image.identifier == frame_img_name:
                         image.symbols[frame_symbol] = {
                             "name": frame_symbol,
@@ -829,6 +826,7 @@
         if "reportNotes" in json_data:
             self.crashlog.errors = json_data["reportNotes"]
 
+
 class TextCrashLogParser(CrashLogParser):
     parent_process_regex = re.compile(r"^Parent Process:\s*(.*)\[(\d+)\]")
     thread_state_regex = re.compile(r"^Thread \d+ crashed with")
@@ -888,7 +886,6 @@
     )
     exception_extra_regex = re.compile(r"^Exception\s+.*:\s+(.*)")
 
-
     class CrashLogParseMode:
         NORMAL = 0
         THREAD = 1
@@ -1209,7 +1206,6 @@
                         "address": symbol["address"] - int(img_lo, 0),
                     }
 
-            self.images.append(image)
             self.crashlog.images.append(image)
             return True
         else:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157044.549579.patch
Type: text/x-patch
Size: 3285 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230812/4df07e9d/attachment-0001.bin>


More information about the lldb-commits mailing list