mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 04:02:42 +01:00
SPU/PPU Debugger: Add decimal mode to registers panel
This commit is contained in:
parent
16f910e350
commit
e882d64d8a
@ -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
|
||||
{
|
||||
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);
|
||||
|
||||
for (uint i = 0; i < 32; ++i)
|
||||
@ -1278,7 +1284,14 @@ void ppu_thread::dump_regs(std::string& ret) const
|
||||
|
||||
if (!printed_error)
|
||||
{
|
||||
fmt::append(ret, "0x%-8llx", reg);
|
||||
if (is_decimal)
|
||||
{
|
||||
fmt::append(ret, "%-11d", reg);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::append(ret, "0x%-8llx", reg);
|
||||
}
|
||||
}
|
||||
|
||||
constexpr u32 max_str_len = 32;
|
||||
@ -1824,7 +1837,7 @@ void ppu_thread::cpu_on_stop()
|
||||
}
|
||||
|
||||
// TODO: More conditions
|
||||
if (Emu.IsStopped() && g_cfg.core.spu_debug)
|
||||
if (Emu.IsStopped() && g_cfg.core.ppu_debug)
|
||||
{
|
||||
std::string 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
|
||||
{
|
||||
public:
|
||||
@ -300,6 +309,7 @@ public:
|
||||
u64 exec_bytes = 0; // Amount of "bytes" executed (4 for each instruction)
|
||||
|
||||
u32 dbg_step_pc = 0;
|
||||
atomic_t<ppu_debugger_mode> debugger_mode{};
|
||||
|
||||
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
|
||||
{
|
||||
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);
|
||||
|
||||
@ -1097,12 +1102,26 @@ void spu_thread::dump_regs(std::string& ret) const
|
||||
if (!printed_error)
|
||||
{
|
||||
// Shortand formatting
|
||||
fmt::append(ret, "%08x", i3);
|
||||
if (is_decimal)
|
||||
{
|
||||
fmt::append(ret, "%-11d", i3);
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::append(ret, "%08x", i3);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fmt::append(ret, "%08x %08x %08x %08x", r.u32r[0], r.u32r[1], r.u32r[2], r.u32r[3]);
|
||||
if (is_decimal)
|
||||
{
|
||||
fmt::append(ret, "%-11d %-11d %-11d %-11d", r.u32r[0], r.u32r[1], r.u32r[2], r.u32r[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
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))
|
||||
|
@ -608,6 +608,15 @@ struct spu_memory_segment_dump_data
|
||||
u32 flags = umax;
|
||||
};
|
||||
|
||||
enum class spu_debugger_mode : u32
|
||||
{
|
||||
_default,
|
||||
is_float,
|
||||
is_decimal,
|
||||
|
||||
max_mode,
|
||||
};
|
||||
|
||||
class spu_thread : public cpu_thread
|
||||
{
|
||||
public:
|
||||
@ -794,7 +803,7 @@ public:
|
||||
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
|
||||
|
||||
atomic_t<u8> debugger_float_mode = 0;
|
||||
atomic_t<spu_debugger_mode> debugger_mode{};
|
||||
|
||||
// PC-based breakpoint list
|
||||
std::array<atomic_t<bool>, SPU_LS_SIZE / 4> local_breakpoints{};
|
||||
|
@ -620,13 +620,26 @@ void debugger_frame::keyPressEvent(QKeyEvent* event)
|
||||
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
|
||||
return;
|
||||
break;
|
||||
}
|
||||
case Qt::Key_R:
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user