Ejemplo n.º 1
0
    def __init__(self, target: lldb.SBTarget, args: lldb.SBStructuredData):
        super().__init__(target, args)

        if not self.target or not self.target.IsValid():
            return

        self.crashlog_path = None

        crashlog_path = args.GetValueForKey("crashlog_path")
        if crashlog_path and crashlog_path.IsValid():
            if crashlog_path.GetType() == lldb.eStructuredDataTypeString:
                self.crashlog_path = crashlog_path.GetStringValue(4096)

        if not self.crashlog_path:
            return

        load_all_images = args.GetValueForKey("load_all_images")
        if load_all_images and load_all_images.IsValid():
            if load_all_images.GetType() == lldb.eStructuredDataTypeBoolean:
                self.load_all_images = load_all_images.GetBooleanValue()

        if not self.load_all_images:
            self.load_all_images = False

        self.pid = super().get_process_id()
        self.crashed_thread_idx = 0
        self.parse_crashlog()
    def __init__(self, target: lldb.SBTarget, args: lldb.SBStructuredData):
        super().__init__(target, args)

        self.backing_target_idx = args.GetValueForKey("backing_target_idx")

        self.corefile_target = None
        self.corefile_process = None
        if (self.backing_target_idx and self.backing_target_idx.IsValid()):
            if self.backing_target_idx.GetType(
            ) == lldb.eStructuredDataTypeInteger:
                idx = self.backing_target_idx.GetIntegerValue(42)
            if self.backing_target_idx.GetType(
            ) == lldb.eStructuredDataTypeString:
                idx = int(self.backing_target_idx.GetStringValue(100))
            self.corefile_target = target.GetDebugger().GetTargetAtIndex(idx)
            self.corefile_process = self.corefile_target.GetProcess()
            for corefile_thread in self.corefile_process:
                structured_data = lldb.SBStructuredData()
                structured_data.SetFromJSON(
                    json.dumps({
                        "backing_target_idx": idx,
                        "thread_idx": corefile_thread.GetIndexID()
                    }))

                self.threads[
                    corefile_thread.GetThreadID()] = StackCoreScriptedThread(
                        self, structured_data)
Ejemplo n.º 3
0
    def __init__(self, target: lldb.SBTarget, args : lldb.SBStructuredData):
        super().__init__(target, args)

        self.backing_target_idx = args.GetValueForKey("backing_target_idx")

        self.corefile_target = None
        self.corefile_process = None
        if (self.backing_target_idx and self.backing_target_idx.IsValid()):
            if self.backing_target_idx.GetType() == lldb.eStructuredDataTypeInteger:
                idx = self.backing_target_idx.GetIntegerValue(42)
            if self.backing_target_idx.GetType() == lldb.eStructuredDataTypeString:
                idx = int(self.backing_target_idx.GetStringValue(100))
            self.corefile_target = target.GetDebugger().GetTargetAtIndex(idx)
            self.corefile_process = self.corefile_target.GetProcess()
Ejemplo n.º 4
0
    def __init__(self, target: lldb.SBTarget, args: lldb.SBStructuredData):
        super().__init__(target, args)

        self.corefile_target = None
        self.corefile_process = None

        self.backing_target_idx = args.GetValueForKey("backing_target_idx")
        if (self.backing_target_idx and self.backing_target_idx.IsValid()):
            if self.backing_target_idx.GetType(
            ) == lldb.eStructuredDataTypeInteger:
                idx = self.backing_target_idx.GetIntegerValue(42)
            if self.backing_target_idx.GetType(
            ) == lldb.eStructuredDataTypeString:
                idx = int(self.backing_target_idx.GetStringValue(100))
            self.corefile_target = target.GetDebugger().GetTargetAtIndex(idx)
            self.corefile_process = self.corefile_target.GetProcess()
            for corefile_thread in self.corefile_process:
                structured_data = lldb.SBStructuredData()
                structured_data.SetFromJSON(
                    json.dumps({
                        "backing_target_idx": idx,
                        "thread_idx": corefile_thread.GetIndexID()
                    }))

                self.threads[
                    corefile_thread.GetThreadID()] = StackCoreScriptedThread(
                        self, structured_data)

        if len(self.threads) == 2:
            self.threads[len(self.threads) - 1].is_stopped = True

        corefile_module = self.get_module_with_name(self.corefile_target,
                                                    "libbaz.dylib")
        if not corefile_module or not corefile_module.IsValid():
            return
        module_path = os.path.join(
            corefile_module.GetFileSpec().GetDirectory(),
            corefile_module.GetFileSpec().GetFilename())
        if not os.path.exists(module_path):
            return
        module_load_addr = corefile_module.GetObjectFileHeaderAddress(
        ).GetLoadAddress(self.corefile_target)

        self.loaded_images.append({
            "path": module_path,
            "load_addr": module_load_addr
        })