diff --git a/src/df/core/df_core.c b/src/df/core/df_core.c index 39912eb5..a2b09bcf 100644 --- a/src/df/core/df_core.c +++ b/src/df/core/df_core.c @@ -1110,6 +1110,16 @@ df_cmd_params_apply_spec_query(Arena *arena, DF_CtrlCtx *ctrl_ctx, DF_CmdParams params->index = u64; df_cmd_params_mark_slot(params, DF_CmdParamSlot_Index); }break; + case DF_CmdParamSlot_BaseUnwindIndex: + { + params->base_unwind_index = u64; + df_cmd_params_mark_slot(params, DF_CmdParamSlot_BaseUnwindIndex); + }break; + case DF_CmdParamSlot_InlineUnwindIndex: + { + params->inline_unwind_index = u64; + df_cmd_params_mark_slot(params, DF_CmdParamSlot_InlineUnwindIndex); + }break; case DF_CmdParamSlot_ID: { params->id = u64; @@ -2853,7 +2863,7 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread) Rng1U64 line_vaddr_rng = {0}; { U64 ip_voff = df_voff_from_vaddr(module, ip_vaddr); - DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, ip_voff); + DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, ip_voff, 0); Rng1U64 line_voff_rng = line_info.voff_range; if(line_voff_rng.max != 0) { @@ -2867,7 +2877,7 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread) // is enabled. This is enabled by default normally. { U64 opl_line_voff_rng = df_voff_from_vaddr(module, line_vaddr_rng.max); - DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, opl_line_voff_rng); + DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, opl_line_voff_rng, 0); if(line_info.pt.line == 0xf00f00 || line_info.pt.line == 0xfeefee) { line_vaddr_rng.max = df_vaddr_from_voff(module, line_info.voff_range.max); @@ -2978,7 +2988,7 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread) Rng1U64 line_vaddr_rng = {0}; { U64 ip_voff = df_voff_from_vaddr(module, ip_vaddr); - DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, ip_voff); + DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, ip_voff, 0); Rng1U64 line_voff_rng = line_info.voff_range; if(line_voff_rng.max != 0) { @@ -2992,7 +3002,7 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread) // is enabled. This is enabled by default normally. { U64 opl_line_voff_rng = df_voff_from_vaddr(module, line_vaddr_rng.max); - DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, opl_line_voff_rng); + DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, opl_line_voff_rng, 0); if(line_info.pt.line == 0xf00f00 || line_info.pt.line == 0xfeefee) { line_vaddr_rng.max = df_vaddr_from_voff(module, line_info.voff_range.max); @@ -3309,7 +3319,7 @@ df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entit //- rjf: voff -> src lookups internal DF_TextLineDasm2SrcInfo -df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff) +df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff, U64 inline_unwind_idx) { Temp scratch = scratch_begin(0, 0); DI_Scope *scope = di_scope_open(); @@ -3317,16 +3327,33 @@ df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff) DF_TextLineDasm2SrcInfo result = {0}; result.file = &df_g_nil_entity; { - U64 unit_idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_UnitVMap, voff); - RDI_Unit *unit = rdi_element_from_name_idx(rdi, Units, unit_idx); - RDI_LineTable *line_table = rdi_element_from_name_idx(rdi, LineTables, unit->line_table_idx); - RDI_ParsedLineTable unit_line_info = {0}; - rdi_parsed_from_line_table(rdi, line_table, &unit_line_info); - U64 line_info_idx = rdi_line_info_idx_from_voff(&unit_line_info, voff); - if(line_info_idx < unit_line_info.count) + RDI_Unit *unit = rdi_unit_from_voff(rdi, voff); + RDI_LineTable *line_table = rdi_line_table_from_unit(rdi, unit); + RDI_Scope *scope = rdi_scope_from_voff(rdi, voff); { - RDI_Line *line = &unit_line_info.lines[line_info_idx]; - RDI_Column *column = (line_info_idx < unit_line_info.col_count) ? &unit_line_info.cols[line_info_idx] : 0; + U64 idx = 0; + for(RDI_Scope *s = scope; + s->inline_site_idx != 0 && idx < inline_unwind_idx; + s = rdi_element_from_name_idx(rdi, Scopes, s->parent_scope_idx), idx += 1) + { + if(idx == inline_unwind_idx) + { + RDI_InlineSite *inline_site = rdi_element_from_name_idx(rdi, InlineSites, s->inline_site_idx); + if(inline_site->line_table_idx != 0) + { + line_table = rdi_element_from_name_idx(rdi, LineTables, inline_site->line_table_idx); + } + break; + } + } + } + RDI_ParsedLineTable parsed_line_table = {0}; + rdi_parsed_from_line_table(rdi, line_table, &parsed_line_table); + U64 line_info_idx = rdi_line_info_idx_from_voff(&parsed_line_table, voff); + if(line_info_idx < parsed_line_table.count) + { + RDI_Line *line = &parsed_line_table.lines[line_info_idx]; + RDI_Column *column = (line_info_idx < parsed_line_table.col_count) ? &parsed_line_table.cols[line_info_idx] : 0; RDI_SourceFile *file = rdi_element_from_name_idx(rdi, SourceFiles, line->file_idx); String8 file_normalized_full_path = {0}; file_normalized_full_path.str = rdi_string_from_idx(rdi, file->normal_full_path_string_idx, &file_normalized_full_path.size); @@ -3336,7 +3363,7 @@ df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff) result.file = df_entity_from_path(file_normalized_full_path, DF_EntityFromPathFlag_All); } result.pt = txt_pt(line->line_num, column ? column->col_first : 1); - result.voff_range = r1u64(unit_line_info.voffs[line_info_idx], unit_line_info.voffs[line_info_idx+1]); + result.voff_range = r1u64(parsed_line_table.voffs[line_info_idx], parsed_line_table.voffs[line_info_idx+1]); } } di_scope_close(scope); @@ -3671,6 +3698,7 @@ df_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, DF_Entity *process, RDI_Scope *scope = rdi_scope_from_voff(rdi, rip_voff); // rjf: add rich frames for inlines + U64 inline_unwind_idx = 0; for(RDI_Scope *s = scope; s->inline_site_idx != 0; s = rdi_element_from_name_idx(rdi, Scopes, s->parent_scope_idx)) { RDI_InlineSite *site = rdi_element_from_name_idx(rdi, InlineSites, s->inline_site_idx); @@ -3681,6 +3709,9 @@ df_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, DF_Entity *process, n->v.rdi = rdi; n->v.procedure = 0; n->v.inline_site = site; + n->v.base_unwind_idx = base_frame_idx; + n->v.inline_unwind_idx = inline_unwind_idx; + inline_unwind_idx += 1; } // rjf: add frame for concrete frame @@ -3691,6 +3722,9 @@ df_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, DF_Entity *process, n->v.rdi = rdi; n->v.procedure = rdi_element_from_name_idx(rdi, Procedures, scope->proc_idx); n->v.inline_site = 0; + n->v.base_unwind_idx = base_frame_idx; + n->v.inline_unwind_idx = inline_unwind_idx; + inline_unwind_idx = 0; } DF_Unwind result = {0}; { @@ -3706,6 +3740,24 @@ df_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, DF_Entity *process, return result; } +internal DF_UnwindFrame * +df_frame_from_unwind_idxs(DF_Unwind *unwind, U64 base_unwind_idx, U64 inline_unwind_idx) +{ + DF_UnwindFrame *f = 0; + for(U64 idx = 0; idx < unwind->frames.count; idx += 1) + { + if(unwind->frames.v[idx].base_unwind_idx == base_unwind_idx) + { + f = &unwind->frames.v[idx]; + if(unwind->frames.v[idx].inline_unwind_idx == inline_unwind_idx) + { + break; + } + } + } + return f; +} + //////////////////////////////// //~ rjf: Entity -> Log Entities @@ -3882,6 +3934,7 @@ df_ctrl_run(DF_RunKind run, DF_Entity *run_thread, CTRL_RunFlags flags, CTRL_Tra // rjf: set control context to top unwind df_state->ctrl_ctx.unwind_count = 0; + df_state->ctrl_ctx.inline_unwind_count = 0; scratch_end(scratch); } @@ -6506,13 +6559,15 @@ df_push_cmd__root(DF_CmdParams *params, DF_CmdSpec *spec) { log_infof("| cmd_spec: \"%S\"\n", params->cmd_spec->info.string); } - if(params->string.size != 0) { log_infof("| string: \"%S\"\n", params->string); } - if(params->file_path.size != 0) { log_infof("| file_path: \"%S\"\n", params->file_path); } - if(params->text_point.line != 0){ log_infof("| text_point: [line:%I64d, col:%I64d]\n", params->text_point.line, params->text_point.column); } - if(params->vaddr != 0) { log_infof("| vaddr: 0x%I64x\n", params->vaddr); } - if(params->voff != 0) { log_infof("| voff: 0x%I64x\n", params->voff); } - if(params->index != 0) { log_infof("| index: 0x%I64x\n", params->index); } - if(params->id != 0) { log_infof("| id: 0x%I64x\n", params->id); } + if(params->string.size != 0) { log_infof("| string: \"%S\"\n", params->string); } + if(params->file_path.size != 0) { log_infof("| file_path: \"%S\"\n", params->file_path); } + if(params->text_point.line != 0) { log_infof("| text_point: [line:%I64d, col:%I64d]\n", params->text_point.line, params->text_point.column); } + if(params->vaddr != 0) { log_infof("| vaddr: 0x%I64x\n", params->vaddr); } + if(params->voff != 0) { log_infof("| voff: 0x%I64x\n", params->voff); } + if(params->index != 0) { log_infof("| index: 0x%I64x\n", params->index); } + if(params->base_unwind_index != 0) { log_infof("| base_unwind_index: 0x%I64x\n", params->base_unwind_index); } + if(params->inline_unwind_index != 0){ log_infof("| inline_unwind_index: 0x%I64x\n", params->inline_unwind_index); } + if(params->id != 0) { log_infof("| id: 0x%I64x\n", params->id); } if(params->os_event != 0) { String8 kind_string = str8_lit(""); @@ -6786,7 +6841,7 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt) DF_Entity *module = df_module_from_process_vaddr(process, stop_thread_vaddr); DI_Key dbgi_key = df_dbgi_key_from_module(module); U64 stop_thread_voff = df_voff_from_vaddr(module, stop_thread_vaddr); - DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, stop_thread_voff); + DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, stop_thread_voff, 0); DF_EntityList user_bps = df_query_cached_entity_list_with_kind(DF_EntityKind_Breakpoint); for(DF_EntityNode *n = user_bps.first; n != 0; n = n->next) { @@ -7623,32 +7678,67 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt) }break; case DF_CoreCmdKind_SelectUnwind: { + DI_Scope *di_scope = di_scope_open(); DF_Entity *thread = df_entity_from_handle(df_state->ctrl_ctx.thread); - CTRL_Unwind unwind = df_query_cached_unwind_from_thread(thread); - U64 max_unwind = unwind.frames.count ? unwind.frames.count-1 : 0; - U64 index = Clamp(0, params.index, max_unwind); - df_state->ctrl_ctx.unwind_count = index; - df_state->ctrl_ctx.inline_unwind_count = 0; - }break; - case DF_CoreCmdKind_SelectInlineUnwind: - { - + DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process); + CTRL_Unwind base_unwind = df_query_cached_unwind_from_thread(thread); + DF_Unwind rich_unwind = df_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind); + DF_UnwindFrame *frame = df_frame_from_unwind_idxs(&rich_unwind, params.base_unwind_index, params.inline_unwind_index); + if(frame != 0) + { + df_state->ctrl_ctx.unwind_count = frame->base_unwind_idx; + df_state->ctrl_ctx.inline_unwind_count = frame->inline_unwind_idx; + } + di_scope_close(di_scope); }break; case DF_CoreCmdKind_UpOneFrame: - { - DF_CtrlCtx ctrl_ctx = df_ctrl_ctx(); - DF_CmdParams p = params; - p.index = (ctrl_ctx.unwind_count > 0 ? ctrl_ctx.unwind_count - 1 : 0); - df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Index); - df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_SelectUnwind)); - }break; case DF_CoreCmdKind_DownOneFrame: { DF_CtrlCtx ctrl_ctx = df_ctrl_ctx(); - DF_CmdParams p = params; - p.index = ctrl_ctx.unwind_count+1; - df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Index); - df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_SelectUnwind)); + DI_Scope *di_scope = di_scope_open(); + DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread); + DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process); + CTRL_Unwind base_unwind = df_query_cached_unwind_from_thread(thread); + DF_Unwind rich_unwind = df_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind); + DF_UnwindFrame *current_frame = 0; + for(U64 idx = 0; idx < rich_unwind.frames.count; idx += 1) + { + if(rich_unwind.frames.v[idx].base_unwind_idx == ctrl_ctx.unwind_count && + rich_unwind.frames.v[idx].inline_unwind_idx == ctrl_ctx.inline_unwind_count) + { + current_frame = &rich_unwind.frames.v[idx]; + break; + } + } + if(current_frame == 0 && rich_unwind.frames.count != 0) + { + current_frame = &rich_unwind.frames.v[0]; + } + DF_UnwindFrame *next_frame = current_frame; + switch(core_cmd_kind) + { + default:{}break; + case DF_CoreCmdKind_UpOneFrame: + if(current_frame != 0 && (current_frame - rich_unwind.frames.v) > 0) + { + next_frame -= 1; + }break; + case DF_CoreCmdKind_DownOneFrame: + if(current_frame != 0 && (current_frame - rich_unwind.frames.v)+1 < rich_unwind.frames.count) + { + next_frame += 1; + }break; + } + if(next_frame != 0) + { + DF_CmdParams p = params; + df_cmd_params_mark_slot(&p, DF_CmdParamSlot_BaseUnwindIndex); + df_cmd_params_mark_slot(&p, DF_CmdParamSlot_InlineUnwindIndex); + p.base_unwind_index = next_frame->base_unwind_idx; + p.inline_unwind_index = next_frame->base_unwind_idx; + df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_SelectUnwind)); + } + di_scope_close(di_scope); }break; case DF_CoreCmdKind_FreezeThread: case DF_CoreCmdKind_ThawThread: diff --git a/src/df/core/df_core.h b/src/df/core/df_core.h index 824cfc38..f4c8029e 100644 --- a/src/df/core/df_core.h +++ b/src/df/core/df_core.h @@ -527,6 +527,8 @@ struct DF_UnwindFrame RDI_Parsed *rdi; RDI_Procedure *procedure; RDI_InlineSite *inline_site; + U64 base_unwind_idx; + U64 inline_unwind_idx; }; typedef struct DF_UnwindFrameNode DF_UnwindFrameNode; @@ -1586,7 +1588,7 @@ internal String8 df_symbol_name_from_process_vaddr(Arena *arena, DF_Entity *proc internal DF_TextLineSrc2DasmInfoListArray df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entity *file, Rng1S64 line_num_range); //- rjf: voff -> src lookups -internal DF_TextLineDasm2SrcInfo df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff); +internal DF_TextLineDasm2SrcInfo df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff, U64 inline_unwind_idx); //- rjf: symbol -> voff lookups internal U64 df_voff_from_dbgi_key_symbol_name(DI_Key *dbgi_key, String8 symbol_name); @@ -1604,6 +1606,7 @@ internal EVAL_String2NumMap *df_push_member_map_from_dbgi_key_voff(Arena *arena, internal B32 df_set_thread_rip(DF_Entity *thread, U64 vaddr); internal DF_Entity *df_module_from_thread_candidates(DF_Entity *thread, DF_EntityList *candidates); internal DF_Unwind df_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, DF_Entity *process, CTRL_Unwind *base_unwind); +internal DF_UnwindFrame *df_frame_from_unwind_idxs(DF_Unwind *unwind, U64 base_unwind_idx, U64 inline_unwind_idx); //////////////////////////////// //~ rjf: Entity -> Log Entities diff --git a/src/df/core/df_core.mdesk b/src/df/core/df_core.mdesk index f4c5b70d..a633106b 100644 --- a/src/df/core/df_core.mdesk +++ b/src/df/core/df_core.mdesk @@ -96,6 +96,8 @@ DF_CmdParamSlotTable: {PreferDisassembly prefer_dasm `B32`} {ForceConfirm force_confirm `B32`} {Dir2 dir2 `Dir2`} + {BaseUnwindIndex base_unwind_index `U64`} + {InlineUnwindIndex inline_unwind_index `U64`} } @table(name lister_omit q_slot q_ent_kind q_allow_files q_allow_folders q_keep_oi q_select_oi q_is_code q_required canonical_icon string display_name desc search_tags ) @@ -152,7 +154,6 @@ DF_CoreCmdTable:// | | | {SelectThreadWindow 0 Entity Thread 0 0 0 0 0 1 Null "select_thread_window" "Select Thread On Window" "Selects a thread for the active window, overriding the global selected thread." "" } {SelectThreadView 0 Entity Thread 0 0 0 0 0 1 Null "select_thread_view" "Select Thread On View" "Selects a thread for the active view, overriding the global and per-window selected threads." "" } {SelectUnwind 1 Null Nil 0 0 0 0 0 0 Null "select_unwind" "Select Unwind" "Selects an unwind frame number for the selected thread." "" } - {SelectInlineUnwind 1 Null Nil 0 0 0 0 0 0 Null "select_inline_unwind" "Select Inline Unwind" "Selects an inline unwind frame number for the selected thread." "" } {UpOneFrame 0 Null Nil 0 0 0 0 0 0 UpArrow "up_one_frame" "Up One Frame" "Selects the callstack frame above the currently selected." "" } {DownOneFrame 0 Null Nil 0 0 0 0 0 0 DownArrow "down_one_frame" "Down One Frame" "Selects the callstack frame below the currently selected." "" } {FreezeThread 0 Entity Thread 0 0 0 0 0 1 Locked "freeze_thread" "Freeze Thread" "Freezes the passed thread." "" } diff --git a/src/df/core/generated/df_core.meta.c b/src/df/core/generated/df_core.meta.c index 55634ee9..ffa020e4 100644 --- a/src/df/core/generated/df_core.meta.c +++ b/src/df/core/generated/df_core.meta.c @@ -4,7 +4,7 @@ //- GENERATED CODE C_LINKAGE_BEGIN -Rng1U64 df_g_cmd_param_slot_range_table[22] = +Rng1U64 df_g_cmd_param_slot_range_table[24] = { {0}, {OffsetOf(DF_CmdParams, window), OffsetOf(DF_CmdParams, window) + sizeof(DF_Handle)}, @@ -28,6 +28,8 @@ Rng1U64 df_g_cmd_param_slot_range_table[22] = {OffsetOf(DF_CmdParams, prefer_dasm), OffsetOf(DF_CmdParams, prefer_dasm) + sizeof(B32)}, {OffsetOf(DF_CmdParams, force_confirm), OffsetOf(DF_CmdParams, force_confirm) + sizeof(B32)}, {OffsetOf(DF_CmdParams, dir2), OffsetOf(DF_CmdParams, dir2) + sizeof(Dir2)}, +{OffsetOf(DF_CmdParams, base_unwind_index), OffsetOf(DF_CmdParams, base_unwind_index) + sizeof(U64)}, +{OffsetOf(DF_CmdParams, inline_unwind_index), OffsetOf(DF_CmdParams, inline_unwind_index) + sizeof(U64)}, }; DF_IconKind df_g_entity_kind_icon_kind_table[26] = @@ -212,7 +214,7 @@ DF_CoreCmdKind_Null, DF_CoreCmdKind_Null, }; -DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[222] = +DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[221] = { { str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp(""), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null}, { str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_X}, @@ -247,7 +249,6 @@ DF_CmdSpecInfo df_g_core_cmd_kind_spec_info_table[222] = { str8_lit_comp("select_thread_window"), str8_lit_comp("Selects a thread for the active window, overriding the global selected thread."), str8_lit_comp(""), str8_lit_comp("Select Thread On Window"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Null}, { str8_lit_comp("select_thread_view"), str8_lit_comp("Selects a thread for the active view, overriding the global and per-window selected threads."), str8_lit_comp(""), str8_lit_comp("Select Thread On View"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Null}, { str8_lit_comp("select_unwind"), str8_lit_comp("Selects an unwind frame number for the selected thread."), str8_lit_comp(""), str8_lit_comp("Select Unwind"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null}, -{ str8_lit_comp("select_inline_unwind"), str8_lit_comp("Selects an inline unwind frame number for the selected thread."), str8_lit_comp(""), str8_lit_comp("Select Inline Unwind"), (DF_CmdSpecFlag_OmitFromLists*1), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_Null}, { str8_lit_comp("up_one_frame"), str8_lit_comp("Selects the callstack frame above the currently selected."), str8_lit_comp(""), str8_lit_comp("Up One Frame"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_UpArrow}, { str8_lit_comp("down_one_frame"), str8_lit_comp("Selects the callstack frame below the currently selected."), str8_lit_comp(""), str8_lit_comp("Down One Frame"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Null, DF_EntityKind_Nil, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*0)}, DF_IconKind_DownArrow}, { str8_lit_comp("freeze_thread"), str8_lit_comp("Freezes the passed thread."), str8_lit_comp(""), str8_lit_comp("Freeze Thread"), (DF_CmdSpecFlag_OmitFromLists*0), {DF_CmdParamSlot_Entity, DF_EntityKind_Thread, (DF_CmdQueryFlag_AllowFiles*0)|(DF_CmdQueryFlag_AllowFolders*0)|(DF_CmdQueryFlag_CodeInput*0)|(DF_CmdQueryFlag_KeepOldInput*0)|(DF_CmdQueryFlag_SelectOldInput*0)|(DF_CmdQueryFlag_Required*1)}, DF_IconKind_Locked}, diff --git a/src/df/core/generated/df_core.meta.h b/src/df/core/generated/df_core.meta.h index fe27d1a6..9da5abe2 100644 --- a/src/df/core/generated/df_core.meta.h +++ b/src/df/core/generated/df_core.meta.h @@ -81,7 +81,6 @@ DF_CoreCmdKind_SelectThread, DF_CoreCmdKind_SelectThreadWindow, DF_CoreCmdKind_SelectThreadView, DF_CoreCmdKind_SelectUnwind, -DF_CoreCmdKind_SelectInlineUnwind, DF_CoreCmdKind_UpOneFrame, DF_CoreCmdKind_DownOneFrame, DF_CoreCmdKind_FreezeThread, @@ -393,6 +392,8 @@ DF_CmdParamSlot_ID, DF_CmdParamSlot_PreferDisassembly, DF_CmdParamSlot_ForceConfirm, DF_CmdParamSlot_Dir2, +DF_CmdParamSlot_BaseUnwindIndex, +DF_CmdParamSlot_InlineUnwindIndex, DF_CmdParamSlot_COUNT, } DF_CmdParamSlot; @@ -421,6 +422,8 @@ U64 id; B32 prefer_dasm; B32 force_confirm; Dir2 dir2; +U64 base_unwind_index; +U64 inline_unwind_index; }; DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array); @@ -1531,7 +1534,7 @@ struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] = {&DEV_updating_indicator, str8_lit_comp("updating_indicator")}, }; C_LINKAGE_BEGIN -extern Rng1U64 df_g_cmd_param_slot_range_table[22]; +extern Rng1U64 df_g_cmd_param_slot_range_table[24]; extern DF_IconKind df_g_entity_kind_icon_kind_table[26]; extern String8 df_g_entity_kind_display_string_table[26]; extern String8 df_g_entity_kind_name_label_table[26]; diff --git a/src/df/gfx/df_gfx.c b/src/df/gfx/df_gfx.c index cf7f9ebe..7bb5e111 100644 --- a/src/df/gfx/df_gfx.c +++ b/src/df/gfx/df_gfx.c @@ -522,13 +522,15 @@ df_cmd_params_from_window(DF_Window *window) df_cmd_params_mark_slot(&p, DF_CmdParamSlot_View); df_cmd_params_mark_slot(&p, DF_CmdParamSlot_PreferDisassembly); df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity); - df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Index); + df_cmd_params_mark_slot(&p, DF_CmdParamSlot_BaseUnwindIndex); + df_cmd_params_mark_slot(&p, DF_CmdParamSlot_InlineUnwindIndex); 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 = ctrl_ctx.thread; - p.index = ctrl_ctx.unwind_count; + p.base_unwind_index = ctrl_ctx.unwind_count; + p.inline_unwind_index = ctrl_ctx.inline_unwind_count; return p; } @@ -542,13 +544,15 @@ df_cmd_params_from_panel(DF_Window *window, DF_Panel *panel) df_cmd_params_mark_slot(&p, DF_CmdParamSlot_View); df_cmd_params_mark_slot(&p, DF_CmdParamSlot_PreferDisassembly); df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity); - df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Index); + df_cmd_params_mark_slot(&p, DF_CmdParamSlot_BaseUnwindIndex); + df_cmd_params_mark_slot(&p, DF_CmdParamSlot_InlineUnwindIndex); p.window = df_handle_from_window(window); 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 = ctrl_ctx.thread; - p.index = ctrl_ctx.unwind_count; + p.base_unwind_index = ctrl_ctx.unwind_count; + p.inline_unwind_index = ctrl_ctx.inline_unwind_count; return p; } @@ -562,13 +566,15 @@ df_cmd_params_from_view(DF_Window *window, DF_Panel *panel, DF_View *view) df_cmd_params_mark_slot(&p, DF_CmdParamSlot_View); df_cmd_params_mark_slot(&p, DF_CmdParamSlot_PreferDisassembly); df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity); - df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Index); + df_cmd_params_mark_slot(&p, DF_CmdParamSlot_BaseUnwindIndex); + df_cmd_params_mark_slot(&p, DF_CmdParamSlot_InlineUnwindIndex); p.window = df_handle_from_window(window); 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 = ctrl_ctx.thread; - p.index = ctrl_ctx.unwind_count; + p.base_unwind_index = ctrl_ctx.unwind_count; + p.inline_unwind_index = ctrl_ctx.inline_unwind_count; return p; } @@ -635,24 +641,18 @@ df_queue_drag_drop(void) } internal void -df_set_hovered_line_info(DI_Key *dbgi_key, U64 voff) +df_set_rich_hover_info(DF_RichHoverInfo *info) { - arena_clear(df_gfx_state->hover_line_arena); - df_gfx_state->hover_line_dbgi_key = di_key_copy(df_gfx_state->hover_line_arena, dbgi_key); - df_gfx_state->hover_line_voff = voff; - df_gfx_state->hover_line_set_this_frame = 1; + arena_clear(df_gfx_state->rich_hover_info_next_arena); + MemoryCopyStruct(&df_gfx_state->rich_hover_info_next, info); + df_gfx_state->rich_hover_info_next.dbgi_key = di_key_copy(df_gfx_state->rich_hover_info_next_arena, &info->dbgi_key); } -internal DI_Key -df_get_hovered_line_info_dbgi_key(void) +internal DF_RichHoverInfo +df_get_rich_hover_info(void) { - return df_gfx_state->hover_line_dbgi_key; -} - -internal U64 -df_get_hovered_line_info_voff(void) -{ - return df_gfx_state->hover_line_voff; + DF_RichHoverInfo info = df_gfx_state->rich_hover_info_current; + return info; } //////////////////////////////// @@ -1264,8 +1264,8 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds) case DF_CoreCmdKind_SelectThread:goto thread_locator; case DF_CoreCmdKind_SelectThreadWindow: { + MemoryZeroStruct(&ws->ctrl_ctx_overrides); ws->ctrl_ctx_overrides.thread = params.entity; - ws->ctrl_ctx_overrides.unwind_count = 0; }goto thread_locator; case DF_CoreCmdKind_SelectThreadView: { @@ -1277,8 +1277,8 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds) } if(!df_view_is_nil(view)) { + MemoryZeroStruct(&view->ctrl_ctx_overrides); view->ctrl_ctx_overrides.thread = params.entity; - view->ctrl_ctx_overrides.unwind_count = 0; } }goto thread_locator; case DF_CoreCmdKind_SelectUnwind: @@ -2598,11 +2598,12 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds) { DI_Scope *scope = di_scope_open(); DF_Entity *thread = df_entity_from_handle(params.entity); - U64 unwind_count = params.index; + U64 base_unwind_index = params.base_unwind_index; + U64 inline_unwind_index = params.inline_unwind_index; if(thread->kind == DF_EntityKind_Thread) { // rjf: grab rip - U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count); + U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, base_unwind_index); // rjf: extract thread/rip info DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process); @@ -2610,7 +2611,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds) DI_Key dbgi_key = df_dbgi_key_from_module(module); RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0); U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr); - DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, rip_voff); + DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, rip_voff, inline_unwind_index); // rjf: snap to resolved line B32 missing_rip = (rip_vaddr == 0); @@ -2632,11 +2633,12 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds) params.entity = df_handle_from_entity(thread); params.voff = rip_voff; params.vaddr = rip_vaddr; - params.index = unwind_count; + params.base_unwind_index = base_unwind_index; + params.inline_unwind_index = inline_unwind_index; df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Entity); df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_VirtualOff); df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_VirtualAddr); - df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Index); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_BaseUnwindIndex); df_cmd_list_push(arena, cmds, ¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation)); } @@ -2647,7 +2649,8 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds) params.entity = df_handle_from_entity(thread); params.voff = rip_voff; params.vaddr = rip_vaddr; - params.index = unwind_count; + params.base_unwind_index = base_unwind_index; + params.inline_unwind_index = inline_unwind_index; df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Entity); df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_VirtualOff); df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_VirtualAddr); @@ -2669,9 +2672,11 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds) DF_Entity *selected_thread = df_entity_from_handle(ctrl_ctx.thread); DF_CmdParams params = df_cmd_params_from_window(ws); params.entity = df_handle_from_entity(selected_thread); - params.index = ctrl_ctx.unwind_count; + params.base_unwind_index = ctrl_ctx.unwind_count; + params.inline_unwind_index = ctrl_ctx.inline_unwind_count; df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Entity); - df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Index); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_BaseUnwindIndex); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_InlineUnwindIndex); df_cmd_list_push(arena, cmds, ¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindThread)); }break; @@ -2804,7 +2809,7 @@ 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_dbgi_key_voff(&voff_dbgi_key, voff); + DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&voff_dbgi_key, voff, 0); DF_CmdParams p = params; { p.file_path = df_full_path_from_entity(scratch.arena, dasm2src_info.file); @@ -11566,11 +11571,23 @@ 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(¶ms->line_src2dasm[line_slice_idx].first->v.dbgi_key, params->line_src2dasm[line_slice_idx].first->v.voff_range.min); + DF_RichHoverInfo info = {0}; + info.process = df_handle_from_entity(selected_thread_process); + info.vaddr_range = df_vaddr_range_from_voff_range(selected_thread_module, params->line_src2dasm[line_slice_idx].first->v.voff_range); + info.module = df_handle_from_entity(selected_thread_module); + info.dbgi_key = params->line_src2dasm[line_slice_idx].first->v.dbgi_key; + info.voff_range = params->line_src2dasm[line_slice_idx].first->v.voff_range; + df_set_rich_hover_info(&info); } if(params->line_dasm2src[line_slice_idx].first != 0) { - df_set_hovered_line_info(¶ms->line_dasm2src[line_slice_idx].first->v.dbgi_key, params->line_dasm2src[line_slice_idx].first->v.voff_range.min); + DF_RichHoverInfo info = {0}; + info.process = df_handle_from_entity(selected_thread_process); + info.vaddr_range = df_vaddr_range_from_voff_range(selected_thread_module, params->line_dasm2src[line_slice_idx].first->v.voff_range); + info.module = df_handle_from_entity(selected_thread_module); + info.dbgi_key = params->line_dasm2src[line_slice_idx].first->v.dbgi_key; + info.voff_range = params->line_dasm2src[line_slice_idx].first->v.voff_range; + df_set_rich_hover_info(&info); } } @@ -11734,8 +11751,9 @@ 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) { - DI_Key hovered_line_dbgi_key = df_get_hovered_line_info_dbgi_key(); - U64 hovered_line_voff = df_get_hovered_line_info_voff(); + DF_RichHoverInfo rich_hover_info = df_get_rich_hover_info(); + DI_Key hovered_line_dbgi_key = rich_hover_info.dbgi_key; + U64 hovered_line_voff = rich_hover_info.voff_range.min; ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f)); UI_WidthFill UI_Column @@ -12029,18 +12047,14 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_ // rjf: check dasm2src if(dasm2src_list->first != 0) { - DI_Key dbgi_key = dasm2src_list->first->v.dbgi_key; - if(di_key_match(&dbgi_key, &dasm2src_list->first->v.dbgi_key)) + for(DF_TextLineDasm2SrcInfoNode *n = dasm2src_list->first; n != 0; n = n->next) { - for(DF_TextLineDasm2SrcInfoNode *n = dasm2src_list->first; n != 0; n = n->next) + if(n->v.voff_range.min <= hovered_line_voff && + hovered_line_voff < n->v.voff_range.max) { - if(n->v.voff_range.min <= hovered_line_voff && - hovered_line_voff < n->v.voff_range.max) - { - line_info_line_num = n->v.pt.line; - matches = 1; - break; - } + line_info_line_num = n->v.pt.line; + matches = 1; + break; } } } @@ -13129,7 +13143,8 @@ df_gfx_init(OS_WindowRepaintFunctionType *window_repaint_entry_point, DF_StateDe df_gfx_state->repaint_hook = window_repaint_entry_point; df_gfx_state->cfg_main_font_path_arena = arena_alloc(); df_gfx_state->cfg_code_font_path_arena = arena_alloc(); - df_gfx_state->hover_line_arena = arena_alloc(); + df_gfx_state->rich_hover_info_next_arena = arena_alloc(); + df_gfx_state->rich_hover_info_current_arena = arena_alloc(); df_clear_bindings(); // rjf: register gfx layer views @@ -13236,7 +13251,9 @@ internal void df_gfx_begin_frame(Arena *arena, DF_CmdList *cmds) { ProfBeginFunction(); - df_gfx_state->hover_line_set_this_frame = 0; + arena_clear(df_gfx_state->rich_hover_info_current_arena); + MemoryCopyStruct(&df_gfx_state->rich_hover_info_current, &df_gfx_state->rich_hover_info_next); + df_gfx_state->rich_hover_info_current.dbgi_key = di_key_copy(df_gfx_state->rich_hover_info_current_arena, &df_gfx_state->rich_hover_info_current.dbgi_key); //- rjf: animate confirmation { @@ -14152,13 +14169,6 @@ df_gfx_end_frame(void) MemoryZeroStruct(&df_g_drag_drop_payload); } - //- rjf: clear hover line info - if(df_gfx_state->hover_line_set_this_frame == 0) - { - MemoryZeroStruct(&df_gfx_state->hover_line_dbgi_key); - df_gfx_state->hover_line_voff = 0; - } - //- rjf: clear frame request state if(df_gfx_state->num_frames_requested > 0) { diff --git a/src/df/gfx/df_gfx.h b/src/df/gfx/df_gfx.h index 1a91dc25..24f3b5b0 100644 --- a/src/df/gfx/df_gfx.h +++ b/src/df/gfx/df_gfx.h @@ -282,6 +282,19 @@ struct DF_DragDropPayload TxtPt text_point; }; +//////////////////////////////// +//~ rjf: Rich Hover Types + +typedef struct DF_RichHoverInfo DF_RichHoverInfo; +struct DF_RichHoverInfo +{ + DF_Handle process; + Rng1U64 vaddr_range; + DF_Handle module; + Rng1U64 voff_range; + DI_Key dbgi_key; +}; + //////////////////////////////// //~ rjf: View Rule Spec Types @@ -719,11 +732,11 @@ struct DF_GfxState // rjf: drag/drop state machine DF_DragDropState drag_drop_state; - // rjf: hover line info correllation state - Arena *hover_line_arena; - DI_Key hover_line_dbgi_key; - U64 hover_line_voff; - B32 hover_line_set_this_frame; + // rjf: rich hover info + Arena *rich_hover_info_next_arena; + Arena *rich_hover_info_current_arena; + DF_RichHoverInfo rich_hover_info_next; + DF_RichHoverInfo rich_hover_info_current; // rjf: running theme state DF_Theme cfg_theme_target; @@ -880,9 +893,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(DI_Key *dbgi_key, U64 voff); -internal DI_Key df_get_hovered_line_info_dbgi_key(void); -internal U64 df_get_hovered_line_info_voff(void); +internal void df_set_rich_hover_info(DF_RichHoverInfo *info); +internal DF_RichHoverInfo df_get_rich_hover_info(void); //////////////////////////////// //~ rjf: View Spec State Functions diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 9d65df49..cd329b61 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -3417,7 +3417,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister) if(ui_hovering(sig)) UI_Tooltip { U64 binary_voff = df_voff_from_dbgi_key_symbol_name(&dbgi_key, name); - DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, binary_voff); + DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, binary_voff, 0); 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); @@ -4808,7 +4808,7 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler) DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr); U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr); DI_Key dbgi_key = df_dbgi_key_from_module(module); - DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, rip_voff); + DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, rip_voff, 0); 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); @@ -4843,7 +4843,6 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack) DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view); DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread); Architecture arch = df_architecture_from_entity(thread); - U64 selected_unwind_count = ctrl_ctx.unwind_count; DF_Entity *process = thread->parent; Vec4F32 thread_color = df_rgba_from_theme_color(DF_ThemeColor_PlainText); if(thread->flags & DF_EntityFlag_HasColor) @@ -4960,7 +4959,12 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack) UI_TextAlignment(UI_TextAlign_Center) UI_FocusHot((row_selected && cs->cursor.x == 0) ? UI_FocusKind_On : UI_FocusKind_Off) { - String8 selected_string = selected_unwind_count == frame_idx ? df_g_icon_kind_text_table[DF_IconKind_RightArrow] : str8_lit(""); + String8 selected_string = {0}; + if(ctrl_ctx.unwind_count == frame->base_unwind_idx && + ctrl_ctx.inline_unwind_count == frame->inline_unwind_idx) + { + selected_string = df_g_icon_kind_text_table[DF_IconKind_RightArrow]; + } UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_DrawText, "%S###selection_%i", selected_string, (int)frame_idx); UI_Signal sig = ui_signal_from_box(box); @@ -4973,8 +4977,10 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack) if(ui_double_clicked(sig) || sig.f&UI_SignalFlag_KeyboardPressed) { DF_CmdParams params = df_cmd_params_from_view(ws, panel, view); - params.index = frame_idx; - df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Index); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_BaseUnwindIndex); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_InlineUnwindIndex); + params.base_unwind_index = frame->base_unwind_idx; + params.inline_unwind_index = frame->inline_unwind_idx; df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_SelectUnwind)); } } @@ -5043,8 +5049,10 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack) if(ui_double_clicked(sig) || sig.f&UI_SignalFlag_KeyboardPressed) { DF_CmdParams params = df_cmd_params_from_view(ws, panel, view); - params.index = frame_idx; - df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Index); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_BaseUnwindIndex); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_InlineUnwindIndex); + params.base_unwind_index = frame->base_unwind_idx; + params.inline_unwind_index = frame->inline_unwind_idx; df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_SelectUnwind)); } } @@ -5064,8 +5072,10 @@ DF_VIEW_UI_FUNCTION_DEF(CallStack) if(ui_double_clicked(sig) || sig.f&UI_SignalFlag_KeyboardPressed) { DF_CmdParams params = df_cmd_params_from_view(ws, panel, view); - params.index = frame_idx; - df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Index); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_BaseUnwindIndex); + df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_InlineUnwindIndex); + params.base_unwind_index = frame->base_unwind_idx; + params.inline_unwind_index = frame->inline_unwind_idx; df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_SelectUnwind)); } } @@ -5953,7 +5963,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code) 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); DI_Key dbgi_key = df_dbgi_key_from_module(module); - DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, rip_voff); + DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, rip_voff, 0); 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; @@ -7093,7 +7103,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_dbgi_key_voff(&dbgi_key, voff); + dasm2src_n->v = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, voff, 0); } } } @@ -7265,7 +7275,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly) DF_Entity *module = df_module_from_process_vaddr(process, vaddr); DI_Key dbgi_key = df_dbgi_key_from_module(module); U64 voff = df_voff_from_vaddr(module, vaddr); - DF_TextLineDasm2SrcInfo dasm2src = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, voff); + DF_TextLineDasm2SrcInfo dasm2src = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, voff, 0); 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;