creport: Implement process open, stub exception parsing.

This commit is contained in:
Michael Scire
2018-06-25 01:45:25 -06:00
parent 6ffc9bd8e0
commit 851d21a276
3 changed files with 207 additions and 3 deletions

View File

@@ -2,16 +2,24 @@
#include <switch.h>
#include "creport_debug_types.hpp"
class CrashReport {
private:
Handle debug_handle;
bool has_extra_info;
Result result;
/* Attach Process Info. */
AttachProcessInfo process_info;
u64 userdata_5x_address;
u64 userdata_5x_size;
public:
CrashReport() : debug_handle(INVALID_HANDLE), result(0x4A2) { }
CrashReport() : debug_handle(INVALID_HANDLE), result(0xC6A8), process_info({0}) { }
void BuildReport(u64 pid, bool has_extra_info);
void ProcessExceptions();
Result GetResult() {
return this->result;
@@ -21,10 +29,25 @@ class CrashReport {
return R_SUCCEEDED(svcDebugActiveProcess(&debug_handle, pid));
}
bool IsOpen() {
return this->debug_handle != INVALID_HANDLE;
}
void Close() {
if (debug_handle != INVALID_HANDLE) {
if (IsOpen()) {
svcCloseHandle(debug_handle);
debug_handle = INVALID_HANDLE;
}
}
bool IsApplication() {
return (process_info.flags & 0x40) != 0;
}
bool Is64Bit() {
return (process_info.flags & 0x01) != 0;
}
private:
void HandleAttachProcess(DebugEventInfo &d);
void HandleException(DebugEventInfo &d);
};