ctrl layer defined handle system, to replace machine-id/demon-handle pairs used everywhere by users

This commit is contained in:
Ryan Fleury
2024-09-11 14:01:38 -07:00
parent e6872cb71e
commit be6458690f
7 changed files with 399 additions and 430 deletions
+4 -4
View File
@@ -1724,7 +1724,7 @@ df_window_frame(DF_Window *ws)
DF_Palette(DF_PaletteCode_ImplicitButton)
{
D_Entity *entity = d_entity_from_handle(ws->entity_ctx_menu_entity);
CTRL_Entity *entity_ctrl = ctrl_entity_from_machine_id_handle(d_state->ctrl_entity_store, entity->ctrl_machine_id, entity->ctrl_handle);
CTRL_Entity *entity_ctrl = ctrl_entity_from_handle(d_state->ctrl_entity_store, entity->ctrl_handle);
DF_IconKind entity_icon = df_entity_kind_icon_kind_table[entity->kind];
D_EntityKindFlags kind_flags = d_entity_kind_flags_table[entity->kind];
String8 display_name = d_display_string_from_entity(scratch.arena, entity);
@@ -4018,7 +4018,7 @@ df_window_frame(DF_Window *ws)
U64 size = e_type_byte_size_from_key(row_eval.type_key);
size = Min(size, 64);
Rng1U64 vaddr_rng = r1u64(row_eval.value.u64, row_eval.value.u64+size);
CTRL_ProcessMemorySlice slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, space_entity->ctrl_machine_id, space_entity->ctrl_handle, vaddr_rng, 0);
CTRL_ProcessMemorySlice slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, space_entity->ctrl_handle, vaddr_rng, 0);
for(U64 idx = 0; idx < (slice.data.size+63)/64; idx += 1)
{
if(slice.byte_changed_flags[idx] != 0)
@@ -7283,7 +7283,7 @@ df_stop_explanation_string_icon_from_ctrl_event(Arena *arena, CTRL_Event *event,
DF_IconKind icon = DF_IconKind_Null;
String8 explanation = {0};
Temp scratch = scratch_begin(&arena, 1);
D_Entity *thread = d_entity_from_ctrl_handle(event->machine_id, event->entity);
D_Entity *thread = d_entity_from_ctrl_handle(event->entity);
String8 thread_display_string = d_display_string_from_entity(scratch.arena, thread);
String8 process_thread_string = thread_display_string;
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
@@ -7868,7 +7868,7 @@ df_frame(void)
CTRL_Unwind unwind = d_query_cached_unwind_from_thread(thread);
D_Entity *module = d_module_from_process_vaddr(process, rip_vaddr);
U64 rip_voff = d_voff_from_vaddr(module, rip_vaddr);
U64 tls_root_vaddr = ctrl_query_cached_tls_root_vaddr_from_thread(d_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
U64 tls_root_vaddr = ctrl_query_cached_tls_root_vaddr_from_thread(d_state->ctrl_entity_store, thread->ctrl_handle);
D_EntityList all_modules = d_query_cached_entity_list_with_kind(D_EntityKind_Module);
U64 eval_modules_count = Max(1, all_modules.count);
E_Module *eval_modules = push_array(scratch.arena, E_Module, eval_modules_count);
+2 -2
View File
@@ -2218,7 +2218,7 @@ df_watch_view_build(DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 d
U64 size = e_type_byte_size_from_key(row_eval.type_key);
size = Min(size, 64);
Rng1U64 vaddr_rng = r1u64(row_eval.value.u64, row_eval.value.u64+size);
CTRL_ProcessMemorySlice slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, space_entity->ctrl_machine_id, space_entity->ctrl_handle, vaddr_rng, 0);
CTRL_ProcessMemorySlice slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, space_entity->ctrl_handle, vaddr_rng, 0);
for(U64 idx = 0; idx < (slice.data.size+63)/64; idx += 1)
{
if(slice.byte_changed_flags[idx] != 0)
@@ -5616,7 +5616,7 @@ DF_VIEW_UI_FUNCTION_DEF(scheduler)
idx += 1)
{
D_Entity *entity = items.v[idx].entity;
CTRL_Entity *entity_ctrl = ctrl_entity_from_machine_id_handle(d_state->ctrl_entity_store, entity->ctrl_machine_id, entity->ctrl_handle);
CTRL_Entity *entity_ctrl = ctrl_entity_from_handle(d_state->ctrl_entity_store, entity->ctrl_handle);
B32 row_is_selected = (cursor.y == (S64)(idx+1));
F32 depth = 0.f;
if(query.size == 0) switch(entity->kind)
+5 -5
View File
@@ -443,7 +443,7 @@ df_entity_tooltips(D_Entity *entity)
}
{
CTRL_Event stop_event = d_ctrl_last_stop_event();
D_Entity *stopper_thread = d_entity_from_ctrl_handle(stop_event.machine_id, stop_event.entity);
D_Entity *stopper_thread = d_entity_from_ctrl_handle(stop_event.entity);
if(stopper_thread == entity)
{
ui_spacer(ui_em(1.5f, 1.f));
@@ -587,7 +587,7 @@ 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.machine_id, stop_event.entity);
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)
{
@@ -952,7 +952,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
U64 selected_thread_rip_unwind_vaddr = d_query_cached_rip_from_thread_unwind(selected_thread, d_regs()->unwind_count);
D_Entity *selected_thread_module = d_module_from_process_vaddr(selected_thread_process, selected_thread_rip_unwind_vaddr);
CTRL_Event stop_event = d_ctrl_last_stop_event();
D_Entity *stopper_thread = d_entity_from_ctrl_handle(stop_event.machine_id, stop_event.entity);
D_Entity *stopper_thread = d_entity_from_ctrl_handle(stop_event.entity);
B32 is_focused = ui_is_focus_active();
B32 ctrlified = (os_get_event_flags() & OS_EventFlag_Ctrl);
Vec4F32 code_line_bgs[] =
@@ -1047,7 +1047,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
{
continue;
}
CTRL_Entity *thread_ctrl = ctrl_entity_from_machine_id_handle(d_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
CTRL_Entity *thread_ctrl = ctrl_entity_from_handle(d_state->ctrl_entity_store, thread->ctrl_handle);
U64 unwind_count = (thread == selected_thread) ? d_regs()->unwind_count : 0;
U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count);
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);
@@ -1206,7 +1206,7 @@ df_code_slice(DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
{
continue;
}
CTRL_Entity *thread_ctrl = ctrl_entity_from_machine_id_handle(d_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
CTRL_Entity *thread_ctrl = ctrl_entity_from_handle(d_state->ctrl_entity_store, thread->ctrl_handle);
U64 unwind_count = (thread == selected_thread) ? d_regs()->unwind_count : 0;
U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count);
D_Entity *process = d_entity_ancestor_from_kind(thread, D_EntityKind_Process);