How to use the crash.Crash.KERNEL function in crash

To help you get started, we’ve selected a few crash examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github saelo / iCrashalyzer / analyzer.py View on Github external
# Analyze the crash further.
        # check for null pointer dereference
        try:
            if int(crash.fa, 16) < self.NULLPTR_THRESHOLD:
                crash.type = Crash.NULLPTR
        except ValueError:
            pass

        # determine architecture
        if len(crash.fa) <= 10:
            crash.arch = '32bit'
        else:
            crash.arch = '64bit'

        # calculate relative address of faulting instruction
        if crash.domain == Crash.KERNEL:
            crash.region = Crash.REGION_KERNEL
            try:
                crash.rpc = '0x%x' % (int(crash.pc, 16) - int(crash.kbase, 16))
            except ValueError:
                pass
        else:
            try:
                # try to find memory region
                mappings = report.get_mappings()
                pc = int(crash.pc, 16)
                for res in mappings:
                    lower, upper, name = res
                    if int(lower, 16) <= pc <= int(upper, 16):
                        # mapped region found
                        crash.rpc = '0x%x' % (pc - int(lower, 16))
                        crash.region = name
github saelo / iCrashalyzer / parser.py View on Github external
crash = Crash()

        # extract basic information
        self.extract('id', report, crash)
        self.extract('os', report, crash)
        self.extract('device', report, crash)

        if 'Largest process' in report:
            # crashed due to low memory
            crash.domain = Crash.USERLAND
            crash.type = Crash.LOWMEM
            return crash

        if 'iBoot version' in report:
            # kernel panic
            crash.domain = Crash.KERNEL
            if 'WDT timeout' in report:         # basic detection for panics caused by the watchdog timer
                crash.type = Crash.TIMEOUT
            else:
                crash.type = Crash.KFAULT
                self.extract('pc', report, crash)
                if int(crash.numeric_os()[0]) < 6:
                    # no KASLR before iOS 6
                    crash.kbase = '0x80002000'  # assume default base address
                else:
                    self.extract('kbase', report, crash)
                self.extract('kfa', report, crash)
        else:
            # userland crash
            crash.domain = Crash.USERLAND
            if 'RPCTimeout message received to terminate' in report:
                crash.type = Crash.TIMEOUT
github saelo / iCrashalyzer / analyzer.py View on Github external
def analyze_report(self, report):
        """Analyze a report and return a crash object containing the information from it."""
        #
        # Extract information from the report and store it in a crash object.
        #
        crash = Crash()
        crash.filename = report.filename

        for key, value in report.extract_all().items():
            setattr(crash, key, value)

        # set additional properties
        if report.is_kernel_crash():
            crash.domain = Crash.KERNEL
            crash.type = Crash.KFAULT
            crash.region = Crash.REGION_KERNEL
            if crash.kbase == '-':
                # if the kernel base could not be extracted assume the default one
                # this will be the case for all crashes from devices before iOS 6
                # as there was no KASLR before that
                crash.kbase = '0x80002000'
        else:
            crash.domain = Crash.USERLAND
        if report.is_wdt_timeout() or report.is_uland_timeout():
            crash.type = Crash.TIMEOUT
        if report.is_lowmem_crash():
            crash.type = Crash.LOWMEM

        #
        # Analyze the crash further.