RSX-Debugger: Implement backwards scrolling

* Use 2 points of known true RSX code roots and follow them in order to peek at the current section of valid RSX code:
These roots are: current RSX instruction address and the last targeted address by a branch instruction.
This commit is contained in:
Eladash 2022-03-25 18:17:25 +03:00 committed by Ivan
parent 26d8120168
commit 1d51f3af0c
10 changed files with 108 additions and 34 deletions

View file

@ -8,6 +8,7 @@
#include "Emu/CPU/CPUDisAsm.h"
#include "Emu/CPU/CPUThread.h"
#include "Emu/RSX/RSXDisAsm.h"
#include "Emu/RSX/RSXThread.h"
#include "Emu/System.h"
#include <QMouseEvent>
@ -164,6 +165,16 @@ void debugger_list::scroll(s32 steps)
steps--;
}
if (m_cpu && m_cpu->id_type() == 0x55 && steps < 0)
{
// If scrolling backwards (upwards), try to obtain the start of commands tail
if (auto [count, res] = static_cast<rsx::thread*>(m_cpu)->try_get_pc_of_x_cmds_backwards(-steps, m_pc); count == 0u - steps)
{
steps = 0;
m_pc = res;
}
}
ShowAddress(m_pc + (steps * 4), false, true);
}