userfriendly bp numbers

This commit is contained in:
folkert van heusden 2024-04-16 17:09:08 +02:00
parent 4f317a3a71
commit 1b4300b357
Signed by untrusted user who does not match committer: folkert
GPG key ID: 6B6455EDFEED3BD1
2 changed files with 3 additions and 8 deletions

10
cpu.cpp
View file

@ -57,15 +57,9 @@ std::optional<std::string> 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)

1
cpu.h
View file

@ -64,6 +64,7 @@ private:
std::atomic_bool any_queued_interrupts { false };
std::map<int, breakpoint *> breakpoints;
int bp_nr { 0 };
bus *const b { nullptr };