Minor debugger fixups

This commit is contained in:
Eladash 2020-04-03 11:21:18 +03:00 committed by Ivan
parent 3f559cd86e
commit 0beea91d5e
3 changed files with 34 additions and 24 deletions

View File

@ -372,10 +372,10 @@ extern bool ppu_patch(u32 addr, u32 value)
std::string ppu_thread::dump_all() const
{
std::string ret = cpu_thread::dump_misc() + '\n';
ret += dump_misc() + '\n';
ret += dump_regs() + '\n';
std::string ret = cpu_thread::dump_misc();
ret += '\n';
ret += dump_regs();
ret += '\n';
ret += dump_callstack();
return ret;
@ -389,16 +389,16 @@ std::string ppu_thread::dump_regs() const
{
auto reg = gpr[i];
fmt::append(ret, "GPR[%-2d] = 0x%-8llx", i, reg);
fmt::append(ret, "r%d%s = 0x%-8llx", i, i <= 9 ? " " : "", reg);
const u32 max_str_len = 32;
const u32 hex_count = 10;
const u32 hex_count = 8;
if (vm::check_addr(reg, max_str_len, vm::page_readable))
if (reg <= UINT32_MAX && vm::check_addr(static_cast<u32>(reg), max_str_len, vm::page_readable))
{
const u64 reg_ptr = vm::read64(reg);
if (vm::check_addr(reg_ptr, max_str_len, vm::page_readable))
if (reg_ptr <= UINT32_MAX && vm::check_addr(static_cast<u32>(reg_ptr), max_str_len, vm::page_readable))
{
reg = reg_ptr;
}
@ -409,11 +409,11 @@ std::string ppu_thread::dump_regs() const
if (std::isprint(static_cast<u8>(buf_tmp[0])) && std::isprint(static_cast<u8>(buf_tmp[1])) && std::isprint(static_cast<u8>(buf_tmp[2])))
{
fmt::append(ret, " -> \"%s\"", buf_tmp.c_str());
fmt::append(ret, " -> \"%s\"", buf_tmp.c_str());
}
else
{
fmt::append(ret, " -> ");
fmt::append(ret, " -> ");
for (u32 j = 0; j < hex_count; ++j)
{
@ -424,8 +424,16 @@ std::string ppu_thread::dump_regs() const
fmt::append(ret, "\n");
}
for (uint i = 0; i < 32; ++i) fmt::append(ret, "FPR[%d] = %.6G\n", i, fpr[i]);
for (uint i = 0; i < 32; ++i) fmt::append(ret, "VR[%d] = %s [x: %g y: %g z: %g w: %g]\n", i, vr[i], vr[i]._f[3], vr[i]._f[2], vr[i]._f[1], vr[i]._f[0]);
for (uint i = 0; i < 32; ++i)
{
fmt::append(ret, "f%d%s = %.6G\n", i, i <= 9 ? " " : "", fpr[i]);
}
for (uint i = 0; i < 32; ++i)
{
fmt::append(ret, "v%d%s = %s [x: %g y: %g z: %g w: %g]\n", i, i <= 9 ? " " : "", vr[i], vr[i]._f[3], vr[i]._f[2], vr[i]._f[1], vr[i]._f[0]);
}
fmt::append(ret, "CR = 0x%08x\n", cr.pack());
fmt::append(ret, "LR = 0x%llx\n", lr);
@ -501,7 +509,9 @@ std::string ppu_thread::dump_misc() const
fmt::append(ret, "Priority: %d\n", +prio);
fmt::append(ret, "Stack: 0x%x..0x%x\n", stack_addr, stack_addr + stack_size - 1);
fmt::append(ret, "Joiner: %s\n", joiner.load());
fmt::append(ret, "Commands: %u\n", cmd_queue.size());
if (const auto size = cmd_queue.size())
fmt::append(ret, "Commands: %u\n", size);
const char* _func = current_function;
@ -512,7 +522,8 @@ std::string ppu_thread::dump_misc() const
ret += '\n';
for (u32 i = 3; i <= 6; i++)
fmt::append(ret, " ** GPR[%d] = 0x%llx\n", i, syscall_args[i - 3]);
if (gpr[i] != syscall_args[i - 3])
fmt::append(ret, " ** r%d = 0x%llx\n", i, syscall_args[i - 3]);
}
else if (is_paused())
{

View File

@ -1011,9 +1011,8 @@ spu_imm_table_t::spu_imm_table_t()
std::string spu_thread::dump_all() const
{
std::string ret = cpu_thread::dump_misc() + '\n';
ret += dump_misc() + '\n';
std::string ret = cpu_thread::dump_misc();
ret += '\n';
ret += dump_regs();
return ret;
@ -1025,7 +1024,7 @@ std::string spu_thread::dump_regs() const
for (u32 i = 0; i < 128; i++)
{
fmt::append(ret, "\nGPR[%d] = %s", i, gpr[i]);
fmt::append(ret, "r%d = %s\n", i, gpr[i]);
}
return ret;
@ -1045,7 +1044,7 @@ std::string spu_thread::dump_misc() const
{
std::string ret;
fmt::append(ret, "\nBlock Weight: %u (Retreats: %u)", block_counter, block_failure);
fmt::append(ret, "Block Weight: %u (Retreats: %u)", block_counter, block_failure);
if (g_cfg.core.spu_prof)
{
@ -1074,7 +1073,7 @@ std::string spu_thread::dump_misc() const
}
else
{
fmt::append(ret, "\n[-]");
break;
}
}

View File

@ -56,9 +56,9 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const s
{
if (_cpu->id_type() == 1)
{
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("GPR[%d]", i)));
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("FPR[%d]", i)));
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("VR[%d]", i)));
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("r%d", i)));
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("f%d", i)));
for (int i = 0; i < 32; i++) m_register_combo->addItem(qstr(fmt::format("v%d", i)));
m_register_combo->addItem("CR");
m_register_combo->addItem("LR");
m_register_combo->addItem("CTR");
@ -67,7 +67,7 @@ register_editor_dialog::register_editor_dialog(QWidget *parent, u32 _pc, const s
}
else
{
for (int i = 0; i < 128; i++) m_register_combo->addItem(qstr(fmt::format("GPR[%d]", i)));
for (int i = 0; i < 128; i++) m_register_combo->addItem(qstr(fmt::format("r%d", i)));
}
}