Index: lldb/examples/python/crashlog.py =================================================================== --- lldb/examples/python/crashlog.py +++ lldb/examples/python/crashlog.py @@ -531,8 +531,6 @@ def __init__(self, debugger, path, verbose): self.path = os.path.expanduser(path) self.verbose = verbose - # List of DarwinImages sorted by their index. - self.images = list() self.crashlog = CrashLog(debugger, self.path, self.verbose) @abc.abstractmethod @@ -627,7 +625,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): @@ -654,7 +651,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", @@ -1197,7 +1194,6 @@ "address": symbol["address"] - int(img_lo, 0), } - self.images.append(image) self.crashlog.images.append(image) return True else: 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