fatal/creport: Add cpu context.
This commit is contained in:
@@ -28,7 +28,7 @@ struct CodeInfo {
|
||||
};
|
||||
|
||||
class CodeList {
|
||||
private:
|
||||
public:
|
||||
static const size_t max_code_count = 0x10;
|
||||
u32 code_count = 0;
|
||||
CodeInfo code_infos[max_code_count];
|
||||
|
||||
@@ -42,6 +42,35 @@ void CrashReport::BuildReport(u64 pid, bool has_extra_info) {
|
||||
}
|
||||
}
|
||||
|
||||
FatalContext *CrashReport::GetFatalContext() {
|
||||
FatalContext *ctx = new FatalContext;
|
||||
*ctx = (FatalContext){0};
|
||||
|
||||
ctx->is_aarch32 = false;
|
||||
ctx->type = static_cast<u32>(this->exception_info.type);
|
||||
|
||||
for (size_t i = 0; i < 29; i++) {
|
||||
ctx->aarch64_ctx.x[i] = this->crashed_thread_info.context.cpu_gprs[i].x;
|
||||
}
|
||||
ctx->aarch64_ctx.fp = this->crashed_thread_info.context.fp;
|
||||
ctx->aarch64_ctx.lr = this->crashed_thread_info.context.lr;
|
||||
ctx->aarch64_ctx.pc = this->crashed_thread_info.context.pc.x;
|
||||
|
||||
ctx->aarch64_ctx.stack_trace_size = this->crashed_thread_info.stack_trace_size;
|
||||
for (size_t i = 0; i < ctx->aarch64_ctx.stack_trace_size; i++) {
|
||||
ctx->aarch64_ctx.stack_trace[i] = this->crashed_thread_info.stack_trace[i];
|
||||
}
|
||||
|
||||
if (this->code_list.code_count) {
|
||||
ctx->aarch64_ctx.start_address = this->code_list.code_infos[0].start_address;
|
||||
}
|
||||
|
||||
/* For ams fatal... */
|
||||
ctx->aarch64_ctx.afsr0 = this->process_info.title_id;
|
||||
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void CrashReport::ProcessExceptions() {
|
||||
if (!IsOpen()) {
|
||||
return;
|
||||
|
||||
@@ -61,6 +61,7 @@ class CrashReport {
|
||||
|
||||
public:
|
||||
void BuildReport(u64 pid, bool has_extra_info);
|
||||
FatalContext *GetFatalContext();
|
||||
void SaveReport();
|
||||
|
||||
bool IsAddressReadable(u64 address, u64 size, MemoryInfo *mi = NULL);
|
||||
|
||||
@@ -132,7 +132,9 @@ int main(int argc, char **argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
fatalWithType(g_Creport.GetResult(), FatalType_ErrorScreen);
|
||||
FatalContext *ctx = g_Creport.GetFatalContext();
|
||||
|
||||
fatalWithContext(g_Creport.GetResult(), FatalType_ErrorScreen, ctx);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "creport_code_info.hpp"
|
||||
|
||||
class ThreadInfo {
|
||||
private:
|
||||
public:
|
||||
ThreadContext context{};
|
||||
u64 thread_id = 0;
|
||||
u64 stack_top = 0;
|
||||
|
||||
Reference in New Issue
Block a user