snap-to-thread if none selected in frontend; fix soft halt logic to match old logic; fix ctrl entity store alloc gen on release

This commit is contained in:
Ryan Fleury
2024-09-12 17:10:39 -07:00
parent f13806b19f
commit 2dfa3dae42
3 changed files with 26 additions and 2 deletions
+3 -1
View File
@@ -801,6 +801,7 @@ ctrl_entity_release(CTRL_EntityStore *store, CTRL_Entity *entity)
// rjf: dec counter
store->entity_kind_counts[t->e->kind] -= 1;
store->entity_kind_alloc_gens[t->e->kind] += 1;
}
scratch_end(scratch);
}
@@ -4190,7 +4191,8 @@ ctrl_thread__kill(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
{
done = 1;
}
if(event->kind == DMN_EventKind_Halt)
if(event->kind == DMN_EventKind_Null ||
event->kind == DMN_EventKind_Error)
{
done = 1;
}
+2 -1
View File
@@ -3939,6 +3939,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints)
d_state->frame_eval_memread_endt_us = os_now_microseconds() + 5000;
d_state->top_regs = &d_state->base_regs;
d_regs_copy_contents(d_frame_arena(), &d_state->top_regs->v, &d_state->top_regs->v);
B32 ctrl_running_pre_tick = d_state->ctrl_is_running;
//////////////////////////////
//- rjf: sync with ctrl thread
@@ -5074,7 +5075,7 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints)
ctrl_msg_list_concat_in_place(&d_state->ctrl_msgs, &msgs_copy);
if(d_state->ctrl_msgs.count != 0)
{
if(!d_state->ctrl_soft_halt_issued && d_state->ctrl_is_running)
if(!d_state->ctrl_soft_halt_issued && ctrl_running_pre_tick)
{
d_state->ctrl_soft_halt_issued = 1;
ctrl_halt();
+21
View File
@@ -12215,6 +12215,27 @@ df_frame(void)
//
D_EventList engine_events = d_tick(scratch.arena, &targets, &breakpoints);
//////////////////////////////
//- rjf: no selected thread? -> try to snap to any existing thread
//
if(ctrl_entity_from_handle(d_state->ctrl_entity_store, df_base_regs()->thread) == &ctrl_entity_nil)
{
CTRL_Entity *process = ctrl_entity_from_handle(d_state->ctrl_entity_store, df_base_regs()->process);
if(process == &ctrl_entity_nil)
{
CTRL_EntityList all_processes = ctrl_entity_list_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Process);
if(all_processes.count != 0)
{
process = all_processes.first->v;
}
}
CTRL_Entity *new_thread = ctrl_entity_child_from_kind(process, CTRL_EntityKind_Thread);
if(new_thread != &ctrl_entity_nil)
{
df_cmd(DF_CmdKind_SelectThread, .thread = new_thread->handle);
}
}
//////////////////////////////
//- rjf: process debug engine events
//