Debugger: Print error codes stored in GPR

This commit is contained in:
Eladash 2023-02-11 21:32:38 +02:00 committed by Megamouse
parent 1dac708323
commit 3976018980
2 changed files with 51 additions and 3 deletions

View File

@ -1060,7 +1060,32 @@ void ppu_thread::dump_regs(std::string& ret) const
is_const = false;
}
fmt::append(ret, "r%d%s%s 0x%-8llx", i, i <= 9 ? " " : "", is_const ? "©" : ":", reg);
fmt::append(ret, "r%d%s%s ", i, i <= 9 ? " " : "", is_const ? "©" : ":");
bool printed_error = false;
if ((reg >> 31) == 0x1'ffff'ffff)
{
const usz old_size = ret.size();
fmt::append(ret, "%s (0x%x)", CellError{static_cast<u32>(reg)}, reg);
// Test if failed to format (appended " 0x8".. in such case)
if (ret[old_size] == '0')
{
// Failed
ret.resize(old_size);
}
else
{
printed_error = true;
}
}
if (!printed_error)
{
fmt::append(ret, "0x%-8llx", reg);
}
constexpr u32 max_str_len = 32;
constexpr u32 hex_count = 8;

View File

@ -1074,8 +1074,31 @@ void spu_thread::dump_regs(std::string& ret) const
if (is_packed)
{
// Shortand formatting
fmt::append(ret, "%08x", i3);
bool printed_error = false;
if (i3 >> 31)
{
const usz old_size = ret.size();
fmt::append(ret, "%s (0x%x)", CellError{i3}, i3);
// Test if failed to format (appended " 0x8".. in such case)
if (ret[old_size] == '0')
{
// Failed
ret.resize(old_size);
}
else
{
printed_error = true;
}
}
if (!printed_error)
{
// Shortand formatting
fmt::append(ret, "08x", i3);
}
}
else
{