diff --git a/src/debugger.cpp b/src/debugger.cpp index 50d2f3a..11a1d98 100644 --- a/src/debugger.cpp +++ b/src/debugger.cpp @@ -248,6 +248,7 @@ void debugger_add_breakpoint(uint16_t address, uint8_t bank /* = 0 */) if (Breakpoints.find(new_bp) == Breakpoints.end()) { Breakpoints.insert(new_bp); Active_breakpoints.insert(new_bp); + Breakpoint_check[address] = true; } } @@ -260,6 +261,13 @@ void debugger_remove_breakpoint(uint16_t address, uint8_t bank /* = 0 */) breakpoint_type old_bp{ address, bank }; Breakpoints.erase(old_bp); Active_breakpoints.erase(old_bp); + Breakpoint_check[address] = false; + for (const auto &bp : Active_breakpoints) { + if (breakpoint_addr(bp) == address) { + Breakpoint_check[address] = true; + break; + } + } } void debugger_activate_breakpoint(uint16_t address, uint8_t bank /* = 0 */) @@ -274,6 +282,7 @@ void debugger_activate_breakpoint(uint16_t address, uint8_t bank /* = 0 */) } if (Active_breakpoints.find(new_bp) == Active_breakpoints.end()) { Active_breakpoints.insert(new_bp); + Breakpoint_check[address] = true; } } @@ -285,6 +294,14 @@ void debugger_deactivate_breakpoint(uint16_t address, uint8_t bank /* = 0 */) breakpoint_type old_bp{ address, bank }; Active_breakpoints.erase(old_bp); + + Breakpoint_check[address] = false; + for (const auto &bp : Active_breakpoints) { + if (breakpoint_addr(bp) == address) { + Breakpoint_check[address] = true; + break; + } + } } bool debugger_breakpoint_is_active(uint16_t address, uint8_t bank /* = 0 */) diff --git a/src/overlay/overlay.cpp b/src/overlay/overlay.cpp index 2ab3f15..7150636 100644 --- a/src/overlay/overlay.cpp +++ b/src/overlay/overlay.cpp @@ -1630,10 +1630,15 @@ static void draw_breakpoints() const auto &breakpoints = debugger_get_breakpoints(); for (auto &[address, bank] : breakpoints) { + ImGui::PushID(address); + ImGui::PushID(bank); + ImGui::TableNextRow(); ImGui::TableNextColumn(); if (ImGui::TileButton(ICON_REMOVE)) { debugger_remove_breakpoint(address, bank); + ImGui::PopID(); + ImGui::PopID(); break; } @@ -1678,6 +1683,9 @@ static void draw_breakpoints() } } } + + ImGui::PopID(); + ImGui::PopID(); } ImGui::EndTable();