[Lldb-commits] [PATCH] D148172: [lldb] Use ObjectFileJSON to create modules for interactive crashlogs
Med Ismail Bennani via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 12 18:13:34 PDT 2023
mib added inline comments.
================
Comment at: lldb/examples/python/crashlog.py:460-464
+ def __init__(self, debugger, path, verbose):
+ super().__init__(debugger, path, verbose)
+ # List of DarwinImages sorted by their index.
+ self.images = list()
+
----------------
Why do we need this ?
================
Comment at: lldb/examples/python/crashlog.py:515
def parse_images(self, json_images):
- idx = 0
- for json_image in json_images:
+ for idx, json_image in enumerate(json_images):
img_uuid = uuid.UUID(json_image['uuid'])
----------------
What do we use `idx` for ?
================
Comment at: lldb/examples/python/crashlog.py:526-527
self.verbose)
+ self.images.append(darwin_image)
self.crashlog.images.append(darwin_image)
----------------
Seems like we're doing the same things for both `self.images` and `self.crashlog.images` ... In that case, is `self.images` really necessary ?
================
Comment at: lldb/examples/python/scripted_process/crashlog_scripted_process.py:25-33
+ if self.load_all_images:
+ for image in self.crashlog.images:
+ image.resolve = True
+ else:
+ for thread in self.crashlog.threads:
+ if thread.did_crash():
+ for ident in thread.idents:
----------------
Nice!
================
Comment at: lldb/examples/python/symbolication.py:387
+ if not self.module and self.section_infos:
+ name = pathlib.Path(self.path).name
+ with tempfile.NamedTemporaryFile(suffix='.' + name) as tf:
----------------
Fancy! Can't we just do this and remove the extra import ?
================
Comment at: lldb/examples/python/symbolication.py:402-403
+ })
+ for symbol in self.symbols.values():
+ data['symbols'].append(symbol)
+ with open(tf.name, 'w') as f:
----------------
This should work, right ?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148172/new/
https://reviews.llvm.org/D148172
More information about the lldb-commits
mailing list