Example #1
0
    def _get_exception_info(self):
        rv = []

        # We only have one exception at a time
        exception = get_path(self.exceptions, 0)
        if not exception:
            return ""

        mechanism = upgrade_legacy_mechanism(exception.get("mechanism")) or {}
        mechanism_meta = get_path(mechanism, "meta", default={})

        signal = get_path(mechanism_meta, "signal", "name")
        name = get_path(mechanism_meta, "mach_exception", "name")

        if name or signal:
            rv.append("Exception Type: %s%s" % (name or "Unknown", signal and
                                                (" (%s)" % signal) or ""))

        exc_name = get_path(mechanism_meta, "signal", "code_name")
        exc_addr = get_path(mechanism, "data", "relevant_address")
        if exc_name:
            rv.append("Exception Codes: %s%s" %
                      (exc_name, exc_addr is not None and
                       (" at %s" % exc_addr) or ""))

        if exception.get("thread_id") is not None:
            rv.append("Crashed Thread: %s" % exception["thread_id"])

        if exception.get("value"):
            rv.append("\nApplication Specific Information:\n%s" %
                      exception["value"])

        return "\n".join(rv)
Example #2
0
    def _get_exception_info(self):
        rv = []
        if self.exceptions and self.exceptions[0]:
            # We only have one exception at a time
            exception = self.exceptions[0] or {}
            mechanism = upgrade_legacy_mechanism(
                exception.get('mechanism')) or {}
            mechanism_meta = mechanism.get('meta', {})

            signal = mechanism_meta.get('signal', {}).get('name')
            name = mechanism_meta.get('mach_exception', {}).get('name')

            if name or signal:
                rv.append('Exception Type: %s%s' % (
                    name or 'Unknown',
                    signal and (' (%s)' % signal) or '',
                ))

            exc_name = (mechanism_meta.get('signal', {})).get('code_name')
            exc_addr = mechanism.get('data', {}).get('relevant_address')
            if exc_name:
                rv.append('Exception Codes: %s%s' % (
                    exc_name,
                    exc_addr is not None and (' at %s' % exc_addr) or '',
                ))

            if exception.get('thread_id') is not None:
                rv.append('Crashed Thread: %s' % exception['thread_id'])

            if exception.get('value'):
                rv.append('\nApplication Specific Information:\n%s' %
                          exception['value'])

        return '\n'.join(rv)
Example #3
0
    def _get_exception_info(self):
        rv = []
        if self.exceptions and self.exceptions[0]:
            # We only have one exception at a time
            exception = self.exceptions[0] or {}
            mechanism = upgrade_legacy_mechanism(exception.get('mechanism')) or {}
            mechanism_meta = mechanism.get('meta', {})

            signal = mechanism_meta.get('signal', {}).get('name')
            name = mechanism_meta.get('mach_exception', {}).get('name')

            if name or signal:
                rv.append(
                    'Exception Type: %s%s' %
                    (name or 'Unknown', signal and (' (%s)' % signal) or '', )
                )

            exc_name = (mechanism_meta.get('signal', {})).get('code_name')
            exc_addr = mechanism.get('data', {}).get('relevant_address')
            if exc_name:
                rv.append(
                    'Exception Codes: %s%s' %
                    (exc_name, exc_addr is not None and (
                        ' at %s' % exc_addr) or '', )
                )

            if exception.get('thread_id') is not None:
                rv.append('Crashed Thread: %s' % exception['thread_id'])

            if exception.get('value'):
                rv.append('\nApplication Specific Information:\n%s' %
                          exception['value'])

        return '\n'.join(rv)
Example #4
0
    def test_upgrade(self):
        data = {
            "posix_signal": {
                "name": "SIGSEGV",
                "code_name": "SEGV_NOOP",
                "signal": 11,
                "code": 0
            },
            "relevant_address": "0x1",
            "mach_exception": {
                "exception": 1,
                "exception_name": "EXC_BAD_ACCESS",
                "subcode": 8,
                "code": 1
            }
        }

        assert upgrade_legacy_mechanism(data) == {
            "type": "generic",
            "data": {
                "relevant_address": "0x1"
            },
            "meta": {
                "mach_exception": {
                    "exception": 1,
                    "subcode": 8,
                    "code": 1,
                    "name": "EXC_BAD_ACCESS"
                },
                "signal": {
                    "number": 11,
                    "code": 0,
                    "name": "SIGSEGV",
                    "code_name": "SEGV_NOOP"
                }
            }
        }
Example #5
0
def test_upgrade():
    data = {
        "posix_signal": {
            "name": "SIGSEGV",
            "code_name": "SEGV_NOOP",
            "signal": 11,
            "code": 0
        },
        "relevant_address": "0x1",
        "mach_exception": {
            "exception": 1,
            "exception_name": "EXC_BAD_ACCESS",
            "subcode": 8,
            "code": 1
        }
    }

    assert upgrade_legacy_mechanism(data) == {
        "type": "generic",
        "data": {
            "relevant_address": "0x1"
        },
        "meta": {
            "mach_exception": {
                "exception": 1,
                "subcode": 8,
                "code": 1,
                "name": "EXC_BAD_ACCESS"
            },
            "signal": {
                "number": 11,
                "code": 0,
                "name": "SIGSEGV",
                "code_name": "SEGV_NOOP"
            }
        }
    }