From 04b5b362bcc6f0d7feb9950a3059dca9d706ae96 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Fri, 26 Jan 2024 19:04:30 -0800 Subject: [PATCH] fix deadlock in launch_and_init - don't hold dbgi scopes open too aggressively, as we may need to eliminate dbgi which they refer to. --- src/ctrl/ctrl_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index 67ae5b0e0..d374335e2 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -1931,7 +1931,6 @@ ctrl_thread__launch_and_init(CTRL_Msg *msg) { ProfBeginFunction(); Temp scratch = scratch_begin(0, 0); - DBGI_Scope *scope = dbgi_scope_open(); //- rjf: launch OS_LaunchOptions opts = {0}; @@ -2016,6 +2015,8 @@ ctrl_thread__launch_and_init(CTRL_Msg *msg) // rjf: done with handshake -> ready to find entry point. search launched processes case DEMON_EventKind_HandshakeComplete: { + DBGI_Scope *scope = dbgi_scope_open(); + // rjf: find entry point vaddr for(U64 process_idx = 0; process_idx < run_ctrls.run_entity_count; process_idx += 1) { @@ -2187,6 +2188,8 @@ ctrl_thread__launch_and_init(CTRL_Msg *msg) stop_event = event; } } + + dbgi_scope_close(scope); }break; } } @@ -2232,7 +2235,6 @@ ctrl_thread__launch_and_init(CTRL_Msg *msg) ctrl_c2u_push_events(&evts); } - dbgi_scope_close(scope); scratch_end(scratch); ProfEnd(); }