mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 15:31:26 +12:00
SPU/PPU Debugger: Add decimal mode to registers panel
This commit is contained in:
parent
16f910e350
commit
e882d64d8a
5 changed files with 74 additions and 10 deletions
|
@ -1237,6 +1237,12 @@ std::array<u32, 2> op_branch_targets(u32 pc, ppu_opcode_t op)
|
||||||
|
|
||||||
void ppu_thread::dump_regs(std::string& ret) const
|
void ppu_thread::dump_regs(std::string& ret) const
|
||||||
{
|
{
|
||||||
|
const system_state emu_state = Emu.GetStatus(false);
|
||||||
|
const bool is_stopped_or_frozen = state & cpu_flag::exit || emu_state == system_state::frozen || emu_state <= system_state::stopping;
|
||||||
|
const ppu_debugger_mode mode = debugger_mode.load();
|
||||||
|
|
||||||
|
const bool is_decimal = !is_stopped_or_frozen && mode == ppu_debugger_mode::is_decimal;
|
||||||
|
|
||||||
PPUDisAsm dis_asm(cpu_disasm_mode::normal, vm::g_sudo_addr);
|
PPUDisAsm dis_asm(cpu_disasm_mode::normal, vm::g_sudo_addr);
|
||||||
|
|
||||||
for (uint i = 0; i < 32; ++i)
|
for (uint i = 0; i < 32; ++i)
|
||||||
|
@ -1277,9 +1283,16 @@ void ppu_thread::dump_regs(std::string& ret) const
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!printed_error)
|
if (!printed_error)
|
||||||
|
{
|
||||||
|
if (is_decimal)
|
||||||
|
{
|
||||||
|
fmt::append(ret, "%-11d", reg);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
fmt::append(ret, "0x%-8llx", reg);
|
fmt::append(ret, "0x%-8llx", reg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
constexpr u32 max_str_len = 32;
|
constexpr u32 max_str_len = 32;
|
||||||
constexpr u32 hex_count = 8;
|
constexpr u32 hex_count = 8;
|
||||||
|
@ -1824,7 +1837,7 @@ void ppu_thread::cpu_on_stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: More conditions
|
// TODO: More conditions
|
||||||
if (Emu.IsStopped() && g_cfg.core.spu_debug)
|
if (Emu.IsStopped() && g_cfg.core.ppu_debug)
|
||||||
{
|
{
|
||||||
std::string ret;
|
std::string ret;
|
||||||
dump_all(ret);
|
dump_all(ret);
|
||||||
|
|
|
@ -125,6 +125,15 @@ struct cmd64
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class ppu_debugger_mode : u32
|
||||||
|
{
|
||||||
|
_default,
|
||||||
|
is_float,
|
||||||
|
is_decimal,
|
||||||
|
|
||||||
|
max_mode,
|
||||||
|
};
|
||||||
|
|
||||||
class ppu_thread : public cpu_thread
|
class ppu_thread : public cpu_thread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -300,6 +309,7 @@ public:
|
||||||
u64 exec_bytes = 0; // Amount of "bytes" executed (4 for each instruction)
|
u64 exec_bytes = 0; // Amount of "bytes" executed (4 for each instruction)
|
||||||
|
|
||||||
u32 dbg_step_pc = 0;
|
u32 dbg_step_pc = 0;
|
||||||
|
atomic_t<ppu_debugger_mode> debugger_mode{};
|
||||||
|
|
||||||
struct call_history_t
|
struct call_history_t
|
||||||
{
|
{
|
||||||
|
|
|
@ -1019,7 +1019,12 @@ spu_imm_table_t::spu_imm_table_t()
|
||||||
|
|
||||||
void spu_thread::dump_regs(std::string& ret) const
|
void spu_thread::dump_regs(std::string& ret) const
|
||||||
{
|
{
|
||||||
const bool floats_only = debugger_float_mode.load();
|
const system_state emu_state = Emu.GetStatus(false);
|
||||||
|
const bool is_stopped_or_frozen = state & cpu_flag::exit || emu_state == system_state::frozen || emu_state <= system_state::stopping;
|
||||||
|
const spu_debugger_mode mode = debugger_mode.load();
|
||||||
|
|
||||||
|
const bool floats_only = !is_stopped_or_frozen && mode == spu_debugger_mode::is_float;
|
||||||
|
const bool is_decimal = !is_stopped_or_frozen && mode == spu_debugger_mode::is_decimal;
|
||||||
|
|
||||||
SPUDisAsm dis_asm(cpu_disasm_mode::normal, ls);
|
SPUDisAsm dis_asm(cpu_disasm_mode::normal, ls);
|
||||||
|
|
||||||
|
@ -1097,13 +1102,27 @@ void spu_thread::dump_regs(std::string& ret) const
|
||||||
if (!printed_error)
|
if (!printed_error)
|
||||||
{
|
{
|
||||||
// Shortand formatting
|
// Shortand formatting
|
||||||
|
if (is_decimal)
|
||||||
|
{
|
||||||
|
fmt::append(ret, "%-11d", i3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
fmt::append(ret, "%08x", i3);
|
fmt::append(ret, "%08x", i3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (is_decimal)
|
||||||
|
{
|
||||||
|
fmt::append(ret, "%-11d %-11d %-11d %-11d", r.u32r[0], r.u32r[1], r.u32r[2], r.u32r[3]);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fmt::append(ret, "%08x %08x %08x %08x", r.u32r[0], r.u32r[1], r.u32r[2], r.u32r[3]);
|
fmt::append(ret, "%08x %08x %08x %08x", r.u32r[0], r.u32r[1], r.u32r[2], r.u32r[3]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (i3 >= 0x80 && is_exec_code(i3, ls))
|
if (i3 >= 0x80 && is_exec_code(i3, ls))
|
||||||
{
|
{
|
||||||
|
|
|
@ -608,6 +608,15 @@ struct spu_memory_segment_dump_data
|
||||||
u32 flags = umax;
|
u32 flags = umax;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum class spu_debugger_mode : u32
|
||||||
|
{
|
||||||
|
_default,
|
||||||
|
is_float,
|
||||||
|
is_decimal,
|
||||||
|
|
||||||
|
max_mode,
|
||||||
|
};
|
||||||
|
|
||||||
class spu_thread : public cpu_thread
|
class spu_thread : public cpu_thread
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -794,7 +803,7 @@ public:
|
||||||
u64 start_time{}; // Starting time of STOP or RDCH bloking function
|
u64 start_time{}; // Starting time of STOP or RDCH bloking function
|
||||||
bool unsavable = false; // Flag indicating whether saving the spu thread state is currently unsafe
|
bool unsavable = false; // Flag indicating whether saving the spu thread state is currently unsafe
|
||||||
|
|
||||||
atomic_t<u8> debugger_float_mode = 0;
|
atomic_t<spu_debugger_mode> debugger_mode{};
|
||||||
|
|
||||||
// PC-based breakpoint list
|
// PC-based breakpoint list
|
||||||
std::array<atomic_t<bool>, SPU_LS_SIZE / 4> local_breakpoints{};
|
std::array<atomic_t<bool>, SPU_LS_SIZE / 4> local_breakpoints{};
|
||||||
|
|
|
@ -620,13 +620,26 @@ void debugger_frame::keyPressEvent(QKeyEvent* event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cpu->id_type() != 2)
|
if (cpu->id_type() == 1)
|
||||||
{
|
{
|
||||||
break;
|
static_cast<ppu_thread*>(cpu)->debugger_mode.atomic_op([](ppu_debugger_mode& mode)
|
||||||
|
{
|
||||||
|
mode = static_cast<ppu_debugger_mode>((static_cast<u32>(mode) + 1) % static_cast<u32>(ppu_debugger_mode::max_mode));
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cpu->id_type() == 2)
|
||||||
|
{
|
||||||
|
static_cast<spu_thread*>(cpu)->debugger_mode.atomic_op([](spu_debugger_mode& mode)
|
||||||
|
{
|
||||||
|
mode = static_cast<spu_debugger_mode>((static_cast<u32>(mode) + 1) % static_cast<u32>(spu_debugger_mode::max_mode));
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static_cast<spu_thread*>(cpu)->debugger_float_mode ^= 1; // Switch mode
|
break;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
case Qt::Key_R:
|
case Qt::Key_R:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue