mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-22 10:42:36 +01:00
Debugger: Allow to unpause a thread which has been paused by global pause
This commit is contained in:
parent
cf6606065d
commit
cfc7865f82
@ -33,6 +33,8 @@
|
||||
|
||||
constexpr auto qstr = QString::fromStdString;
|
||||
|
||||
constexpr auto s_pause_flags = cpu_flag::dbg_pause + cpu_flag::dbg_global_pause;
|
||||
|
||||
debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *parent)
|
||||
: custom_dock_widget(tr("Debugger"), parent), xgui_settings(settings)
|
||||
{
|
||||
@ -140,11 +142,24 @@ debugger_frame::debugger_frame(std::shared_ptr<gui_settings> settings, QWidget *
|
||||
{
|
||||
if (const auto cpu = get_cpu())
|
||||
{
|
||||
// Alter dbg_pause bit state (disable->enable, enable->disable)
|
||||
const auto old = cpu->state.xor_fetch(cpu_flag::dbg_pause);
|
||||
// If paused, unpause.
|
||||
// If not paused, add dbg_pause.
|
||||
const auto old = cpu->state.atomic_op([](bs_t<cpu_flag>& state)
|
||||
{
|
||||
if (state & s_pause_flags)
|
||||
{
|
||||
state -= s_pause_flags;
|
||||
}
|
||||
else
|
||||
{
|
||||
state += cpu_flag::dbg_pause;
|
||||
}
|
||||
|
||||
return state;
|
||||
});
|
||||
|
||||
// Notify only if no pause flags are set after this change
|
||||
if (!(old & (cpu_flag::dbg_pause + cpu_flag::dbg_global_pause)))
|
||||
if (!(old & s_pause_flags))
|
||||
{
|
||||
cpu->notify();
|
||||
}
|
||||
@ -441,7 +456,7 @@ void debugger_frame::UpdateUI()
|
||||
m_last_pc = cia;
|
||||
DoUpdate();
|
||||
|
||||
if (cpu->state & cpu_flag::dbg_pause)
|
||||
if (cpu->state & s_pause_flags)
|
||||
{
|
||||
m_btn_run->setText(RunString);
|
||||
m_btn_step->setEnabled(true);
|
||||
@ -725,13 +740,7 @@ void debugger_frame::DoStep(bool stepOver)
|
||||
{
|
||||
bool should_step_over = stepOver && cpu->id_type() == 1;
|
||||
|
||||
if (+cpu_flag::dbg_pause & +cpu->state.fetch_op([&](bs_t<cpu_flag>& state)
|
||||
{
|
||||
if (!should_step_over)
|
||||
state += cpu_flag::dbg_step;
|
||||
|
||||
state -= cpu_flag::dbg_pause;
|
||||
}))
|
||||
if (cpu->state & s_pause_flags)
|
||||
{
|
||||
if (should_step_over)
|
||||
{
|
||||
@ -751,6 +760,13 @@ void debugger_frame::DoStep(bool stepOver)
|
||||
m_last_step_over_breakpoint = next_instruction_pc;
|
||||
}
|
||||
|
||||
cpu->state.atomic_op([&](bs_t<cpu_flag>& state)
|
||||
{
|
||||
state -= s_pause_flags;
|
||||
|
||||
if (!should_step_over) state += cpu_flag::dbg_step;
|
||||
});
|
||||
|
||||
cpu->notify();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user