10 const std::string& condition,
11 const std::string& description) {
26 LOG_INFO(
"Breakpoint",
"Added breakpoint #%d: %s at $%06X (type=%d, cpu=%d)",
27 bp.
id, bp.
description.c_str(), address,
static_cast<int>(type),
28 static_cast<int>(cpu));
36 LOG_INFO(
"Breakpoint",
"Removed breakpoint #%d",
id);
44 it->second.enabled = enabled;
45 LOG_INFO(
"Breakpoint",
"Breakpoint #%d %s",
id, enabled ?
"enabled" :
"disabled");
51 if (!bp.enabled || bp.cpu != cpu || bp.type !=
Type::EXECUTE) {
55 if (bp.address == pc) {
60 if (!bp.condition.empty()) {
66 LOG_INFO(
"Breakpoint",
"Hit breakpoint #%d at PC=$%06X (hits=%d)",
67 id, pc, bp.hit_count);
75 uint8_t value, uint32_t pc) {
77 if (!bp.enabled || bp.address != address) {
102 if (!bp.condition.empty()) {
108 LOG_INFO(
"Breakpoint",
"Hit %s breakpoint #%d at $%06X (value=$%02X, PC=$%06X, hits=%d)",
109 is_write ?
"WRITE" :
"READ", id, address, value, pc, bp.hit_count);
117 std::vector<Breakpoint> result;
120 result.push_back(bp);
123 std::sort(result.begin(), result.end(),
129 std::vector<Breakpoint> result;
132 result.push_back(bp);
135 std::sort(result.begin(), result.end(),
150 if (it->second.cpu == cpu) {
157 LOG_INFO(
"Breakpoint",
"Cleared %d breakpoints for %s", cleared,
168 uint32_t pc, uint32_t address,
173 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,...)
Main namespace for the application.