another checkpoint in moving previously engine-controlled behavior to frontend, and getting engine completely off d_entities

This commit is contained in:
Ryan Fleury
2024-09-12 16:51:48 -07:00
parent 71cb03f3be
commit f13806b19f
4 changed files with 19 additions and 12 deletions
+2
View File
@@ -824,6 +824,7 @@ internal CTRL_Entity *
ctrl_entity_from_handle(CTRL_EntityStore *store, CTRL_Handle handle)
{
CTRL_Entity *entity = &ctrl_entity_nil;
if(!ctrl_handle_match(handle, ctrl_handle_zero()))
{
U64 hash = ctrl_hash_from_handle(handle);
U64 slot_idx = hash%store->hash_slots_count;
@@ -944,6 +945,7 @@ ctrl_entity_list_from_kind(CTRL_EntityStore *store, CTRL_EntityKind kind)
if(store->entity_kind_lists_gens[kind] != store->entity_kind_alloc_gens[kind])
{
arena_clear(store->entity_kind_lists_arenas[kind]);
MemoryZeroStruct(&store->entity_kind_lists[kind]);
for(CTRL_Entity *e = store->root;
e != &ctrl_entity_nil;
e = ctrl_entity_rec_depth_first_pre(e, store->root).next)
+9 -7
View File
@@ -1582,7 +1582,7 @@ df_window_frame(DF_Window *ws)
HS_Scope *hs_scope = hs_scope_open();
TxtRng range = ws->code_ctx_menu_range;
D_LineList lines = ws->code_ctx_menu_lines;
if(!txt_pt_match(range.min, range.max) && ui_clicked(df_cmd_spec_button(df_cmd_kind_info_table[DF_CmdKind_Copy].display_name)))
if(!txt_pt_match(range.min, range.max) && ui_clicked(df_cmd_spec_button(df_cmd_kind_info_table[DF_CmdKind_Copy].string)))
{
U128 hash = {0};
TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, ws->code_ctx_menu_text_key, ws->code_ctx_menu_lang_kind, &hash);
@@ -1909,14 +1909,15 @@ df_window_frame(DF_Window *ws)
{
if(entity->kind == D_EntityKind_Thread)
{
B32 is_selected = d_handle_match(d_base_regs()->thread, d_handle_from_entity(entity));
CTRL_Entity *entity_ctrl = ctrl_entity_from_handle(d_state->ctrl_entity_store, entity->ctrl_handle);
B32 is_selected = ctrl_handle_match(df_base_regs()->thread, entity_ctrl->handle);
if(is_selected)
{
df_icon_buttonf(DF_IconKind_Thread, 0, "[Selected]###select_entity");
}
else if(ui_clicked(df_icon_buttonf(DF_IconKind_Thread, 0, "Select###select_entity")))
{
df_cmd(DF_CmdKind_SelectThread, .entity = d_handle_from_entity(entity));
df_cmd(DF_CmdKind_SelectThread, .thread = entity_ctrl->handle);
ui_ctx_menu_close();
}
}
@@ -10543,7 +10544,7 @@ df_frame(void)
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, df_regs()->thread);
U64 unwind_index = df_regs()->unwind_count;
U64 inline_depth = df_regs()->inline_depth;
if(thread->kind == D_EntityKind_Thread)
if(thread->kind == CTRL_EntityKind_Thread)
{
// rjf: grab rip
U64 rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_index);
@@ -12168,7 +12169,7 @@ df_frame(void)
for(D_EntityNode *n = target_entities.first; n != 0; n = n->next, idx += 1)
{
D_Entity *src_target = n->entity;
D_Entity *src_target_exe = d_entity_child_from_kind(src_target, D_EntityKind_Target);
D_Entity *src_target_exe = d_entity_child_from_kind(src_target, D_EntityKind_Executable);
D_Entity *src_target_args = d_entity_child_from_kind(src_target, D_EntityKind_Arguments);
D_Entity *src_target_wdir = d_entity_child_from_kind(src_target, D_EntityKind_WorkingDirectory);
D_Entity *src_target_entry = d_entity_child_from_kind(src_target, D_EntityKind_EntryPoint);
@@ -12231,14 +12232,15 @@ df_frame(void)
// rjf: valid stop thread? -> select & snap
if(thread != &ctrl_entity_nil)
{
// TODO(rjf)
df_cmd(DF_CmdKind_SelectThread, .thread = thread->handle);
df_cmd(DF_CmdKind_FindThread, .thread = thread->handle);
}
// rjf: no stop-causing thread, but have selected thread? -> snap to selected
CTRL_Entity *selected_thread = &ctrl_entity_nil; // TODO(rjf): ctrl_entity_from_handle(d_state->ctrl_entity_store, df_base_regs()->thread);
if(thread == &ctrl_entity_nil && selected_thread != &ctrl_entity_nil)
{
// TODO(rjf)
df_cmd(DF_CmdKind_FindThread);
}
// rjf: increment breakpoint hit counts
+5 -4
View File
@@ -590,13 +590,14 @@ df_entity_desc_button(D_Entity *entity, FuzzyMatchRangeList *name_matches, Strin
if(entity->kind == D_EntityKind_Thread)
{
CTRL_Event stop_event = d_ctrl_last_stop_event();
D_Entity *stopped_thread = d_entity_from_ctrl_handle(stop_event.entity);
D_Entity *selected_thread = d_entity_from_handle(d_base_regs()->thread);
if(selected_thread == entity)
CTRL_Entity *entity_ctrl = ctrl_entity_from_handle(d_state->ctrl_entity_store, entity->ctrl_handle);
CTRL_Entity *stopped_thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, stop_event.entity);
CTRL_Entity *selected_thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, df_base_regs()->thread);
if(selected_thread == entity_ctrl)
{
palette = df_palette_from_code(DF_PaletteCode_NeutralPopButton);
}
if(stopped_thread == entity &&
if(stopped_thread == entity_ctrl &&
(stop_event.cause == CTRL_EventCause_UserBreakpoint ||
stop_event.cause == CTRL_EventCause_InterruptedByException ||
stop_event.cause == CTRL_EventCause_InterruptedByTrap ||
+3 -1
View File
@@ -810,6 +810,9 @@ ui_begin_build(OS_Handle window, UI_EventList *events, UI_IconInfo *icon_info, U
next = n->lru_next;
if(n->last_touched_build_index+1 < ui_state->build_index)
{
U64 slot_idx = n->key.u64[0]%ui_state->anim_slots_count;
UI_AnimSlot *slot = &ui_state->anim_slots[slot_idx];
DLLRemove_NPZ(&ui_nil_anim_node, slot->first, slot->last, n, slot_next, slot_prev);;
DLLRemove_NPZ(&ui_nil_anim_node, ui_state->lru_anim_node, ui_state->mru_anim_node, n, lru_next, lru_prev);
SLLStackPush_N(ui_state->free_anim_node, n, slot_next);
}
@@ -2942,7 +2945,6 @@ ui_signal_from_box(UI_Box *box)
}
}
ProfEnd();
return sig;
}