From c896d05afc4d5ee2a7f19248b8cbf4adc2405135 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 20 Aug 2024 13:53:54 -0700 Subject: [PATCH] relocate entity; fix incorrect eval mode for procedures view; fix incorrect evaluation of callstack frames in new callstack view --- src/df/core/df_core.c | 27 ++++++++++++++++++++++++--- src/df/gfx/df_views.c | 4 +--- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/df/core/df_core.c b/src/df/core/df_core.c index 6b3d7a6e..052865b5 100644 --- a/src/df/core/df_core.c +++ b/src/df/core/df_core.c @@ -3345,7 +3345,6 @@ df_lines_from_file_path_line_num(Arena *arena, String8 file_path, S64 line_num) internal DF_Entity * df_module_from_process_vaddr(DF_Entity *process, U64 vaddr) { - ProfBeginFunction(); DF_Entity *module = &df_g_nil_entity; for(DF_Entity *child = process->first; !df_entity_is_nil(child); child = child->next) { @@ -3355,7 +3354,6 @@ df_module_from_process_vaddr(DF_Entity *process, U64 vaddr) break; } } - ProfEnd(); return module; } @@ -4955,7 +4953,7 @@ df_expr_from_eval_viz_block_index(Arena *arena, DF_EvalVizBlock *block, U64 inde RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, type_idx); E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, (U32)(module - e_parse_ctx->modules)); item_expr = e_push_expr(arena, E_ExprKind_LeafBytecode, 0); - item_expr->mode = E_Mode_Offset; + item_expr->mode = E_Mode_Value; item_expr->space = module->space; item_expr->type_key = type_key; item_expr->bytecode = bytecode; @@ -7937,6 +7935,29 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt) } } }break; + case DF_CoreCmdKind_RelocateEntity: + { + DF_Entity *entity = df_entity_from_handle(params.entity); + DF_Entity *location = df_entity_child_from_kind(entity, DF_EntityKind_Location); + if(df_entity_is_nil(location)) + { + location = df_entity_alloc(entity, DF_EntityKind_Location); + } + location->flags &= ~DF_EntityFlag_HasTextPoint; + location->flags &= ~DF_EntityFlag_HasVAddr; + if(params.text_point.line != 0) + { + df_entity_equip_txt_pt(location, params.text_point); + } + if(params.vaddr != 0) + { + df_entity_equip_vaddr(location, params.vaddr); + } + if(params.file_path.size != 0) + { + df_entity_equip_name(location, params.file_path); + } + }break; //- rjf: breakpoints case DF_CoreCmdKind_AddBreakpoint: diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 78f95ca6..ac4d7737 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -1630,10 +1630,8 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS type_key = e_type_key_ext(E_TypeKind_Function, row->inline_site->type_idx, e_parse_ctx_module_idx_from_rdi(row->rdi)); } U64 row_vaddr = regs_rip_from_arch_block(arch, row->regs); - DF_Entity *module = df_module_from_process_vaddr(process, row_vaddr); - U64 row_voff = df_voff_from_vaddr(module, row_vaddr); E_OpList ops = {0}; - e_oplist_push_op(scratch.arena, &ops, RDI_EvalOp_ModuleOff, row_voff); + e_oplist_push_op(scratch.arena, &ops, RDI_EvalOp_ConstU64, row_vaddr); String8 bytecode = e_bytecode_from_oplist(scratch.arena, &ops); E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafBytecode, 0); expr->bytecode = bytecode;