From 87edc583bf81a9e7d5c83ababd47a08c73a21fb8 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Mon, 13 Oct 2025 12:40:28 -0700 Subject: [PATCH] define ctrl entity eval spaces once, in ctrl layer - nest in rd layer --- src/ctrl/ctrl_core.c | 8 +--- src/ctrl/ctrl_core.h | 4 +- src/eval/eval_core.h | 4 +- src/eval/eval_interpret.c | 75 ++++++++++++++++++++++++++++-- src/eval/eval_interpret.h | 1 - src/eval/eval_types.c | 53 +++++++++++++++++++++ src/raddbg/raddbg_core.c | 92 +++++++++---------------------------- src/raddbg/raddbg_core.h | 9 ++-- src/raddbg/raddbg_eval.c | 2 +- src/raddbg/raddbg_views.c | 18 ++++---- src/raddbg/raddbg_widgets.c | 2 +- 11 files changed, 166 insertions(+), 102 deletions(-) diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index 4f922e78..66e3d0c3 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -4201,7 +4201,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, //- rjf: eval helpers internal B32 -ctrl_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range) +ctrl_eval_space_read(E_Space space, void *out, Rng1U64 range) { B32 result = 0; switch(space.kind) @@ -4235,12 +4235,6 @@ ctrl_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range) }break; } }break; - - //- rjf: meta evaluations - case CTRL_EvalSpaceKind_Meta: - { - - }break; } return result; } diff --git a/src/ctrl/ctrl_core.h b/src/ctrl/ctrl_core.h index 49cf7b78..9879a71a 100644 --- a/src/ctrl/ctrl_core.h +++ b/src/ctrl/ctrl_core.h @@ -357,7 +357,7 @@ typedef U64 CTRL_EvalSpaceKind; enum { CTRL_EvalSpaceKind_Entity = E_SpaceKind_FirstUserDefined, - CTRL_EvalSpaceKind_Meta, + CTRL_EvalSpaceKind_FirstUserDefined, }; //////////////////////////////// @@ -981,7 +981,7 @@ internal void ctrl_thread__module_close(CTRL_Handle process, CTRL_Handle module, internal DMN_Event *ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, DMN_RunCtrls *run_ctrls, CTRL_Spoof *spoof); //- rjf: eval helpers -internal B32 ctrl_eval_space_read(void *u, E_Space space, void *out, Rng1U64 vaddr_range); +internal B32 ctrl_eval_space_read(E_Space space, void *out, Rng1U64 vaddr_range); //- rjf: control thread eval scopes internal CTRL_EvalScope *ctrl_thread__eval_scope_begin(Arena *arena, CTRL_UserBreakpointList *user_bps, CTRL_Entity *thread); diff --git a/src/eval/eval_core.h b/src/eval/eval_core.h index e658fdff..a0a35717 100644 --- a/src/eval/eval_core.h +++ b/src/eval/eval_core.h @@ -745,8 +745,8 @@ struct E_AutoHookParams //////////////////////////////// //~ rjf: Evaluation Context -typedef U64 E_SpaceGenFunction(void *user_data, E_Space space); -typedef B32 E_SpaceRWFunction(void *user_data, E_Space space, void *out, Rng1U64 offset_range); +typedef U64 E_SpaceGenFunction(E_Space space); +typedef B32 E_SpaceRWFunction(E_Space space, void *out, Rng1U64 offset_range); //- rjf: base context diff --git a/src/eval/eval_interpret.c b/src/eval/eval_interpret.c index a31993c1..74fffeda 100644 --- a/src/eval/eval_interpret.c +++ b/src/eval/eval_interpret.c @@ -61,7 +61,7 @@ e_space_gen(E_Space space) U64 result = 0; if(e_base_ctx->space_gen != 0) { - result = e_base_ctx->space_gen(e_base_ctx->space_rw_user_data, space); + result = e_base_ctx->space_gen(space); } return result; } @@ -71,9 +71,70 @@ e_space_read(E_Space space, void *out, Rng1U64 range) { ProfBeginFunction(); B32 result = 0; - if(e_interpret_ctx->space_read != 0) { - result = e_interpret_ctx->space_read(e_interpret_ctx->space_rw_user_data, space, out, range); + switch(space.kind) + { + //- rjf: reads from hash store key + case E_SpaceKind_HashStoreKey: + { + C_Root root = {space.u64_0}; + C_ID id = {space.u128}; + C_Key key = c_key_make(root, id); + U128 hash = c_hash_from_key(key, 0); + Access *access = access_open(); + { + String8 data = c_data_from_hash(access, hash); + Rng1U64 legal_range = r1u64(0, data.size); + Rng1U64 read_range = intersect_1u64(range, legal_range); + if(read_range.min < read_range.max) + { + result = 1; + MemoryCopy(out, data.str + read_range.min, dim_1u64(read_range)); + } + } + access_close(access); + }break; + + //- rjf: file reads + case E_SpaceKind_File: + { + // rjf: unpack space/path + U64 file_path_string_id = space.u64_0; + String8 file_path = e_string_from_id(file_path_string_id); + + // rjf: find containing chunk range + U64 chunk_size = KB(4); + Rng1U64 containing_range = range; + containing_range.min -= containing_range.min%chunk_size; + containing_range.max += chunk_size-1; + containing_range.max -= containing_range.max%chunk_size; + + // rjf: map to hash + C_Key key = fs_key_from_path_range(file_path, containing_range, 0); + U128 hash = c_hash_from_key(key, 0); + + // rjf: look up from hash store + Access *access = access_open(); + { + String8 data = c_data_from_hash(access, hash); + Rng1U64 legal_range = r1u64(containing_range.min, containing_range.min + data.size); + Rng1U64 read_range = intersect_1u64(range, legal_range); + if(read_range.min < read_range.max) + { + result = 1; + MemoryCopy(out, data.str + read_range.min - containing_range.min, dim_1u64(read_range)); + } + } + access_close(access); + }break; + + //- rjf: default -> use hooks + default: + if(e_interpret_ctx->space_read != 0) + { + result = e_interpret_ctx->space_read(space, out, range); + }break; + } } ProfEnd(); return result; @@ -86,7 +147,13 @@ e_space_write(E_Space space, void *in, Rng1U64 range) B32 result = 0; if(e_interpret_ctx->space_write != 0) { - result = e_interpret_ctx->space_write(e_interpret_ctx->space_rw_user_data, space, in, range); + switch(space.kind) + { + default: + { + result = e_interpret_ctx->space_write(space, in, range); + }break; + } } ProfEnd(); return result; diff --git a/src/eval/eval_interpret.h b/src/eval/eval_interpret.h index cca6cd97..4151a837 100644 --- a/src/eval/eval_interpret.h +++ b/src/eval/eval_interpret.h @@ -10,7 +10,6 @@ typedef struct E_InterpretCtx E_InterpretCtx; struct E_InterpretCtx { - void *space_rw_user_data; E_SpaceRWFunction *space_read; E_SpaceRWFunction *space_write; E_Space primary_space; diff --git a/src/eval/eval_types.c b/src/eval/eval_types.c index fb580740..23deef63 100644 --- a/src/eval/eval_types.c +++ b/src/eval/eval_types.c @@ -2570,6 +2570,59 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(array) } } +//////////////////////////////// +//~ rjf: (Built-In Type Hooks) `list` lens + +typedef struct E_ListGatherArtifact E_ListGatherArtifact; +struct E_ListGatherArtifact +{ + U64 *node_vaddrs; + U64 node_vaddrs_count; +}; + +internal AC_Artifact +e_list_gather_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *gen_out) +{ + +} + +internal void +e_list_gather_artifact_destroy(AC_Artifact artifact) +{ + +} + +E_TYPE_EXPAND_INFO_FUNCTION_DEF(list) +{ + E_Type *type = e_type_from_key(eval.irtree.type_key); + String8 next_link_member_name = str8_lit("next"); + if(type->args != 0 && type->count > 0) + { + next_link_member_name = type->args[0]->string; + } + E_TypeKey node_type_key = e_type_key_unwrap(eval.irtree.type_key, E_TypeUnwrapFlag_All); + E_Member next_link_member = e_type_member_from_key_name__cached(node_type_key, next_link_member_name); + if(next_link_member.kind != E_MemberKind_DataField) + { + // TODO(rjf): error reporting + } + else + { + + } + E_TypeExpandInfo info = {0, 0}; + return info; +} + +E_TYPE_EXPAND_RANGE_FUNCTION_DEF(list) +{ + U64 read_range_count = dim_1u64(idx_range); + for(U64 idx = 0; idx < read_range_count; idx += 1) + { + evals_out[idx] = e_eval_wrapf(eval, "$[%I64u]", idx_range.min + idx); + } +} + //////////////////////////////// //~ rjf: (Built-In Type Hooks) `slice` lens diff --git a/src/raddbg/raddbg_core.c b/src/raddbg/raddbg_core.c index 13b0455f..a5ab4c9b 100644 --- a/src/raddbg/raddbg_core.c +++ b/src/raddbg/raddbg_core.c @@ -1684,7 +1684,7 @@ internal CTRL_Entity * rd_ctrl_entity_from_eval_space(E_Space space) { CTRL_Entity *entity = &ctrl_entity_nil; - if(space.kind == RD_EvalSpaceKind_CtrlEntity || + if(space.kind == CTRL_EvalSpaceKind_Entity || space.kind == RD_EvalSpaceKind_MetaCtrlEntity || space.kind == RD_EvalSpaceKind_MetaUnattachedProcess) { @@ -1721,7 +1721,7 @@ rd_cmd_name_from_eval(E_Eval eval) //- rjf: eval space reads/writes internal U64 -rd_eval_space_gen(void *u, E_Space space) +rd_eval_space_gen(E_Space space) { U64 result = 0; switch(space.kind) @@ -1736,68 +1736,19 @@ rd_eval_space_gen(void *u, E_Space space) } internal B32 -rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range) +rd_eval_space_read(E_Space space, void *out, Rng1U64 range) { Temp scratch = scratch_begin(0, 0); B32 result = 0; switch(space.kind) { - //- rjf: reads from hash store key - case E_SpaceKind_HashStoreKey: + default: { - C_Root root = {space.u64_0}; - C_ID id = {space.u128}; - C_Key key = c_key_make(root, id); - U128 hash = c_hash_from_key(key, 0); - Access *access = access_open(); - { - String8 data = c_data_from_hash(access, hash); - Rng1U64 legal_range = r1u64(0, data.size); - Rng1U64 read_range = intersect_1u64(range, legal_range); - if(read_range.min < read_range.max) - { - result = 1; - MemoryCopy(out, data.str + read_range.min, dim_1u64(read_range)); - } - } - access_close(access); - }break; - - //- rjf: file reads - case E_SpaceKind_File: - { - // rjf: unpack space/path - U64 file_path_string_id = space.u64_0; - String8 file_path = e_string_from_id(file_path_string_id); - - // rjf: find containing chunk range - U64 chunk_size = KB(4); - Rng1U64 containing_range = range; - containing_range.min -= containing_range.min%chunk_size; - containing_range.max += chunk_size-1; - containing_range.max -= containing_range.max%chunk_size; - - // rjf: map to hash - C_Key key = fs_key_from_path_range(file_path, containing_range, 0); - U128 hash = c_hash_from_key(key, 0); - - // rjf: look up from hash store - Access *access = access_open(); - { - String8 data = c_data_from_hash(access, hash); - Rng1U64 legal_range = r1u64(containing_range.min, containing_range.min + data.size); - Rng1U64 read_range = intersect_1u64(range, legal_range); - if(read_range.min < read_range.max) - { - result = 1; - MemoryCopy(out, data.str + read_range.min - containing_range.min, dim_1u64(read_range)); - } - } - access_close(access); + result = ctrl_eval_space_read(space, out, range); }break; //- rjf: interior control entity reads (inside process address space or thread register block) - case RD_EvalSpaceKind_CtrlEntity: + case CTRL_EvalSpaceKind_Entity: { CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(space); switch(entity->kind) @@ -1997,7 +1948,7 @@ rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range) } internal B32 -rd_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range) +rd_eval_space_write(E_Space space, void *in, Rng1U64 range) { B32 result = 0; switch(space.kind) @@ -2006,7 +1957,7 @@ rd_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range) //- rjf: interior control entity writes (inside process address space or // thread register block) - case RD_EvalSpaceKind_CtrlEntity: + case CTRL_EvalSpaceKind_Entity: { CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(space); switch(entity->kind) @@ -2082,6 +2033,7 @@ rd_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range) } }break; + //- rjf: meta-ctrl-entity writes case RD_EvalSpaceKind_MetaCtrlEntity: { Temp scratch = scratch_begin(0, 0); @@ -2154,7 +2106,7 @@ rd_key_from_eval_space_range(E_Space space, Rng1U64 range, B32 zero_terminated) String8 file_path = e_string_from_id(file_path_string_id); result = fs_key_from_path_range(file_path, range, 0); }break; - case RD_EvalSpaceKind_CtrlEntity: + case CTRL_EvalSpaceKind_Entity: { CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(space); if(entity->kind == CTRL_EntityKind_Process) @@ -2194,7 +2146,7 @@ rd_whole_range_from_eval_space(E_Space space) FileProperties props = os_properties_from_file_path(file_path); result = r1u64(0, props.size); }break; - case RD_EvalSpaceKind_CtrlEntity: + case CTRL_EvalSpaceKind_Entity: { CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(space); if(entity->kind == CTRL_EntityKind_Process) @@ -4536,7 +4488,7 @@ rd_view_ui(Rng2F32 rect) //////////////////// //- rjf: draw start of cache lines in expansions // - if(row->eval.space.kind == RD_EvalSpaceKind_CtrlEntity && row_info->view_ui_rule == &rd_nil_view_ui_rule) + if(row->eval.space.kind == CTRL_EvalSpaceKind_Entity && row_info->view_ui_rule == &rd_nil_view_ui_rule) { CTRL_Entity *space_entity = rd_ctrl_entity_from_eval_space(row->eval.space); if(space_entity->kind == CTRL_EntityKind_Process) @@ -4557,7 +4509,7 @@ rd_view_ui(Rng2F32 rect) ////////////// //- rjf: draw mid-row cache line boundaries in expansions // - if(row->eval.space.kind == RD_EvalSpaceKind_CtrlEntity && row_info->view_ui_rule == &rd_nil_view_ui_rule) + if(row->eval.space.kind == CTRL_EvalSpaceKind_Entity && row_info->view_ui_rule == &rd_nil_view_ui_rule) { CTRL_Entity *space_entity = rd_ctrl_entity_from_eval_space(row->eval.space); if(space_entity->kind == CTRL_EntityKind_Process && @@ -4639,7 +4591,7 @@ rd_view_ui(Rng2F32 rect) cell_is_rich_hovered = (intersection.max > intersection.min); } CTRL_Entity *space_entity = rd_ctrl_entity_from_eval_space(cell->eval.space); - if(cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity && space_entity->kind == CTRL_EntityKind_Process) + if(cell->eval.space.kind == CTRL_EvalSpaceKind_Entity && space_entity->kind == CTRL_EntityKind_Process) { CTRL_ProcessMemorySlice slice = ctrl_process_memory_slice_from_vaddr_range(scratch.arena, space_entity->handle, cell_vaddr_rng, 0, rd_state->frame_eval_memread_endt_us); for(U64 idx = 0; idx < (slice.data.size+63)/64; idx += 1) @@ -5044,7 +4996,7 @@ rd_view_ui(Rng2F32 rect) // rjf: apply type note if(!(cell_info.flags & RD_WatchCellFlag_NoEval) && - cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity && + cell->eval.space.kind == CTRL_EvalSpaceKind_Entity && row_info->callstack_thread == &ctrl_entity_nil && e_type_kind_from_key(cell->eval.irtree.type_key) != E_TypeKind_Function) UI_FontSize(ui_top_font_size()*0.9f) @@ -5169,7 +5121,7 @@ rd_view_ui(Rng2F32 rect) case CTRL_EntityKind_Thread:{RD_RegsScope(.thread = cell_info.entity->handle) rd_drag_begin(RD_RegSlot_Thread);}break; } } - else if(cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity || + else if(cell->eval.space.kind == CTRL_EvalSpaceKind_Entity || cell->eval.space.kind == E_SpaceKind_FileSystem || cell->eval.space.kind == E_SpaceKind_File || cell->eval.space.kind == E_SpaceKind_Null) @@ -5323,7 +5275,7 @@ rd_view_ui(Rng2F32 rect) } // rjf: can't edit, but has address info? -> go to address - else if(cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity) + else if(cell->eval.space.kind == CTRL_EvalSpaceKind_Entity) { CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(cell->eval.space); CTRL_Entity *process = ctrl_process_from_entity(entity); @@ -7099,7 +7051,7 @@ rd_window_frame(void) build_hover_eval = 0; } else if((hover_eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity || - hover_eval.space.kind == RD_EvalSpaceKind_CtrlEntity) && + hover_eval.space.kind == CTRL_EvalSpaceKind_Entity) && rd_ctrl_entity_from_eval_space(hover_eval.space) == &ctrl_entity_nil) { build_hover_eval = 0; @@ -7200,7 +7152,7 @@ rd_window_frame(void) rd_cmd(RD_CmdKind_CancelQuery); } else if((eval.space.kind == RD_EvalSpaceKind_MetaCtrlEntity || - eval.space.kind == RD_EvalSpaceKind_CtrlEntity) && + eval.space.kind == CTRL_EvalSpaceKind_Entity) && rd_ctrl_entity_from_eval_space(eval.space) == &ctrl_entity_nil) { query_is_open = 0; @@ -11917,7 +11869,7 @@ rd_frame(void) eval_modules[eval_module_idx].dbgi_key = dbgi_key; eval_modules[eval_module_idx].rdi = di_rdi_from_key(rd_state->frame_access, dbgi_key, 0, 0); eval_modules[eval_module_idx].vaddr_range = m->vaddr_range; - eval_modules[eval_module_idx].space = rd_eval_space_from_ctrl_entity(ctrl_entity_ancestor_from_kind(m, CTRL_EntityKind_Process), RD_EvalSpaceKind_CtrlEntity); + eval_modules[eval_module_idx].space = rd_eval_space_from_ctrl_entity(ctrl_entity_ancestor_from_kind(m, CTRL_EntityKind_Process), CTRL_EvalSpaceKind_Entity); if(module == m) { eval_modules_primary = &eval_modules[eval_module_idx]; @@ -11942,7 +11894,7 @@ rd_frame(void) //- rjf: fill instruction pointer info ctx->thread_ip_vaddr = rip_vaddr; ctx->thread_ip_voff = rip_voff; - ctx->thread_reg_space = rd_eval_space_from_ctrl_entity(thread, RD_EvalSpaceKind_CtrlEntity); + ctx->thread_reg_space = rd_eval_space_from_ctrl_entity(thread, CTRL_EvalSpaceKind_Entity); ctx->thread_arch = thread->arch; ctx->thread_unwind_count = unwind_count; @@ -12737,7 +12689,7 @@ rd_frame(void) ctx->space_write = rd_eval_space_write; ctx->primary_space = eval_modules_primary->space; ctx->reg_arch = eval_modules_primary->arch; - ctx->reg_space = rd_eval_space_from_ctrl_entity(thread, RD_EvalSpaceKind_CtrlEntity); + ctx->reg_space = rd_eval_space_from_ctrl_entity(thread, CTRL_EvalSpaceKind_Entity); ctx->reg_unwind_count = unwind_count; ctx->module_base = push_array(scratch.arena, U64, 1); ctx->module_base[0] = module->vaddr_range.min; diff --git a/src/raddbg/raddbg_core.h b/src/raddbg/raddbg_core.h index ad58381e..1f54172d 100644 --- a/src/raddbg/raddbg_core.h +++ b/src/raddbg/raddbg_core.h @@ -81,8 +81,7 @@ struct RD_KeyMap typedef U64 RD_EvalSpaceKind; enum { - RD_EvalSpaceKind_CtrlEntity = E_SpaceKind_FirstUserDefined, - RD_EvalSpaceKind_MetaQuery, + RD_EvalSpaceKind_MetaQuery = CTRL_EvalSpaceKind_FirstUserDefined, RD_EvalSpaceKind_MetaCfg, RD_EvalSpaceKind_MetaCmd, RD_EvalSpaceKind_MetaTheme, @@ -889,9 +888,9 @@ internal E_Space rd_eval_space_from_ctrl_entity(CTRL_Entity *entity, E_SpaceKind internal String8 rd_cmd_name_from_eval(E_Eval eval); //- rjf: eval space reads/writes -internal U64 rd_eval_space_gen(void *u, E_Space space); -internal B32 rd_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range); -internal B32 rd_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range); +internal U64 rd_eval_space_gen(E_Space space); +internal B32 rd_eval_space_read(E_Space space, void *out, Rng1U64 range); +internal B32 rd_eval_space_write(E_Space space, void *in, Rng1U64 range); //- rjf: asynchronous streamed reads -> hashes from spaces internal C_Key rd_key_from_eval_space_range(E_Space space, Rng1U64 range, B32 zero_terminated); diff --git a/src/raddbg/raddbg_eval.c b/src/raddbg/raddbg_eval.c index e5b35811..d07597b5 100644 --- a/src/raddbg/raddbg_eval.c +++ b/src/raddbg/raddbg_eval.c @@ -978,7 +978,7 @@ E_TYPE_ACCESS_FUNCTION_DEF(call_stack) { CTRL_Entity *process = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, accel->process); CTRL_CallStackFrame *f = &call_stack->frames[rhs_value.u64]; - result.root = e_irtree_set_space(arena, rd_eval_space_from_ctrl_entity(process, RD_EvalSpaceKind_CtrlEntity), e_irtree_const_u(arena, regs_rip_from_arch_block(accel->arch, f->regs))); + result.root = e_irtree_set_space(arena, rd_eval_space_from_ctrl_entity(process, CTRL_EvalSpaceKind_Entity), e_irtree_const_u(arena, regs_rip_from_arch_block(accel->arch, f->regs))); result.type_key = e_type_key_cons(.arch = process->arch, .kind = E_TypeKind_Ptr, .direct_key = e_type_key_basic(E_TypeKind_Function), .count = 1, .depth = f->inline_depth); result.mode = E_Mode_Value; } diff --git a/src/raddbg/raddbg_views.c b/src/raddbg/raddbg_views.c index 5db18c39..1f832c49 100644 --- a/src/raddbg/raddbg_views.c +++ b/src/raddbg/raddbg_views.c @@ -993,7 +993,7 @@ rd_watch_row_info_from_row(Arena *arena, EV_Row *row) //////////////////////////// //- rjf: fill row's module // - if(row->eval.space.kind == RD_EvalSpaceKind_CtrlEntity) + if(row->eval.space.kind == CTRL_EvalSpaceKind_Entity) { CTRL_Entity *row_ctrl_entity = rd_ctrl_entity_from_eval_space(row->eval.space); switch(row_ctrl_entity->kind) @@ -1782,7 +1782,7 @@ rd_info_from_watch_row_cell(Arena *arena, EV_Row *row, EV_StringFlags string_fla { string_params.radix = 16; } - if(cell->eval.space.kind == RD_EvalSpaceKind_CtrlEntity && + if(cell->eval.space.kind == CTRL_EvalSpaceKind_Entity && rd_ctrl_entity_from_eval_space(cell->eval.space)->kind == CTRL_EntityKind_Thread) { string_params.radix = 16; @@ -2431,13 +2431,13 @@ RD_VIEW_UI_FUNCTION_DEF(disasm) if(dv->temp_look_vaddr != 0 && dv->temp_look_run_gen == ctrl_run_gen()) { auto_selected = 1; - auto_space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, dv->temp_look_process), RD_EvalSpaceKind_CtrlEntity); + auto_space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, dv->temp_look_process), CTRL_EvalSpaceKind_Entity); eval = e_eval_from_stringf("(0x%I64x & (~(0x4000 - 1)))", dv->temp_look_vaddr); } else { auto_selected = 1; - auto_space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->process), RD_EvalSpaceKind_CtrlEntity); + auto_space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->process), CTRL_EvalSpaceKind_Entity); eval = e_eval_from_stringf("(reg:rip & (~(0x4000 - 1)))"); } } @@ -2539,7 +2539,7 @@ RD_VIEW_UI_FUNCTION_DEF(disasm) U128 dasm_text_hash = {0}; TXT_TextInfo dasm_text_info = txt_text_info_from_key_lang(access, rd_regs()->text_key, rd_regs()->lang_kind, &dasm_text_hash); String8 dasm_text_data = c_data_from_hash(access, dasm_text_hash); - B32 is_loading = (dasm_text_info.lines_count == 0 && dim_1u64(range) != 0 && eval.msgs.max_kind == E_MsgKind_Null && (space.kind != RD_EvalSpaceKind_CtrlEntity || space_entity != &ctrl_entity_nil)); + B32 is_loading = (dasm_text_info.lines_count == 0 && dim_1u64(range) != 0 && eval.msgs.max_kind == E_MsgKind_Null && (space.kind != CTRL_EvalSpaceKind_Entity || space_entity != &ctrl_entity_nil)); B32 has_disasm = (dasm_text_info.lines_count != 0 && dasm_info.lines.count != 0); ////////////////////////////// @@ -2670,7 +2670,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory) Rng1U64 view_range = rd_space_range_from_eval(eval); if(eval.space.kind == 0) { - eval.space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->process), RD_EvalSpaceKind_CtrlEntity); + eval.space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->process), CTRL_EvalSpaceKind_Entity); view_range = rd_whole_range_from_eval_space(eval.space); } @@ -3035,7 +3035,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory) { e_space_read(eval.space, visible_memory, viz_range_bytes); } - if(eval.space.kind == RD_EvalSpaceKind_CtrlEntity) + if(eval.space.kind == CTRL_EvalSpaceKind_Entity) { CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(eval.space); if(entity->kind == CTRL_EntityKind_Process) @@ -3077,7 +3077,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory) CTRL_Entity *selected_process = ctrl_entity_ancestor_from_kind(selected_thread, CTRL_EntityKind_Process); CTRL_CallStack selected_call_stack = ctrl_call_stack_from_thread(access, selected_thread->handle, 1, 0); CTRL_Entity *eval_process = &ctrl_entity_nil; - if(eval.space.kind == RD_EvalSpaceKind_CtrlEntity) + if(eval.space.kind == CTRL_EvalSpaceKind_Entity) { eval_process = rd_ctrl_entity_from_eval_space(eval.space); } @@ -3149,7 +3149,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory) } //- rjf: fill local variable annotations - if(e_space_match(rd_eval_space_from_ctrl_entity(selected_process, RD_EvalSpaceKind_CtrlEntity), eval.space)) + if(e_space_match(rd_eval_space_from_ctrl_entity(selected_process, CTRL_EvalSpaceKind_Entity), eval.space)) { Vec4F32 local_color = ui_color_from_name(str8_lit("code_local")); Vec4F32 color_gen_table[] = diff --git a/src/raddbg/raddbg_widgets.c b/src/raddbg/raddbg_widgets.c index 36cbe7f6..95f84b74 100644 --- a/src/raddbg/raddbg_widgets.c +++ b/src/raddbg/raddbg_widgets.c @@ -2565,7 +2565,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe { E_Eval eval = e_eval_from_string(mouse_expr); B32 eval_implicit_hover = (eval.irtree.mode != E_Mode_Null && - eval.space.kind == RD_EvalSpaceKind_CtrlEntity); + eval.space.kind == CTRL_EvalSpaceKind_Entity); if(eval.msgs.max_kind == E_MsgKind_Null && (eval_implicit_hover || mouse_expr_is_explicit)) { U64 line_vaddr = 0;