mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-19 17:35:06 -04:00
Fatal: save auto-debug info to SD card.
This commit is contained in:
parent
962fa0a690
commit
8054b2d219
8 changed files with 151 additions and 6 deletions
|
@ -146,6 +146,7 @@ void TryCollectDebugInformation(FatalThrowContext *ctx, u64 pid) {
|
|||
while (R_SUCCEEDED(svcGetDebugEvent((u8 *)&d, debug_handle))) {
|
||||
if (d.type == DebugEventType::AttachProcess) {
|
||||
ctx->cpu_ctx.is_aarch32 = (d.info.attach_process.flags & 1) == 0;
|
||||
memcpy(ctx->proc_name, d.info.attach_process.name, sizeof(d.info.attach_process.name));
|
||||
got_attach_process = true;
|
||||
} else if (d.type == DebugEventType::AttachThread) {
|
||||
thread_id_to_tls[d.info.attach_thread.thread_id] = d.info.attach_thread.tls_address;
|
||||
|
@ -228,6 +229,16 @@ void TryCollectDebugInformation(FatalThrowContext *ctx, u64 pid) {
|
|||
cur_fp = cur_frame.fp;
|
||||
}
|
||||
|
||||
/* Try to read up to 0x100 of stack. */
|
||||
for (size_t sz = 0x100; sz > 0; sz -= 0x10) {
|
||||
if (IsAddressReadable(debug_handle, ctx->cpu_ctx.aarch64_ctx.sp, sz, nullptr)) {
|
||||
if (R_SUCCEEDED(svcReadDebugProcessMemory(ctx->stack_dump, debug_handle, ctx->cpu_ctx.aarch64_ctx.sp, sz))) {
|
||||
ctx->stack_dump_size = sz;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the starting address. */
|
||||
{
|
||||
u64 guess = thread_ctx.pc.x;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue