From f130f23b3f2e80b38431d72e3ea78e54b915aa07 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Tue, 30 Jan 2024 06:18:02 -0800 Subject: [PATCH] include jmc line number hacks in line step-over and step-into trap-net --- src/df/core/df_core.c | 26 ++++++++++++++++++++++++++ src/df/gfx/df_gfx.c | 3 ++- src/df/gfx/df_views.c | 4 ++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/df/core/df_core.c b/src/df/core/df_core.c index 86b71ce7..6d6b924f 100644 --- a/src/df/core/df_core.c +++ b/src/df/core/df_core.c @@ -2796,6 +2796,19 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread) } } + // rjf: opl line_vaddr_rng -> 0xf00f00 or 0xfeefee? => include in line vaddr range + // + // MSVC exports line info at these line numbers when /JMC (Just My Code) debugging + // 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_binary_voff(binary, opl_line_voff_rng); + 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); + } + } + // rjf: line vaddr range => did we find anything successfully? B32 good_line_info = (line_vaddr_rng.max != 0); @@ -2908,6 +2921,19 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread) } } + // rjf: opl line_vaddr_rng -> 0xf00f00 or 0xfeefee? => include in line vaddr range + // + // MSVC exports line info at these line numbers when /JMC (Just My Code) debugging + // 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_binary_voff(binary, opl_line_voff_rng); + 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); + } + } + // rjf: line vaddr range => did we find anything successfully? B32 good_line_info = (line_vaddr_rng.max != 0); diff --git a/src/df/gfx/df_gfx.c b/src/df/gfx/df_gfx.c index 756a5866..d80c643e 100644 --- a/src/df/gfx/df_gfx.c +++ b/src/df/gfx/df_gfx.c @@ -9649,7 +9649,8 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_ if(text_container_sig.hovering && contains_1s64(params->line_num_range, mouse_pt.line)) { U64 line_slice_idx = mouse_pt.line-params->line_num_range.min; - if(params->line_src2dasm[line_slice_idx].first != 0) + 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); } diff --git a/src/df/gfx/df_views.c b/src/df/gfx/df_views.c index 939aefd7..75690bb2 100644 --- a/src/df/gfx/df_views.c +++ b/src/df/gfx/df_views.c @@ -4907,7 +4907,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code) 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); - if(dasm2src_info.file == entity && visible_line_num_range.min <= dasm2src_info.pt.line && dasm2src_info.pt.line < visible_line_num_range.max) + 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; df_entity_list_push(scratch.arena, &code_slice_params.line_ips[slice_line_idx], thread); @@ -4921,7 +4921,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code) for(DF_Entity *wp = entity->first; !df_entity_is_nil(wp); wp = wp->next) { if(wp->deleted || wp->kind != DF_EntityKind_WatchPin) { continue; } - if(visible_line_num_range.min <= wp->text_point.line && wp->text_point.line < visible_line_num_range.max) + if(visible_line_num_range.min <= wp->text_point.line && wp->text_point.line <= visible_line_num_range.max) { U64 slice_line_idx = (wp->text_point.line-visible_line_num_range.min); df_entity_list_push(scratch.arena, &code_slice_params.line_pins[slice_line_idx], wp);