Skip to content

Commit

Permalink
update debugger to allow unsetting breakpoints and listing active bre…
Browse files Browse the repository at this point in the history
…akpoints
  • Loading branch information
jonathanballs committed Sep 12, 2024
1 parent 444e9a4 commit 87daca0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/gameboy/debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,22 @@ impl GameBoy {

"b" | "break" => {
if args.len() != 1 {
println!("{:?}", self.breakpoints);
println!("{}", "ERR: Please provide two numerical arguments".red());
continue;
}

match parse_number(args[0]) {
Some(breakpoint) => {
self.breakpoints.insert(breakpoint);
if self.breakpoints.contains(&breakpoint) {
println!("{}", "Removing breakpoint".green());
self.breakpoints.remove(&breakpoint);
} else {
self.breakpoints.insert(breakpoint);
}
}
_ => {
println!("{}", "ERR: Invalid invalid numbers passed to mem".red());
println!("{}", "ERR: Invalid invalid numbers passed to break".red());
}
}
}
Expand Down

0 comments on commit 87daca0

Please sign in to comment.