[lldb/crashlog] Add '-t|--target' option to interactive mode

This patch introduces a new flag for the interactive crashlog mode, that
allow the user to specify, which target to use to create the scripted
process.

This can be very useful when lldb already have few targets created:
Instead of taking the first one (zeroth index), we will use that flag to
create a new target. If the user didn't provide a target path, we will rely
on the symbolicator to create a targer.If that fails and there are already
some targets loaded in lldb, we use the first one.

rdar://94682869

Differential Revision: https://reviews.llvm.org/D129611

Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
This commit is contained in:
Med Ismail Bennani
2022-08-03 14:11:43 -07:00
parent d44f8a50d5
commit a633c5e11b
3 changed files with 26 additions and 7 deletions

View File

@@ -13,7 +13,7 @@ class CrashLogScriptedProcess(ScriptedProcess):
try:
crash_log = CrashLogParser().parse(self.dbg, self.crashlog_path, False)
except Exception as e:
return
raise e
self.pid = crash_log.process_id
self.addr_mask = crash_log.addr_mask
@@ -44,6 +44,7 @@ class CrashLogScriptedProcess(ScriptedProcess):
super().__init__(target, args)
if not self.target or not self.target.IsValid():
# Return error
return
self.crashlog_path = None
@@ -54,6 +55,7 @@ class CrashLogScriptedProcess(ScriptedProcess):
self.crashlog_path = crashlog_path.GetStringValue(4096)
if not self.crashlog_path:
# Return error
return
load_all_images = args.GetValueForKey("load_all_images")