get ctrl and debug frontend layers onto new pdb-path-based debug info loader layer; sketch out standalone fuzzy search layer, to replace old dbgi searching functionality; shift all debug frontend code from referring to debug info via 'binaries' to referring to debug info via 'dbgis', just file entities at the location of o.g. debug info

This commit is contained in:
Ryan Fleury
2024-05-21 10:08:28 -07:00
parent b9ac104276
commit a019115b95
17 changed files with 1029 additions and 499 deletions
+61 -69
View File
@@ -583,17 +583,17 @@ df_queue_drag_drop(void)
}
internal void
df_set_hovered_line_info(DF_Entity *binary, U64 voff)
df_set_hovered_line_info(DF_Entity *dbgi, U64 voff)
{
df_gfx_state->hover_line_binary = df_handle_from_entity(binary);
df_gfx_state->hover_line_dbgi = df_handle_from_entity(dbgi);
df_gfx_state->hover_line_voff = voff;
df_gfx_state->hover_line_set_this_frame = 1;
}
internal DF_Entity *
df_get_hovered_line_info_binary(void)
df_get_hovered_line_info_dbgi(void)
{
return df_entity_from_handle(df_gfx_state->hover_line_binary);
return df_entity_from_handle(df_gfx_state->hover_line_dbgi);
}
internal U64
@@ -2488,7 +2488,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
//- rjf: thread finding
case DF_CoreCmdKind_FindThread:
{
DBGI_Scope *scope = dbgi_scope_open();
DI_Scope *scope = di_scope_open();
DF_Entity *thread = df_entity_from_handle(params.entity);
U64 unwind_count = params.index;
if(thread->kind == DF_EntityKind_Thread)
@@ -2499,15 +2499,15 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
// rjf: extract thread/rip info
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *debug = df_dbgi_from_module(module);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
DBGI_Parse *dbgi = df_dbgi_parse_from_binary_file(scope, binary);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_binary_voff(binary, rip_voff);
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, debug);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(debug, rip_voff);
// rjf: snap to resolved line
B32 missing_rip = (rip_vaddr == 0);
B32 binary_missing = (binary->flags & DF_EntityFlag_IsMissing);
B32 dbg_info_pending = !binary_missing && dbgi == &dbgi_parse_nil;
B32 binary_missing = (debug->flags & DF_EntityFlag_IsMissing);
B32 dbg_info_pending = !binary_missing && rdi == &di_rdi_parsed_nil;
B32 has_line_info = (line_info.voff_range.max != line_info.voff_range.min);
B32 has_module = !df_entity_is_nil(module);
B32 has_dbg_info = has_module && !binary_missing;
@@ -2537,7 +2537,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindThread));
}
}
dbgi_scope_close(scope);
di_scope_close(scope);
}break;
case DF_CoreCmdKind_FindSelectedThread:
{
@@ -2561,17 +2561,17 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
// rjf: try to resolve name as a symbol
U64 voff = 0;
DF_Entity *voff_binary = &df_g_nil_entity;
DF_Entity *voff_dbgi = &df_g_nil_entity;
if(name_resolved == 0)
{
DF_EntityList binaries = df_push_active_binary_list(scratch.arena);
for(DF_EntityNode *n = binaries.first; n != 0; n = n->next)
DF_EntityList dbgis = df_push_active_dbgi_list(scratch.arena);
for(DF_EntityNode *n = dbgis.first; n != 0; n = n->next)
{
U64 binary_voff = df_voff_from_binary_symbol_name(n->entity, name);
U64 binary_voff = df_voff_from_dbgi_symbol_name(n->entity, name);
if(binary_voff != 0)
{
voff = binary_voff;
voff_binary = n->entity;
voff_dbgi = n->entity;
name_resolved = 1;
break;
}
@@ -2680,19 +2680,25 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
// rjf: name resolved to voff * dbg info
if(name_resolved != 0 && voff != 0)
{
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_binary_voff(voff_binary, voff);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_voff(voff_dbgi, voff);
DF_CmdParams p = params;
{
p.file_path = df_full_path_from_entity(scratch.arena, dasm2src_info.file);
p.text_point = dasm2src_info.pt;
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_FilePath);
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_TextPoint);
if(!df_entity_is_nil(voff_binary))
if(!df_entity_is_nil(voff_dbgi))
{
p.entity = df_handle_from_entity(voff_binary);
p.voff = dasm2src_info.voff_range.min;
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity);
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_VirtualOff);
DF_EntityList modules = df_modules_from_dbgi(scratch.arena, voff_dbgi);
DF_Entity *module = df_first_entity_from_list(&modules);
DF_Entity *process = df_entity_ancestor_from_kind(module, DF_EntityKind_Process);
if(!df_entity_is_nil(process))
{
p.entity = df_handle_from_entity(process);
p.vaddr = module->vaddr_rng.min + dasm2src_info.voff_range.min;
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity);
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_VirtualAddr);
}
}
}
df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation));
@@ -2911,7 +2917,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
{
for(DF_TextLineSrc2DasmInfoNode *n = src2dasm.v[src2dasm_idx].first; n != 0; n = n->next)
{
DF_EntityList modules = df_modules_from_binary_file(scratch.arena, n->v.binary);
DF_EntityList modules = df_modules_from_dbgi(scratch.arena, n->v.dbgi);
DF_Entity *module = df_module_from_thread_candidates(thread, &modules);
vaddr = df_vaddr_from_voff(module, n->v.voff_range.min);
goto end_lookup;
@@ -3411,26 +3417,10 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
case DF_EntityKind_Module:
{
DF_Entity *bin_file = df_binary_file_from_module(entity);
if(ui_clicked(df_icon_buttonf(DF_IconKind_Module, 0, "Inspect Binary File Memory")))
{
DF_CmdParams params = df_cmd_params_from_panel(ws, panel);
params.entity = df_handle_from_entity(bin_file);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_Entity);
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PendingEntity));
ui_ctx_menu_close();
}
if(ui_clicked(df_icon_buttonf(DF_IconKind_Module, 0, "View Binary File Disassembly")))
{
DF_CmdParams params = df_cmd_params_from_panel(ws, panel);
params.entity = df_handle_from_entity(bin_file);
df_cmd_params_mark_slot(&params, DF_CmdParamSlot_Entity);
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PendingEntity));
ui_ctx_menu_close();
}
}break;
case DF_EntityKind_Process:
{
#if 0
if(ui_clicked(df_icon_buttonf(DF_IconKind_FileOutline, 0, "Open Process Log")))
{
DF_Entity *log = df_log_from_entity(entity);
@@ -3440,9 +3430,11 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Code));
ui_ctx_menu_close();
}
#endif
}break;
case DF_EntityKind_Thread:
{
#if 0
if(ui_clicked(df_icon_buttonf(DF_IconKind_FileOutline, 0, "Open Thread Log")))
{
DF_Entity *log = df_log_from_entity(entity);
@@ -3452,6 +3444,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
df_push_cmd__root(&params, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Code));
ui_ctx_menu_close();
}
#endif
}break;
}
}
@@ -3928,9 +3921,9 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
{
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, unwind.frames.v[frame_idx].regs);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *dbgi = df_dbgi_from_module(module);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
String8 symbol = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
String8 symbol = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
if(symbol.size != 0)
{
str8_list_pushf(scratch.arena, &lines, "0x%I64x: %S", rip_vaddr, symbol);
@@ -4255,7 +4248,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
DF_Entity *module = df_module_from_process_vaddr(process, thread_rip_vaddr);
U64 thread_rip_voff = df_voff_from_vaddr(module, thread_rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *dbgi = df_dbgi_from_module(module);
//- rjf: gather lister items
DF_AutoCompListerItemChunkList item_list = {0};
@@ -4263,7 +4256,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
//- rjf: gather locals
if(ws->autocomp_lister_params.flags & DF_AutoCompListerFlag_Locals)
{
EVAL_String2NumMap *locals_map = df_query_cached_locals_map_from_binary_voff(binary, thread_rip_voff);
EVAL_String2NumMap *locals_map = df_query_cached_locals_map_from_dbgi_voff(dbgi, thread_rip_voff);
for(EVAL_String2NumMapNode *n = locals_map->first; n != 0; n = n->order_next)
{
DF_AutoCompListerItem item = {0};
@@ -5716,7 +5709,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
UI_FontSize(df_font_size_from_slot(ws, DF_FontSlot_Main))
{
Temp scratch = scratch_begin(&arena, 1);
DBGI_Scope *scope = dbgi_scope_open();
DI_Scope *scope = di_scope_open();
DF_CtrlCtx ctrl_ctx = ws->hover_eval_ctrl_ctx;
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
@@ -5983,7 +5976,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
}
}
dbgi_scope_close(scope);
di_scope_close(scope);
scratch_end(scratch);
}
}
@@ -8311,7 +8304,7 @@ df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags
}
internal DF_EvalVizWindowedRowList
df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks)
df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks)
{
ProfBeginFunction();
Temp scratch = scratch_begin(&arena, 1);
@@ -8697,12 +8690,12 @@ df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DBGI_Scope *scop
for(U64 idx = visible_idx_range.min; idx < visible_idx_range.max; idx += 1)
{
// rjf: unpack info about this row
String8 name = dbgi_fuzzy_item_string_from_rdi_target_element_idx(parse_ctx->rdi, block->dbgi_target, block->backing_search_items.v[idx].idx);
String8 name = push_str8f(arena, "Item %I64u", idx); // TODO(rjf): dbgi_fuzzy_item_string_from_rdi_target_element_idx(parse_ctx->rdi, block->dbgi_target, block->fzy_backing_items.v[idx].idx);
// rjf: get keys for this row
DF_ExpandKey parent_key = block->parent_key;
DF_ExpandKey key = block->key;
key.child_num = block->backing_search_items.v[idx].idx;
key.child_num = block->fzy_backing_items.v[idx].idx;
// rjf: get eval for this row
DF_Eval eval = df_eval_from_string(arena, scope, ctrl_ctx, parse_ctx, macro_map, name);
@@ -9942,9 +9935,9 @@ df_entity_tooltips(DF_Entity *entity)
{
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, unwind.frames.v[idx].regs);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *dbgi = df_dbgi_from_module(module);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
String8 symbol = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
String8 symbol = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
UI_PrefWidth(ui_children_sum(1)) UI_Row
{
UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_PrefWidth(ui_em(18.f, 1.f)) UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) ui_labelf("0x%I64x", rip_vaddr);
@@ -10138,8 +10131,8 @@ df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *nam
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, f->regs);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
String8 procedure_name = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
DF_Entity *dbgi = df_dbgi_from_module(module);
String8 procedure_name = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
if(procedure_name.size != 0)
{
FuzzyMatchRangeList fuzzy_matches = {0};
@@ -10582,7 +10575,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
U64 thread_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
DF_Entity *module = df_module_from_process_vaddr(process, thread_rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *dbgi = df_dbgi_from_module(module);
U64 thread_rip_voff = df_voff_from_vaddr(module, thread_rip_vaddr);
// rjf: thread info => color
@@ -10649,7 +10642,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
n != 0;
n = n->next)
{
if(n->v.binary == binary)
if(n->v.dbgi == dbgi)
{
line_info = &n->v;
break;
@@ -10964,7 +10957,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
//
UI_Focus(UI_FocusKind_Off)
{
DBGI_Scope *scope = dbgi_scope_open();
DI_Scope *scope = di_scope_open();
U64 line_idx = 0;
for(S64 line_num = params->line_num_range.min;
line_num < params->line_num_range.max;
@@ -11029,7 +11022,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
}
}
}
dbgi_scope_close(scope);
di_scope_close(scope);
}
//////////////////////////////
@@ -11257,11 +11250,11 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
if(params->line_src2dasm[line_slice_idx].first != 0 &&
params->line_src2dasm[line_slice_idx].first->v.remap_line == mouse_pt.line)
{
df_set_hovered_line_info(params->line_src2dasm[line_slice_idx].first->v.binary, params->line_src2dasm[line_slice_idx].first->v.voff_range.min);
df_set_hovered_line_info(params->line_src2dasm[line_slice_idx].first->v.dbgi, params->line_src2dasm[line_slice_idx].first->v.voff_range.min);
}
if(params->line_dasm2src[line_slice_idx].first != 0)
{
df_set_hovered_line_info(params->line_dasm2src[line_slice_idx].first->v.binary, params->line_dasm2src[line_slice_idx].first->v.voff_range.min);
df_set_hovered_line_info(params->line_dasm2src[line_slice_idx].first->v.dbgi, params->line_dasm2src[line_slice_idx].first->v.voff_range.min);
}
}
@@ -11399,7 +11392,6 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
}
if(dasm2src_info != 0)
{
DF_Entity *binary = dasm2src_info->binary;
has_line_info = 1;
line_info_line_num = dasm2src_info->pt.line;
line_info_t = selected_thread_module->alive_t;
@@ -11426,7 +11418,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
//
UI_Parent(text_container_box) ProfScope("build line text") UI_Focus(UI_FocusKind_Off)
{
DF_Entity *hovered_line_binary = df_get_hovered_line_info_binary();
DF_Entity *hovered_line_dbgi = df_get_hovered_line_info_dbgi();
U64 hovered_line_voff = df_get_hovered_line_info_voff();
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
UI_WidthFill
@@ -11501,12 +11493,12 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
if(token->kind == TXT_TokenKind_Identifier || token->kind == TXT_TokenKind_Keyword)
{
B32 mapped_special = 0;
for(DF_EntityNode *n = params->relevant_binaries.first; n != 0; n = n->next)
for(DF_EntityNode *n = params->relevant_dbgis.first; n != 0; n = n->next)
{
DF_Entity *binary = n->entity;
DF_Entity *dbgi = n->entity;
if(!mapped_special && token->kind == TXT_TokenKind_Identifier)
{
U64 voff = df_voff_from_binary_symbol_name(binary, token_string);
U64 voff = df_voff_from_dbgi_symbol_name(dbgi, token_string);
if(voff != 0)
{
mapped_special = 1;
@@ -11516,7 +11508,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
}
if(!mapped_special && token->kind == TXT_TokenKind_Identifier)
{
U64 type_num = df_type_num_from_binary_name(binary, token_string);
U64 type_num = df_type_num_from_dbgi_name(dbgi, token_string);
if(type_num != 0)
{
mapped_special = 1;
@@ -11708,7 +11700,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
for(DF_TextLineSrc2DasmInfoNode *n = src2dasm_list->first; n != 0; n = n->next)
{
if(n->v.remap_line == line_num &&
n->v.binary == hovered_line_binary &&
n->v.dbgi == hovered_line_dbgi &&
n->v.voff_range.min <= hovered_line_voff && hovered_line_voff < n->v.voff_range.max)
{
matches = 1;
@@ -11721,8 +11713,8 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
// rjf: check dasm2src
if(dasm2src_list->first != 0)
{
DF_Entity *binary = dasm2src_list->first->v.binary;
if(binary == hovered_line_binary)
DF_Entity *dbgi = dasm2src_list->first->v.dbgi;
if(dbgi == hovered_line_dbgi)
{
for(DF_TextLineDasm2SrcInfoNode *n = dasm2src_list->first; n != 0; n = n->next)
{
@@ -13829,7 +13821,7 @@ df_gfx_end_frame(void)
//- rjf: clear hover line info
if(df_gfx_state->hover_line_set_this_frame == 0)
{
df_gfx_state->hover_line_binary = df_handle_zero();
df_gfx_state->hover_line_dbgi = df_handle_zero();
df_gfx_state->hover_line_voff = 0;
}
+7 -7
View File
@@ -300,11 +300,11 @@ enum
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name) df_gfx_view_rule_line_stringize__##name
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(name) internal DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_SIG(DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name))
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(DF_ExpandKey key, DF_Eval eval, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg)
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(DF_ExpandKey key, DF_Eval eval, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg)
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name) df_gfx_view_rule_row_ui__##name
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name))
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, DF_Eval eval, String8 string, DBGI_Scope *dbgi_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg, Vec2F32 dim)
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, DF_Eval eval, String8 string, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg, Vec2F32 dim)
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_NAME(name) df_gfx_view_rule_block_ui__##name
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_NAME(name))
@@ -405,7 +405,7 @@ struct DF_CodeSliceParams
DF_EntityList *line_pins;
DF_TextLineDasm2SrcInfoList *line_dasm2src;
DF_TextLineSrc2DasmInfoList *line_src2dasm;
DF_EntityList relevant_binaries;
DF_EntityList relevant_dbgis;
// rjf: visual parameters
F_Tag font;
@@ -714,7 +714,7 @@ struct DF_GfxState
DF_DragDropState drag_drop_state;
// rjf: hover line info correllation state
DF_Handle hover_line_binary;
DF_Handle hover_line_dbgi;
U64 hover_line_voff;
B32 hover_line_set_this_frame;
@@ -871,8 +871,8 @@ internal B32 df_drag_drop(DF_DragDropPayload *out_payload);
internal void df_drag_kill(void);
internal void df_queue_drag_drop(void);
internal void df_set_hovered_line_info(DF_Entity *binary, U64 voff);
internal DF_Entity *df_get_hovered_line_info_binary(void);
internal void df_set_hovered_line_info(DF_Entity *dbgi, U64 voff);
internal DF_Entity *df_get_hovered_line_info_dbgi(void);
internal U64 df_get_hovered_line_info_voff(void);
////////////////////////////////
@@ -930,7 +930,7 @@ internal void df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdLis
internal String8 df_eval_escaped_from_raw_string(Arena *arena, String8 raw);
internal String8List df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags flags, TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_ctx, U32 default_radix, F_Tag font, F32 font_size, F32 max_size, S32 depth, DF_Eval eval, TG_Member *opt_member, DF_CfgTable *cfg_table);
internal DF_EvalVizWindowedRowList df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks);
internal DF_EvalVizWindowedRowList df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks);
////////////////////////////////
//~ rjf: Hover Eval
+17 -18
View File
@@ -23,7 +23,7 @@ DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array)
str8_list_push(scratch.arena, &array_size_expr_strs, child->string);
}
String8 array_size_expr = str8_list_join(scratch.arena, &array_size_expr_strs, 0);
DF_Eval array_size_eval = df_eval_from_string(arena, dbgi_scope, ctrl_ctx, parse_ctx, macro_map, array_size_expr);
DF_Eval array_size_eval = df_eval_from_string(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, array_size_expr);
DF_Eval array_size_eval_value = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, array_size_eval);
eval_error_list_concat_in_place(&eval.errors, &array_size_eval.errors);
array_size = array_size_eval_value.imm_u64;
@@ -468,7 +468,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
//~ rjf: "text"
internal DF_TxtTopologyInfo
df_vr_txt_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
df_vr_txt_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
{
Temp scratch = scratch_begin(0, 0);
DF_TxtTopologyInfo result = zero_struct;
@@ -526,7 +526,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
//
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
DF_TxtTopologyInfo top = df_vr_txt_topology_info_from_cfg(dbgi_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
DF_TxtTopologyInfo top = df_vr_txt_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr + (top.size_cap ? top.size_cap : 2048));
@@ -609,7 +609,7 @@ DF_VIEW_UI_FUNCTION_DEF(text)
//~ rjf: "disasm"
internal DF_DisasmTopologyInfo
df_vr_disasm_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
df_vr_disasm_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
{
Temp scratch = scratch_begin(0, 0);
DF_DisasmTopologyInfo result = zero_struct;
@@ -668,7 +668,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
state->last_open_frame_idx = df_frame_index();
{
//- rjf: unpack params
DF_DisasmTopologyInfo top = df_vr_disasm_topology_info_from_cfg(dbgi_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
DF_DisasmTopologyInfo top = df_vr_disasm_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
//- rjf: resolve to address value & range
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
@@ -691,7 +691,6 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
dasm_params.style_flags = DASM_StyleFlag_Addresses;
dasm_params.syntax = DASM_Syntax_Intel;
dasm_params.base_vaddr = 0;
dasm_params.exe_path = str8_zero();
}
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &data_hash);
String8 dasm_text_data = {0};
@@ -820,7 +819,7 @@ df_bitmap_view_state__canvas_from_screen_rect(DF_BitmapViewState *bvs, Rng2F32 r
}
internal DF_BitmapTopologyInfo
df_vr_bitmap_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
df_vr_bitmap_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
{
Temp scratch = scratch_begin(0, 0);
DF_BitmapTopologyInfo info = {0};
@@ -945,7 +944,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
//
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
DF_BitmapTopologyInfo topology_info = df_vr_bitmap_topology_info_from_cfg(dbgi_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
DF_BitmapTopologyInfo topology_info = df_vr_bitmap_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
U64 expected_size = topology_info.width*topology_info.height*r_tex2d_format_bytes_per_pixel_table[topology_info.fmt];
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr+expected_size);
@@ -1000,7 +999,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
DF_VIEW_SETUP_FUNCTION_DEF(bitmap)
{
DF_BitmapViewState *bvs = df_view_user_state(view, DF_BitmapViewState);
DBGI_Scope *dbgi_scope = dbgi_scope_open();
DI_Scope *di_scope = di_scope_open();
DF_CfgNode *view_center_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("view_center"), StringMatchFlag_CaseInsensitive);
DF_CfgNode *zoom_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("zoom"), StringMatchFlag_CaseInsensitive);
DF_CfgNode *bitmap_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("bitmap"), StringMatchFlag_CaseInsensitive);
@@ -1008,16 +1007,16 @@ DF_VIEW_SETUP_FUNCTION_DEF(bitmap)
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, process, thread_unwind_rip_vaddr);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, thread_unwind_rip_vaddr);
bvs->view_center_pos.x = (F32)f64_from_str8(bitmap_cfg->first->string);
bvs->view_center_pos.y = (F32)f64_from_str8(bitmap_cfg->first->next->string);
bvs->zoom = (F32)f64_from_str8(zoom_cfg->first->string);
bvs->top = df_vr_bitmap_topology_info_from_cfg(dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, bitmap_cfg);
bvs->top = df_vr_bitmap_topology_info_from_cfg(di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, bitmap_cfg);
if(bvs->zoom == 0)
{
bvs->zoom = 1.f;
}
dbgi_scope_close(dbgi_scope);
di_scope_close(di_scope);
}
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(bitmap)
@@ -1068,7 +1067,7 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
{
DF_BitmapViewState *bvs = df_view_user_state(view, DF_BitmapViewState);
Temp scratch = scratch_begin(0, 0);
DBGI_Scope *dbgi_scope = dbgi_scope_open();
DI_Scope *di_scope = di_scope_open();
HS_Scope *hs_scope = hs_scope_open();
TEX_Scope *tex_scope = tex_scope_open();
@@ -1079,13 +1078,13 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, process, thread_unwind_rip_vaddr);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, thread_unwind_rip_vaddr);
//////////////////////////////
//- rjf: evaluate expression
//
String8 expr = str8(view->query_buffer, view->query_string_size);
DF_Eval eval = df_eval_from_string(scratch.arena, dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
DF_Eval eval = df_eval_from_string(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx.type_graph, parse_ctx.rdi, &ctrl_ctx, eval);
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
U64 expected_size = bvs->top.width*bvs->top.height*r_tex2d_format_bytes_per_pixel_table[bvs->top.fmt];
@@ -1163,7 +1162,7 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
hs_scope_close(hs_scope);
tex_scope_close(tex_scope);
dbgi_scope_close(dbgi_scope);
di_scope_close(di_scope);
scratch_end(scratch);
}
@@ -1171,7 +1170,7 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
//~ rjf: "geo"
internal DF_GeoTopologyInfo
df_vr_geo_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
df_vr_geo_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
{
Temp scratch = scratch_begin(0, 0);
DF_GeoTopologyInfo result = {0};
@@ -1292,7 +1291,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(geo)
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
//- rjf: extract extra geo topology info from view rule
DF_GeoTopologyInfo top = df_vr_geo_topology_info_from_cfg(dbgi_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
DF_GeoTopologyInfo top = df_vr_geo_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
Rng1U64 index_buffer_vaddr_range = r1u64(base_vaddr, base_vaddr+top.index_count*sizeof(U32));
Rng1U64 vertex_buffer_vaddr_range = top.vertices_vaddr_range;
+4 -4
View File
@@ -38,7 +38,7 @@ struct DF_VR_TextState
F32 loaded_t;
};
internal DF_TxtTopologyInfo df_vr_txt_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
internal DF_TxtTopologyInfo df_vr_txt_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
////////////////////////////////
//~ rjf: "disasm"
@@ -61,7 +61,7 @@ struct DF_VR_DisasmState
F32 loaded_t;
};
internal DF_DisasmTopologyInfo df_vr_disasm_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
internal DF_DisasmTopologyInfo df_vr_disasm_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
////////////////////////////////
//~ rjf: "bitmap"
@@ -104,7 +104,7 @@ internal Vec2F32 df_bitmap_view_state__screen_from_canvas_pos(DF_BitmapViewState
internal Rng2F32 df_bitmap_view_state__screen_from_canvas_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 cvs);
internal Vec2F32 df_bitmap_view_state__canvas_from_screen_pos(DF_BitmapViewState *bvs, Rng2F32 rect, Vec2F32 scr);
internal Rng2F32 df_bitmap_view_state__canvas_from_screen_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 scr);
internal DF_BitmapTopologyInfo df_vr_bitmap_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
internal DF_BitmapTopologyInfo df_vr_bitmap_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
////////////////////////////////
//~ rjf: "geo"
@@ -139,6 +139,6 @@ struct DF_VR_GeoBoxDrawData
F32 loaded_t;
};
internal DF_GeoTopologyInfo df_vr_geo_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
internal DF_GeoTopologyInfo df_vr_geo_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
#endif // DF_VIEW_RULES_H
+86 -87
View File
@@ -543,7 +543,7 @@ df_watch_view_text_edit_state_from_pt(DF_WatchViewState *wv, DF_WatchViewPoint p
//- rjf: windowed watch tree visualization (both single-line and multi-line)
internal DF_EvalVizBlockList
df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews)
df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews)
{
ProfBeginFunction();
Temp scratch = scratch_begin(&arena, 1);
@@ -551,7 +551,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
DF_EvalViewKey eval_view_key = df_eval_view_key_from_eval_watch_view(ews);
DF_EvalView *eval_view = df_eval_view_from_key(eval_view_key);
String8 filter = str8(view->query_buffer, view->query_string_size);
DBGI_FuzzySearchTarget dbgi_target = DBGI_FuzzySearchTarget_UDTs;
FZY_Target fzy_target = FZY_Target_UDTs;
switch(ews->fill_kind)
{
////////////////////////////
@@ -635,10 +635,10 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
////////////////////////////
//- rjf: debug info table fill -> build split debug info table blocks
//
case DF_WatchViewFillKind_Globals: dbgi_target = DBGI_FuzzySearchTarget_GlobalVariables; goto dbgi_table;
case DF_WatchViewFillKind_ThreadLocals: dbgi_target = DBGI_FuzzySearchTarget_ThreadVariables; goto dbgi_table;
case DF_WatchViewFillKind_Types: dbgi_target = DBGI_FuzzySearchTarget_UDTs; goto dbgi_table;
case DF_WatchViewFillKind_Procedures: dbgi_target = DBGI_FuzzySearchTarget_Procedures; goto dbgi_table;
case DF_WatchViewFillKind_Globals: fzy_target = FZY_Target_GlobalVariables; goto dbgi_table;
case DF_WatchViewFillKind_ThreadLocals: fzy_target = FZY_Target_ThreadVariables; goto dbgi_table;
case DF_WatchViewFillKind_Types: fzy_target = FZY_Target_UDTs; goto dbgi_table;
case DF_WatchViewFillKind_Procedures: fzy_target = FZY_Target_Procedures; goto dbgi_table;
dbgi_table:;
{
//- rjf: unpack context
@@ -646,10 +646,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
U64 thread_rip_unwind_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx->unwind_count);
DF_Entity *module = df_module_from_process_vaddr(process, thread_rip_unwind_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
String8 exe_path = df_full_path_from_entity(scratch.arena, binary);
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, exe_path, os_now_microseconds()+100);
RDI_Parsed *rdi = &dbgi->rdi;
DF_Entity *dbgi = df_dbgi_from_module(module);
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
//- rjf: calculate top-level keys, expand root-level, grab root expansion node
DF_ExpandKey parent_key = df_expand_key_make(5381, 0);
@@ -660,7 +658,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
//- rjf: query all filtered items from dbgi searching system
U128 fuzzy_search_key = {(U64)view, df_hash_from_string(str8_struct(&view))};
B32 items_stale = 0;
DBGI_FuzzySearchItemArray items = dbgi_fuzzy_search_items_from_key_exe_query(scope, fuzzy_search_key, exe_path, filter, dbgi_target, os_now_microseconds()+100, &items_stale);
// TODO(rjf)
FZY_ItemArray items = {0}; // dbgi_fuzzy_search_items_from_key_exe_query(scope, fuzzy_search_key, exe_path, filter, dbgi_target, os_now_microseconds()+100, &items_stale);
if(items_stale)
{
df_gfx_request_frame();
@@ -691,7 +690,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
U64 idx = 0;
for(DF_ExpandNode *child = root_node->first; child != 0; child = child->next)
{
U64 item_num = dbgi_fuzzy_item_num_from_array_element_idx__linear_search(&items, child->key.child_num);
U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&items, child->key.child_num);
if(item_num != 0)
{
sub_expand_keys[idx] = child->key;
@@ -731,8 +730,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
DF_EvalVizBlock *last_vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_DebugInfoTable, parent_key, root_key, 0);
{
last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, items.count);
last_vb->dbgi_target = dbgi_target;
last_vb->backing_search_items = items;
last_vb->fzy_target = fzy_target;
last_vb->fzy_backing_items = items;
}
for(U64 sub_expand_idx = 0; sub_expand_idx < sub_expand_keys_count; sub_expand_idx += 1)
{
@@ -740,7 +739,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
last_vb = df_eval_viz_block_split_and_continue(arena, &blocks, last_vb, sub_expand_item_idxs[sub_expand_idx]);
// rjf: grab name for the expanded row
String8 name = dbgi_fuzzy_item_string_from_rdi_target_element_idx(&dbgi->rdi, dbgi_target, sub_expand_keys[sub_expand_idx].child_num);
// TODO(rjf)
String8 name = {0}; // dbgi_fuzzy_item_string_from_rdi_target_element_idx(&dbgi->rdi, dbgi_target, sub_expand_keys[sub_expand_idx].child_num);
// rjf: recurse for sub-expansion
{
@@ -817,7 +817,7 @@ internal void
df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 default_radix, Rng2F32 rect)
{
ProfBeginFunction();
DBGI_Scope *scope = dbgi_scope_open();
DI_Scope *scope = di_scope_open();
Temp scratch = scratch_begin(0, 0);
//////////////////////////////
@@ -2035,7 +2035,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
}
scratch_end(scratch);
dbgi_scope_close(scope);
di_scope_close(scope);
ProfEnd();
}
@@ -3228,15 +3228,15 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
{
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
DBGI_Scope *scope = dbgi_scope_open();
DI_Scope *scope = di_scope_open();
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
DF_Entity *module = df_module_from_process_vaddr(process, thread_unwind_rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
String8 exe_path = df_full_path_from_entity(scratch.arena, binary);
DF_Entity *dbgi = df_dbgi_from_module(module);
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
String8 query = str8(view->query_buffer, view->query_string_size);
TG_Graph *graph = tg_graph_begin(bit_size_from_arch(df_architecture_from_entity(thread))/8, 256);
@@ -3250,10 +3250,9 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
//- rjf: query -> raddbg, filtered items
U128 fuzzy_search_key = {(U64)view, df_hash_from_string(str8_struct(&view))};
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, exe_path, os_now_microseconds()+100);
RDI_Parsed *rdi = &dbgi->rdi;
B32 items_stale = 0;
DBGI_FuzzySearchItemArray items = dbgi_fuzzy_search_items_from_key_exe_query(scope, fuzzy_search_key, exe_path, query, DBGI_FuzzySearchTarget_Procedures, os_now_microseconds()+100, &items_stale);
// TODO(rjf)
FZY_ItemArray items = {0}; // dbgi_fuzzy_search_items_from_key_exe_query(scope, fuzzy_search_key, exe_path, query, DBGI_FuzzySearchTarget_Procedures, os_now_microseconds()+100, &items_stale);
if(items_stale)
{
df_gfx_request_frame();
@@ -3304,7 +3303,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
idx += 1)
UI_Focus((slv->cursor.y == idx+1) ? UI_FocusKind_On : UI_FocusKind_Off)
{
DBGI_FuzzySearchItem *item = &items.v[idx];
FZY_Item *item = &items.v[idx];
RDI_Procedure *procedure = rdi_element_from_idx(rdi, procedures, item->idx);
U64 name_size = 0;
U8 *name_base = rdi_string_from_idx(rdi, procedure->name_string_idx, &name_size);
@@ -3339,8 +3338,8 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
}
if(ui_hovering(sig)) UI_Tooltip
{
U64 binary_voff = df_voff_from_binary_symbol_name(binary, name);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_binary_voff(binary, binary_voff);
U64 binary_voff = df_voff_from_dbgi_symbol_name(dbgi, name);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, binary_voff);
String8 file_path = df_full_path_from_entity(scratch.arena, dasm2src_info.file);
S64 line_num = dasm2src_info.pt.line;
df_code_label(1.f, 0, df_rgba_from_theme_color(DF_ThemeColor_CodeFunction), name);
@@ -3360,7 +3359,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
}
}
dbgi_scope_close(scope);
di_scope_close(scope);
scratch_end(scratch);
ProfEnd();
}
@@ -4520,7 +4519,6 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
{
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
DBGI_Scope *scope = dbgi_scope_open();
String8 query = str8(view->query_buffer, view->query_string_size);
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
@@ -4735,8 +4733,8 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
U64 rip_vaddr = df_query_cached_rip_from_thread(entity);
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_binary_voff(binary, rip_voff);
DF_Entity *dbgi = df_dbgi_from_module(module);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, rip_voff);
if(!df_entity_is_nil(line_info.file))
{
UI_PrefWidth(ui_children_sum(0)) df_entity_src_loc_button(ws, line_info.file, line_info.pt);
@@ -4753,7 +4751,6 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
sv->selected_column = cursor.x;
sv->selected_entity = (1 <= cursor.y && cursor.y <= items.count) ? df_handle_from_entity(items.v[cursor.y-1].entity) : df_handle_zero();
dbgi_scope_close(scope);
scratch_end(scratch);
ProfEnd();
}
@@ -5029,7 +5026,7 @@ DF_VIEW_CMD_FUNCTION_DEF(Modules)
{
String8 exe_path = module->name;
String8 dbg_path = pick_string;
dbgi_force_exe_path_dbg_path(exe_path, dbg_path);
// TODO(rjf)
}
scratch_end(scratch);
}break;
@@ -5041,7 +5038,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
{
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
DBGI_Scope *scope = dbgi_scope_open();
DI_Scope *scope = di_scope_open();
String8 query = str8(view->query_buffer, view->query_string_size);
//- rjf: get state
@@ -5208,16 +5205,17 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
B32 brw_is_selected = (row_is_selected && cursor.x == 3);
// rjf: unpack module info
DF_Entity *binary = df_binary_file_from_module(entity);
DBGI_Parse *dbgi = df_dbgi_parse_from_binary_file(scope, binary);
B32 dbgi_is_valid = (dbgi->dbg_props.modified != 0);
DF_Entity *dbgi = df_dbgi_from_module(entity);
String8 dbgi_path = df_full_path_from_entity(scratch.arena, dbgi);
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
B32 dbgi_is_valid = (rdi != &di_rdi_parsed_nil);
// rjf: begin editing
if(txt_is_selected && edit_begin)
{
mv->txt_editing = 1;
mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi->dbg_path.size);
MemoryCopy(mv->txt_buffer, dbgi->dbg_path.str, mv->txt_size);
mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi_path.size);
MemoryCopy(mv->txt_buffer, dbgi_path.str, mv->txt_size);
mv->txt_cursor = txt_pt(1, 1+mv->txt_size);
mv->txt_mark = txt_pt(1, 1);
}
@@ -5229,7 +5227,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
UI_WidthFill
{
UI_TextColor(!dbgi_is_valid ? df_rgba_from_theme_color(DF_ThemeColor_FailureBackground) : ui_top_text_color())
sig = df_line_editf(DF_LineEditFlag_NoBackground, 0, 0, &mv->txt_cursor, &mv->txt_mark, mv->txt_buffer, sizeof(mv->txt_buffer), &mv->txt_size, 0, dbgi->dbg_path, "###dbg_path_%p", entity);
sig = df_line_editf(DF_LineEditFlag_NoBackground, 0, 0, &mv->txt_cursor, &mv->txt_mark, mv->txt_buffer, sizeof(mv->txt_buffer), &mv->txt_size, 0, dbgi_path, "###dbg_path_%p", entity);
edit_commit = (edit_commit || ui_committed(sig));
}
@@ -5247,8 +5245,8 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
{
ui_kill_action();
mv->txt_editing = 1;
mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi->dbg_path.size);
MemoryCopy(mv->txt_buffer, dbgi->dbg_path.str, mv->txt_size);
mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi_path.size);
MemoryCopy(mv->txt_buffer, dbgi_path.str, mv->txt_size);
mv->txt_cursor = txt_pt(1, 1+mv->txt_size);
mv->txt_mark = txt_pt(1, 1);
}
@@ -5287,7 +5285,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
{
String8 exe_path = commit_module->name;
String8 dbg_path = str8(mv->txt_buffer, mv->txt_size);
dbgi_force_exe_path_dbg_path(exe_path, dbg_path);
// TODO(rjf)
}
if(edit_submit)
{
@@ -5305,7 +5303,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
mv->selected_column = cursor.x;
mv->selected_entity = (1 <= cursor.y && cursor.y <= items.count) ? df_handle_from_entity(items.v[cursor.y-1].entity) : df_handle_zero();
dbgi_scope_close(scope);
di_scope_close(scope);
scratch_end(scratch);
ProfEnd();
}
@@ -5539,8 +5537,8 @@ DF_VIEW_CMD_FUNCTION_DEF(Code)
if(src2dasm_list->first != 0)
{
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
DF_Entity *binary = src2dasm_list->first->v.binary;
DF_EntityList possible_modules = df_modules_from_binary_file(scratch.arena, binary);
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
DF_Entity *thread_dst_module = df_module_from_thread_candidates(thread, &possible_modules);
U64 thread_dst_voff = voff_rng.min;
if(!df_entity_is_nil(thread_dst_module) && thread_dst_voff != 0)
@@ -5665,7 +5663,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
HS_Scope *hs_scope = hs_scope_open();
DBGI_Scope *dbgi_scope = dbgi_scope_open();
DI_Scope *di_scope = di_scope_open();
TXT_Scope *txt_scope = txt_scope_open();
DF_CodeViewState *tv = df_view_user_state(view, DF_CodeViewState);
@@ -5692,7 +5690,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
U64 unwind_count = ctrl_ctx.unwind_count;
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, process, rip_vaddr);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, rip_vaddr);
//////////////////////////////
//- rjf: unpack file/text entity info
@@ -5842,8 +5840,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
U64 last_inst_on_unwound_rip_vaddr = rip_vaddr - !!unwind_count;
DF_Entity *module = df_module_from_process_vaddr(process, last_inst_on_unwound_rip_vaddr);
U64 rip_voff = df_voff_from_vaddr(module, last_inst_on_unwound_rip_vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_binary_voff(binary, rip_voff);
DF_Entity *dbgi = df_dbgi_from_module(module);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, rip_voff);
if(dasm2src_info.file == entity && visible_line_num_range.min <= dasm2src_info.pt.line && dasm2src_info.pt.line <= visible_line_num_range.max)
{
U64 slice_line_idx = dasm2src_info.pt.line-visible_line_num_range.min;
@@ -5874,7 +5872,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
{
MemoryCopy(code_slice_params.line_src2dasm, src2dasm.v, sizeof(DF_TextLineSrc2DasmInfoList)*src2dasm.count);
}
code_slice_params.relevant_binaries = src2dasm.binaries;
code_slice_params.relevant_dbgis = src2dasm.dbgis;
}
}
@@ -6118,7 +6116,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
String8 expr = txt_string_from_info_data_txt_rng(&text_info, data, expr_rng);
if(expr.size != 0)
{
DF_Eval eval = df_eval_from_string(scratch.arena, dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
DF_Eval eval = df_eval_from_string(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
if(eval.mode != EVAL_EvalMode_NULL)
{
df_set_hover_eval(ws, sig.mouse_expr_baseline_pos, ctrl_ctx, entity, sig.mouse_pt, 0, expr);
@@ -6190,8 +6188,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
if(src2dasm_list->first != 0)
{
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
DF_Entity *binary = src2dasm_list->first->v.binary;
DF_EntityList possible_modules = df_modules_from_binary_file(scratch.arena, binary);
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
DF_Entity *thread_dst_module = df_module_from_thread_candidates(dropped_entity, &possible_modules);
U64 thread_dst_voff = voff_rng.min;
if(!df_entity_is_nil(thread_dst_module) && thread_dst_voff != 0)
@@ -6247,8 +6245,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
if(src2dasm_list->first != 0)
{
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
DF_Entity *binary = src2dasm_list->first->v.binary;
DF_EntityList possible_modules = df_modules_from_binary_file(scratch.arena, binary);
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
DF_Entity *thread_dst_module = df_module_from_thread_candidates(thread, &possible_modules);
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
@@ -6406,20 +6404,19 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
//- rjf: determine up-to-dateness of source file
//
B32 file_is_out_of_date = 0;
String8 out_of_date_binary_name = {0};
for(DF_EntityNode *n = code_slice_params.relevant_binaries.first; n != 0; n = n->next)
String8 out_of_date_dbgi_name = {0};
for(DF_EntityNode *n = code_slice_params.relevant_dbgis.first; n != 0; n = n->next)
{
DF_Entity *binary = n->entity;
if(!df_entity_is_nil(binary))
DF_Entity *dbgi = n->entity;
if(!df_entity_is_nil(dbgi))
{
String8 full_path = df_full_path_from_entity(scratch.arena, entity);
TXTI_Handle handle = txti_handle_from_path(full_path);
TXTI_BufferInfo info = txti_buffer_info_from_handle(scratch.arena, handle);
DBGI_Parse *parse = df_dbgi_parse_from_binary_file(dbgi_scope, binary);
if(parse->exe_props.modified < info.timestamp)
if(dbgi->timestamp < info.timestamp)
{
file_is_out_of_date = 1;
out_of_date_binary_name = binary->name;
out_of_date_dbgi_name = dbgi->name;
break;
}
}
@@ -6457,9 +6454,9 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
{
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(1, 1))
{
ui_labelf("This file has changed since ", out_of_date_binary_name);
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_Highlight0)) ui_label(out_of_date_binary_name);
ui_labelf(" was built.");
ui_labelf("This file has changed since ", out_of_date_dbgi_name);
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_Highlight0)) ui_label(out_of_date_dbgi_name);
ui_labelf(" was produced.");
}
}
}
@@ -6479,7 +6476,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
}
txt_scope_close(txt_scope);
dbgi_scope_close(dbgi_scope);
di_scope_close(di_scope);
hs_scope_close(hs_scope);
scratch_end(scratch);
ProfEnd();
@@ -6521,8 +6518,8 @@ DF_VIEW_CMD_FUNCTION_DEF(Disassembly)
DF_Entity *process = df_entity_from_handle(dv->process);
Architecture arch = df_architecture_from_entity(process);
U64 dasm_base_vaddr = AlignDownPow2(dv->base_vaddr, KB(64));
DF_Entity *dasm_module = df_module_from_process_vaddr(process, dasm_base_vaddr);
DF_Entity *dasm_binary = df_binary_file_from_module(dasm_module);
DF_Entity *dasm_module = df_module_from_process_vaddr(process, dasm_base_vaddr);
DF_Entity *dasm_dbgi = df_dbgi_from_module(dasm_module);
Rng1U64 dasm_vaddr_range = r1u64(dasm_base_vaddr, dasm_base_vaddr+KB(64));
U128 dasm_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, dasm_vaddr_range, 0);
U128 dasm_data_hash = {0};
@@ -6533,7 +6530,8 @@ DF_VIEW_CMD_FUNCTION_DEF(Disassembly)
dasm_params.style_flags = dv->style_flags;
dasm_params.syntax = DASM_Syntax_Intel;
dasm_params.base_vaddr = dasm_module->vaddr_rng.min;
dasm_params.exe_path = df_full_path_from_entity(scratch.arena, dasm_binary);
dasm_params.dbg_path = df_full_path_from_entity(scratch.arena, dasm_dbgi);
dasm_params.dbg_timestamp = dasm_dbgi->timestamp;
}
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash);
U128 dasm_text_hash = {0};
@@ -6732,7 +6730,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
HS_Scope *hs_scope = hs_scope_open();
DASM_Scope *dasm_scope = dasm_scope_open();
TXT_Scope *txt_scope = txt_scope_open();
DBGI_Scope *dbgi_scope = dbgi_scope_open();
DI_Scope *di_scope = di_scope_open();
DF_DisasmViewState *dv = df_view_user_state(view, DF_DisasmViewState);
//////////////////////////////
@@ -6757,7 +6755,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
DF_Entity *selected_process = df_entity_ancestor_from_kind(selected_thread, DF_EntityKind_Process);
U64 unwind_count = ctrl_ctx.unwind_count;
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(selected_thread, unwind_count);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, selected_process, rip_vaddr);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, selected_process, rip_vaddr);
//////////////////////////////
//- rjf: no disasm process open? -> snap to selected thread
@@ -6776,7 +6774,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
Architecture arch = df_architecture_from_entity(process);
U64 dasm_base_vaddr = AlignDownPow2(dv->base_vaddr, KB(64));
DF_Entity *dasm_module = df_module_from_process_vaddr(process, dasm_base_vaddr);
DF_Entity *dasm_binary = df_binary_file_from_module(dasm_module);
DF_Entity *dasm_dbgi = df_dbgi_from_module(dasm_module);
Rng1U64 dasm_vaddr_range = r1u64(dasm_base_vaddr, dasm_base_vaddr+KB(64));
U128 dasm_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, dasm_vaddr_range, 0);
U128 dasm_data_hash = {0};
@@ -6787,7 +6785,8 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
dasm_params.style_flags = dv->style_flags;
dasm_params.syntax = DASM_Syntax_Intel;
dasm_params.base_vaddr = dasm_module->vaddr_rng.min;
dasm_params.exe_path = df_full_path_from_entity(scratch.arena, dasm_binary);
dasm_params.dbg_path = df_full_path_from_entity(scratch.arena, dasm_dbgi);
dasm_params.dbg_timestamp = dasm_dbgi->timestamp;
}
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash);
U128 dasm_text_hash = {0};
@@ -6800,7 +6799,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
//- rjf: unpack module info for this region
//
DF_Entity *module = df_module_from_process_vaddr(process, dasm_vaddr_range.min);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *dbgi = df_dbgi_from_module(module);
//////////////////////////////
//- rjf: is loading -> equip view with loading information
@@ -6889,7 +6888,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
{
code_slice_params.margin_float_off_px = 0;
}
df_entity_list_push(scratch.arena, &code_slice_params.relevant_binaries, binary);
df_entity_list_push(scratch.arena, &code_slice_params.relevant_dbgis, dbgi);
// rjf: fill text info
{
@@ -6971,7 +6970,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
// rjf: fill dasm -> src info
{
DF_Entity *module = df_module_from_process_vaddr(process, dasm_vaddr_range.min);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *dbgi = df_dbgi_from_module(module);
for(S64 line_num = visible_line_num_range.min; line_num < visible_line_num_range.max; line_num += 1)
{
U64 vaddr = dasm_vaddr_range.min + dasm_inst_array_code_off_from_idx(&dasm_info.insts, line_num-1);
@@ -6980,7 +6979,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
DF_TextLineDasm2SrcInfoNode *dasm2src_n = push_array(scratch.arena, DF_TextLineDasm2SrcInfoNode, 1);
SLLQueuePush(code_slice_params.line_dasm2src[slice_idx].first, code_slice_params.line_dasm2src[slice_idx].last, dasm2src_n);
code_slice_params.line_dasm2src[slice_idx].count += 1;
dasm2src_n->v = df_text_line_dasm2src_info_from_binary_voff(binary, voff);
dasm2src_n->v = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, voff);
}
}
}
@@ -7050,7 +7049,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
String8 expr = str8_substr(code_slice_params.line_text[line_idx], r1u64(sig.mouse_expr_rng.min.column-1, sig.mouse_expr_rng.max.column-1));
if(expr.size != 0)
{
DF_Eval eval = df_eval_from_string(scratch.arena, dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
DF_Eval eval = df_eval_from_string(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
if(eval.mode != EVAL_EvalMode_NULL)
{
U64 off = dasm_inst_array_code_off_from_idx(&dasm_info.insts, sig.mouse_expr_rng.min.line-1);
@@ -7150,9 +7149,9 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
{
U64 vaddr = dasm_vaddr_range.min+dasm_inst_array_code_off_from_idx(&dasm_info.insts, sig.goto_src_line_num-1);
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *dbgi = df_dbgi_from_module(module);
U64 voff = df_voff_from_vaddr(module, vaddr);
DF_TextLineDasm2SrcInfo dasm2src = df_text_line_dasm2src_info_from_binary_voff(binary, voff);
DF_TextLineDasm2SrcInfo dasm2src = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, voff);
String8 file_path = df_full_path_from_entity(scratch.arena, dasm2src.file);
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
params.text_point = dasm2src.pt;
@@ -7326,7 +7325,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
}
}
dbgi_scope_close(dbgi_scope);
di_scope_close(di_scope);
txt_scope_close(txt_scope);
dasm_scope_close(dasm_scope);
hs_scope_close(hs_scope);
@@ -7598,7 +7597,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
{
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
DBGI_Scope *scope = dbgi_scope_open();
DI_Scope *scope = di_scope_open();
DF_CodeViewState *tv = df_view_user_state(view, DF_CodeViewState);
//////////////////////////////
@@ -8119,7 +8118,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
}
}
dbgi_scope_close(scope);
di_scope_close(scope);
scratch_end(scratch);
ProfEnd();
}
@@ -8492,9 +8491,9 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
{
U64 f_rip = regs_rip_from_arch_block(thread->arch, f->regs);
DF_Entity *module = df_module_from_process_vaddr(process, f_rip);
DF_Entity *binary = df_binary_file_from_module(module);
DF_Entity *dbgi = df_dbgi_from_module(module);
U64 rip_voff = df_voff_from_vaddr(module, f_rip);
String8 symbol_name = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
String8 symbol_name = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
Annotation *annotation = push_array(scratch.arena, Annotation, 1);
annotation->name_string = symbol_name.size != 0 ? symbol_name : str8_lit("[external code]");
annotation->kind_string = str8_lit("Call Stack Frame");
@@ -8544,7 +8543,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
df_rgba_from_theme_color(DF_ThemeColor_Thread6),
df_rgba_from_theme_color(DF_ThemeColor_Thread7),
};
DBGI_Scope *scope = dbgi_scope_open();
DI_Scope *scope = di_scope_open();
U64 thread_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(scope, process, thread_rip_vaddr);
RDI_Parsed *rdi = parse_ctx.rdi;
@@ -8575,7 +8574,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
}
}
}
dbgi_scope_close(scope);
di_scope_close(scope);
}
}
+1 -1
View File
@@ -495,7 +495,7 @@ internal String8 df_string_from_eval_viz_row_column_kind(Arena *arena, DF_EvalVi
internal DF_WatchViewTextEditState *df_watch_view_text_edit_state_from_pt(DF_WatchViewState *wv, DF_WatchViewPoint pt);
//- rjf: windowed watch tree visualization
internal DF_EvalVizBlockList df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews);
internal DF_EvalVizBlockList df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews);
//- rjf: eval/watch views main hooks
internal void df_watch_view_init(DF_WatchViewState *ewv, DF_View *view, DF_WatchViewFillKind fill_kind);