From 3c8f58cb3896a36cc42a1cd1403815e8431962c1 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Fri, 21 Feb 2025 13:23:12 -0800 Subject: [PATCH] add tracking to dbgi scopes --- src/dbgi/dbgi.c | 10 ++++++++-- src/dbgi/dbgi.h | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/dbgi/dbgi.c b/src/dbgi/dbgi.c index 063be596..a3fbccaf 100644 --- a/src/dbgi/dbgi.c +++ b/src/dbgi/dbgi.c @@ -262,12 +262,14 @@ di_scope_open(void) scope = push_array_no_zero(di_tctx->arena, DI_Scope, 1); } MemoryZeroStruct(scope); + DLLPushBack(di_tctx->first_scope, di_tctx->last_scope, scope); return scope; } internal void di_scope_close(DI_Scope *scope) { + DLLRemove(di_tctx->first_scope, di_tctx->last_scope, scope); for(DI_Touch *t = scope->first_touch, *next = 0; t != 0; t = next) { next = t->next; @@ -1349,7 +1351,6 @@ di_search_thread__entry_point(void *p) for(;;) { Temp scratch = scratch_begin(0, 0); - DI_Scope *di_scope = di_scope_open(); //- rjf: get next key, unpack U128 key = di_u2s_dequeue_req(thread_idx); @@ -1380,6 +1381,9 @@ di_search_thread__entry_point(void *p) } } + //- rjf: begin debug info scope + DI_Scope *di_scope = di_scope_open(); + //- rjf: get all rdis U64 rdis_count = params.dbgi_keys.count; RDI_Parsed **rdis = push_array(scratch.arena, RDI_Parsed *, rdis_count); @@ -1428,6 +1432,9 @@ di_search_thread__entry_point(void *p) cancelled = (cancelled || out->cancelled); } + //- rjf: end debug info scope + di_scope_close(di_scope); + //- rjf: list -> array DI_SearchItemArray items = {0}; if(arena != 0 && !cancelled) @@ -1496,7 +1503,6 @@ di_search_thread__entry_point(void *p) } } - di_scope_close(di_scope); scratch_end(scratch); } } diff --git a/src/dbgi/dbgi.h b/src/dbgi/dbgi.h index 3b3b23ea..76754bd4 100644 --- a/src/dbgi/dbgi.h +++ b/src/dbgi/dbgi.h @@ -225,6 +225,7 @@ typedef struct DI_Scope DI_Scope; struct DI_Scope { DI_Scope *next; + DI_Scope *prev; DI_Touch *first_touch; DI_Touch *last_touch; }; @@ -233,6 +234,8 @@ typedef struct DI_TCTX DI_TCTX; struct DI_TCTX { Arena *arena; + DI_Scope *first_scope; + DI_Scope *last_scope; DI_Scope *free_scope; DI_Touch *free_touch; };