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