mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
dead code elimination; bp hit count reset on initial-step-into fix; notes
This commit is contained in:
@@ -11964,6 +11964,8 @@ rd_frame(void)
|
||||
case RD_CmdKind_Run:
|
||||
case RD_CmdKind_LaunchAndRun:
|
||||
case RD_CmdKind_LaunchAndInit:
|
||||
case RD_CmdKind_StepInto:
|
||||
case RD_CmdKind_StepOver:
|
||||
{
|
||||
CTRL_EntityList processes = ctrl_entity_list_from_kind(d_state->ctrl_entity_store, CTRL_EntityKind_Process);
|
||||
if(processes.count == 0)
|
||||
@@ -13477,57 +13479,6 @@ rd_frame(void)
|
||||
arena_clear(rd_state->current_path_arena);
|
||||
rd_state->current_path = push_str8_copy(rd_state->current_path_arena, rd_regs()->file_path);
|
||||
}break;
|
||||
|
||||
//- rjf: override file links
|
||||
case RD_CmdKind_SetFileOverrideLinkSrc:
|
||||
case RD_CmdKind_SetFileOverrideLinkDst:
|
||||
{
|
||||
#if 0 // TODO(rjf): @msgs
|
||||
// rjf: unpack args
|
||||
RD_Entity *map = rd_entity_from_handle(rd_regs()->entity);
|
||||
String8 path = path_normalized_from_string(scratch.arena, rd_regs()->file_path);
|
||||
String8 path_folder = str8_chop_last_slash(path);
|
||||
String8 path_file = str8_skip_last_slash(path);
|
||||
|
||||
// rjf: src -> move map & commit name; dst -> open destination file & refer to it in map
|
||||
switch(kind)
|
||||
{
|
||||
default:{}break;
|
||||
case RD_CmdKind_SetFileOverrideLinkSrc:
|
||||
{
|
||||
RD_Entity *map_parent = (rd_regs()->file_path.size != 0) ? d_entity_from_path(path_folder, D_EntityFromPathFlag_OpenAsNeeded|D_EntityFromPathFlag_OpenMissing) : rd_entity_root();
|
||||
if(rd_entity_is_nil(map))
|
||||
{
|
||||
map = rd_entity_alloc(map_parent, RD_EntityKind_FilePathMap);
|
||||
}
|
||||
else
|
||||
{
|
||||
rd_entity_change_parent(map, map->parent, map_parent, &d_nil_entity);
|
||||
}
|
||||
rd_entity_equip_name(map, path_file);
|
||||
}break;
|
||||
case RD_CmdKind_SetFileOverrideLinkDst:
|
||||
{
|
||||
if(rd_entity_is_nil(map))
|
||||
{
|
||||
map = rd_entity_alloc(rd_entity_root(), RD_EntityKind_FilePathMap);
|
||||
}
|
||||
RD_Entity *map_dst_entity = &d_nil_entity;
|
||||
if(rd_regs()->file_path.size != 0)
|
||||
{
|
||||
map_dst_entity = d_entity_from_path(path, D_EntityFromPathFlag_All);
|
||||
}
|
||||
rd_entity_equip_entity_handle(map, rd_handle_from_entity(map_dst_entity));
|
||||
}break;
|
||||
}
|
||||
|
||||
// rjf: empty src/dest -> delete
|
||||
if(!rd_entity_is_nil(map) && map->string.size == 0 && rd_entity_is_nil(rd_entity_from_handle(map->entity_handle)))
|
||||
{
|
||||
rd_entity_mark_for_deletion(map);
|
||||
}
|
||||
#endif
|
||||
}break;
|
||||
case RD_CmdKind_SetFileReplacementPath:
|
||||
{
|
||||
// NOTE(rjf):
|
||||
@@ -13599,42 +13550,6 @@ rd_frame(void)
|
||||
RD_Entity *dst = rd_entity_alloc(map, RD_EntityKind_Dest);
|
||||
rd_entity_equip_name(src, map_src);
|
||||
rd_entity_equip_name(dst, map_dst);
|
||||
|
||||
#if 0 // TODO(rjf): @msgs
|
||||
|
||||
//- rjf: grab src file & chosen replacement
|
||||
RD_Entity *file = rd_entity_from_handle(params.entity);
|
||||
RD_Entity *replacement = d_entity_from_path(params.file_path, D_EntityFromPathFlag_OpenAsNeeded|D_EntityFromPathFlag_OpenMissing);
|
||||
|
||||
//- rjf: find
|
||||
RD_Entity *first_diff_src = file;
|
||||
RD_Entity *first_diff_dst = replacement;
|
||||
for(;!rd_entity_is_nil(first_diff_src) && !rd_entity_is_nil(first_diff_dst);)
|
||||
{
|
||||
if(!str8_match(first_diff_src->string, first_diff_dst->string, StringMatchFlag_CaseInsensitive) ||
|
||||
first_diff_src->parent->kind != RD_EntityKind_File ||
|
||||
first_diff_src->parent->parent->kind != RD_EntityKind_File ||
|
||||
first_diff_dst->parent->kind != RD_EntityKind_File ||
|
||||
first_diff_dst->parent->parent->kind != RD_EntityKind_File)
|
||||
{
|
||||
break;
|
||||
}
|
||||
first_diff_src = first_diff_src->parent;
|
||||
first_diff_dst = first_diff_dst->parent;
|
||||
}
|
||||
|
||||
//- rjf: override first different
|
||||
if(!rd_entity_is_nil(first_diff_src) && !rd_entity_is_nil(first_diff_dst))
|
||||
{
|
||||
RD_Entity *link = rd_entity_child_from_string_and_kind(first_diff_src->parent, first_diff_src->name, RD_EntityKind_FilePathMap);
|
||||
if(rd_entity_is_nil(link))
|
||||
{
|
||||
link = rd_entity_alloc(first_diff_src->parent, RD_EntityKind_FilePathMap);
|
||||
rd_entity_equip_name(link, first_diff_src->name);
|
||||
}
|
||||
rd_entity_equip_entity_handle(link, rd_handle_from_entity(first_diff_dst));
|
||||
}
|
||||
#endif
|
||||
}break;
|
||||
|
||||
//- rjf: auto view rules
|
||||
@@ -16036,7 +15951,7 @@ rd_frame(void)
|
||||
//
|
||||
U64 exception_code_filters[(CTRL_ExceptionCodeKind_COUNT+63)/64] = {0};
|
||||
{
|
||||
// TODO(rjf): @msgs
|
||||
MemoryCopyArray(exception_code_filters, rd_state->ctrl_exception_code_filters);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
|
||||
@@ -14,18 +14,11 @@
|
||||
//
|
||||
// [ ] post-@msgs TODOs:
|
||||
// [ ] ensure the following issues are resolved with this new pass:
|
||||
// [ ] global evaluation across DLL boundaries
|
||||
// [ ] mohit-reported callstack-frame-selection bug (with inlines)
|
||||
// [ ] empty user file causing failure to launch
|
||||
// [ ] decay arrays to pointers in pointer/value comparison
|
||||
// [ ] visualize all breakpoints everywhere - source view should show up in
|
||||
// disasm, disasm should show up in source view, function should show up in
|
||||
// both, etc.
|
||||
// [ ] ** Function breakpoints should show up in the source listing. Without
|
||||
// them being visible, it is confusing when you run and you stop there,
|
||||
// because you're like "wait why did it stop" and then you later remember
|
||||
// that's because there was a function breakpoint there.
|
||||
// [ ] debugger readme pass
|
||||
// [x] global evaluation across DLL boundaries
|
||||
// [x] mohit-reported callstack-frame-selection bug (with inlines)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: post-0.9.12 TODO notes
|
||||
@@ -44,6 +37,13 @@
|
||||
// [ ] save view column pcts; generalize to being a first-class thing in
|
||||
// RD_View, e.g. by just having a string -> f32 store
|
||||
// [ ] auto-scroll output window
|
||||
// [ ] visualize all breakpoints everywhere - source view should show up in
|
||||
// disasm, disasm should show up in source view, function should show up in
|
||||
// both, etc.
|
||||
// [ ] ** Function breakpoints should show up in the source listing. Without
|
||||
// them being visible, it is confusing when you run and you stop there,
|
||||
// because you're like "wait why did it stop" and then you later remember
|
||||
// that's because there was a function breakpoint there.
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Frontend/UI Pass Tasks
|
||||
|
||||
@@ -5148,339 +5148,6 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(file_path_map)
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
#if 0 // TODO(rjf): @msgs
|
||||
typedef struct RD_FilePathMapViewState RD_FilePathMapViewState;
|
||||
struct RD_FilePathMapViewState
|
||||
{
|
||||
B32 initialized;
|
||||
Vec2S64 cursor;
|
||||
TxtPt input_cursor;
|
||||
TxtPt input_mark;
|
||||
U8 input_buffer[1024];
|
||||
U64 input_size;
|
||||
B32 input_editing;
|
||||
RD_Handle pick_file_dst_map;
|
||||
Side pick_file_dst_side;
|
||||
F32 src_column_pct;
|
||||
F32 dst_column_pct;
|
||||
};
|
||||
|
||||
RD_VIEW_RULE_UI_FUNCTION_DEF(file_path_map)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
RD_EntityList maps_list = rd_query_cached_entity_list_with_kind(RD_EntityKind_FilePathMap);
|
||||
RD_EntityArray maps = rd_entity_array_from_list(scratch.arena, &maps_list);
|
||||
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
||||
|
||||
RD_FilePathMapViewState *fpms = rd_view_state(RD_FilePathMapViewState);
|
||||
UI_ScrollPt2 scroll_pos = rd_view_scroll_pos();
|
||||
if(fpms->initialized == 0)
|
||||
{
|
||||
fpms->initialized = 1;
|
||||
fpms->src_column_pct = 0.5f;
|
||||
fpms->dst_column_pct = 0.5f;
|
||||
}
|
||||
|
||||
#if 0 // TODO(rjf): @msgs
|
||||
RD_FilePathMapViewState *fpms = rd_view_state(RD_FilePathMapViewState);
|
||||
|
||||
// rjf: process commands
|
||||
for(RD_Cmd *cmd = 0; rd_next_cmd(&cmd);)
|
||||
{
|
||||
// rjf: mismatched window/panel => skip
|
||||
if(!rd_handle_match(rd_regs()->view, cmd->regs->view))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
//rjf: process
|
||||
RD_CmdKind kind = rd_cmd_kind_from_string(cmd->name);
|
||||
switch(kind)
|
||||
{
|
||||
default:break;
|
||||
case RD_CmdKind_PickFile:
|
||||
case RD_CmdKind_PickFolder:
|
||||
case RD_CmdKind_PickFileOrFolder:
|
||||
{
|
||||
String8 pick_string = cmd->regs->file_path;
|
||||
Side pick_side = fpms->pick_file_dst_side;
|
||||
RD_Entity *storage_entity = rd_entity_from_handle(fpms->pick_file_dst_map);
|
||||
rd_cmd(pick_side == Side_Min ?
|
||||
RD_CmdKind_SetFileOverrideLinkSrc :
|
||||
RD_CmdKind_SetFileOverrideLinkDst,
|
||||
.entity = rd_handle_from_entity(storage_entity),
|
||||
.file_path = pick_string);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//- rjf: take controls to start/end editing
|
||||
B32 edit_begin = 0;
|
||||
B32 edit_end = 0;
|
||||
B32 edit_commit = 0;
|
||||
B32 edit_submit = 0;
|
||||
UI_Focus(UI_FocusKind_On) if(ui_is_focus_active())
|
||||
{
|
||||
if(!fpms->input_editing)
|
||||
{
|
||||
for(UI_Event *evt = 0; ui_next_event(&evt);)
|
||||
{
|
||||
if(evt->string.size != 0 || evt->flags & UI_EventFlag_Paste)
|
||||
{
|
||||
edit_begin = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(ui_slot_press(UI_EventActionSlot_Edit))
|
||||
{
|
||||
edit_begin = 1;
|
||||
}
|
||||
}
|
||||
if(fpms->input_editing)
|
||||
{
|
||||
if(ui_slot_press(UI_EventActionSlot_Cancel))
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = 0;
|
||||
}
|
||||
if(ui_slot_press(UI_EventActionSlot_Accept))
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = 1;
|
||||
edit_submit = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: build
|
||||
RD_Handle commit_map = rd_handle_zero();
|
||||
Side commit_side = Side_Invalid;
|
||||
F32 *col_pcts[] = { &fpms->src_column_pct, &fpms->dst_column_pct };
|
||||
Vec2S64 next_cursor = fpms->cursor;
|
||||
Rng1S64 visible_row_range = {0};
|
||||
UI_ScrollListParams scroll_list_params = {0};
|
||||
{
|
||||
scroll_list_params.flags = UI_ScrollListFlag_All;
|
||||
scroll_list_params.row_height_px = row_height_px;
|
||||
scroll_list_params.dim_px = dim_2f32(rect);
|
||||
scroll_list_params.cursor_range = r2s64(v2s64(0, 0), v2s64(3, maps.count + 1));
|
||||
scroll_list_params.item_range = r1s64(0, maps.count+2);
|
||||
scroll_list_params.cursor_min_is_empty_selection[Axis2_Y] = 1;
|
||||
}
|
||||
UI_ScrollListSignal scroll_list_sig = {0};
|
||||
UI_Focus(UI_FocusKind_On)
|
||||
UI_ScrollList(&scroll_list_params,
|
||||
&scroll_pos.y,
|
||||
fpms->input_editing ? 0 : &fpms->cursor,
|
||||
0,
|
||||
&visible_row_range,
|
||||
&scroll_list_sig)
|
||||
UI_Focus(UI_FocusKind_Null)
|
||||
UI_TableF(ArrayCount(col_pcts), col_pcts, "###tbl")
|
||||
{
|
||||
next_cursor = fpms->cursor;
|
||||
|
||||
//- rjf: header
|
||||
if(visible_row_range.min == 0) UI_TableVector UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||
{
|
||||
UI_TableCell if(rd_help_label(str8_lit("Source Path"))) UI_Tooltip
|
||||
{
|
||||
ui_label_multiline(ui_top_font_size()*30, str8_lit("When the debugger attempts to open a file or folder at a Source Path specified in this table, it will redirect to the file or folder specified by the Destination Path."));
|
||||
}
|
||||
UI_TableCell ui_label(str8_lit("Destination Path"));
|
||||
}
|
||||
|
||||
//- rjf: map rows
|
||||
for(S64 row_idx = Max(1, visible_row_range.min);
|
||||
row_idx <= visible_row_range.max && row_idx <= maps.count+1;
|
||||
row_idx += 1) UI_TableVector
|
||||
{
|
||||
U64 map_idx = row_idx-1;
|
||||
RD_Entity *map = (map_idx < maps.count ? maps.v[map_idx] : &d_nil_entity);
|
||||
RD_Entity *map_src = rd_entity_child_from_kind(map, RD_EntityKind_Source);
|
||||
RD_Entity *map_dst = rd_entity_child_from_kind(map, RD_EntityKind_Dest);
|
||||
String8 map_src_path = map_src->string;
|
||||
String8 map_dst_path = map_dst->string;
|
||||
B32 row_selected = (fpms->cursor.y == row_idx);
|
||||
|
||||
//- rjf: src
|
||||
UI_TableCell UI_WidthFill
|
||||
{
|
||||
//- rjf: editor
|
||||
{
|
||||
B32 value_selected = (row_selected && fpms->cursor.x == 0);
|
||||
|
||||
// rjf: begin editing
|
||||
if(value_selected && edit_begin)
|
||||
{
|
||||
fpms->input_editing = 1;
|
||||
fpms->input_size = Min(sizeof(fpms->input_buffer), map_src_path.size);
|
||||
MemoryCopy(fpms->input_buffer, map_src_path.str, fpms->input_size);
|
||||
fpms->input_cursor = txt_pt(1, 1+fpms->input_size);
|
||||
fpms->input_mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
// rjf: build
|
||||
UI_Signal sig = {0};
|
||||
UI_FocusHot(value_selected ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_FocusActive((value_selected && fpms->input_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
{
|
||||
sig = rd_line_editf(RD_LineEditFlag_NoBackground, 0, 0, &fpms->input_cursor, &fpms->input_mark, fpms->input_buffer, sizeof(fpms->input_buffer), &fpms->input_size, 0, map_src_path, "###src_editor_%p", map);
|
||||
edit_commit = edit_commit || ui_committed(sig);
|
||||
}
|
||||
|
||||
// rjf: focus panel on press
|
||||
if(ui_pressed(sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_FocusPanel);
|
||||
}
|
||||
|
||||
// rjf: begin editing on double-click
|
||||
if(!fpms->input_editing && ui_double_clicked(sig))
|
||||
{
|
||||
fpms->input_editing = 1;
|
||||
fpms->input_size = Min(sizeof(fpms->input_buffer), map_src_path.size);
|
||||
MemoryCopy(fpms->input_buffer, map_src_path.str, fpms->input_size);
|
||||
fpms->input_cursor = txt_pt(1, 1+fpms->input_size);
|
||||
fpms->input_mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
// rjf: press on non-selected => commit edit, change selected cell
|
||||
if(ui_pressed(sig) && !value_selected)
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = fpms->input_editing;
|
||||
next_cursor.x = 0;
|
||||
next_cursor.y = map_idx+1;
|
||||
}
|
||||
|
||||
// rjf: store commit information
|
||||
if(value_selected)
|
||||
{
|
||||
commit_side = Side_Min;
|
||||
commit_map = rd_handle_from_entity(map);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: browse button
|
||||
UI_FocusHot((row_selected && fpms->cursor.x == 1) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
if(ui_clicked(ui_buttonf("Browse...")))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_PickFileOrFolder].string);
|
||||
fpms->pick_file_dst_map = rd_handle_from_entity(map);
|
||||
fpms->pick_file_dst_side = Side_Min;
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: dst
|
||||
UI_TableCell UI_WidthFill
|
||||
{
|
||||
//- rjf: editor
|
||||
{
|
||||
B32 value_selected = (row_selected && fpms->cursor.x == 2);
|
||||
|
||||
// rjf: begin editing
|
||||
if(value_selected && edit_begin)
|
||||
{
|
||||
fpms->input_editing = 1;
|
||||
fpms->input_size = Min(sizeof(fpms->input_buffer), map_dst_path.size);
|
||||
MemoryCopy(fpms->input_buffer, map_dst_path.str, fpms->input_size);
|
||||
fpms->input_cursor = txt_pt(1, 1+fpms->input_size);
|
||||
fpms->input_mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
// rjf: build
|
||||
UI_Signal sig = {0};
|
||||
UI_FocusHot(value_selected ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_FocusActive((value_selected && fpms->input_editing) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
{
|
||||
sig = rd_line_editf(RD_LineEditFlag_NoBackground, 0, 0, &fpms->input_cursor, &fpms->input_mark, fpms->input_buffer, sizeof(fpms->input_buffer), &fpms->input_size, 0, map_dst_path, "###dst_editor_%p", map);
|
||||
edit_commit = edit_commit || ui_committed(sig);
|
||||
}
|
||||
|
||||
// rjf: focus panel on press
|
||||
if(ui_pressed(sig))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_FocusPanel);
|
||||
}
|
||||
|
||||
// rjf: begin editing on double-click
|
||||
if(!fpms->input_editing && ui_double_clicked(sig))
|
||||
{
|
||||
fpms->input_editing = 1;
|
||||
fpms->input_size = Min(sizeof(fpms->input_buffer), map_dst_path.size);
|
||||
MemoryCopy(fpms->input_buffer, map_dst_path.str, fpms->input_size);
|
||||
fpms->input_cursor = txt_pt(1, 1+fpms->input_size);
|
||||
fpms->input_mark = txt_pt(1, 1);
|
||||
}
|
||||
|
||||
// rjf: press on non-selected => commit edit, change selected cell
|
||||
if(ui_pressed(sig) && !value_selected)
|
||||
{
|
||||
edit_end = 1;
|
||||
edit_commit = fpms->input_editing;
|
||||
next_cursor.x = 2;
|
||||
next_cursor.y = map_idx+1;
|
||||
}
|
||||
|
||||
// rjf: store commit information
|
||||
if(value_selected)
|
||||
{
|
||||
commit_side = Side_Max;
|
||||
commit_map = rd_handle_from_entity(map);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: browse button
|
||||
{
|
||||
UI_FocusHot((row_selected && fpms->cursor.x == 3) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
UI_PrefWidth(ui_text_dim(10, 1))
|
||||
if(ui_clicked(ui_buttonf("Browse...")))
|
||||
{
|
||||
rd_cmd(RD_CmdKind_RunCommand, .string = rd_cmd_kind_info_table[RD_CmdKind_PickFileOrFolder].string);
|
||||
fpms->pick_file_dst_map = rd_handle_from_entity(map);
|
||||
fpms->pick_file_dst_side = Side_Max;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: apply commit
|
||||
if(edit_commit && commit_side != Side_Invalid)
|
||||
{
|
||||
String8 new_string = str8(fpms->input_buffer, fpms->input_size);
|
||||
rd_cmd(commit_side == Side_Min ?
|
||||
RD_CmdKind_SetFileOverrideLinkSrc :
|
||||
RD_CmdKind_SetFileOverrideLinkDst,
|
||||
.entity = commit_map,
|
||||
.file_path = new_string);
|
||||
}
|
||||
|
||||
//- rjf: apply editing finish
|
||||
if(edit_end)
|
||||
{
|
||||
fpms->input_editing = 0;
|
||||
}
|
||||
|
||||
//- rjf: move down one row if submitted
|
||||
if(edit_submit)
|
||||
{
|
||||
next_cursor.y += 1;
|
||||
}
|
||||
|
||||
//- rjf: apply moves to selection
|
||||
fpms->cursor = next_cursor;
|
||||
|
||||
rd_store_view_scroll_pos(scroll_pos);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: auto_view_rules @view_hook_impl
|
||||
|
||||
|
||||
Reference in New Issue
Block a user