@@ -3189,7 +3189,7 @@ ctrl_thread__entry_point(void *p)
31893189 CTRL_Entity * module = ctrl_entity_from_handle (entity_ctx , msg -> entity );
31903190 CTRL_Entity * debug_info_path = ctrl_entity_child_from_kind (module , CTRL_EntityKind_DebugInfoPath );
31913191 DI_Key old_dbgi_key = di_key_from_path_timestamp (debug_info_path -> string , debug_info_path -> timestamp );
3192- di_close (old_dbgi_key );
3192+ di_close (old_dbgi_key , 0 );
31933193 MutexScopeW (ctrl_state -> ctrl_thread_entity_ctx_rw_mutex )
31943194 {
31953195 ctrl_entity_equip_string (ctrl_state -> ctrl_thread_entity_store , debug_info_path , path_normalized_from_string (scratch .arena , path ));
@@ -4112,7 +4112,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
41124112 out_evt -> entity = module_handle ;
41134113 out_evt -> string = module_path ;
41144114 DI_Key dbgi_key = ctrl_dbgi_key_from_module (module_ent );
4115- di_close (dbgi_key );
4115+ di_close (dbgi_key , 0 );
41164116 }break ;
41174117 case DMN_EventKind_DebugString :
41184118 {
@@ -4274,15 +4274,19 @@ ctrl_thread__eval_scope_begin(Arena *arena, CTRL_UserBreakpointList *user_bps, C
42744274 U64 thread_rip_voff = ctrl_voff_from_vaddr (module , thread_rip_vaddr );
42754275
42764276 //////////////////////////////
4277- //- rjf: gather evaluation modules
4277+ //- rjf: gather evaluation debug infos & modules
42784278 //
42794279 U64 eval_modules_count = Max (1 , entity_ctx -> entity_kind_counts [CTRL_EntityKind_Module ]);
42804280 E_Module * eval_modules = push_array (arena , E_Module , eval_modules_count );
42814281 E_Module * eval_modules_primary = & eval_modules [0 ];
4282- eval_modules_primary -> rdi = & rdi_parsed_nil ;
42834282 eval_modules_primary -> vaddr_range = r1u64 (0 , max_U64 );
4283+ U64 eval_dbg_infos_count = Max (1 , entity_ctx -> entity_kind_counts [CTRL_EntityKind_Module ]);
4284+ E_DbgInfo * eval_dbg_infos = push_array (arena , E_DbgInfo , eval_dbg_infos_count );
4285+ E_DbgInfo * eval_dbg_infos_primary = & eval_dbg_infos [0 ];
4286+ MemoryCopyStruct (eval_dbg_infos_primary , & e_dbg_info_nil );
42844287 {
42854288 U64 eval_module_idx = 0 ;
4289+ U64 eval_dbg_info_idx = 0 ;
42864290 for (CTRL_Entity * machine = entity_ctx -> root -> first ;
42874291 machine != & ctrl_entity_nil ;
42884292 machine = machine -> next )
@@ -4392,10 +4396,18 @@ ctrl_thread__eval_scope_begin(Arena *arena, CTRL_UserBreakpointList *user_bps, C
43924396 rdi = di_rdi_from_key (scope -> access , dbgi_key , 1 , max_U64 );
43934397 }
43944398
4399+ //- rjf: fill debug info
4400+ eval_dbg_infos [eval_dbg_info_idx ].dbgi_key = dbgi_key ;
4401+ eval_dbg_infos [eval_dbg_info_idx ].rdi = rdi ;
4402+ if (mod == module )
4403+ {
4404+ eval_dbg_infos_primary = & eval_dbg_infos [eval_dbg_info_idx ];
4405+ }
4406+ eval_dbg_info_idx += 1 ;
4407+
43954408 //- rjf: fill evaluation module info
43964409 eval_modules [eval_module_idx ].arch = arch ;
4397- eval_modules [eval_module_idx ].dbgi_key = dbgi_key ;
4398- eval_modules [eval_module_idx ].rdi = rdi ;
4410+ eval_modules [eval_module_idx ].dbg_info_num = (U32 )eval_dbg_info_idx ;
43994411 eval_modules [eval_module_idx ].vaddr_range = mod -> vaddr_range ;
44004412 eval_modules [eval_module_idx ].space = e_space_make (CTRL_EvalSpaceKind_Entity );
44014413 eval_modules [eval_module_idx ].space .u64_0 = (U64 )process ;
@@ -4427,6 +4439,11 @@ ctrl_thread__eval_scope_begin(Arena *arena, CTRL_UserBreakpointList *user_bps, C
44274439 ctx -> thread_reg_space = e_space_make (CTRL_EvalSpaceKind_Entity );
44284440 ctx -> thread_reg_space .u64_0 = (U64 )thread ;
44294441
4442+ //- rjf: fill debug infos
4443+ ctx -> dbg_infos = eval_dbg_infos ;
4444+ ctx -> dbg_infos_count = eval_dbg_infos_count ;
4445+ ctx -> primary_dbg_info = eval_dbg_infos_primary ;
4446+
44304447 //- rjf: fill modules
44314448 ctx -> modules = eval_modules ;
44324449 ctx -> modules_count = eval_modules_count ;
@@ -4445,8 +4462,8 @@ ctrl_thread__eval_scope_begin(Arena *arena, CTRL_UserBreakpointList *user_bps, C
44454462 E_IRCtx * ctx = & scope -> ir_ctx ;
44464463 ctx -> regs_map = ctrl_string2reg_from_arch (arch );
44474464 ctx -> reg_alias_map = ctrl_string2alias_from_arch (arch );
4448- ctx -> locals_map = e_push_locals_map_from_rdi_voff (arena , eval_modules_primary -> rdi , thread_rip_voff );
4449- ctx -> member_map = e_push_member_map_from_rdi_voff (arena , eval_modules_primary -> rdi , thread_rip_voff );
4465+ ctx -> locals_map = e_push_locals_map_from_rdi_voff (arena , eval_dbg_infos_primary -> rdi , thread_rip_voff );
4466+ ctx -> member_map = e_push_member_map_from_rdi_voff (arena , eval_dbg_infos_primary -> rdi , thread_rip_voff );
44504467 ctx -> macro_map = push_array (arena , E_String2ExprMap , 1 );
44514468 ctx -> macro_map [0 ] = e_string2expr_map_make (arena , 512 );
44524469 ctx -> auto_hook_map = push_array (arena , E_AutoHookMap , 1 );
@@ -4469,7 +4486,7 @@ ctrl_thread__eval_scope_begin(Arena *arena, CTRL_UserBreakpointList *user_bps, C
44694486 // TODO(rjf): need to compute this out here somehow... ctx->frame_base[0] = ;
44704487 ctx -> tls_base = push_array (arena , U64 , 1 );
44714488 }
4472- e_select_interpret_ctx (& scope -> interpret_ctx , eval_modules_primary -> rdi , thread_rip_voff );
4489+ e_select_interpret_ctx (& scope -> interpret_ctx , eval_dbg_infos_primary -> rdi , thread_rip_voff );
44734490
44744491 ProfEnd ();
44754492 return scope ;
0 commit comments