decay arrays to pointers when doing pointer-array comparisons; begin gathering recent file history into project state; prefer larger src/disasm panels when finding a new location; do not over-ambitiously hold top-level frame scopes for dbgi/fzy - stop before per-frame sleep

This commit is contained in:
Ryan Fleury
2024-10-14 10:20:27 -07:00
parent 89f47df0e2
commit d87704c91f
6 changed files with 160 additions and 92 deletions
+6 -4
View File
@@ -360,7 +360,6 @@ e_irtree_convert_hi(Arena *arena, E_IRNode *c, E_TypeKey out, E_TypeKey in)
internal E_IRNode *
e_irtree_resolve_to_value(Arena *arena, E_Space from_space, E_Mode from_mode, E_IRNode *tree, E_TypeKey type_key)
{
// TODO(rjf): @spaces double check that this path is working for register spaces
E_IRNode *result = tree;
if(from_mode == E_Mode_Offset)
{
@@ -981,11 +980,11 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
}
else if(kind == E_ExprKind_EqEq)
{
if(l_type_kind == E_TypeKind_Array && r_type_kind == E_TypeKind_Ptr)
if(l_type_kind == E_TypeKind_Array && (r_type_kind == E_TypeKind_Ptr || r_is_decay))
{
arith_path = E_ArithPath_PtrArrayCompare;
}
if(r_type_kind == E_TypeKind_Array && l_type_kind == E_TypeKind_Ptr)
if(r_type_kind == E_TypeKind_Array && (l_type_kind == E_TypeKind_Ptr || l_is_decay))
{
arith_path = E_ArithPath_PtrArrayCompare;
}
@@ -1114,10 +1113,12 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
case E_ArithPath_PtrArrayCompare:
{
// rjf: map l/r to pointer/array
B32 ptr_is_decay = l_is_decay;
E_IRTreeAndType *ptr_tree = &l_tree;
E_IRTreeAndType *arr_tree = &r_tree;
if(l_type_kind == E_TypeKind_Array)
if(l_type_kind == E_TypeKind_Array && l_tree.mode == E_Mode_Value)
{
ptr_is_decay = r_is_decay;
ptr_tree = &r_tree;
arr_tree = &l_tree;
}
@@ -1125,6 +1126,7 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
// rjf: resolve pointer to value, sized same as array
E_IRNode *ptr_root = ptr_tree->root;
E_IRNode *arr_root = arr_tree->root;
if(!ptr_is_decay)
{
ptr_root = e_irtree_resolve_to_value(arena, ptr_tree->space, ptr_tree->mode, ptr_tree->root, ptr_tree->type_key);
}
+15 -8
View File
@@ -36,7 +36,7 @@ RD_CmdKind_Null,
RD_CmdKind_Null,
};
String8 d_entity_kind_display_string_table[30] =
String8 d_entity_kind_display_string_table[31] =
{
str8_lit_comp("Nil"),
str8_lit_comp("Root"),
@@ -59,6 +59,7 @@ str8_lit_comp("Window"),
str8_lit_comp("Panel"),
str8_lit_comp("View"),
str8_lit_comp("Recent Project"),
str8_lit_comp("Recent File"),
str8_lit_comp("Source"),
str8_lit_comp("Destination"),
str8_lit_comp("Process"),
@@ -70,7 +71,7 @@ str8_lit_comp("Conversion Task"),
str8_lit_comp("Conversion Failure"),
};
String8 d_entity_kind_name_lower_table[30] =
String8 d_entity_kind_name_lower_table[31] =
{
str8_lit_comp("nil"),
str8_lit_comp("root"),
@@ -93,6 +94,7 @@ str8_lit_comp("window"),
str8_lit_comp("panel"),
str8_lit_comp("view"),
str8_lit_comp("recent_project"),
str8_lit_comp("recent_file"),
str8_lit_comp("source"),
str8_lit_comp("dest"),
str8_lit_comp("process"),
@@ -104,7 +106,7 @@ str8_lit_comp("conversion_task"),
str8_lit_comp("conversion_fail"),
};
String8 d_entity_kind_name_lower_plural_table[30] =
String8 d_entity_kind_name_lower_plural_table[31] =
{
str8_lit_comp("nils"),
str8_lit_comp("roots"),
@@ -127,6 +129,7 @@ str8_lit_comp("windows"),
str8_lit_comp("panels"),
str8_lit_comp("views"),
str8_lit_comp("recent_projects"),
str8_lit_comp("recent_files"),
str8_lit_comp("sources"),
str8_lit_comp("dests"),
str8_lit_comp("processes"),
@@ -138,7 +141,7 @@ str8_lit_comp("conversion_tasks"),
str8_lit_comp("conversion_fails"),
};
String8 d_entity_kind_name_label_table[30] =
String8 d_entity_kind_name_label_table[31] =
{
str8_lit_comp("Label"),
str8_lit_comp("Label"),
@@ -163,6 +166,7 @@ str8_lit_comp("Label"),
str8_lit_comp("Path"),
str8_lit_comp("Path"),
str8_lit_comp("Path"),
str8_lit_comp("Path"),
str8_lit_comp("Label"),
str8_lit_comp("Label"),
str8_lit_comp("Label"),
@@ -172,7 +176,7 @@ str8_lit_comp("Label"),
str8_lit_comp("Label"),
};
RD_EntityKindFlags rd_entity_kind_flags_table[30] =
RD_EntityKindFlags rd_entity_kind_flags_table[31] =
{
(0*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (0*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (0*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (0*RD_EntityKindFlag_NameIsPath) | (0*RD_EntityKindFlag_UserDefinedLifetime) | (0*RD_EntityKindFlag_IsSerializedToConfig),
(0*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (0*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (0*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (0*RD_EntityKindFlag_NameIsPath) | (0*RD_EntityKindFlag_UserDefinedLifetime) | (0*RD_EntityKindFlag_IsSerializedToConfig),
@@ -195,6 +199,7 @@ RD_EntityKindFlags rd_entity_kind_flags_table[30] =
(1*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (0*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (1*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (0*RD_EntityKindFlag_NameIsPath) | (1*RD_EntityKindFlag_UserDefinedLifetime) | (1*RD_EntityKindFlag_IsSerializedToConfig),
(1*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (0*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (1*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (0*RD_EntityKindFlag_NameIsPath) | (1*RD_EntityKindFlag_UserDefinedLifetime) | (1*RD_EntityKindFlag_IsSerializedToConfig),
(0*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (0*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (0*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (1*RD_EntityKindFlag_NameIsPath) | (0*RD_EntityKindFlag_UserDefinedLifetime) | (1*RD_EntityKindFlag_IsSerializedToConfig),
(0*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (0*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (0*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (1*RD_EntityKindFlag_NameIsPath) | (0*RD_EntityKindFlag_UserDefinedLifetime) | (1*RD_EntityKindFlag_IsSerializedToConfig),
(0*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (0*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (0*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (0*RD_EntityKindFlag_NameIsPath) | (0*RD_EntityKindFlag_UserDefinedLifetime) | (0*RD_EntityKindFlag_IsSerializedToConfig),
(0*RD_EntityKindFlag_CanDelete) | (0*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (0*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (0*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (0*RD_EntityKindFlag_NameIsPath) | (0*RD_EntityKindFlag_UserDefinedLifetime) | (0*RD_EntityKindFlag_IsSerializedToConfig),
(0*RD_EntityKindFlag_CanDelete) | (1*RD_EntityKindFlag_CanFreeze) | (0*RD_EntityKindFlag_CanEdit) | (1*RD_EntityKindFlag_CanRename) | (0*RD_EntityKindFlag_CanEnable) | (0*RD_EntityKindFlag_CanCondition) | (0*RD_EntityKindFlag_CanDuplicate) | (0*RD_EntityKindFlag_NameIsCode) | (0*RD_EntityKindFlag_NameIsPath) | (0*RD_EntityKindFlag_UserDefinedLifetime) | (0*RD_EntityKindFlag_IsSerializedToConfig),
@@ -244,7 +249,7 @@ Rng1U64 rd_reg_slot_range_table[34] =
{OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)},
};
RD_CmdKindInfo rd_cmd_kind_info_table[216] =
RD_CmdKindInfo rd_cmd_kind_info_table[217] =
{
{0},
{ str8_lit_comp("launch_and_run"), str8_lit_comp("Starts debugging a new instance of a target, then runs."), str8_lit_comp("launch,start,run,target"), str8_lit_comp("Launch and Run"), RD_IconKind_Play, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_EntityList, str8_lit_comp(""), RD_EntityKind_Target}},
@@ -328,8 +333,9 @@ RD_CmdKindInfo rd_cmd_kind_info_table[216] =
{ str8_lit_comp("tab_bar_bottom"), str8_lit_comp("Anchors a panel's tab bar to the bottom of the panel."), str8_lit_comp(""), str8_lit_comp("Anchor Tab Bar To Bottom"), RD_IconKind_DownArrow, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
{ str8_lit_comp("set_current_path"), str8_lit_comp("Sets the debugger's current path, which is used as a starting point when browsing for files."), str8_lit_comp(""), str8_lit_comp("Set Current Path"), RD_IconKind_FileOutline, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
{ str8_lit_comp("open"), str8_lit_comp("Opens a file."), str8_lit_comp("code,source,file"), str8_lit_comp("Open"), RD_IconKind_FileOutline, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*1)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_FilePath, str8_lit_comp(""), RD_EntityKind_Nil}},
{ str8_lit_comp("switch"), str8_lit_comp("Switches to a loaded file."), str8_lit_comp("code,source,file"), str8_lit_comp("Switch"), RD_IconKind_FileOutline, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_File}},
{ str8_lit_comp("switch"), str8_lit_comp("Switches to a recent file."), str8_lit_comp("code,source,file"), str8_lit_comp("Switch"), RD_IconKind_FileOutline, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*1), RD_RegSlot_Entity, str8_lit_comp(""), RD_EntityKind_RecentFile}},
{ str8_lit_comp("switch_to_partner_file"), str8_lit_comp("Switches to the focused file's partner; or from header to implementation or vice versa."), str8_lit_comp("code,source,file"), str8_lit_comp("Switch To Partner File"), RD_IconKind_FileOutline, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
{ str8_lit_comp("record_file_in_project"), str8_lit_comp("Records the passed file path as a recent file in the currently loaded project."), str8_lit_comp(""), str8_lit_comp("Record File In Project"), RD_IconKind_FileOutline, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
{ str8_lit_comp("go_to_disassembly"), str8_lit_comp("Goes to the disassembly, if any, for a given source code line."), str8_lit_comp("code,source,disassembly,disasm"), str8_lit_comp("Go To Disassembly"), RD_IconKind_Glasses, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
{ str8_lit_comp("go_to_source"), str8_lit_comp("Goes to the source code, if any, for a given disassembly line."), str8_lit_comp("code,source,disassembly,disasm"), str8_lit_comp("Go To Source"), RD_IconKind_FileOutline, (RD_CmdKindFlag_ListInUI*1)|(RD_CmdKindFlag_ListInIPCDocs*1), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
{ str8_lit_comp("set_file_override_link_src"), str8_lit_comp("Sets the source path for an override file link."), str8_lit_comp(""), str8_lit_comp("Set File Override Link Source"), RD_IconKind_Null, (RD_CmdKindFlag_ListInUI*0)|(RD_CmdKindFlag_ListInIPCDocs*0), {(RD_QueryFlag_AllowFiles*0)|(RD_QueryFlag_AllowFolders*0)|(RD_QueryFlag_CodeInput*0)|(RD_QueryFlag_KeepOldInput*0)|(RD_QueryFlag_SelectOldInput*0)|(RD_QueryFlag_Required*0), RD_RegSlot_Null, str8_lit_comp(""), RD_EntityKind_Nil}},
@@ -865,7 +871,7 @@ RD_ViewRuleInfo rd_view_rule_kind_info_table[34] =
{str8_lit_comp("geo3d"), str8_lit_comp("Visualizes memory as 3D geometry."), str8_lit_comp("Geometry (3D)"), str8_lit_comp("x:{'count':expr, 'vtx':expr, 'vtx_size':expr}"), RD_IconKind_Binoculars, (RD_ViewRuleInfoFlag_ShowInDocs*1|RD_ViewRuleInfoFlag_CanFilter*0|RD_ViewRuleInfoFlag_FilterIsCode*0|RD_ViewRuleInfoFlag_TypingAutomaticallyFilters*0|RD_ViewRuleInfoFlag_CanUseInWatchTable*1|RD_ViewRuleInfoFlag_CanFillValueCell*0|RD_ViewRuleInfoFlag_CanExpand*1), EV_VIEW_RULE_EXPR_EXPAND_INFO_FUNCTION_NAME(geo3d) , RD_VIEW_RULE_UI_FUNCTION_NAME(geo3d)},
};
RD_IconKind rd_entity_kind_icon_kind_table[30] =
RD_IconKind rd_entity_kind_icon_kind_table[31] =
{
RD_IconKind_Null,
RD_IconKind_Null,
@@ -888,6 +894,7 @@ RD_IconKind_Window,
RD_IconKind_XSplit,
RD_IconKind_Null,
RD_IconKind_Briefcase,
RD_IconKind_FileOutline,
RD_IconKind_Null,
RD_IconKind_Null,
RD_IconKind_Threads,
+8 -6
View File
@@ -38,6 +38,7 @@ RD_EntityKind_Window,
RD_EntityKind_Panel,
RD_EntityKind_View,
RD_EntityKind_RecentProject,
RD_EntityKind_RecentFile,
RD_EntityKind_Source,
RD_EntityKind_Dest,
RD_EntityKind_Process,
@@ -175,6 +176,7 @@ RD_CmdKind_SetCurrentPath,
RD_CmdKind_Open,
RD_CmdKind_Switch,
RD_CmdKind_SwitchToPartnerFile,
RD_CmdKind_RecordFileInProject,
RD_CmdKind_GoToDisassembly,
RD_CmdKind_GoToSource,
RD_CmdKind_SetFileOverrideLinkSrc,
@@ -762,11 +764,11 @@ extern String8 rd_cfg_src_string_table[4];
extern RD_CmdKind rd_cfg_src_load_cmd_kind_table[4];
extern RD_CmdKind rd_cfg_src_write_cmd_kind_table[4];
extern RD_CmdKind rd_cfg_src_apply_cmd_kind_table[4];
extern String8 d_entity_kind_display_string_table[30];
extern String8 d_entity_kind_name_lower_table[30];
extern String8 d_entity_kind_name_lower_plural_table[30];
extern String8 d_entity_kind_name_label_table[30];
extern RD_EntityKindFlags rd_entity_kind_flags_table[30];
extern String8 d_entity_kind_display_string_table[31];
extern String8 d_entity_kind_name_lower_table[31];
extern String8 d_entity_kind_name_lower_plural_table[31];
extern String8 d_entity_kind_name_label_table[31];
extern RD_EntityKindFlags rd_entity_kind_flags_table[31];
extern Rng1U64 rd_reg_slot_range_table[34];
extern RD_StringBindingPair rd_default_binding_table[110];
extern String8 rd_binding_version_remap_old_name_table[7];
@@ -780,7 +782,7 @@ extern EV_ViewRuleExprExpandRangeInfoHookFunctionType * rd_collection_expr_expan
extern EV_ViewRuleExprExpandIDFromNumHookFunctionType * rd_collection_expr_expand_id_from_num_hook_function_table[18];
extern EV_ViewRuleExprExpandIDFromNumHookFunctionType * rd_collection_expr_expand_num_from_id_hook_function_table[18];
extern RD_ViewRuleInfo rd_view_rule_kind_info_table[34];
extern RD_IconKind rd_entity_kind_icon_kind_table[30];
extern RD_IconKind rd_entity_kind_icon_kind_table[31];
extern String8 rd_theme_preset_display_string_table[9];
extern String8 rd_theme_preset_code_string_table[9];
extern String8 rd_theme_color_version_remap_old_name_table[22];
+5 -1
View File
@@ -104,6 +104,9 @@ RD_EntityKindTable:
//- rjf: recent projects
{RecentProject recent_project recent_projects 0 0 0 0 0 0 0 0 1 0 1 "Path" Briefcase "Recent Project" }
//- rjf: recent files
{RecentFile recent_file recent_files 0 0 0 0 0 0 0 0 1 0 1 "Path" FileOutline "Recent File" }
//- rjf: src -> dst mapping
{Source source sources 0 0 0 0 0 0 0 0 0 0 0 "Path" Null "Source" }
{Dest dest dests 0 0 0 0 0 0 0 0 0 0 0 "Path" Null "Destination" }
@@ -309,8 +312,9 @@ RD_CmdTable: // | | | |
//- rjf: files
{SetCurrentPath 0 1 Null null Nil 0 0 0 0 0 0 FileOutline "set_current_path" "Set Current Path" "Sets the debugger's current path, which is used as a starting point when browsing for files." "" }
{Open 1 1 FilePath null Nil 1 0 0 0 0 1 FileOutline "open" "Open" "Opens a file." "code,source,file" }
{Switch 1 1 Entity null File 0 0 0 0 0 1 FileOutline "switch" "Switch" "Switches to a loaded file." "code,source,file" }
{Switch 1 1 Entity null RecentFile 0 0 0 0 0 1 FileOutline "switch" "Switch" "Switches to a recent file." "code,source,file" }
{SwitchToPartnerFile 1 1 Null null Nil 0 0 0 0 0 0 FileOutline "switch_to_partner_file" "Switch To Partner File" "Switches to the focused file's partner; or from header to implementation or vice versa." "code,source,file" }
{RecordFileInProject 0 0 Null null Nil 0 0 0 0 0 0 FileOutline "record_file_in_project" "Record File In Project" "Records the passed file path as a recent file in the currently loaded project." "" }
//- rjf: source <-> disasm
{GoToDisassembly 1 1 Null null Nil 0 0 0 0 0 0 Glasses "go_to_disassembly" "Go To Disassembly" "Goes to the disassembly, if any, for a given source code line." "code,source,disassembly,disasm" }
+125 -72
View File
@@ -1363,20 +1363,22 @@ rd_entity_change_parent(RD_Entity *entity, RD_Entity *old_parent, RD_Entity *new
{
Assert(entity->parent == old_parent);
Assert(prev_child->parent == old_parent || rd_entity_is_nil(prev_child));
// rjf: fix up links
if(!rd_entity_is_nil(old_parent))
if(prev_child != entity)
{
DLLRemove_NPZ(&d_nil_entity, old_parent->first, old_parent->last, entity, next, prev);
// rjf: fix up links
if(!rd_entity_is_nil(old_parent))
{
DLLRemove_NPZ(&d_nil_entity, old_parent->first, old_parent->last, entity, next, prev);
}
if(!rd_entity_is_nil(new_parent))
{
DLLInsert_NPZ(&d_nil_entity, new_parent->first, new_parent->last, prev_child, entity, next, prev);
}
entity->parent = new_parent;
// rjf: notify
rd_state->kind_alloc_gens[entity->kind] += 1;
}
if(!rd_entity_is_nil(new_parent))
{
DLLInsert_NPZ(&d_nil_entity, new_parent->first, new_parent->last, prev_child, entity, next, prev);
}
entity->parent = new_parent;
// rjf: notify
rd_state->kind_alloc_gens[entity->kind] += 1;
}
internal RD_Entity *
@@ -3955,6 +3957,10 @@ rd_window_frame(RD_Window *ws)
//
case RD_RegSlot_Cursor:
{
// TODO(rjf): with new registers-based commands, all of this can be deduplicated with the
// command-based path, but I am holding off on that until post 0.9.12 - these should be
// able to just all push commands for their corresponding actions
//
TXT_Scope *txt_scope = txt_scope_open();
HS_Scope *hs_scope = hs_scope_open();
TxtRng range = txt_rng(regs->cursor, regs->mark);
@@ -5509,29 +5515,6 @@ rd_window_frame(RD_Window *ws)
};
Assert(ArrayCount(codepoints) == ArrayCount(cmds));
rd_cmd_list_menu_buttons(ArrayCount(cmds), cmds, codepoints);
RD_Palette(RD_PaletteCode_Floating) ui_divider(ui_em(1.f, 1.f));
RD_EntityList targets_list = rd_query_cached_entity_list_with_kind(RD_EntityKind_Target);
for(RD_EntityNode *n = targets_list.first; n != 0; n = n->next)
{
RD_Entity *target = n->entity;
UI_Palette *palette = ui_top_palette();
if(target->flags & RD_EntityFlag_HasColor)
{
palette = ui_build_palette(ui_top_palette(), .text = rd_rgba_from_entity(target));
}
String8 target_name = rd_display_string_from_entity(scratch.arena, target);
UI_Signal sig = {0};
UI_Palette(palette) sig = rd_icon_buttonf(RD_IconKind_Target, 0, "%S##%p", target_name, target);
if(ui_clicked(sig))
{
// TODO(rjf): @msgs
#if 0
rd_cmd(RD_CmdKind_EditTarget, .entity = rd_handle_from_entity(target));
ui_ctx_menu_close();
ws->menu_bar_focused = 0;
#endif
}
}
scratch_end(scratch);
}
@@ -13874,6 +13857,7 @@ rd_frame(void)
FileProperties props = os_properties_from_file_path(path);
if(props.created != 0)
{
rd_cmd(RD_CmdKind_RecordFileInProject);
rd_cmd(RD_CmdKind_OpenTab,
.string = rd_eval_string_from_file_path(scratch.arena, path),
.params_tree = md_tree_from_string(scratch.arena, rd_view_rule_kind_info_table[RD_ViewRuleKind_PendingFile].string)->first);
@@ -13949,13 +13933,63 @@ rd_frame(void)
}
}
}break;
case RD_CmdKind_RecordFileInProject:
if(rd_regs()->file_path.size != 0)
{
String8 path = path_normalized_from_string(scratch.arena, rd_regs()->file_path);
RD_EntityList recent_files = rd_query_cached_entity_list_with_kind(RD_EntityKind_RecentFile);
if(recent_files.count >= 256)
{
rd_entity_mark_for_deletion(recent_files.first->entity);
}
RD_Entity *existing_recent_file = &d_nil_entity;
for(RD_EntityNode *n = recent_files.first; n != 0; n = n->next)
{
if(str8_match(n->entity->string, path, StringMatchFlag_CaseInsensitive))
{
existing_recent_file = n->entity;
break;
}
}
if(rd_entity_is_nil(existing_recent_file))
{
RD_Entity *recent_file = rd_entity_alloc(rd_entity_root(), RD_EntityKind_RecentFile);
rd_entity_equip_name(recent_file, path);
rd_entity_equip_cfg_src(recent_file, RD_CfgSrc_Project);
}
else
{
rd_entity_change_parent(existing_recent_file, rd_entity_root(), rd_entity_root(), rd_entity_root()->last);
}
}break;
//- rjf: source <-> disasm
case RD_CmdKind_GoToDisassembly:
{
// TODO(rjf): @msgs
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread);
U64 vaddr = 0;
for(D_LineNode *n = rd_regs()->lines.first; n != 0; n = n->next)
{
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, d_state->ctrl_entity_store, &n->v.dbgi_key);
CTRL_Entity *module = ctrl_module_from_thread_candidates(d_state->ctrl_entity_store, thread, &modules);
if(module != &ctrl_entity_nil)
{
vaddr = ctrl_vaddr_from_voff(module, n->v.voff_range.min);
break;
}
}
rd_cmd(RD_CmdKind_FindCodeLocation, .vaddr = vaddr);
}break;
case RD_CmdKind_GoToSource:
{
// TODO(rjf): @msgs
if(rd_regs()->lines.first != 0)
{
rd_cmd(RD_CmdKind_FindCodeLocation,
.file_path = rd_regs()->lines.first->v.file_path,
.cursor = rd_regs()->lines.first->v.pt,
.vaddr = 0,
.process = ctrl_handle_zero());
}
}break;
//- rjf: panel built-in layout builds
@@ -14674,46 +14708,62 @@ rd_frame(void)
}
}
// rjf: find a panel that already has *any* code open
// rjf: find a panel that already has *any* code open (prioritize largest)
RD_Panel *panel_w_any_src_code = &rd_nil_panel;
for(RD_Panel *panel = ws->root_panel; !rd_panel_is_nil(panel); panel = rd_panel_rec_depth_first_pre(panel).next)
{
if(!rd_panel_is_nil(panel->first))
Rng2F32 root_rect = os_client_rect_from_window(ws->os);
F32 best_panel_area = 0;
for(RD_Panel *panel = ws->root_panel; !rd_panel_is_nil(panel); panel = rd_panel_rec_depth_first_pre(panel).next)
{
continue;
}
for(RD_View *view = panel->first_tab_view; !rd_view_is_nil(view); view = view->order_next)
{
if(rd_view_is_project_filtered(view)) { continue; }
RD_ViewRuleKind view_kind = rd_view_rule_kind_from_string(view->spec->string);
if(view_kind == RD_ViewRuleKind_Text)
if(!rd_panel_is_nil(panel->first))
{
panel_w_any_src_code = panel;
break;
continue;
}
Rng2F32 panel_rect = rd_target_rect_from_panel(root_rect, ws->root_panel, panel);
Vec2F32 panel_rect_dim = dim_2f32(panel_rect);
F32 panel_area = panel_rect_dim.x*panel_rect_dim.y;
for(RD_View *view = panel->first_tab_view; !rd_view_is_nil(view); view = view->order_next)
{
if(rd_view_is_project_filtered(view)) { continue; }
RD_ViewRuleKind view_kind = rd_view_rule_kind_from_string(view->spec->string);
if(view_kind == RD_ViewRuleKind_Text && panel_area > best_panel_area)
{
panel_w_any_src_code = panel;
best_panel_area = panel_area;
break;
}
}
}
}
// rjf: try to find panel/view pair that has disassembly open
// rjf: try to find panel/view pair that has disassembly open (prioritize largest)
RD_Panel *panel_w_disasm = &rd_nil_panel;
RD_View *view_w_disasm = &rd_nil_view;
for(RD_Panel *panel = ws->root_panel; !rd_panel_is_nil(panel); panel = rd_panel_rec_depth_first_pre(panel).next)
{
if(!rd_panel_is_nil(panel->first))
Rng2F32 root_rect = os_client_rect_from_window(ws->os);
F32 best_panel_area = 0;
for(RD_Panel *panel = ws->root_panel; !rd_panel_is_nil(panel); panel = rd_panel_rec_depth_first_pre(panel).next)
{
continue;
}
for(RD_View *view = panel->first_tab_view; !rd_view_is_nil(view); view = view->order_next)
{
if(rd_view_is_project_filtered(view)) { continue; }
RD_ViewRuleKind view_kind = rd_view_rule_kind_from_string(view->spec->string);
if(view_kind == RD_ViewRuleKind_Disasm && view->query_string_size == 0)
if(!rd_panel_is_nil(panel->first))
{
panel_w_disasm = panel;
view_w_disasm = view;
if(view == rd_selected_tab_from_panel(panel))
continue;
}
Rng2F32 panel_rect = rd_target_rect_from_panel(root_rect, ws->root_panel, panel);
Vec2F32 panel_rect_dim = dim_2f32(panel_rect);
F32 panel_area = panel_rect_dim.x*panel_rect_dim.y;
for(RD_View *view = panel->first_tab_view; !rd_view_is_nil(view); view = view->order_next)
{
if(rd_view_is_project_filtered(view)) { continue; }
RD_ViewRuleKind view_kind = rd_view_rule_kind_from_string(view->spec->string);
if(view_kind == RD_ViewRuleKind_Disasm && view->query_string_size == 0 && panel_area > best_panel_area)
{
break;
panel_w_disasm = panel;
view_w_disasm = view;
best_panel_area = panel_area;
if(view == rd_selected_tab_from_panel(panel))
{
break;
}
}
}
}
@@ -14818,6 +14868,9 @@ rd_frame(void)
.view = rd_handle_from_view(dst_view));
panel_used_for_src_code = dst_panel;
}
// rjf: record
rd_cmd(RD_CmdKind_RecordFileInProject, .file_path = file_path);
}
// rjf: given the above, find disassembly location.
@@ -16379,6 +16432,15 @@ rd_frame(void)
rd_state->num_frames_requested -= 1;
}
//////////////////////////////
//- rjf: close scopes
//
if(depth == 0)
{
di_scope_close(rd_state->frame_di_scope);
fzy_scope_close(rd_state->frame_fzy_scope);
}
//////////////////////////////
//- rjf: submit rendering to all windows
//
@@ -16479,14 +16541,5 @@ rd_frame(void)
}
}
//////////////////////////////
//- rjf: close scopes
//
if(depth == 0)
{
di_scope_close(rd_state->frame_di_scope);
fzy_scope_close(rd_state->frame_fzy_scope);
}
scratch_end(scratch);
}
+1 -1
View File
@@ -15,7 +15,6 @@
// [ ] post-@msgs TODOs:
// [ ] ensure the following issues are resolved with this new pass:
// [ ] empty user file causing failure to launch
// [ ] decay arrays to pointers in pointer/value comparison
// [ ] debugger readme pass
////////////////////////////////
@@ -521,6 +520,7 @@
// [x] @feature types -> auto view rules (don't statefully fill view rules
// given types, just query if no other view rule is present, & autofill
// when editing)
// [x] decay arrays to pointers in pointer/value comparison
////////////////////////////////
//~ rjf: Build Options