From 1b4300b3577b63dd4d58c50ef984759ecf02550b Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Tue, 16 Apr 2024 17:09:08 +0200 Subject: [PATCH] userfriendly bp numbers --- cpu.cpp | 10 ++-------- cpu.h | 1 + 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/cpu.cpp b/cpu.cpp index 86d8caa..e2c24d5 100644 --- a/cpu.cpp +++ b/cpu.cpp @@ -57,15 +57,9 @@ std::optional cpu::check_breakpoint() int cpu::set_breakpoint(breakpoint *const bp) { - int id = 0; + breakpoints.insert({ ++bp_nr, bp }); - do { - id = rand(); - } while(breakpoints.find(id) != breakpoints.end()); - - breakpoints.insert({ id, bp }); - - return id; + return bp_nr; } bool cpu::remove_breakpoint(const int bp_id) diff --git a/cpu.h b/cpu.h index f7c4935..38b990d 100644 --- a/cpu.h +++ b/cpu.h @@ -64,6 +64,7 @@ private: std::atomic_bool any_queued_interrupts { false }; std::map breakpoints; + int bp_nr { 0 }; bus *const b { nullptr };