rsx-debugger: bugfixes and improvements

*always translate given address
*add a few missing methods names
*fix branches
This commit is contained in:
eladash 2018-08-17 22:11:32 +03:00 committed by kd-11
parent 56d553f10d
commit 874d18f761
3 changed files with 19 additions and 14 deletions

View file

@ -6,6 +6,11 @@
namespace namespace
{ {
const std::unordered_map<u32, const char*> methods_name = { const std::unordered_map<u32, const char*> methods_name = {
{NV406E_SET_REFERENCE, "NV406E_SET_REFERENCE"},
{NV406E_SET_CONTEXT_DMA_SEMAPHORE, "NV406E_SET_CONTEXT_DMA_SEMAPHORE"},
{NV406E_SEMAPHORE_OFFSET, "NV406E_SEMAPHORE_OFFSET"},
{NV406E_SEMAPHORE_ACQUIRE, "NV406E_SEMAPHORE_ACQUIRE"},
{NV406E_SEMAPHORE_RELEASE, "NV406E_SEMAPHORE_RELEASE"},
{NV4097_NO_OPERATION, "NV4097_NO_OPERATION"}, {NV4097_NOTIFY, "NV4097_NOTIFY"}, {NV4097_NO_OPERATION, "NV4097_NO_OPERATION"}, {NV4097_NOTIFY, "NV4097_NOTIFY"},
{NV4097_WAIT_FOR_IDLE, "NV4097_WAIT_FOR_IDLE"}, {NV4097_PM_TRIGGER, "NV4097_PM_TRIGGER"}, {NV4097_WAIT_FOR_IDLE, "NV4097_WAIT_FOR_IDLE"}, {NV4097_PM_TRIGGER, "NV4097_PM_TRIGGER"},
{NV4097_SET_CONTEXT_DMA_NOTIFIES, "NV4097_SET_CONTEXT_DMA_NOTIFIES"}, {NV4097_SET_CONTEXT_DMA_NOTIFIES, "NV4097_SET_CONTEXT_DMA_NOTIFIES"},

View file

@ -215,9 +215,9 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
{ {
if (const auto render = rsx::get_current_renderer()) if (const auto render = rsx::get_current_renderer())
{ {
if (u32 realAddr = RSXIOMem.RealAddr(render->ctrl->get.load())) if (RSXIOMem.RealAddr(render->ctrl->get.load()))
{ {
m_addr = realAddr; m_addr = render->ctrl->get.load();
UpdateInformation(); UpdateInformation();
} }
} }
@ -226,9 +226,9 @@ rsx_debugger::rsx_debugger(std::shared_ptr<gui_settings> gui_settings, QWidget*
{ {
if (const auto render = rsx::get_current_renderer()) if (const auto render = rsx::get_current_renderer())
{ {
if (u32 realAddr = RSXIOMem.RealAddr(render->ctrl->put.load())) if (RSXIOMem.RealAddr(render->ctrl->put.load()))
{ {
m_addr = realAddr; m_addr = render->ctrl->put.load();
UpdateInformation(); UpdateInformation();
} }
} }
@ -622,12 +622,12 @@ void rsx_debugger::GetMemory()
address_item->setData(Qt::UserRole, addr); address_item->setData(Qt::UserRole, addr);
m_list_commands->setItem(i, 0, address_item); m_list_commands->setItem(i, 0, address_item);
if (vm::check_addr(addr)) if (vm::check_addr(RSXIOMem.RealAddr(addr)))
{ {
u32 cmd = vm::read32(addr); u32 cmd = vm::read32(RSXIOMem.RealAddr(addr));
u32 count = (cmd >> 18) & 0x7ff; u32 count = (cmd >> 18) & 0x7ff;
m_list_commands->setItem(i, 1, new QTableWidgetItem(qstr(fmt::format("%08x", cmd)))); m_list_commands->setItem(i, 1, new QTableWidgetItem(qstr(fmt::format("%08x", cmd))));
m_list_commands->setItem(i, 2, new QTableWidgetItem(DisAsmCommand(cmd, count, addr, 0))); m_list_commands->setItem(i, 2, new QTableWidgetItem(DisAsmCommand(cmd, count, addr)));
m_list_commands->setItem(i, 3, new QTableWidgetItem(QString::number(count))); m_list_commands->setItem(i, 3, new QTableWidgetItem(QString::number(count)));
if((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) != RSX_METHOD_OLD_JUMP_CMD if((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) != RSX_METHOD_OLD_JUMP_CMD
@ -1066,7 +1066,7 @@ const char* rsx_debugger::ParseGCMEnum(u32 value, u32 type)
index = (cmd - a) / m; \ index = (cmd - a) / m; \
case a \ case a \
QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioAddr) QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 ioAddr)
{ {
std::string disasm; std::string disasm;
@ -1074,17 +1074,17 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioA
if((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) == RSX_METHOD_OLD_JUMP_CMD) if((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) == RSX_METHOD_OLD_JUMP_CMD)
{ {
u32 jumpAddr = cmd & RSX_METHOD_OLD_JUMP_OFFSET_MASK; u32 jumpAddr = cmd & RSX_METHOD_OLD_JUMP_OFFSET_MASK;
DISASM("JUMP: %08x -> %08x", currentAddr, ioAddr+jumpAddr); DISASM("JUMP: %08x -> %08x", ioAddr, jumpAddr);
} }
else if((cmd & RSX_METHOD_NEW_JUMP_CMD_MASK) == RSX_METHOD_NEW_JUMP_CMD) else if((cmd & RSX_METHOD_NEW_JUMP_CMD_MASK) == RSX_METHOD_NEW_JUMP_CMD)
{ {
u32 jumpAddr = cmd & RSX_METHOD_NEW_JUMP_OFFSET_MASK; u32 jumpAddr = cmd & RSX_METHOD_NEW_JUMP_OFFSET_MASK;
DISASM("JUMP: %08x -> %08x", currentAddr, ioAddr + jumpAddr); DISASM("JUMP: %08x -> %08x", ioAddr, jumpAddr);
} }
else if((cmd & RSX_METHOD_CALL_CMD_MASK) == RSX_METHOD_CALL_CMD) else if((cmd & RSX_METHOD_CALL_CMD_MASK) == RSX_METHOD_CALL_CMD)
{ {
u32 callAddr = cmd & RSX_METHOD_CALL_OFFSET_MASK; u32 callAddr = cmd & RSX_METHOD_CALL_OFFSET_MASK;
DISASM("CALL: %08x -> %08x", currentAddr, ioAddr+callAddr); DISASM("CALL: %08x -> %08x", ioAddr, callAddr);
} }
if(cmd == RSX_METHOD_RETURN_CMD) if(cmd == RSX_METHOD_RETURN_CMD)
{ {
@ -1093,14 +1093,14 @@ QString rsx_debugger::DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioA
if(cmd == 0) if(cmd == 0)
{ {
DISASM("Null cmd"); DISASM("NOP");
} }
else if ((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) != RSX_METHOD_OLD_JUMP_CMD else if ((cmd & RSX_METHOD_OLD_JUMP_CMD_MASK) != RSX_METHOD_OLD_JUMP_CMD
&& (cmd & RSX_METHOD_NEW_JUMP_CMD_MASK) != RSX_METHOD_NEW_JUMP_CMD && (cmd & RSX_METHOD_NEW_JUMP_CMD_MASK) != RSX_METHOD_NEW_JUMP_CMD
&& (cmd & RSX_METHOD_CALL_CMD_MASK) != RSX_METHOD_CALL_CMD && (cmd & RSX_METHOD_CALL_CMD_MASK) != RSX_METHOD_CALL_CMD
&& cmd != RSX_METHOD_RETURN_CMD) && cmd != RSX_METHOD_RETURN_CMD)
{ {
auto args = vm::ptr<u32>::make(currentAddr + 4); auto args = vm::ptr<u32>::make(RSXIOMem.RealAddr(ioAddr + 4));
u32 index = 0; u32 index = 0;
switch((cmd & 0x3ffff) >> 2) switch((cmd & 0x3ffff) >> 2)

View file

@ -92,7 +92,7 @@ public:
virtual void GetSettings(); virtual void GetSettings();
const char* ParseGCMEnum(u32 value, u32 type); const char* ParseGCMEnum(u32 value, u32 type);
QString DisAsmCommand(u32 cmd, u32 count, u32 currentAddr, u32 ioAddr); QString DisAsmCommand(u32 cmd, u32 count, u32 ioAddr);
void SetPC(const uint pc); void SetPC(const uint pc);