diff options
Diffstat (limited to 'm68k_debugging.cpp')
-rw-r--r-- | m68k_debugging.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/m68k_debugging.cpp b/m68k_debugging.cpp index 509299d..d02e463 100644 --- a/m68k_debugging.cpp +++ b/m68k_debugging.cpp @@ -157,10 +157,28 @@ void M68KDebuggingControl::SetBreakpoint(BreakpointType type, uint32_t address, code_bkpts.push_back(Breakpoint{address, length}); } break; case BreakpointType::kWriteWatchpoint: { + const auto it = std::find_if( + write_bkpts.begin(), + write_bkpts.end(), + [&](const Breakpoint& b) { return b.offset == address && b.length == length; }); + if (it == write_bkpts.end()) + write_bkpts.push_back(Breakpoint{address, length}); } break; case BreakpointType::kReadWatchpoint: { + const auto it = std::find_if( + read_bkpts.begin(), + read_bkpts.end(), + [&](const Breakpoint& b) { return b.offset == address && b.length == length; }); + if (it == read_bkpts.end()) + read_bkpts.push_back(Breakpoint{address, length}); } break; case BreakpointType::kAccessWatchpoint: { + const auto it = std::find_if( + access_bkpts.begin(), + access_bkpts.end(), + [&](const Breakpoint& b) { return b.offset == address && b.length == length; }); + if (it == access_bkpts.end()) + access_bkpts.push_back(Breakpoint{address, length}); } break; break; case BreakpointType::kUnsupported: { @@ -182,10 +200,28 @@ void M68KDebuggingControl::RemoveBreakpoint(BreakpointType type, uint32_t addres code_bkpts.erase(it); } break; case BreakpointType::kWriteWatchpoint: { + const auto it = std::find_if( + write_bkpts.begin(), + write_bkpts.end(), + [&](const Breakpoint& b) { return b.offset == address && b.length == length; }); + if (it != write_bkpts.end()) + write_bkpts.erase(it); } break; case BreakpointType::kReadWatchpoint: { + const auto it = std::find_if( + read_bkpts.begin(), + read_bkpts.end(), + [&](const Breakpoint& b) { return b.offset == address && b.length == length; }); + if (it != read_bkpts.end()) + read_bkpts.erase(it); } break; case BreakpointType::kAccessWatchpoint: { + const auto it = std::find_if( + access_bkpts.begin(), + access_bkpts.end(), + [&](const Breakpoint& b) { return b.offset == address && b.length == length; }); + if (it != access_bkpts.end()) + access_bkpts.erase(it); } break; break; case BreakpointType::kUnsupported: { |