[lldb/crashlog] Avoid StopAtEntry when launch crashlog in interactive mode (#154651)
In 88f409194, we changed the way the crashlog scripted process was launched since the previous approach required to parse the file twice, by stopping at entry, setting the crashlog object in the middle of the scripted process launch and resuming it. Since then, we've introduced SBScriptObject which allows to pass any arbitrary python object accross the SBAPI boundary to another scripted affordance. This patch make sure of that to include the parse crashlog object into the scripted process launch info dictionary, which eliviates the need to stop at entry. Signed-off-by: Med Ismail Bennani <ismail@bennani.ma> Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
This commit is contained in:
parent
0fff460592
commit
595148ab76
@ -1540,13 +1540,19 @@ def load_crashlog_in_scripted_process(debugger, crashlog_path, options, result):
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
crashlog_sd = lldb.SBStructuredData()
|
||||
crashlog_sd.SetGenericValue(
|
||||
lldb.SBScriptObject(crashlog, lldb.eScriptLanguagePython)
|
||||
)
|
||||
structured_data.SetValueForKey("crashlog", crashlog_sd)
|
||||
|
||||
launch_info = lldb.SBLaunchInfo(None)
|
||||
launch_info.SetProcessPluginName("ScriptedProcess")
|
||||
launch_info.SetScriptedProcessClassName(
|
||||
"crashlog_scripted_process.CrashLogScriptedProcess"
|
||||
)
|
||||
launch_info.SetScriptedProcessDictionary(structured_data)
|
||||
launch_info.SetLaunchFlags(lldb.eLaunchFlagStopAtEntry)
|
||||
|
||||
error = lldb.SBError()
|
||||
process = target.Launch(launch_info, error)
|
||||
@ -1554,9 +1560,6 @@ def load_crashlog_in_scripted_process(debugger, crashlog_path, options, result):
|
||||
if not process or error.Fail():
|
||||
raise InteractiveCrashLogException("couldn't launch Scripted Process", error)
|
||||
|
||||
process.GetScriptedImplementation().set_crashlog(crashlog)
|
||||
process.Continue()
|
||||
|
||||
if not options.skip_status:
|
||||
|
||||
@contextlib.contextmanager
|
||||
|
@ -10,8 +10,7 @@ from lldb.macosx.crashlog import CrashLog, CrashLogParser
|
||||
|
||||
|
||||
class CrashLogScriptedProcess(ScriptedProcess):
|
||||
def set_crashlog(self, crashlog):
|
||||
self.crashlog = crashlog
|
||||
def parse_crashlog(self):
|
||||
if self.crashlog.process_id:
|
||||
if type(self.crashlog.process_id) is int:
|
||||
self.pid = self.crashlog.process_id
|
||||
@ -29,8 +28,6 @@ class CrashLogScriptedProcess(ScriptedProcess):
|
||||
if hasattr(self.crashlog, "asb"):
|
||||
self.extended_thread_info = self.crashlog.asb
|
||||
|
||||
crashlog.load_images(self.options, self.loaded_images)
|
||||
|
||||
for thread in self.crashlog.threads:
|
||||
if (
|
||||
hasattr(thread, "app_specific_backtrace")
|
||||
@ -92,10 +89,21 @@ class CrashLogScriptedProcess(ScriptedProcess):
|
||||
no_parallel_image_loading.GetBooleanValue()
|
||||
)
|
||||
|
||||
self.crashlog = None
|
||||
crashlog = args.GetValueForKey("crashlog")
|
||||
if crashlog and crashlog.IsValid():
|
||||
if crashlog.GetType() == lldb.eStructuredDataTypeGeneric:
|
||||
self.crashlog = crashlog.GetGenericValue()
|
||||
|
||||
if not self.crashlog:
|
||||
# Return error
|
||||
return
|
||||
|
||||
self.pid = super().get_process_id()
|
||||
self.crashed_thread_idx = 0
|
||||
self.exception = None
|
||||
self.extended_thread_info = None
|
||||
self.parse_crashlog()
|
||||
|
||||
def read_memory_at_address(
|
||||
self, addr: int, size: int, error: lldb.SBError
|
||||
@ -104,8 +112,8 @@ class CrashLogScriptedProcess(ScriptedProcess):
|
||||
return lldb.SBData()
|
||||
|
||||
def get_loaded_images(self):
|
||||
# TODO: Iterate over corefile_target modules and build a data structure
|
||||
# from it.
|
||||
if len(self.loaded_images) == 0:
|
||||
self.crashlog.load_images(self.options, self.loaded_images)
|
||||
return self.loaded_images
|
||||
|
||||
def should_stop(self) -> bool:
|
||||
|
Loading…
x
Reference in New Issue
Block a user