[Lldb-commits] [PATCH] D129611: [lldb/crashlog] Add '-t|--target' option to interactive mode

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 13 10:01:32 PDT 2022


JDevlieghere added inline comments.


================
Comment at: lldb/examples/python/crashlog.py:1022
+    # 1. Try to use the user-provided target
+    if options.target_path is not None and options.target_path != "":
+        target = debugger.CreateTarget(options.target_path)
----------------



================
Comment at: lldb/examples/python/crashlog.py:1024
+        target = debugger.CreateTarget(options.target_path)
+    # 2. If that didn't work, try to create a target using the symbolicator
+    if target is None or not target.IsValid():
----------------
I think if the user provided a target path and that didn't work, we should report and error and give up. 


================
Comment at: lldb/examples/python/crashlog.py:1025
+    # 2. If that didn't work, try to create a target using the symbolicator
+    if target is None or not target.IsValid():
         target = crashlog.create_target()
----------------



================
Comment at: lldb/examples/python/crashlog.py:1197
+            dest='target_path',
+            help='the target binary path that should be used for interactive crashlog')
     return option_parser
----------------
Please make it clear that this is optional and describe the fallback behavior.


================
Comment at: lldb/examples/python/scripted_process/crashlog_scripted_process.py:46
 
-        if not self.target or not self.target.IsValid():
+        if not self.target.GetExecutable() or not self.target.IsValid():
+            # Return error
----------------
Maybe leave a comment why the executable matters here rather than just the target.


================
Comment at: lldb/examples/python/scripted_process/crashlog_scripted_process.py:47-48
+        if not self.target.GetExecutable() or not self.target.IsValid():
+            # Return error
             return
 
----------------
The comment says return error but we're not returning anything. Should this raise an exception? 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129611



More information about the lldb-commits mailing list