1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-05 19:51:45 +00:00

creport: Fix formatting error.

This commit is contained in:
Michael Scire 2019-01-19 16:32:33 -08:00
parent 50db685274
commit 2a2d1bc78b

View file

@ -19,8 +19,10 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <switch.h>
#include "creport_crash_report.hpp"
#include "creport_debug_types.hpp"
void CrashReport::BuildReport(u64 pid, bool has_extra_info) {
this->has_extra_info = has_extra_info;
if (OpenProcess(pid)) {
@ -44,6 +46,7 @@ void CrashReport::BuildReport(u64 pid, bool has_extra_info) {
Close();
}
}
FatalContext *CrashReport::GetFatalContext() {
FatalContext *ctx = new FatalContext;
*ctx = (FatalContext){0};
@ -72,6 +75,7 @@ FatalContext *CrashReport::GetFatalContext() {
return ctx;
}
void CrashReport::ProcessExceptions() {
if (!IsOpen()) {
return;
@ -94,6 +98,7 @@ void CrashReport::ProcessExceptions() {
}
}
}
void CrashReport::HandleAttachProcess(DebugEventInfo &d) {
this->process_info = d.info.attach_process;
if (kernelAbove500() && IsApplication()) {
@ -131,6 +136,7 @@ void CrashReport::HandleAttachProcess(DebugEventInfo &d) {
this->dying_message_size = userdata_size;
}
}
void CrashReport::HandleException(DebugEventInfo &d) {
switch (d.info.exception.type) {
case DebugExceptionType::UndefinedInstruction:
@ -177,6 +183,7 @@ void CrashReport::HandleException(DebugEventInfo &d) {
/* Parse crashing thread info. */
this->crashed_thread_info.ReadFromProcess(this->debug_handle, d.thread_id, Is64Bit());
}
void CrashReport::ProcessDyingMessage() {
/* Dying message is only stored starting in 5.0.0. */
if (!kernelAbove500()) {
@ -202,6 +209,7 @@ void CrashReport::ProcessDyingMessage() {
svcReadDebugProcessMemory(this->dying_message, this->debug_handle, this->dying_message_address, this->dying_message_size);
}
bool CrashReport::IsAddressReadable(u64 address, u64 size, MemoryInfo *o_mi) {
MemoryInfo mi;
u32 pi;
@ -225,6 +233,7 @@ bool CrashReport::IsAddressReadable(u64 address, u64 size, MemoryInfo *o_mi) {
}
return true;
}
bool CrashReport::GetCurrentTime(u64 *out) {
*out = 0;
@ -247,6 +256,7 @@ bool CrashReport::GetCurrentTime(u64 *out) {
}
return success;
}
void CrashReport::EnsureReportDirectories() {
char path[FS_MAX_PATH];
strcpy(path, "sdmc:/atmosphere");
@ -256,6 +266,7 @@ void CrashReport::EnsureReportDirectories() {
strcat(path, "/dumps");
mkdir(path, S_IRWXU);
}
void CrashReport::SaveReport() {
/* Save the report to the SD card. */
char report_path[FS_MAX_PATH];
@ -284,6 +295,7 @@ void CrashReport::SaveReport() {
this->thread_list.DumpBinary(f_report, this->crashed_thread_info.GetId());
fclose(f_report);
}
void CrashReport::SaveToFile(FILE *f_report) {
char buf[0x10] = {0};
fprintf(f_report, "Atmosphère Crash Report (v1.2):\n");
@ -341,6 +353,7 @@ void CrashReport::SaveToFile(FILE *f_report) {
fprintf(f_report, "\nThread Report:\n");
this->thread_list.SaveToFile(f_report);
}
/* Lifted from hactool. */
void CrashReport::Memdump(FILE *f, const char *prefix, const void *data, size_t size) {
uint8_t *p = (uint8_t *)data;