From 6a5fa58d8a9853be8aea16ca9cb94c3710d4fdd1 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Sat, 12 Apr 2025 14:47:29 -0700 Subject: [PATCH] dedup flagged traps, so we don't write the same data breakpoint into the registers multiple times --- src/demon/win32/demon_core_win32.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/demon/win32/demon_core_win32.c b/src/demon/win32/demon_core_win32.c index 4853fb23..bca362dd 100644 --- a/src/demon/win32/demon_core_win32.c +++ b/src/demon/win32/demon_core_win32.c @@ -1602,7 +1602,23 @@ dmn_ctrl_run(Arena *arena, DMN_CtrlCtx *ctx, DMN_RunCtrls *ctrls) SLLQueuePush(first_flagged_trap_task, last_flagged_trap_task, task); task->process = trap->process; } - dmn_trap_chunk_list_push(scratch.arena, &task->traps, 8, trap); + B32 already_in_task = 0; + for(DMN_TrapChunkNode *n = task->traps.first; n != 0; n = n->next) + { + for(U64 n_idx = 0; n_idx < n->count; n_idx += 1) + { + if(n->v[n_idx].id == trap->id) + { + already_in_task = 1; + goto end_look_for_existing_trap_in_task; + } + } + } + end_look_for_existing_trap_in_task:; + if(!already_in_task) + { + dmn_trap_chunk_list_push(scratch.arena, &task->traps, 8, trap); + } } } }