refactor(debug): move watchpoint slot state into the session

This commit is contained in:
2026-09-14 18:22:00 +02:00
parent 909f874797
commit 4f190ee1a2
7 changed files with 38 additions and 51 deletions
+4 -5
View File
@@ -275,8 +275,7 @@ func TestBreakpointInfo(t *testing.T) {
}
func TestWatchpointSlotTracking(t *testing.T) {
wpSlots = [4]bool{} // reset
s := &Session{}
s := &Session{} // per-session slots start free
// All four slots are free initially.
for i := range 4 {
@@ -289,8 +288,8 @@ func TestWatchpointSlotTracking(t *testing.T) {
}
// Manually mark slots 0 and 2 as used (simulating successful SetWatchpoint).
wpSlots[0] = true
wpSlots[2] = true
s.wpSlots[0] = true
s.wpSlots[2] = true
if !s.IsWatchpointSlotUsed(0) {
t.Error("slot 0 should be in use")
@@ -318,7 +317,7 @@ func TestWatchpointSlotTracking(t *testing.T) {
// Mark all slots used: FindFreeWatchpointSlot returns -1.
for i := range 4 {
wpSlots[i] = true
s.wpSlots[i] = true
}
if got := s.FindFreeWatchpointSlot(); got != -1 {
t.Errorf("FindFreeWatchpointSlot() with all slots used = %d, want -1", got)