From ee4f20d8627063f7310aac4625f18421c3799a77 Mon Sep 17 00:00:00 2001 From: Oxore Date: Sun, 25 Sep 2022 16:39:51 +0300 Subject: Impl access watchpoint --- emulator.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/emulator.cpp b/emulator.cpp index ea2c051..7e0d1b3 100644 --- a/emulator.cpp +++ b/emulator.cpp @@ -299,6 +299,16 @@ static inline bool ranges_overlap( // XXX Maybe better move it to bus.cpp? void m68k_read_callback(const uint32_t address, const uint32_t size) { + const auto access_it = std::find_if( + access_bkpts.begin(), + access_bkpts.end(), + [&](const Breakpoint& b) { return ranges_overlap(address, size, b.offset, b.length); }); + if (access_it != access_bkpts.end()) { + g_m68k_debug.SetRunning(false); + g_m68k_debug.RaiseBreakpoint(); + m68k_end_timeslice(); + printf("Access watchpoint @ 0x%08x\n", address); + } const auto it = std::find_if( read_bkpts.begin(), read_bkpts.end(), @@ -314,6 +324,16 @@ void m68k_read_callback(const uint32_t address, const uint32_t size) // XXX Maybe better move it to bus.cpp? void m68k_write_callback(const uint32_t address, const uint32_t size) { + const auto access_it = std::find_if( + access_bkpts.begin(), + access_bkpts.end(), + [&](const Breakpoint& b) { return ranges_overlap(address, size, b.offset, b.length); }); + if (access_it != access_bkpts.end()) { + g_m68k_debug.SetRunning(false); + g_m68k_debug.RaiseBreakpoint(); + m68k_end_timeslice(); + printf("Access watchpoint @ 0x%08x\n", address); + } const auto it = std::find_if( write_bkpts.begin(), write_bkpts.end(), -- cgit v1.2.3