12 const std::string& condition,
13 const std::string& description) {
29 LOG_INFO(
"Breakpoint",
"Added breakpoint #%d: %s at $%06X (type=%d, cpu=%d)",
30 bp.
id, bp.
description.c_str(), address,
static_cast<int>(type),
31 static_cast<int>(cpu));
39 LOG_INFO(
"Breakpoint",
"Removed breakpoint #%d",
id);
47 it->second.enabled = enabled;
48 LOG_INFO(
"Breakpoint",
"Breakpoint #%d %s",
id,
49 enabled ?
"enabled" :
"disabled");
55 if (!bp.enabled || bp.cpu != cpu || bp.type !=
Type::EXECUTE) {
59 if (bp.address == pc) {
64 if (!bp.condition.empty()) {
70 LOG_INFO(
"Breakpoint",
"Hit breakpoint #%d at PC=$%06X (hits=%d)",
id, pc,
79 bool is_write, uint8_t value,
82 if (!bp.enabled || bp.address != address) {
107 if (!bp.condition.empty()) {
115 "Hit %s breakpoint #%d at $%06X (value=$%02X, PC=$%06X, hits=%d)",
116 is_write ?
"WRITE" :
"READ", id, address, value, pc, bp.hit_count);
123std::vector<BreakpointManager::Breakpoint>
125 std::vector<Breakpoint> result;
128 result.push_back(bp);
132 result.begin(), result.end(),
139 std::vector<Breakpoint> result;
142 result.push_back(bp);
146 result.begin(), result.end(),
152 LOG_INFO(
"Breakpoint",
"Cleared all breakpoints (%zu total)",
162 if (it->second.cpu == cpu) {
169 LOG_INFO(
"Breakpoint",
"Cleared %d breakpoints for %s", cleared,
180 uint32_t pc, uint32_t address,
185 if (condition.empty()) {
const Breakpoint * last_hit_
bool ShouldBreakOnExecute(uint32_t pc, CpuType cpu)
Check if execution should break at this address.
void RemoveBreakpoint(uint32_t id)
Remove a breakpoint by ID.
bool ShouldBreakOnMemoryAccess(uint32_t address, bool is_write, uint8_t value, uint32_t pc)
Check if execution should break on memory access.
void ClearAll()
Clear all breakpoints.
void SetEnabled(uint32_t id, bool enabled)
Enable or disable a breakpoint.
std::vector< Breakpoint > GetAllBreakpoints() const
Get all breakpoints.
bool EvaluateCondition(const std::string &condition, uint32_t pc, uint32_t address, uint8_t value)
void ResetHitCounts()
Reset hit counts for all breakpoints.
std::vector< Breakpoint > GetBreakpoints(CpuType cpu) const
Get breakpoints for specific CPU.
std::unordered_map< uint32_t, Breakpoint > breakpoints_
uint32_t AddBreakpoint(uint32_t address, Type type, CpuType cpu, const std::string &condition="", const std::string &description="")
Add a new breakpoint.
#define LOG_INFO(category, format,...)