split eval systems, to decouple types/exprs/parsing (debug info dependent), from irization (macro map dependent), from interpretation (completely independent of the former two stages & all their dependencies)

This commit is contained in:
Ryan Fleury
2024-08-06 13:57:48 -07:00
parent c1cea82ae7
commit 5a682e5888
21 changed files with 6753 additions and 6486 deletions
+79 -57
View File
@@ -8603,59 +8603,95 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
scratch_end(scratch);
}
//- rjf: choose evaluation context
//- rjf: unpack eval-dependent info
DF_Entity *process = df_entity_from_handle(df_interact_regs()->process);
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
Architecture arch = df_architecture_from_entity(thread);
U64 unwind_count = df_interact_regs()->unwind_count;
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
DF_EntityList all_modules = df_query_cached_entity_list_with_kind(DF_EntityKind_Module);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
U64 tls_root_vaddr = ctrl_query_cached_tls_root_vaddr_from_thread(df_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
U64 rdis_count = all_modules.count;
RDI_Parsed **rdis = push_array(arena, RDI_Parsed *, rdis_count);
Rng1U64 *rdis_vaddr_ranges = push_array(arena, Rng1U64, rdis_count);
RDI_Parsed *rdi_primary = &di_rdi_parsed_nil;
DI_Key primary_dbgi_key = {0};
{
DF_Entity *process = df_entity_from_handle(df_interact_regs()->process);
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
U64 unwind_count = df_interact_regs()->unwind_count;
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
DF_EntityList all_modules = df_query_cached_entity_list_with_kind(DF_EntityKind_Module);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
U64 tls_root_vaddr = ctrl_query_cached_tls_root_vaddr_from_thread(df_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
E_Ctx *ctx = push_array(arena, E_Ctx, 1);
ctx->arch = df_architecture_from_entity(thread);
ctx->ip_vaddr = rip_vaddr;
ctx->ip_voff = rip_voff;
DI_Key primary_dbgi_key = {0};
if(all_modules.count == 0)
U64 idx = 0;
for(DF_EntityNode *n = all_modules.first; n != 0; n = n->next, idx += 1)
{
ctx->rdis_count = 1;
ctx->rdis = push_array(arena, RDI_Parsed *, 1);
ctx->rdis[0] = &di_rdi_parsed_nil;
}
else
{
ctx->rdis_count = all_modules.count;
ctx->rdis = push_array(arena, RDI_Parsed *, ctx->rdis_count);
ctx->rdis_vaddr_ranges = push_array(arena, Rng1U64, ctx->rdis_count);
DI_Key dbgi_key = df_dbgi_key_from_module(n->entity);
rdis[idx] = di_rdi_from_key(df_state->frame_di_scope, &dbgi_key, 0);
rdis_vaddr_ranges[idx] = n->entity->vaddr_rng;
if(n->entity == module)
{
U64 primary_idx = 0;
U64 idx = 0;
for(DF_EntityNode *n = all_modules.first; n != 0; n = n->next, idx += 1)
{
DI_Key dbgi_key = df_dbgi_key_from_module(n->entity);
ctx->rdis[idx] = di_rdi_from_key(df_state->frame_di_scope, &dbgi_key, 0);
ctx->rdis_vaddr_ranges[idx] = n->entity->vaddr_rng;
if(n->entity == module)
{
primary_dbgi_key = dbgi_key;
primary_idx = idx;
}
}
if(primary_idx != 0)
{
Swap(RDI_Parsed *, ctx->rdis[0], ctx->rdis[primary_idx]);
Swap(Rng1U64, ctx->rdis_vaddr_ranges[0], ctx->rdis_vaddr_ranges[primary_idx]);
}
primary_dbgi_key = dbgi_key;
rdi_primary = rdis[idx];
}
}
}
//- rjf: build eval type context
E_TypeCtx *type_ctx = push_array(arena, E_TypeCtx, 1);
{
E_TypeCtx *ctx = type_ctx;
ctx->arch = arch;
ctx->ip_vaddr = rip_vaddr;
ctx->ip_voff = rip_voff;
ctx->rdi_primary = rdi_primary;
ctx->rdis_count = rdis_count;
ctx->rdis = rdis;
ctx->rdis_vaddr_ranges = rdis_vaddr_ranges;
}
e_select_type_ctx(type_ctx);
//- rjf: build eval parse context
E_ParseCtx *parse_ctx = push_array(arena, E_ParseCtx, 1);
ProfScope("build eval parse context")
{
E_ParseCtx *ctx = parse_ctx;
ctx->arch = arch;
ctx->ip_vaddr = rip_vaddr;
ctx->ip_voff = rip_voff;
ctx->rdi_primary = rdi_primary;
ctx->rdis_count = rdis_count;
ctx->rdis = rdis;
ctx->rdis_vaddr_ranges = rdis_vaddr_ranges;
ctx->regs_map = ctrl_string2reg_from_arch(ctx->arch);
ctx->reg_alias_map = ctrl_string2alias_from_arch(ctx->arch);
ctx->locals_map = df_query_cached_locals_map_from_dbgi_key_voff(&primary_dbgi_key, rip_voff);
ctx->member_map = df_query_cached_member_map_from_dbgi_key_voff(&primary_dbgi_key, rip_voff);
}
e_select_parse_ctx(parse_ctx);
//- rjf: build eval IR context
E_IRCtx *ir_ctx = push_array(arena, E_IRCtx, 1);
{
E_IRCtx *ctx = ir_ctx;
ctx->macro_map = push_array(arena, E_String2ExprMap, 1);
ctx->macro_map[0] = e_string2expr_map_make(arena, 512);
DF_EntityList watches = df_query_cached_entity_list_with_kind(DF_EntityKind_Watch);
for(DF_EntityNode *n = watches.first; n != 0; n = n->next)
{
DF_Entity *watch = n->entity;
String8 expr = watch->name;
E_TokenArray tokens = e_token_array_from_text(arena, expr);
E_Parse parse = e_parse_expr_from_text_tokens(arena, expr, &tokens);
if(parse.msgs.max_kind == E_MsgKind_Null)
{
e_push_leaf_ident_exprs_from_expr__in_place(arena, ctx->macro_map, parse.expr);
}
}
}
e_select_ir_ctx(ir_ctx);
//- rjf: build eval interpretation context
E_InterpretCtx *interpret_ctx = push_array(arena, E_InterpretCtx, 1);
{
E_InterpretCtx *ctx = interpret_ctx;
ctx->arch = arch;
ctx->memory_read_user_data = process;
ctx->memory_read = df_eval_memory_read;
ctx->reg_data = ctrl_query_cached_reg_block_from_thread(arena, df_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
@@ -8664,22 +8700,8 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
ctx->module_base[0]= module->vaddr_rng.min;
ctx->tls_base = push_array(arena, U64, 1);
ctx->tls_base[0] = df_query_cached_tls_base_vaddr_from_process_root_rip(process, tls_root_vaddr, rip_vaddr);
e_select_ctx(ctx);
{
DF_EntityList watches = df_query_cached_entity_list_with_kind(DF_EntityKind_Watch);
for(DF_EntityNode *n = watches.first; n != 0; n = n->next)
{
DF_Entity *watch = n->entity;
String8 expr = watch->name;
E_TokenArray tokens = e_token_array_from_text(arena, expr);
E_Parse parse = e_parse_expr_from_text_tokens(arena, expr, &tokens);
if(parse.msgs.max_kind == E_MsgKind_Null)
{
e_push_leaf_ident_exprs_from_expr__in_place(arena, ctx->macro_map, parse.expr);
}
}
}
}
e_select_interpret_ctx(interpret_ctx);
ProfEnd();
}
+124 -101
View File
@@ -507,8 +507,8 @@ df_cmd_params_from_window(DF_Window *window)
p.window = df_handle_from_window(window);
p.panel = df_handle_from_panel(window->focused_panel);
p.view = df_handle_from_view(df_selected_tab_from_panel(window->focused_panel));
p.prefer_dasm = df_prefer_dasm_from_window(window);
p.entity = df_interact_regs()->thread;
p.prefer_dasm = df_prefer_dasm_from_window(window);
p.entity = df_interact_regs()->thread;
p.unwind_index = df_interact_regs()->unwind_count;
p.inline_depth = df_interact_regs()->inline_depth;
return p;
@@ -529,7 +529,7 @@ df_cmd_params_from_panel(DF_Window *window, DF_Panel *panel)
p.panel = df_handle_from_panel(panel);
p.view = df_handle_from_view(df_selected_tab_from_panel(panel));
p.prefer_dasm = df_prefer_dasm_from_window(window);
p.entity = df_interact_regs()->thread;
p.entity = df_interact_regs()->thread;
p.unwind_index = df_interact_regs()->unwind_count;
p.inline_depth = df_interact_regs()->inline_depth;
return p;
@@ -550,7 +550,7 @@ df_cmd_params_from_view(DF_Window *window, DF_Panel *panel, DF_View *view)
p.panel = df_handle_from_panel(panel);
p.view = df_handle_from_view(view);
p.prefer_dasm = df_prefer_dasm_from_window(window);
p.entity = df_interact_regs()->thread;
p.entity = df_interact_regs()->thread;
p.unwind_index = df_interact_regs()->unwind_count;
p.inline_depth = df_interact_regs()->inline_depth;
return p;
@@ -2596,8 +2596,8 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_Entity);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_VirtualOff);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_VirtualAddr);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_UnwindIndex);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_InlineDepth);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_UnwindIndex);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_InlineDepth);
df_cmd_list_push(arena, cmds, &params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation));
}
@@ -2613,7 +2613,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_Entity);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_VirtualOff);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_VirtualAddr);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_UnwindIndex);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_UnwindIndex);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_InlineDepth);
df_cmd_list_push(arena, cmds, &params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation));
}
@@ -2627,7 +2627,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
di_scope_close(scope);
}break;
case DF_CoreCmdKind_FindSelectedThread:
{
{
DF_Entity *selected_thread = df_entity_from_handle(df_base_interact_regs()->thread);
DF_CmdParams params = df_cmd_params_from_window(ws);
params.entity = df_handle_from_entity(selected_thread);
@@ -4295,37 +4295,37 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
DF_Entity *process = df_entity_ancestor_from_kind(entity, DF_EntityKind_Process);
CTRL_Unwind base_unwind = df_query_cached_unwind_from_thread(entity);
DF_Unwind rich_unwind = df_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
String8List lines = {0};
for(U64 frame_idx = 0; frame_idx < rich_unwind.frames.concrete_frame_count; frame_idx += 1)
{
DF_UnwindFrame *concrete_frame = &rich_unwind.frames.v[frame_idx];
String8List lines = {0};
for(U64 frame_idx = 0; frame_idx < rich_unwind.frames.concrete_frame_count; frame_idx += 1)
{
DF_UnwindFrame *concrete_frame = &rich_unwind.frames.v[frame_idx];
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, concrete_frame->regs);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
RDI_Parsed *rdi = concrete_frame->rdi;
RDI_Procedure *procedure = concrete_frame->procedure;
for(DF_UnwindInlineFrame *inline_frame = concrete_frame->last_inline_frame;
inline_frame != 0;
inline_frame = inline_frame->prev)
{
RDI_InlineSite *inline_site = inline_frame->inline_site;
RDI_Parsed *rdi = concrete_frame->rdi;
RDI_Procedure *procedure = concrete_frame->procedure;
for(DF_UnwindInlineFrame *inline_frame = concrete_frame->last_inline_frame;
inline_frame != 0;
inline_frame = inline_frame->prev)
{
RDI_InlineSite *inline_site = inline_frame->inline_site;
String8 name = {0};
name.str = rdi_string_from_idx(rdi, inline_site->name_string_idx, &name.size);
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [inlined] \"%S\"%s%S", rip_vaddr, name, df_entity_is_nil(module) ? "" : " in ", module->name);
}
if(procedure != 0)
{
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [inlined] \"%S\"%s%S", rip_vaddr, name, df_entity_is_nil(module) ? "" : " in ", module->name);
}
if(procedure != 0)
{
String8 name = {0};
name.str = rdi_name_from_procedure(rdi, procedure, &name.size);
str8_list_pushf(scratch.arena, &lines, "0x%I64x: \"%S\"%s%S", rip_vaddr, name, df_entity_is_nil(module) ? "" : " in ", module->name);
}
else if(!df_entity_is_nil(module))
{
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [??? in %S]", rip_vaddr, module->name);
}
else
{
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [??? in ???]", rip_vaddr);
}
str8_list_pushf(scratch.arena, &lines, "0x%I64x: \"%S\"%s%S", rip_vaddr, name, df_entity_is_nil(module) ? "" : " in ", module->name);
}
else if(!df_entity_is_nil(module))
{
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [??? in %S]", rip_vaddr, module->name);
}
else
{
str8_list_pushf(scratch.arena, &lines, "0x%I64x: [??? in ???]", rip_vaddr);
}
}
StringJoin join = {0};
join.sep = join.post = str8_lit("\n");
@@ -4672,6 +4672,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
if(ws->autocomp_lister_params.flags & DF_AutoCompListerFlag_Locals)
{
E_String2NumMap *locals_map = df_query_cached_locals_map_from_dbgi_key_voff(&dbgi_key, thread_rip_voff);
E_String2NumMap *member_map = df_query_cached_member_map_from_dbgi_key_voff(&dbgi_key, thread_rip_voff);
for(E_String2NumMapNode *n = locals_map->first; n != 0; n = n->order_next)
{
DF_AutoCompListerItem item = {0};
@@ -4685,6 +4686,19 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
df_autocomp_lister_item_chunk_list_push(scratch.arena, &item_list, 256, &item);
}
}
for(E_String2NumMapNode *n = member_map->first; n != 0; n = n->order_next)
{
DF_AutoCompListerItem item = {0};
{
item.string = n->string;
item.kind_string = str8_lit("Local (Member)");
item.matches = fuzzy_match_find(scratch.arena, query, n->string);
}
if(query.size == 0 || item.matches.count != 0)
{
df_autocomp_lister_item_chunk_list_push(scratch.arena, &item_list, 256, &item);
}
}
}
//- rjf: gather registers
@@ -4750,6 +4764,12 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
}
}
//- rjf: gather members
if(ws->autocomp_lister_params.flags & DF_AutoCompListerFlag_Members)
{
}
//- rjf: gather languages
if(ws->autocomp_lister_params.flags & DF_AutoCompListerFlag_Languages)
{
@@ -8358,12 +8378,12 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
scratch_end(scratch);
}
//////////////////////////////
//- rjf: increment per-window frame counter
//
ws->frames_alive += 1;
//////////////////////////////
//- rjf: increment per-window frame counter
//
ws->frames_alive += 1;
ProfEnd();
}
@@ -8514,7 +8534,10 @@ df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags
}
// rjf: special-case: strings
if(!has_array && direct_type_is_string && (flags & DF_EvalVizStringFlag_ReadOnlyDisplayRules) && eval.mode == E_Mode_Addr)
if(!has_array &&
direct_type_is_string &&
(flags & DF_EvalVizStringFlag_ReadOnlyDisplayRules) &&
eval.mode == E_Mode_Addr)
{
U64 string_memory_addr = value_eval.value.u64;
U64 element_size = e_type_byte_size_from_key(direct_type_key);
@@ -8547,7 +8570,7 @@ df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags
// rjf: descend to pointed-at thing
else if(direct_type_has_content && (flags & DF_EvalVizStringFlag_ReadOnlyDisplayRules))
{
if(depth < 5)
if(depth < 4)
{
E_Eval pted_eval = zero_struct;
pted_eval.type_key = direct_type_key;
@@ -8636,8 +8659,8 @@ df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags
{
E_Eval element_eval = zero_struct;
element_eval.type_key = direct_type_key;
element_eval.mode = eval.mode;
element_eval.value = eval.value;
element_eval.mode = eval.mode;
element_eval.value = eval.value;
element_eval.value.u64 += direct_type_byte_size*idx;
String8List element_strs = df_single_line_eval_value_strings_from_eval(arena, flags, default_radix, font, font_size, max_size-space_taken, depth+1, element_eval, opt_member, cfg_table);
space_taken += f_dim_from_tag_size_string_list(font, font_size, 0, 0, element_strs).x;
@@ -8695,8 +8718,8 @@ df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags
E_Eval member_eval = zero_struct;
member_eval.type_key = mem->type_key;
member_eval.mode = eval.mode;
member_eval.value = eval.value;
member_eval.value.u64 += mem->off;
member_eval.value = eval.value;
member_eval.value.u64 += mem->off;
String8List member_strs = df_single_line_eval_value_strings_from_eval(arena, flags, default_radix, font, font_size, max_size-space_taken, depth+1, member_eval, opt_member, cfg_table);
space_taken += f_dim_from_tag_size_string_list(font, font_size, 0, 0, member_strs).x;
str8_list_concat_in_place(&list, &member_strs);
@@ -8902,9 +8925,9 @@ df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope,
E_Eval member_eval = zero_struct;
{
member_eval.type_key = member->type_key;
member_eval.mode = block->eval.mode;
member_eval.value = block->eval.value;
member_eval.value.u64 += member->off;
member_eval.mode = block->eval.mode;
member_eval.value = block->eval.value;
member_eval.value.u64 += member->off;
}
// rjf: get view rules
@@ -9005,9 +9028,9 @@ df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope,
E_Eval elem_eval = zero_struct;
{
elem_eval.type_key = direct_type_key;
elem_eval.mode = block->eval.mode;
elem_eval.value = block->eval.value;
elem_eval.value.u64 += idx*direct_type_key_byte_size;
elem_eval.mode = block->eval.mode;
elem_eval.value = block->eval.value;
elem_eval.value.u64 += idx*direct_type_key_byte_size;
}
// rjf: get view rules
@@ -9060,8 +9083,8 @@ df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope,
E_Eval link_eval = zero_struct;
{
link_eval.type_key = block->eval.type_key;
link_eval.mode = link_base->mode;
link_eval.value.u64= link_base->offset;
link_eval.mode = link_base->mode;
link_eval.value.u64= link_base->offset;
}
// rjf: get view rules
@@ -9111,31 +9134,31 @@ df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope,
}break;
//////////////////////////////
//- rjf: all types -> produce rows for visible range
//- rjf: all elements of a debug info table -> produce rows for visible range
//
case DF_EvalVizBlockKind_DebugInfoTable:
for(U64 idx = visible_idx_range.min; idx < visible_idx_range.max; idx += 1)
{
FZY_Item *item = &block->fzy_backing_items.v[idx];
{
FZY_Item *item = &block->fzy_backing_items.v[idx];
// rjf: determine dbgi/rdi to which this item belongs
RDI_Parsed *rdi = &di_rdi_parsed_nil;
{
U64 base_idx = 0;
for(U64 rdi_idx = 0; rdi_idx < e_state->ctx->rdis_count; rdi_idx += 1)
for(U64 rdi_idx = 0; rdi_idx < e_parse_ctx->rdis_count; rdi_idx += 1)
{
U64 all_items_count = 0;
rdi_section_raw_table_from_kind(e_state->ctx->rdis[rdi_idx], block->fzy_target, &all_items_count);
rdi_section_raw_table_from_kind(e_parse_ctx->rdis[rdi_idx], block->fzy_target, &all_items_count);
if(base_idx <= item->idx && item->idx < base_idx + all_items_count)
{
rdi = e_state->ctx->rdis[rdi_idx];
rdi = e_parse_ctx->rdis[rdi_idx];
break;
}
base_idx += all_items_count;
}
}
// rjf: unpack info about this row
}
// rjf: unpack info about this row
String8 name = fzy_item_string_from_rdi_target_element_idx(rdi, block->fzy_target, block->fzy_backing_items.v[idx].idx);
// rjf: get keys for this row
@@ -10586,23 +10609,23 @@ df_entity_tooltips(DF_Window *ws, DF_Entity *entity)
DI_Scope *di_scope = di_scope_open();
DF_Entity *process = df_entity_ancestor_from_kind(entity, DF_EntityKind_Process);
CTRL_Unwind base_unwind = df_query_cached_unwind_from_thread(entity);
DF_Unwind rich_unwind = df_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
for(U64 idx = 0; idx < rich_unwind.frames.concrete_frame_count; idx += 1)
{
DF_UnwindFrame *f = &rich_unwind.frames.v[idx];
DF_Unwind rich_unwind = df_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
for(U64 idx = 0; idx < rich_unwind.frames.concrete_frame_count; idx += 1)
{
DF_UnwindFrame *f = &rich_unwind.frames.v[idx];
RDI_Parsed *rdi = f->rdi;
RDI_Procedure *procedure = f->procedure;
RDI_Procedure *procedure = f->procedure;
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, f->regs);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
String8 module_name = df_entity_is_nil(module) ? str8_lit("???") : str8_skip_last_slash(module->name);
// rjf: inline frames
for(DF_UnwindInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
UI_PrefWidth(ui_children_sum(1)) UI_Row
{
String8 name = {0};
name.str = rdi_string_from_idx(rdi, fin->inline_site->name_string_idx, &name.size);
DF_Font(ws, DF_FontSlot_Code) UI_PrefWidth(ui_em(18.f, 1.f)) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_labelf("0x%I64x", rip_vaddr);
String8 module_name = df_entity_is_nil(module) ? str8_lit("???") : str8_skip_last_slash(module->name);
// rjf: inline frames
for(DF_UnwindInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
UI_PrefWidth(ui_children_sum(1)) UI_Row
{
String8 name = {0};
name.str = rdi_string_from_idx(rdi, fin->inline_site->name_string_idx, &name.size);
DF_Font(ws, DF_FontSlot_Code) UI_PrefWidth(ui_em(18.f, 1.f)) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_labelf("0x%I64x", rip_vaddr);
DF_Font(ws, DF_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_PrefWidth(ui_text_dim(10, 1)) ui_label(str8_lit("[inlined]"));
if(name.size != 0)
{
@@ -10614,14 +10637,14 @@ df_entity_tooltips(DF_Window *ws, DF_Entity *entity)
else
{
DF_Font(ws, DF_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("[??? in %S]", module_name);
}
}
// rjf: concrete frame
UI_PrefWidth(ui_children_sum(1)) UI_Row
{
String8 name = {0};
name.str = rdi_name_from_procedure(rdi, procedure, &name.size);
}
}
// rjf: concrete frame
UI_PrefWidth(ui_children_sum(1)) UI_Row
{
String8 name = {0};
name.str = rdi_name_from_procedure(rdi, procedure, &name.size);
DF_Font(ws, DF_FontSlot_Code) UI_PrefWidth(ui_em(18.f, 1.f)) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_labelf("0x%I64x", rip_vaddr);
if(name.size != 0)
{
@@ -10633,8 +10656,8 @@ df_entity_tooltips(DF_Window *ws, DF_Entity *entity)
else
{
DF_Font(ws, DF_FontSlot_Code) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) UI_PrefWidth(ui_text_dim(10, 1)) ui_labelf("[??? in %S]", module_name);
}
}
}
}
}
di_scope_close(di_scope);
}break;
@@ -12201,13 +12224,13 @@ df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *m
//
UI_Parent(text_container_box) ProfScope("build line text") UI_Focus(UI_FocusKind_Off)
{
DF_RichHoverInfo rich_hover = df_get_rich_hover_info();
Rng1U64 rich_hover_voff_range = rich_hover.voff_range;
if(rich_hover_voff_range.min == 0 && rich_hover_voff_range.max == 0)
{
DF_Entity *module = df_entity_from_handle(rich_hover.module);
rich_hover_voff_range = df_voff_range_from_vaddr_range(module, rich_hover.vaddr_range);
}
DF_RichHoverInfo rich_hover = df_get_rich_hover_info();
Rng1U64 rich_hover_voff_range = rich_hover.voff_range;
if(rich_hover_voff_range.min == 0 && rich_hover_voff_range.max == 0)
{
DF_Entity *module = df_entity_from_handle(rich_hover.module);
rich_hover_voff_range = df_voff_range_from_vaddr_range(module, rich_hover.vaddr_range);
}
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
UI_WidthFill
UI_Column
@@ -12306,7 +12329,7 @@ df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *m
}
if(!mapped_special && token->kind == TXT_TokenKind_Identifier)
{
U64 local_num = e_num_from_string(e_state->ctx->locals_map, token_string);
U64 local_num = e_num_from_string(e_parse_ctx->locals_map, token_string);
if(local_num != 0)
{
mapped_special = 1;
@@ -12318,7 +12341,7 @@ df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *m
}
if(!mapped_special)
{
U64 reg_num = e_num_from_string(e_state->ctx->regs_map, token_string);
U64 reg_num = e_num_from_string(e_parse_ctx->regs_map, token_string);
if(reg_num != 0)
{
mapped_special = 1;
@@ -12328,7 +12351,7 @@ df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *m
}
if(!mapped_special)
{
U64 alias_num = e_num_from_string(e_state->ctx->reg_alias_map, token_string);
U64 alias_num = e_num_from_string(e_parse_ctx->reg_alias_map, token_string);
if(alias_num != 0)
{
mapped_special = 1;
@@ -12477,12 +12500,12 @@ df_code_slice(DF_Window *ws, DF_CodeSliceParams *params, TxtPt *cursor, TxtPt *m
{
B32 matches = 0;
S64 line_info_line_num = 0;
DF_LineList *lines = &params->line_infos[line_idx];
DF_LineList *lines = &params->line_infos[line_idx];
for(DF_LineNode *n = lines->first; n != 0; n = n->next)
{
{
if((n->v.pt.line == line_num || df_entity_is_nil(df_entity_from_handle(df_interact_regs()->file))) &&
((di_key_match(&n->v.dbgi_key, &rich_hover.dbgi_key) &&
n->v.voff_range.min <= rich_hover_voff_range.min && rich_hover_voff_range.min < n->v.voff_range.max) ||
n->v.voff_range.min <= rich_hover_voff_range.min && rich_hover_voff_range.min < n->v.voff_range.max) ||
(params->line_vaddrs[line_idx] == rich_hover.vaddr_range.min && rich_hover.vaddr_range.min != 0)))
{
matches = 1;
@@ -13544,7 +13567,7 @@ df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds)
//- rjf: exiting
case DF_CoreCmdKind_Exit:
{
{
// rjf: save
{
DF_CmdParams params = df_cmd_params_zero();
+10 -10
View File
@@ -1314,7 +1314,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
//
case DF_WatchViewFillKind_Locals:
{
E_String2NumMapNodeArray nodes = e_string2num_map_node_array_from_map(scratch.arena, e_state->ctx->locals_map);
E_String2NumMapNodeArray nodes = e_string2num_map_node_array_from_map(scratch.arena, e_parse_ctx->locals_map);
e_string2num_map_node_array_sort__in_place(&nodes);
for(U64 idx = 0; idx < nodes.count; idx += 1)
{
@@ -1671,7 +1671,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
//
case DF_WatchViewFillKind_Locals:
{
E_String2NumMapNodeArray nodes = e_string2num_map_node_array_from_map(scratch.arena, e_state->ctx->locals_map);
E_String2NumMapNodeArray nodes = e_string2num_map_node_array_from_map(scratch.arena, e_parse_ctx->locals_map);
e_string2num_map_node_array_sort__in_place(&nodes);
for(U64 idx = 0; idx < nodes.count; idx += 1)
{
@@ -1806,14 +1806,14 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
{
for(U64 rdi_idx = 0; rdi_idx < rdis_count; rdi_idx += 1)
{
U64 procedures_count = 0;
rdi_section_raw_table_from_kind(rdis[rdi_idx], RDI_SectionKind_Procedures, &procedures_count);
if(base_idx <= item->idx && item->idx < base_idx + procedures_count)
U64 elements_count = 0;
rdi_section_raw_table_from_kind(rdis[rdi_idx], fzy_target, &elements_count);
if(base_idx <= item->idx && item->idx < base_idx + elements_count)
{
rdi = rdis[rdi_idx];
break;
}
base_idx += procedures_count;
base_idx += elements_count;
}
}
@@ -4318,7 +4318,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
U8 *name_base = rdi_string_from_idx(rdi, procedure->name_string_idx, &name_size);
String8 name = str8(name_base, name_size);
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, procedure->type_idx);
E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), procedure->type_idx, e_idx_from_rdi(rdi));
E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), procedure->type_idx, e_parse_ctx_idx_from_rdi(rdi));
//- rjf: build item button
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
@@ -5915,13 +5915,13 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack)
{
symbol_name.str = rdi_name_from_procedure(row->rdi, row->procedure, &symbol_name.size);
RDI_TypeNode *type = rdi_element_from_name_idx(row->rdi, TypeNodes, row->procedure->type_idx);
symbol_type_string = e_type_string_from_key(scratch.arena, e_type_key_ext(e_type_kind_from_rdi(type->kind), row->procedure->type_idx, e_idx_from_rdi(row->rdi)));
symbol_type_string = e_type_string_from_key(scratch.arena, e_type_key_ext(e_type_kind_from_rdi(type->kind), row->procedure->type_idx, e_parse_ctx_idx_from_rdi(row->rdi)));
}
if(row->inline_site != 0)
{
symbol_name.str = rdi_string_from_idx(row->rdi, row->inline_site->name_string_idx, &symbol_name.size);
RDI_TypeNode *type = rdi_element_from_name_idx(row->rdi, TypeNodes, row->inline_site->type_idx);
symbol_type_string = e_type_string_from_key(scratch.arena, e_type_key_ext(e_type_kind_from_rdi(type->kind), row->inline_site->type_idx, e_idx_from_rdi(row->rdi)));
symbol_type_string = e_type_string_from_key(scratch.arena, e_type_key_ext(e_type_kind_from_rdi(type->kind), row->inline_site->type_idx, e_parse_ctx_idx_from_rdi(row->rdi)));
}
// rjf: build row
@@ -7632,7 +7632,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
df_rgba_from_theme_color(DF_ThemeColor_Thread7),
};
U64 thread_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, df_interact_regs()->unwind_count);
for(E_String2NumMapNode *n = e_ctx()->locals_map->first; n != 0; n = n->order_next)
for(E_String2NumMapNode *n = e_parse_ctx->locals_map->first; n != 0; n = n->order_next)
{
String8 local_name = n->string;
E_Eval local_eval = e_eval_from_string(scratch.arena, local_name);