Debug fixes

This commit is contained in:
Eladash 2023-07-09 08:45:15 +03:00 committed by Elad Ashkenazi
parent 050b8fa7df
commit 17d8f2884e
3 changed files with 31 additions and 9 deletions

View file

@ -133,14 +133,26 @@ void fmt_class_string<typename ppu_thread::call_history_t>::format(std::string&
PPUDisAsm dis_asm(cpu_disasm_mode::normal, vm::g_sudo_addr);
for (u64 count = 0, idx = history.index - 1; idx != umax && count < ppu_thread::call_history_max_size; count++, idx--)
for (u64 count = 0, idx = history.index - 1; idx != umax && count < history.data.size(); count++, idx--)
{
const u32 pc = history.data[idx % ppu_thread::call_history_max_size];
const u32 pc = history.data[idx % history.data.size()];
dis_asm.disasm(pc);
fmt::append(out, "\n(%u) 0x%08x: %s", count, pc, dis_asm.last_opcode);
}
}
template <>
void fmt_class_string<typename ppu_thread::syscall_history_t>::format(std::string& out, u64 arg)
{
const auto& history = get_object(arg);
for (u64 count = 0, idx = history.index - 1; idx != umax && count < history.data.size(); count++, idx--)
{
const auto& entry = history.data[idx % history.data.size()];
fmt::append(out, "\n(%u) 0x%08x: %s, 0x%x, r3=0x%x, r4=0x%x, r5=0x%x, r6=0x%x", count, entry.cia, entry.func_name, entry.error, entry.args[0], entry.args[1], entry.args[2], entry.args[3]);
}
}
extern const ppu_decoder<ppu_itype> g_ppu_itype{};
extern const ppu_decoder<ppu_iname> g_ppu_iname{};
@ -1601,6 +1613,15 @@ void ppu_thread::dump_all(std::string& ret) const
fmt::append(ret, "%s", call_history);
}
if (syscall_history.data.size() > 1)
{
ret +=
"\nHLE/LV2 History:"
"\n================";
fmt::append(ret, "%s", syscall_history);
}
}
extern thread_local std::string(*g_tls_log_prefix)();