2018-03-02 22:40:29 +01:00
|
|
|
#include "breakpoint_handler.h"
|
|
|
|
|
|
2021-07-30 20:30:29 +02:00
|
|
|
extern bool ppu_breakpoint(u32 loc, bool is_adding);
|
2018-03-02 22:40:29 +01:00
|
|
|
|
2025-03-01 17:08:10 +01:00
|
|
|
bool breakpoint_handler::IsBreakOnBPM() const
|
2018-03-02 22:40:29 +01:00
|
|
|
{
|
2025-03-01 17:08:10 +01:00
|
|
|
return m_break_on_bpm;
|
2018-03-02 22:40:29 +01:00
|
|
|
}
|
|
|
|
|
|
2025-03-01 17:08:10 +01:00
|
|
|
void breakpoint_handler::SetBreakOnBPM(bool break_on_bpm)
|
2018-03-02 22:40:29 +01:00
|
|
|
{
|
2025-03-01 17:08:10 +01:00
|
|
|
m_break_on_bpm = break_on_bpm;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool breakpoint_handler::HasBreakpoint(u32 loc, bs_t<breakpoint_types> type)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard lock(mutex_breakpoints);
|
|
|
|
|
|
|
|
|
|
return m_breakpoints.contains(loc) && ((m_breakpoints.at(loc) & type) == type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool breakpoint_handler::AddBreakpoint(u32 loc, bs_t<breakpoint_types> type)
|
|
|
|
|
{
|
|
|
|
|
std::lock_guard lock(mutex_breakpoints);
|
|
|
|
|
|
|
|
|
|
if ((type & breakpoint_types::bp_exec) && !ppu_breakpoint(loc, true))
|
2021-07-30 20:30:29 +02:00
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-01 17:08:10 +01:00
|
|
|
return m_breakpoints.insert({loc, type}).second;
|
2018-03-02 22:40:29 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool breakpoint_handler::RemoveBreakpoint(u32 loc)
|
|
|
|
|
{
|
2025-03-01 17:08:10 +01:00
|
|
|
std::lock_guard lock(mutex_breakpoints);
|
|
|
|
|
|
|
|
|
|
bs_t<breakpoint_types> bp_type{};
|
|
|
|
|
if (m_breakpoints.contains(loc))
|
|
|
|
|
{
|
|
|
|
|
bp_type = m_breakpoints.at(loc);
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-30 20:30:29 +02:00
|
|
|
if (m_breakpoints.erase(loc) == 0)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2025-03-01 17:08:10 +01:00
|
|
|
if (bp_type & breakpoint_types::bp_exec)
|
|
|
|
|
{
|
|
|
|
|
ensure(ppu_breakpoint(loc, false));
|
|
|
|
|
}
|
2018-03-02 22:40:29 +01:00
|
|
|
return true;
|
|
|
|
|
}
|