Support watchpoints
This commit is contained in:
+21
-1
@@ -18,8 +18,9 @@ use egui_toast::{Toast, ToastKind, ToastOptions};
|
||||
|
||||
use crate::{audio::Audio, graphics::TextureSink};
|
||||
use shrooms_vb_core::{Sim, StopReason, EXPECTED_FRAME_SIZE};
|
||||
pub use shrooms_vb_core::{VBKey, VBRegister};
|
||||
pub use shrooms_vb_core::{VBKey, VBRegister, VBWatchpointType};
|
||||
|
||||
mod address_set;
|
||||
mod shrooms_vb_core;
|
||||
|
||||
#[derive(PartialEq, Eq, Hash, Clone, Copy, Debug)]
|
||||
@@ -421,6 +422,9 @@ impl Emulator {
|
||||
if let Some(reason) = sim.stop_reason() {
|
||||
let stop_reason = match reason {
|
||||
StopReason::Stepped => DebugStopReason::Trace,
|
||||
StopReason::Watchpoint(watch, address) => {
|
||||
DebugStopReason::Watchpoint(watch, address)
|
||||
}
|
||||
StopReason::Breakpoint => DebugStopReason::Breakpoint,
|
||||
};
|
||||
self.debug_stop(sim_id, stop_reason);
|
||||
@@ -547,6 +551,18 @@ impl Emulator {
|
||||
};
|
||||
sim.remove_breakpoint(address);
|
||||
}
|
||||
EmulatorCommand::AddWatchpoint(sim_id, address, length, watch) => {
|
||||
let Some(sim) = self.sims.get_mut(sim_id.to_index()) else {
|
||||
return;
|
||||
};
|
||||
sim.add_watchpoint(address, length, watch);
|
||||
}
|
||||
EmulatorCommand::RemoveWatchpoint(sim_id, address, length, watch) => {
|
||||
let Some(sim) = self.sims.get_mut(sim_id.to_index()) else {
|
||||
return;
|
||||
};
|
||||
sim.remove_watchpoint(address, length, watch);
|
||||
}
|
||||
EmulatorCommand::SetAudioEnabled(p1, p2) => {
|
||||
self.audio_on[SimId::Player1.to_index()].store(p1, Ordering::Release);
|
||||
self.audio_on[SimId::Player2.to_index()].store(p2, Ordering::Release);
|
||||
@@ -613,6 +629,8 @@ pub enum EmulatorCommand {
|
||||
ReadMemory(SimId, u32, usize, Vec<u8>, oneshot::Sender<Vec<u8>>),
|
||||
AddBreakpoint(SimId, u32),
|
||||
RemoveBreakpoint(SimId, u32),
|
||||
AddWatchpoint(SimId, u32, usize, VBWatchpointType),
|
||||
RemoveWatchpoint(SimId, u32, usize, VBWatchpointType),
|
||||
SetAudioEnabled(bool, bool),
|
||||
Link,
|
||||
Unlink,
|
||||
@@ -645,6 +663,8 @@ pub enum DebugStopReason {
|
||||
Trace,
|
||||
// We hit a breakpoint
|
||||
Breakpoint,
|
||||
// We hit a watchpoint
|
||||
Watchpoint(VBWatchpointType, u32),
|
||||
// The debugger told us to pause
|
||||
Trapped,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user