feat: Add breakpoint and watchpoint management for enhanced debugging

- Introduced BreakpointManager and WatchpointManager classes to manage CPU breakpoints and memory watchpoints, respectively.
- Implemented functionality for adding, removing, enabling, and disabling breakpoints and watchpoints.
- Added support for conditional breakpoints and logging memory access history for watchpoints.
- Enhanced the Emulator class to integrate breakpoint and instruction logging callbacks for improved debugging capabilities.
- Updated DisassemblyViewer to record executed instructions and manage instruction limits for performance optimization.
This commit is contained in:
scawful
2025-10-08 17:20:07 -04:00
parent 3d1d961d0a
commit 9bc31bc8fc
11 changed files with 819 additions and 26 deletions

View File

@@ -5,6 +5,8 @@
#include <vector>
#include "app/emu/snes.h"
#include "app/emu/debug/breakpoint_manager.h"
#include "app/emu/debug/disassembly_viewer.h"
#include "app/rom.h"
namespace yaze {
@@ -54,6 +56,11 @@ class Emulator {
auto wanted_samples() const -> int { return wanted_samples_; }
void set_renderer(gfx::IRenderer* renderer) { renderer_ = renderer; }
// Debugger access
BreakpointManager& breakpoint_manager() { return breakpoint_manager_; }
bool is_debugging() const { return debugging_; }
void set_debugging(bool debugging) { debugging_ = debugging; }
// AI Agent Integration API
bool IsEmulatorReady() const { return snes_.running() && !rom_data_.empty(); }
double GetCurrentFPS() const { return current_fps_; }
@@ -136,8 +143,13 @@ class Emulator {
Snes snes_;
bool initialized_ = false;
bool snes_initialized_ = false;
bool debugging_ = false;
gfx::IRenderer* renderer_ = nullptr;
void* ppu_texture_ = nullptr;
// Debugger infrastructure
BreakpointManager breakpoint_manager_;
debug::DisassemblyViewer disassembly_viewer_;
std::vector<uint8_t> rom_data_;