Ejemplo n.º 1
0
def _merge_minidump_response(data, response):
    data["platform"] = "native"
    if response.get("crashed") is not None:
        data["level"] = "fatal" if response["crashed"] else "info"

    validate_and_set_timestamp(data, response.get("timestamp"))

    if response.get("system_info"):
        _merge_system_info(data, response["system_info"])

    sdk_info = get_sdk_from_event(data)

    images = []
    set_path(data, "debug_meta", "images", value=images)

    for complete_image in response["modules"]:
        image = {}
        _merge_image(image, complete_image, sdk_info,
                     lambda e: write_error(e, data))
        images.append(image)

    # Extract the crash reason and infos
    data_exception = get_path(data, "exception", "values", 0)
    exc_value = ("Assertion Error: %s" % response.get("assertion")
                 if response.get("assertion") else "Fatal Error: %s" %
                 response.get("crash_reason"))
    data_exception["value"] = exc_value
    data_exception["type"] = response.get("crash_reason")

    data_threads = []
    if response["stacktraces"]:
        data["threads"] = {"values": data_threads}
    else:
        error = SymbolicationFailed(message="minidump has no thread list",
                                    type=EventError.NATIVE_SYMBOLICATOR_FAILED)
        write_error(error, data)

    for complete_stacktrace in response["stacktraces"]:
        is_requesting = complete_stacktrace.get("is_requesting")
        thread_id = complete_stacktrace.get("thread_id")

        data_thread = {"id": thread_id, "crashed": is_requesting}
        data_threads.append(data_thread)

        if is_requesting:
            data_exception["thread_id"] = thread_id
            data_stacktrace = data_exception.setdefault("stacktrace", {})
            data_stacktrace["frames"] = []
        else:
            data_thread["stacktrace"] = data_stacktrace = {"frames": []}

        if complete_stacktrace.get("registers"):
            data_stacktrace["registers"] = complete_stacktrace["registers"]

        for complete_frame in reversed(complete_stacktrace["frames"]):
            new_frame = {}
            _merge_frame(new_frame, complete_frame)
            data_stacktrace["frames"].append(new_frame)
Ejemplo n.º 2
0
def _merge_full_response(data, response):
    data["platform"] = "native"
    if response.get("crashed") is not None:
        data["level"] = "fatal" if response["crashed"] else "info"

    validate_and_set_timestamp(data, response.get("timestamp"))

    if response.get("system_info"):
        _merge_system_info(data, response["system_info"])

    sdk_info = get_sdk_from_event(data)

    images = []
    set_path(data, "debug_meta", "images", value=images)

    for complete_image in response["modules"]:
        image = {}
        _merge_image(image, complete_image, sdk_info,
                     lambda e: write_error(e, data))
        images.append(image)

    # Extract the crash reason and infos
    data_exception = get_path(data, "exception", "values", 0)
    if response.get("assertion"):
        data_exception["value"] = "Assertion Error: %s" % (
            response["assertion"], )
    elif response.get("crash_details"):
        data_exception["value"] = response["crash_details"]
    elif response.get("crash_reason"):
        data_exception["value"] = "Fatal Error: %s" % (
            response["crash_reason"], )
    else:
        # We're merging a full response, so there was no initial payload
        # submitted. Assuming that this still contains the placeholder, remove
        # it rather than showing a default value.
        data_exception.pop("value", None)

    if response.get("crash_reason"):
        data_exception["type"] = response["crash_reason"]

    data_threads = []
    if response["stacktraces"]:
        data["threads"] = {"values": data_threads}
    else:
        error = SymbolicationFailed(message="minidump has no thread list",
                                    type=EventError.NATIVE_SYMBOLICATOR_FAILED)
        write_error(error, data)

    for complete_stacktrace in response["stacktraces"]:
        is_requesting = complete_stacktrace.get("is_requesting")
        thread_id = complete_stacktrace.get("thread_id")

        data_thread = {"id": thread_id, "crashed": is_requesting}
        data_threads.append(data_thread)

        if is_requesting:
            data_exception["thread_id"] = thread_id
            data_stacktrace = data_exception.setdefault("stacktrace", {})
            data_stacktrace["frames"] = []
        else:
            data_thread["stacktrace"] = data_stacktrace = {"frames": []}

        if complete_stacktrace.get("registers"):
            data_stacktrace["registers"] = complete_stacktrace["registers"]

        for complete_frame in reversed(complete_stacktrace["frames"]):
            new_frame = {}
            _merge_frame(new_frame, complete_frame)
            data_stacktrace["frames"].append(new_frame)
Ejemplo n.º 3
0
def _merge_minidump_response(data, response):
    data['platform'] = 'native'
    if response.get('crashed') is not None:
        data['level'] = 'fatal' if response['crashed'] else 'info'

    validate_and_set_timestamp(data, response.get('timestamp'))

    if response.get('system_info'):
        _merge_system_info(data, response['system_info'])

    sdk_info = get_sdk_from_event(data)

    images = []
    set_path(data, 'debug_meta', 'images', value=images)

    for complete_image in response['modules']:
        image = {}
        _merge_image(image, complete_image, sdk_info,
                     lambda e: write_error(e, data))
        images.append(image)

    # Extract the crash reason and infos
    data_exception = get_path(data, 'exception', 'values', 0)
    exc_value = ('Assertion Error: %s' % response.get('assertion')
                 if response.get('assertion') else 'Fatal Error: %s' %
                 response.get('crash_reason'))
    data_exception['value'] = exc_value
    data_exception['type'] = response.get('crash_reason')

    data_threads = []
    if response['stacktraces']:
        data['threads'] = {'values': data_threads}
    else:
        error = SymbolicationFailed(message='minidump has no thread list',
                                    type=EventError.NATIVE_SYMBOLICATOR_FAILED)
        write_error(error, data)

    for complete_stacktrace in response['stacktraces']:
        is_requesting = complete_stacktrace.get('is_requesting')
        thread_id = complete_stacktrace.get('thread_id')

        data_thread = {
            'id': thread_id,
            'crashed': is_requesting,
        }
        data_threads.append(data_thread)

        if is_requesting:
            data_exception['thread_id'] = thread_id
            data_stacktrace = data_exception.setdefault('stacktrace', {})
            data_stacktrace['frames'] = []
        else:
            data_thread['stacktrace'] = data_stacktrace = {'frames': []}

        if complete_stacktrace.get('registers'):
            data_stacktrace['registers'] = complete_stacktrace['registers']

        for complete_frame in reversed(complete_stacktrace['frames']):
            new_frame = {}
            _merge_frame(new_frame, complete_frame)
            data_stacktrace['frames'].append(new_frame)