stratosphere: migrate result headers to libstrat

This commit is contained in:
Michael Scire
2019-03-28 14:23:34 -07:00
parent 23424629c9
commit 2678735f73
14 changed files with 18 additions and 126 deletions

View File

@@ -140,20 +140,20 @@ void CrashReport::HandleAttachProcess(DebugEventInfo &d) {
void CrashReport::HandleException(DebugEventInfo &d) {
switch (d.info.exception.type) {
case DebugExceptionType::UndefinedInstruction:
this->result = (Result)CrashReportResult::UndefinedInstruction;
this->result = ResultCreportUndefinedInstruction;
break;
case DebugExceptionType::InstructionAbort:
this->result = (Result)CrashReportResult::InstructionAbort;
this->result = ResultCreportInstructionAbort;
d.info.exception.specific.raw = 0;
break;
case DebugExceptionType::DataAbort:
this->result = (Result)CrashReportResult::DataAbort;
this->result = ResultCreportDataAbort;
break;
case DebugExceptionType::AlignmentFault:
this->result = (Result)CrashReportResult::AlignmentFault;
this->result = ResultCreportAlignmentFault;
break;
case DebugExceptionType::UserBreak:
this->result = (Result)CrashReportResult::UserBreak;
this->result = ResultCreportUserBreak;
/* Try to parse out the user break result. */
if (kernelAbove500()) {
Result user_result = 0;
@@ -167,10 +167,10 @@ void CrashReport::HandleException(DebugEventInfo &d) {
}
break;
case DebugExceptionType::BadSvc:
this->result = (Result)CrashReportResult::BadSvc;
this->result = ResultCreportBadSvc;
break;
case DebugExceptionType::UnknownNine:
this->result = (Result)CrashReportResult::UnknownNine;
case DebugExceptionType::SystemMemoryError:
this->result = ResultCreportSystemMemoryError;
d.info.exception.specific.raw = 0;
break;
case DebugExceptionType::DebuggerAttached:

View File

@@ -17,31 +17,18 @@
#pragma once
#include <switch.h>
#include <stratosphere.hpp>
#include <cstdio>
#include "creport_debug_types.hpp"
#include "creport_thread_info.hpp"
#include "creport_code_info.hpp"
enum class CrashReportResult : Result {
UndefinedInstruction = 0x00A8,
InstructionAbort = 0x02A8,
DataAbort = 0x04A8,
AlignmentFault = 0x06A8,
DebuggerAttached = 0x08A8,
BreakPoint = 0x0AA8,
UserBreak = 0x0CA8,
DebuggerBreak = 0x0EA8,
BadSvc = 0x10A8,
UnknownNine = 0x12A8,
IncompleteReport = 0xC6A8,
};
class CrashReport {
private:
Handle debug_handle = INVALID_HANDLE;
bool has_extra_info;
Result result = static_cast<Result>(CrashReportResult::IncompleteReport);
Result result = ResultCreportIncompleteReport;
/* Attach Process Info. */
AttachProcessInfo process_info{};
@@ -73,7 +60,7 @@ class CrashReport {
}
bool WasSuccessful() {
return this->result != (Result)CrashReportResult::IncompleteReport;
return this->result != ResultCreportIncompleteReport;
}
bool OpenProcess(u64 pid) {

View File

@@ -49,7 +49,7 @@ enum class DebugExceptionType : u32 {
UserBreak = 6,
DebuggerBreak = 7,
BadSvc = 8,
UnknownNine = 9,
SystemMemoryError = 9,
};
static inline const char *GetDebugExceptionTypeStr(DebugExceptionType type) {
@@ -72,8 +72,8 @@ static inline const char *GetDebugExceptionTypeStr(DebugExceptionType type) {
return "Debugger Break";
case DebugExceptionType::BadSvc:
return "Bad Svc";
case DebugExceptionType::UnknownNine:
return "Unknown Nine";
case DebugExceptionType::SystemMemoryError:
return "System Memory Error";
default:
return "Unknown";
}