summaryrefslogtreecommitdiff
path: root/m68k_debugging.cpp
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2022-09-25 16:37:03 +0300
committerOxore <oxore@protonmail.com>2022-09-25 16:37:03 +0300
commit9c78f70071daa8d4d65ffe335c21af0e4b523841 (patch)
tree8a10d95459027035b49f815ae891da85fa3e0d03 /m68k_debugging.cpp
parentbf5c361ed5ff57c077bb3b45d794325e8bdadc9a (diff)
Impl read and write watchpoints
Diffstat (limited to 'm68k_debugging.cpp')
-rw-r--r--m68k_debugging.cpp36
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: {