Memoize and print r3-r6 under Current function in the ppu_thread::dump()

This commit is contained in:
Nekotekina 2020-03-22 12:23:58 +03:00
parent 7d33ca7059
commit e606130262
3 changed files with 5 additions and 3 deletions

View File

@ -9,7 +9,7 @@ using ppu_function_t = bool(*)(ppu_thread&);
const auto old_f = ppu.current_function;\
if (!old_f) ppu.last_function = #func;\
ppu.current_function = #func;\
ppu.syscall_r3 = ppu.gpr[3];\
std::memcpy(ppu.syscall_args, ppu.gpr + 3, sizeof(ppu.syscall_args)); \
ppu_func_detail::do_call(ppu, func);\
ppu.current_function = old_f;\
ppu.cia += 4;\

View File

@ -432,7 +432,9 @@ std::string ppu_thread::dump() const
ret += "Current function: ";
ret += _func;
ret += '\n';
fmt::append(ret, "syscall r3: 0x%llx\n", syscall_r3);
for (u32 i = 3; i <= 6; i++)
fmt::append(ret, " ** GPR[%d] = 0x%llx\n", i, syscall_args[i - 3]);
}
else if (is_paused())
{

View File

@ -189,7 +189,7 @@ public:
cmd64 cmd_get(u32 index) { return cmd_queue[cmd_queue.peek() + index].load(); }
u64 start_time{0}; // Sleep start timepoint
u64 syscall_r3{0}; // Save r3 before syscalls
alignas(64) u64 syscall_args[4]{0}; // Last syscall arguments stored
const char* current_function{}; // Current function name for diagnosis, optimized for speed.
const char* last_function{}; // Sticky copy of current_function, is not cleared on function return