fatal: include stack/tls in reports
This commit is contained in:
@@ -81,7 +81,7 @@ namespace ams::fatal::srv {
|
||||
if (f_report != NULL) {
|
||||
ON_SCOPE_EXIT { fclose(f_report); };
|
||||
|
||||
fprintf(f_report, "Atmosphère Fatal Report (v1.0):\n");
|
||||
fprintf(f_report, "Atmosphère Fatal Report (v1.1):\n");
|
||||
fprintf(f_report, "Result: 0x%X (2%03d-%04d)\n\n", this->context->result.GetValue(), this->context->result.GetModule(), this->context->result.GetDescription());
|
||||
fprintf(f_report, "Program ID: %016lx\n", static_cast<u64>(this->context->program_id));
|
||||
if (strlen(this->context->proc_name)) {
|
||||
@@ -114,16 +114,41 @@ namespace ams::fatal::srv {
|
||||
fprintf(f_report, " ReturnAddress[%02u]: %016lx\n", i, this->context->cpu_ctx.aarch64_ctx.stack_trace[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->context->stack_dump_size != 0) {
|
||||
fprintf(f_report, "Stack Dump: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n");
|
||||
for (size_t i = 0; i < 0x10; i++) {
|
||||
const size_t ofs = i * 0x10;
|
||||
fprintf(f_report, " %012lx %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
this->context->stack_dump_base + ofs, this->context->stack_dump[ofs + 0], this->context->stack_dump[ofs + 1], this->context->stack_dump[ofs + 2], this->context->stack_dump[ofs + 3], this->context->stack_dump[ofs + 4], this->context->stack_dump[ofs + 5], this->context->stack_dump[ofs + 6], this->context->stack_dump[ofs + 7],
|
||||
this->context->stack_dump[ofs + 8], this->context->stack_dump[ofs + 9], this->context->stack_dump[ofs + 10], this->context->stack_dump[ofs + 11], this->context->stack_dump[ofs + 12], this->context->stack_dump[ofs + 13], this->context->stack_dump[ofs + 14], this->context->stack_dump[ofs + 15]);
|
||||
}
|
||||
}
|
||||
|
||||
if (this->context->tls_address != 0) {
|
||||
fprintf(f_report, "TLS Address: %016lx\n", this->context->tls_address);
|
||||
fprintf(f_report, "TLS Dump: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f\n");
|
||||
for (size_t i = 0; i < 0x10; i++) {
|
||||
const size_t ofs = i * 0x10;
|
||||
fprintf(f_report, " %012lx %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
this->context->tls_address + ofs, this->context->tls_dump[ofs + 0], this->context->tls_dump[ofs + 1], this->context->tls_dump[ofs + 2], this->context->tls_dump[ofs + 3], this->context->tls_dump[ofs + 4], this->context->tls_dump[ofs + 5], this->context->tls_dump[ofs + 6], this->context->tls_dump[ofs + 7],
|
||||
this->context->tls_dump[ofs + 8], this->context->tls_dump[ofs + 9], this->context->tls_dump[ofs + 10], this->context->tls_dump[ofs + 11], this->context->tls_dump[ofs + 12], this->context->tls_dump[ofs + 13], this->context->tls_dump[ofs + 14], this->context->tls_dump[ofs + 15]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this->context->stack_dump_size) {
|
||||
/* Dump data to file. */
|
||||
{
|
||||
snprintf(file_path, sizeof(file_path) - 1, "sdmc:/atmosphere/fatal_reports/dumps/%011lu_%016lx.bin", timestamp, static_cast<u64>(this->context->program_id));
|
||||
FILE *f_stackdump = fopen(file_path, "wb");
|
||||
if (f_stackdump == NULL) { return; }
|
||||
ON_SCOPE_EXIT { fclose(f_stackdump); };
|
||||
FILE *f_dump = fopen(file_path, "wb");
|
||||
if (f_dump == NULL) { return; }
|
||||
ON_SCOPE_EXIT { fclose(f_dump); };
|
||||
|
||||
fwrite(this->context->stack_dump, this->context->stack_dump_size, 1, f_stackdump);
|
||||
fflush(f_stackdump);
|
||||
fwrite(this->context->tls_dump, sizeof(this->context->tls_dump), 1, f_dump);
|
||||
if (this->context->stack_dump_size) {
|
||||
fwrite(this->context->stack_dump, this->context->stack_dump_size, 1, f_dump);
|
||||
}
|
||||
fflush(f_dump);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user