mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2024-11-28 04:04:20 +01:00
Extract the exception record from the minidump
Change-Id: Ia622560960513e24b21184532f2272a09b9cdc95 Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/1986339 Reviewed-by: Ivan Penkov <ivanpe@chromium.org>
This commit is contained in:
parent
e5ef907c2e
commit
4e15f7d230
124
src/google_breakpad/processor/exception_record.h
Normal file
124
src/google_breakpad/processor/exception_record.h
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
// Copyright (c) 2019 Google Inc.
|
||||||
|
// All rights reserved.
|
||||||
|
//
|
||||||
|
// Redistribution and use in source and binary forms, with or without
|
||||||
|
// modification, are permitted provided that the following conditions are
|
||||||
|
// met:
|
||||||
|
//
|
||||||
|
// * Redistributions of source code must retain the above copyright
|
||||||
|
// notice, this list of conditions and the following disclaimer.
|
||||||
|
// * Redistributions in binary form must reproduce the above
|
||||||
|
// copyright notice, this list of conditions and the following disclaimer
|
||||||
|
// in the documentation and/or other materials provided with the
|
||||||
|
// distribution.
|
||||||
|
// * Neither the name of Google Inc. nor the names of its
|
||||||
|
// contributors may be used to endorse or promote products derived from
|
||||||
|
// this software without specific prior written permission.
|
||||||
|
//
|
||||||
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
//
|
||||||
|
// exception_record.h: A snapshot of an exception record.
|
||||||
|
//
|
||||||
|
// Author: Ivan Penkov
|
||||||
|
|
||||||
|
#ifndef THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_
|
||||||
|
#define THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace google_breakpad {
|
||||||
|
|
||||||
|
// Additional argument that describes the exception.
|
||||||
|
class ExceptionParameter {
|
||||||
|
public:
|
||||||
|
ExceptionParameter(uint64_t value, const string& description)
|
||||||
|
: value_(value), description_(description) {}
|
||||||
|
// Accessors. See the data declarations below.
|
||||||
|
uint64_t value() const { return value_; }
|
||||||
|
void set_value(uint64_t value) { value_ = value; }
|
||||||
|
const string& description() const { return description_; }
|
||||||
|
void set_description(const string& description) {
|
||||||
|
description_ = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Parameter value.
|
||||||
|
uint64_t value_;
|
||||||
|
// Human readable description/interpretation of the above value.
|
||||||
|
string description_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// A snapshot of an exception record. Contains exception record details: code,
|
||||||
|
// flags, address, parameters.
|
||||||
|
class ExceptionRecord {
|
||||||
|
public:
|
||||||
|
// Accessors. See the data declarations below.
|
||||||
|
uint32_t code() const { return code_; }
|
||||||
|
const string& code_description() const { return code_description_; }
|
||||||
|
void set_code(uint32_t code, const string& description) {
|
||||||
|
code_ = code;
|
||||||
|
code_description_ = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t flags() const { return flags_; }
|
||||||
|
const string& flags_description() const { return flags_description_; }
|
||||||
|
void set_flags(uint32_t flags, const string& description) {
|
||||||
|
flags_ = flags;
|
||||||
|
flags_description_ = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t nested_exception_record_address() const {
|
||||||
|
return nested_exception_record_address_;
|
||||||
|
}
|
||||||
|
void set_nested_exception_record_address(
|
||||||
|
uint64_t nested_exception_record_address) {
|
||||||
|
nested_exception_record_address_ = nested_exception_record_address;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t address() const { return address_; }
|
||||||
|
void set_address(uint64_t address) { address_ = address; }
|
||||||
|
|
||||||
|
const std::vector<ExceptionParameter>* parameters() const {
|
||||||
|
return ¶meters_;
|
||||||
|
}
|
||||||
|
void add_parameter(uint64_t value, const string& description) {
|
||||||
|
parameters_.push_back(ExceptionParameter(value, description));
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Exception code.
|
||||||
|
uint32_t code_;
|
||||||
|
string code_description_;
|
||||||
|
|
||||||
|
// Exception flags.
|
||||||
|
uint32_t flags_;
|
||||||
|
string flags_description_;
|
||||||
|
|
||||||
|
// The address of an associated MDException structure. Exception records can
|
||||||
|
// be chained together to provide additional information when nested
|
||||||
|
// exceptions occur.
|
||||||
|
uint64_t nested_exception_record_address_;
|
||||||
|
|
||||||
|
// The memory address that caused the exception. For data access errors,
|
||||||
|
// this will be the data address that caused the fault. For code errors,
|
||||||
|
// this will be the address of the instruction that caused the fault.
|
||||||
|
uint64_t address_;
|
||||||
|
|
||||||
|
// An array of additional arguments that describe the exception.
|
||||||
|
std::vector<ExceptionParameter> parameters_;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace google_breakpad
|
||||||
|
|
||||||
|
|
||||||
|
#endif // THIRD_PARTY_BREAKPAD_SRC_GOOGLE_BREAKPAD_PROCESSOR_EXCEPTION_RECORD_H_
|
@ -40,6 +40,7 @@
|
|||||||
#include "common/using_std_string.h"
|
#include "common/using_std_string.h"
|
||||||
#include "google_breakpad/common/breakpad_types.h"
|
#include "google_breakpad/common/breakpad_types.h"
|
||||||
#include "google_breakpad/processor/code_modules.h"
|
#include "google_breakpad/processor/code_modules.h"
|
||||||
|
#include "google_breakpad/processor/exception_record.h"
|
||||||
#include "google_breakpad/processor/minidump.h"
|
#include "google_breakpad/processor/minidump.h"
|
||||||
#include "google_breakpad/processor/system_info.h"
|
#include "google_breakpad/processor/system_info.h"
|
||||||
#include "processor/linked_ptr.h"
|
#include "processor/linked_ptr.h"
|
||||||
@ -105,6 +106,7 @@ class ProcessState {
|
|||||||
uint64_t crash_address() const { return crash_address_; }
|
uint64_t crash_address() const { return crash_address_; }
|
||||||
string assertion() const { return assertion_; }
|
string assertion() const { return assertion_; }
|
||||||
int requesting_thread() const { return requesting_thread_; }
|
int requesting_thread() const { return requesting_thread_; }
|
||||||
|
const ExceptionRecord* exception_record() const { return &exception_record_; }
|
||||||
const vector<CallStack*>* threads() const { return &threads_; }
|
const vector<CallStack*>* threads() const { return &threads_; }
|
||||||
const vector<MemoryRegion*>* thread_memory_regions() const {
|
const vector<MemoryRegion*>* thread_memory_regions() const {
|
||||||
return &thread_memory_regions_;
|
return &thread_memory_regions_;
|
||||||
@ -166,6 +168,9 @@ class ProcessState {
|
|||||||
// indicating that the dump thread is not available.
|
// indicating that the dump thread is not available.
|
||||||
int requesting_thread_;
|
int requesting_thread_;
|
||||||
|
|
||||||
|
// Exception record details: code, flags, address, parameters.
|
||||||
|
ExceptionRecord exception_record_;
|
||||||
|
|
||||||
// Stacks for each thread (except possibly the exception handler
|
// Stacks for each thread (except possibly the exception handler
|
||||||
// thread) at the time of the crash.
|
// thread) at the time of the crash.
|
||||||
vector<CallStack*> threads_;
|
vector<CallStack*> threads_;
|
||||||
|
@ -116,6 +116,25 @@ ProcessResult MinidumpProcessor::Process(
|
|||||||
|
|
||||||
process_state->crash_reason_ = GetCrashReason(
|
process_state->crash_reason_ = GetCrashReason(
|
||||||
dump, &process_state->crash_address_);
|
dump, &process_state->crash_address_);
|
||||||
|
|
||||||
|
process_state->exception_record_.set_code(
|
||||||
|
exception->exception()->exception_record.exception_code,
|
||||||
|
// TODO(ivanpe): Populate description.
|
||||||
|
/* description = */ "");
|
||||||
|
process_state->exception_record_.set_flags(
|
||||||
|
exception->exception()->exception_record.exception_flags,
|
||||||
|
// TODO(ivanpe): Populate description.
|
||||||
|
/* description = */ "");
|
||||||
|
process_state->exception_record_.set_nested_exception_record_address(
|
||||||
|
exception->exception()->exception_record.exception_record);
|
||||||
|
process_state->exception_record_.set_address(process_state->crash_address_);
|
||||||
|
for (uint32_t i = 0;
|
||||||
|
i < exception->exception()->exception_record.number_parameters; i++) {
|
||||||
|
process_state->exception_record_.add_parameter(
|
||||||
|
exception->exception()->exception_record.exception_information[i],
|
||||||
|
// TODO(ivanpe): Populate description.
|
||||||
|
/* description = */ "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// This will just return an empty string if it doesn't exist.
|
// This will just return an empty string if it doesn't exist.
|
||||||
|
Loading…
Reference in New Issue
Block a user