mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-31 19:30:03 +00:00
memory view fixups for new visualization systems; breakpoint editing work
This commit is contained in:
@@ -405,7 +405,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[214] =
|
||||
{ str8_lit_comp("enable_entity"), str8_lit_comp("Enables an entity."), str8_lit_comp(""), str8_lit_comp("Enable Entity"), 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}},
|
||||
{ str8_lit_comp("disable_entity"), str8_lit_comp("Disables an entity."), str8_lit_comp(""), str8_lit_comp("Disable Entity"), 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}},
|
||||
{ str8_lit_comp("select_entity"), str8_lit_comp("Selects an entity, disabling all others of the same kind."), str8_lit_comp(""), str8_lit_comp("Select Entity"), RD_IconKind_CheckHollow, (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("remove_entity"), str8_lit_comp("Removes an entity."), str8_lit_comp(""), str8_lit_comp("Remove Entity"), 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}},
|
||||
{ str8_lit_comp("remove_entity"), str8_lit_comp("Removes an entity."), str8_lit_comp(""), str8_lit_comp("Remove Entity"), RD_IconKind_Trash, (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("name_entity"), str8_lit_comp("Equips an entity with a name."), str8_lit_comp(""), str8_lit_comp("Name Entity"), 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}},
|
||||
{ str8_lit_comp("duplicate_entity"), str8_lit_comp("Duplicates an entity."), str8_lit_comp(""), str8_lit_comp("Duplicate Entity"), 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}},
|
||||
{ str8_lit_comp("relocate_entity"), str8_lit_comp("Relocates an entity."), str8_lit_comp(""), str8_lit_comp("Relocate Entity"), 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}},
|
||||
|
||||
@@ -416,7 +416,7 @@ RD_CmdTable: // | | | |
|
||||
{EnableEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "enable_entity" "Enable Entity" "Enables an entity." "" }
|
||||
{DisableEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "disable_entity" "Disable Entity" "Disables an entity." "" }
|
||||
{SelectEntity 0 0 Null null Nil 0 0 0 0 0 0 CheckHollow "select_entity" "Select Entity" "Selects an entity, disabling all others of the same kind." "" }
|
||||
{RemoveEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "remove_entity" "Remove Entity" "Removes an entity." "" }
|
||||
{RemoveEntity 0 0 Null null Nil 0 0 0 0 0 0 Trash "remove_entity" "Remove Entity" "Removes an entity." "" }
|
||||
{NameEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "name_entity" "Name Entity" "Equips an entity with a name." "" }
|
||||
{DuplicateEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "duplicate_entity" "Duplicate Entity" "Duplicates an entity." "" }
|
||||
{RelocateEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "relocate_entity" "Relocate Entity" "Relocates an entity." "" }
|
||||
|
||||
+105
-24
@@ -1774,6 +1774,12 @@ rd_title_fstrs_from_entity(Arena *arena, RD_Entity *entity, Vec4F32 secondary_co
|
||||
else if(loc->string.size != 0)
|
||||
{
|
||||
location = loc->string;
|
||||
location_is_code = 1;
|
||||
}
|
||||
else if(loc->flags & RD_EntityFlag_HasVAddr)
|
||||
{
|
||||
location = push_str8f(arena, "0x%I64x", loc->vaddr);
|
||||
location_is_code = 1;
|
||||
}
|
||||
}
|
||||
B32 extra = 0;
|
||||
@@ -1792,7 +1798,17 @@ rd_title_fstrs_from_entity(Arena *arena, RD_Entity *entity, Vec4F32 secondary_co
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, v4f32(0, 0, 0, 0), str8_lit(" "));
|
||||
}
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(location_is_code ? RD_FontSlot_Code : RD_FontSlot_Main), size_extrafied, color_extrafied, location);
|
||||
if(location_is_code)
|
||||
{
|
||||
DR_FancyStringList loc_fstrs = {0};
|
||||
RD_Font(RD_FontSlot_Code)
|
||||
loc_fstrs = rd_fancy_string_list_from_code_string(arena, 1.f, 0, color_extrafied, location);
|
||||
dr_fancy_string_list_concat_in_place(&result, &loc_fstrs);
|
||||
}
|
||||
else
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), size_extrafied, color_extrafied, location);
|
||||
}
|
||||
extra = 1;
|
||||
size_extrafied = size*0.95f;
|
||||
color_extrafied = secondary_color;
|
||||
@@ -2057,14 +2073,20 @@ rd_ctrl_meta_eval_from_entity(Arena *arena, RD_Entity *entity)
|
||||
RD_Entity *loc = rd_entity_child_from_kind(entity, RD_EntityKind_Location);
|
||||
RD_Entity *cnd = rd_entity_child_from_kind(entity, RD_EntityKind_Condition);
|
||||
String8 label_string = push_str8_copy(arena, entity->string);
|
||||
String8 loc_string = {0};
|
||||
String8 src_loc_string = {0};
|
||||
String8 vaddr_loc_string = {0};
|
||||
String8 function_loc_string = {0};
|
||||
if(loc->flags & RD_EntityFlag_HasTextPoint)
|
||||
{
|
||||
loc_string = push_str8f(arena, "%S:%I64u:%I64u", loc->string, loc->text_point.line, loc->text_point.column);
|
||||
src_loc_string = push_str8f(arena, "%S:%I64u:%I64u", loc->string, loc->text_point.line, loc->text_point.column);
|
||||
}
|
||||
else if(loc->flags & RD_EntityFlag_HasVAddr)
|
||||
{
|
||||
loc_string = push_str8f(arena, "0x%I64x", loc->vaddr);
|
||||
vaddr_loc_string = push_str8f(arena, "0x%I64x", loc->vaddr);
|
||||
}
|
||||
else if(loc->string.size != 0)
|
||||
{
|
||||
function_loc_string = push_str8_copy(arena, loc->string);
|
||||
}
|
||||
String8 cnd_string = push_str8_copy(arena, cnd->string);
|
||||
meval->enabled = !entity->disabled;
|
||||
@@ -2075,7 +2097,9 @@ rd_ctrl_meta_eval_from_entity(Arena *arena, RD_Entity *entity)
|
||||
meval->args = args->string;
|
||||
meval->working_directory = wdir->string;
|
||||
meval->entry_point = entr->string;
|
||||
meval->location = loc_string;
|
||||
meval->source_location = src_loc_string;
|
||||
meval->address_location = vaddr_loc_string;
|
||||
meval->function_location = function_loc_string;
|
||||
meval->condition = cnd_string;
|
||||
return meval;
|
||||
}
|
||||
@@ -2289,6 +2313,24 @@ rd_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range)
|
||||
StringMemberCase(working_directory) {result = 1; rd_entity_equip_name(rd_entity_child_from_kind_or_alloc(entity, RD_EntityKind_WorkingDirectory), str8_cstring_capped(in, (U8 *)in + 4096));}
|
||||
StringMemberCase(entry_point) {result = 1; rd_entity_equip_name(rd_entity_child_from_kind_or_alloc(entity, RD_EntityKind_EntryPoint), str8_cstring_capped(in, (U8 *)in + 4096));}
|
||||
StringMemberCase(condition) {result = 1; rd_entity_equip_name(rd_entity_child_from_kind_or_alloc(entity, RD_EntityKind_Condition), str8_cstring_capped(in, (U8 *)in + 4096));}
|
||||
StringMemberCase(source_location)
|
||||
{
|
||||
result = 1;
|
||||
String8TxtPtPair src_loc = str8_txt_pt_pair_from_string(str8_cstring_capped(in, (U8 *)in + 4096));
|
||||
RD_Entity *loc = rd_entity_child_from_kind_or_alloc(entity, RD_EntityKind_Location);
|
||||
rd_entity_equip_name(loc, src_loc.string);
|
||||
rd_entity_equip_txt_pt(loc, src_loc.pt);
|
||||
}
|
||||
StringMemberCase(address_location)
|
||||
{
|
||||
}
|
||||
StringMemberCase(function_location)
|
||||
{
|
||||
result = 1;
|
||||
RD_Entity *loc = rd_entity_child_from_kind_or_alloc(entity, RD_EntityKind_Location);
|
||||
loc->flags &= ~RD_EntityFlag_HasTextPoint;
|
||||
rd_entity_equip_name(loc, str8_cstring_capped(in, (U8 *)in + 4096));
|
||||
}
|
||||
#undef FlatMemberCase
|
||||
#undef StringMemberCase
|
||||
scratch_end(scratch);
|
||||
@@ -2413,17 +2455,9 @@ rd_commit_eval_value_string(E_Eval dst_eval, String8 string)
|
||||
E_Eval src_eval = e_eval_from_string(scratch.arena, string);
|
||||
E_Eval src_eval_value = e_value_eval_from_eval(src_eval);
|
||||
E_TypeKind src_eval_value_type_kind = e_type_kind_from_key(src_eval_value.type_key);
|
||||
if(type_kind == E_TypeKind_Ptr &&
|
||||
(e_type_kind_is_pointer_or_ref(src_eval_value_type_kind) ||
|
||||
e_type_kind_is_integer(src_eval_value_type_kind)) &&
|
||||
src_eval_value.mode == E_Mode_Value)
|
||||
{
|
||||
commit_data = push_str8_copy(scratch.arena, str8_struct(&src_eval.value));
|
||||
commit_data.size = Min(commit_data.size, e_type_byte_size_from_key(type_key));
|
||||
}
|
||||
else if(direct_type_kind == E_TypeKind_Char8 ||
|
||||
direct_type_kind == E_TypeKind_UChar8 ||
|
||||
e_type_kind_is_integer(direct_type_kind))
|
||||
if(direct_type_kind == E_TypeKind_Char8 ||
|
||||
direct_type_kind == E_TypeKind_UChar8 ||
|
||||
e_type_kind_is_integer(direct_type_kind))
|
||||
{
|
||||
B32 is_quoted = 0;
|
||||
if(string.size >= 1 && string.str[0] == '"')
|
||||
@@ -2449,6 +2483,15 @@ rd_commit_eval_value_string(E_Eval dst_eval, String8 string)
|
||||
commit_at_ptr_dest = 1;
|
||||
}
|
||||
}
|
||||
else if(type_kind == E_TypeKind_Ptr &&
|
||||
(e_type_kind_is_pointer_or_ref(src_eval_value_type_kind) ||
|
||||
e_type_kind_is_integer(src_eval_value_type_kind)) &&
|
||||
src_eval_value.mode == E_Mode_Value)
|
||||
{
|
||||
commit_data = push_str8_copy(scratch.arena, str8_struct(&src_eval.value));
|
||||
commit_data.size = Min(commit_data.size, e_type_byte_size_from_key(src_eval.type_key));
|
||||
commit_data.size = Min(commit_data.size, e_type_byte_size_from_key(type_key));
|
||||
}
|
||||
}
|
||||
if(commit_data.size != 0 && e_type_byte_size_from_key(type_key) != 0)
|
||||
{
|
||||
@@ -3373,7 +3416,7 @@ rd_window_frame(RD_Window *ws)
|
||||
RD_RegSlot slot = ((rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active()) ? rd_state->drag_drop_regs_slot : rd_state->hover_regs_slot);
|
||||
RD_Regs *regs = (((rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active()) ? rd_state->drag_drop_regs : rd_state->hover_regs));
|
||||
CTRL_Entity *ctrl_entity = &ctrl_entity_nil;
|
||||
UI_Tooltip RD_Palette(RD_PaletteCode_Floating) switch(slot)
|
||||
RD_Palette(RD_PaletteCode_Floating) switch(slot)
|
||||
{
|
||||
default:{}break;
|
||||
|
||||
@@ -3381,6 +3424,7 @@ rd_window_frame(RD_Window *ws)
|
||||
//- rjf: frontend entity tooltips
|
||||
//
|
||||
case RD_RegSlot_Entity:
|
||||
UI_Tooltip
|
||||
{
|
||||
// rjf: unpack
|
||||
RD_Entity *entity = rd_entity_from_handle(regs->entity);
|
||||
@@ -3403,6 +3447,7 @@ rd_window_frame(RD_Window *ws)
|
||||
case RD_RegSlot_Thread: {ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->thread); }goto ctrl_entity_tooltip;
|
||||
case RD_RegSlot_CtrlEntity:{ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->ctrl_entity); }goto ctrl_entity_tooltip;
|
||||
ctrl_entity_tooltip:;
|
||||
UI_Tooltip
|
||||
{
|
||||
// rjf: unpack
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
@@ -3980,10 +4025,11 @@ rd_window_frame(RD_Window *ws)
|
||||
//////////////////////
|
||||
//- rjf: ctrl entities
|
||||
//
|
||||
case RD_RegSlot_Machine: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->machine); goto ctrl_entity_title;
|
||||
case RD_RegSlot_Process: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->process); goto ctrl_entity_title;
|
||||
case RD_RegSlot_Module: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->module); goto ctrl_entity_title;
|
||||
case RD_RegSlot_Thread: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->thread); goto ctrl_entity_title;
|
||||
case RD_RegSlot_Machine: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->machine); goto ctrl_entity_title;
|
||||
case RD_RegSlot_Process: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->process); goto ctrl_entity_title;
|
||||
case RD_RegSlot_Module: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->module); goto ctrl_entity_title;
|
||||
case RD_RegSlot_Thread: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->thread); goto ctrl_entity_title;
|
||||
case RD_RegSlot_CtrlEntity: ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->ctrl_entity); goto ctrl_entity_title;
|
||||
ctrl_entity_title:;
|
||||
{
|
||||
//- rjf: title
|
||||
@@ -4271,6 +4317,38 @@ rd_window_frame(RD_Window *ws)
|
||||
#endif
|
||||
}break;
|
||||
|
||||
//////////////////////
|
||||
//- rjf: frontend entities
|
||||
//
|
||||
case RD_RegSlot_Entity:
|
||||
{
|
||||
RD_Entity *entity = rd_entity_from_handle(regs->entity);
|
||||
|
||||
//- rjf: title
|
||||
UI_Row
|
||||
UI_PrefWidth(ui_text_dim(5, 1))
|
||||
UI_TextAlignment(UI_TextAlign_Center)
|
||||
UI_TextPadding(ui_top_font_size()*1.5f)
|
||||
{
|
||||
DR_FancyStringList fstrs = rd_title_fstrs_from_entity(scratch.arena, entity, ui_top_palette()->text_weak, ui_top_font_size());
|
||||
UI_Box *title_box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(title_box, &fstrs);
|
||||
if(ctrl_entity->kind == CTRL_EntityKind_Thread)
|
||||
{
|
||||
ui_spacer(ui_em(0.5f, 1.f));
|
||||
UI_FontSize(ui_top_font_size() - 1.f)
|
||||
UI_CornerRadius(ui_top_font_size()*0.5f)
|
||||
RD_Palette(RD_PaletteCode_NeutralPopButton)
|
||||
UI_TextPadding(ui_top_font_size()*0.5f)
|
||||
{
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak|UI_BoxFlag_DrawBorder) ui_label(string_from_arch(ctrl_entity->arch));
|
||||
ui_spacer(ui_em(0.5f, 1.f));
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak|UI_BoxFlag_DrawBorder) ui_labelf("TID: %i", (U32)ctrl_entity->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9789,8 +9867,8 @@ rd_cfg_strings_from_gfx(Arena *arena, String8 root_path, RD_CfgSrc source)
|
||||
entity_name_escaped = escaped_from_raw_str8(arena, e->string);
|
||||
}
|
||||
EntityInfoFlags info_flags = 0;
|
||||
if(entity_name_escaped.size != 0) { info_flags |= EntityInfoFlag_HasName; }
|
||||
if(!!e->disabled) { info_flags |= EntityInfoFlag_HasDisabled; }
|
||||
if(entity_name_escaped.size != 0) { info_flags |= EntityInfoFlag_HasName; }
|
||||
if(!!e->disabled) { info_flags |= EntityInfoFlag_HasDisabled; }
|
||||
if(e->flags & RD_EntityFlag_HasTextPoint) { info_flags |= EntityInfoFlag_HasTxtPt; }
|
||||
if(e->flags & RD_EntityFlag_HasVAddr) { info_flags |= EntityInfoFlag_HasVAddr; }
|
||||
if(e->flags & RD_EntityFlag_HasColor) { info_flags |= EntityInfoFlag_HasColor; }
|
||||
@@ -14570,9 +14648,12 @@ rd_frame(void)
|
||||
}
|
||||
}break;
|
||||
case RD_CmdKind_AddAddressBreakpoint:
|
||||
{
|
||||
rd_cmd(RD_CmdKind_AddBreakpoint, .string = str8_zero());
|
||||
}break;
|
||||
case RD_CmdKind_AddFunctionBreakpoint:
|
||||
{
|
||||
rd_cmd(RD_CmdKind_AddBreakpoint);
|
||||
rd_cmd(RD_CmdKind_AddBreakpoint, .vaddr = 0);
|
||||
}break;
|
||||
|
||||
//- rjf: watch pins
|
||||
|
||||
+111
-74
@@ -1204,9 +1204,12 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
}
|
||||
RD_WatchViewRowCtrl row_ctrls_[] =
|
||||
{
|
||||
{RD_EntityKind_Target, CTRL_EntityKind_Null, RD_CmdKind_LaunchAndRun },
|
||||
{RD_EntityKind_Target, CTRL_EntityKind_Null, RD_CmdKind_LaunchAndInit },
|
||||
{RD_EntityKind_Target, CTRL_EntityKind_Null, RD_CmdKind_SelectEntity },
|
||||
{RD_EntityKind_Target, CTRL_EntityKind_Null, RD_CmdKind_LaunchAndRun },
|
||||
{RD_EntityKind_Target, CTRL_EntityKind_Null, RD_CmdKind_LaunchAndInit },
|
||||
{RD_EntityKind_Target, CTRL_EntityKind_Null, RD_CmdKind_SelectEntity },
|
||||
{RD_EntityKind_Target, CTRL_EntityKind_Null, RD_CmdKind_RemoveEntity },
|
||||
{RD_EntityKind_Breakpoint, CTRL_EntityKind_Null, RD_CmdKind_EnableEntity },
|
||||
{RD_EntityKind_Breakpoint, CTRL_EntityKind_Null, RD_CmdKind_RemoveEntity },
|
||||
{RD_EntityKind_Nil, CTRL_EntityKind_Thread, RD_CmdKind_FreezeThread },
|
||||
{RD_EntityKind_Nil, CTRL_EntityKind_Thread, RD_CmdKind_SelectThread },
|
||||
};
|
||||
@@ -2599,7 +2602,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
B32 is_frozen = ctrl_entity_tree_is_frozen(ctrl_entity);
|
||||
RD_IconKind icon_kind = rd_cmd_kind_info_table[ctrl->kind].icon_kind;
|
||||
UI_Palette *palette = ui_top_palette();
|
||||
if(ctrl->kind == RD_CmdKind_SelectEntity)
|
||||
if(ctrl->kind == RD_CmdKind_SelectEntity || ctrl->kind == RD_CmdKind_EnableEntity)
|
||||
{
|
||||
icon_kind = entity->disabled ? RD_IconKind_CheckHollow : RD_IconKind_CheckFilled;
|
||||
}
|
||||
@@ -2623,6 +2626,10 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
sig.event_flags & OS_Modifier_Ctrl && !entity->disabled ? RD_CmdKind_DisableEntity :
|
||||
RD_CmdKind_SelectEntity, .entity = rd_handle_from_entity(entity));
|
||||
}
|
||||
else if(ctrl->kind == RD_CmdKind_EnableEntity)
|
||||
{
|
||||
rd_cmd(entity->disabled ? RD_CmdKind_EnableEntity : RD_CmdKind_DisableEntity, .entity = rd_handle_from_entity(entity));
|
||||
}
|
||||
else if(ctrl->kind == RD_CmdKind_SelectThread)
|
||||
{
|
||||
rd_cmd(RD_CmdKind_SelectThread, .thread = ctrl_entity->handle);
|
||||
@@ -5371,7 +5378,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(breakpoints)
|
||||
rd_watch_view_column_alloc(wv, RD_WatchViewColumnKind_Value, 0.75f, .dequote_string = 1);
|
||||
}
|
||||
rd_watch_view_build(wv, RD_WatchViewFlag_NoHeader|RD_WatchViewFlag_PrettyNameMembers|RD_WatchViewFlag_PrettyEntityRows|RD_WatchViewFlag_DisableCacheLines,
|
||||
str8_lit("breakpoints"), str8_lit("only: label condition str hit_count location"), 0, 10, rect);
|
||||
str8_lit("breakpoints"), str8_lit("only: label condition str hit_count source_location address_location function_location"), 0, 10, rect);
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
@@ -6525,6 +6532,10 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
{
|
||||
eval.space = rd_eval_space_from_ctrl_entity(ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->process), RD_EvalSpaceKind_CtrlEntity);
|
||||
space_range = rd_whole_range_from_eval_space(eval.space);
|
||||
if(dim_1u64(space_range) == 0)
|
||||
{
|
||||
space_range = r1u64(0, 0x7FFFFFFFFFFFull);
|
||||
}
|
||||
}
|
||||
U64 cursor = rd_value_from_params_key(params, str8_lit("cursor_vaddr")).u64;
|
||||
U64 mark = rd_value_from_params_key(params, str8_lit("mark_vaddr")).u64;
|
||||
@@ -6564,10 +6575,8 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
}break;
|
||||
case RD_CmdKind_GoToAddress:
|
||||
{
|
||||
// NOTE(rjf): go-to-address occurs with disassembly snaps, and we don't
|
||||
// generally want to respond to those in thise view, so just skip any
|
||||
// go-to-address commands that haven't been *explicitly* parameterized
|
||||
// with this view.
|
||||
cursor = mark = cmd->regs->vaddr;
|
||||
mv->center_cursor = 1;
|
||||
}break;
|
||||
case RD_CmdKind_SetColumns:
|
||||
{
|
||||
@@ -6594,7 +6603,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
//////////////////////////////
|
||||
//- rjf: determine legal scroll range
|
||||
//
|
||||
Rng1S64 scroll_idx_rng = r1s64(0, space_range.max/num_columns);
|
||||
Rng1S64 scroll_idx_rng = r1s64(0, dim_1u64(space_range)/num_columns);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: determine info about visible range of rows
|
||||
@@ -6608,12 +6617,13 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
viz_range_rows.max = scroll_pos.y.idx + (S64)scroll_pos.y.off + num_possible_visible_rows,
|
||||
viz_range_rows.min = clamp_1s64(scroll_idx_rng, viz_range_rows.min);
|
||||
viz_range_rows.max = clamp_1s64(scroll_idx_rng, viz_range_rows.max);
|
||||
viz_range_bytes.min = viz_range_rows.min*num_columns;
|
||||
viz_range_bytes.max = (viz_range_rows.max+1)*num_columns+1;
|
||||
viz_range_bytes.min = space_range.min + viz_range_rows.min*num_columns;
|
||||
viz_range_bytes.max = space_range.min + (viz_range_rows.max+1)*num_columns+1;
|
||||
if(viz_range_bytes.min > viz_range_bytes.max)
|
||||
{
|
||||
Swap(U64, viz_range_bytes.min, viz_range_bytes.max);
|
||||
}
|
||||
viz_range_bytes = intersect_1u64(space_range, viz_range_bytes);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -6670,7 +6680,6 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
cell_delta.y = ClampBot(cell_delta.y, (S64)-(next_cursor/num_columns));
|
||||
next_cursor += cell_delta.x;
|
||||
next_cursor += cell_delta.y*num_columns;
|
||||
next_cursor = ClampTop(0x7FFFFFFFFFFFull, next_cursor);
|
||||
}
|
||||
if(good_action && evt->flags & UI_EventFlag_PickSelectSide && cursor != mark)
|
||||
{
|
||||
@@ -6702,6 +6711,10 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
//
|
||||
{
|
||||
Rng1U64 cursor_valid_rng = space_range;
|
||||
if(cursor_valid_rng.max != 0)
|
||||
{
|
||||
cursor_valid_rng.max -= 1;
|
||||
}
|
||||
cursor = clamp_1u64(cursor_valid_rng, cursor);
|
||||
mark = clamp_1u64(cursor_valid_rng, mark);
|
||||
}
|
||||
@@ -7071,7 +7084,8 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
UI_WidthFill UI_PrefHeight(ui_px(row_height_px, 1.f))
|
||||
for(S64 row_idx = viz_range_rows.min; row_idx <= viz_range_rows.max; row_idx += 1)
|
||||
{
|
||||
Rng1U64 row_range_bytes = r1u64(row_idx*num_columns, (row_idx+1)*num_columns);
|
||||
Rng1U64 row_range_bytes = r1u64(viz_range_bytes.min + row_idx*num_columns,
|
||||
viz_range_bytes.min + (row_idx+1)*num_columns);
|
||||
B32 row_is_boundary = 0;
|
||||
Vec4F32 row_boundary_color = {0};
|
||||
if(row_range_bytes.min%64 == 0)
|
||||
@@ -7096,77 +7110,94 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
{
|
||||
for(U64 col_idx = 0; col_idx < num_columns; col_idx += 1)
|
||||
{
|
||||
// rjf: unpack information about this slot
|
||||
U64 visible_byte_idx = (row_idx-viz_range_rows.min)*num_columns + col_idx;
|
||||
U64 global_byte_idx = viz_range_bytes.min+visible_byte_idx;
|
||||
U64 global_byte_num = global_byte_idx+1;
|
||||
U8 byte_value = visible_memory[visible_byte_idx];
|
||||
Annotation *annotation = visible_memory_annotations[visible_byte_idx].first;
|
||||
UI_BoxFlags cell_flags = 0;
|
||||
Vec4F32 cell_border_rgba = {0};
|
||||
Vec4F32 cell_bg_rgba = {0};
|
||||
if(global_byte_num == mouse_hover_byte_num)
|
||||
|
||||
// rjf: build space, if this cell is out-of-range
|
||||
if(global_byte_idx >= viz_range_bytes.max)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawSideTop|UI_BoxFlag_DrawSideBottom|UI_BoxFlag_DrawSideLeft|UI_BoxFlag_DrawSideRight;
|
||||
cell_border_rgba = rd_rgba_from_theme_color(RD_ThemeColor_Hover);
|
||||
ui_build_box_from_key(0, ui_key_zero());
|
||||
}
|
||||
if(annotation != 0)
|
||||
|
||||
// rjf: build actual cell
|
||||
else
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawBackground;
|
||||
cell_bg_rgba = annotation->color;
|
||||
if(contains_1u64(annotation->vaddr_range, mouse_hover_byte_num-1))
|
||||
// rjf: unpack byte info
|
||||
U8 byte_value = visible_memory[visible_byte_idx];
|
||||
Annotation *annotation = visible_memory_annotations[visible_byte_idx].first;
|
||||
|
||||
// rjf: unpack visual cell info
|
||||
UI_BoxFlags cell_flags = 0;
|
||||
Vec4F32 cell_border_rgba = {0};
|
||||
Vec4F32 cell_bg_rgba = {0};
|
||||
if(global_byte_num == mouse_hover_byte_num)
|
||||
{
|
||||
cell_bg_rgba.w *= 0.15f;
|
||||
cell_flags |= UI_BoxFlag_DrawBorder|UI_BoxFlag_DrawSideTop|UI_BoxFlag_DrawSideBottom|UI_BoxFlag_DrawSideLeft|UI_BoxFlag_DrawSideRight;
|
||||
cell_border_rgba = rd_rgba_from_theme_color(RD_ThemeColor_Hover);
|
||||
}
|
||||
else
|
||||
if(annotation != 0)
|
||||
{
|
||||
cell_bg_rgba.w *= 0.08f;
|
||||
}
|
||||
}
|
||||
if(selection.min <= global_byte_idx && global_byte_idx <= selection.max)
|
||||
{
|
||||
cell_flags |= UI_BoxFlag_DrawBackground;
|
||||
cell_bg_rgba = rd_rgba_from_theme_color(RD_ThemeColor_SelectionOverlay);
|
||||
}
|
||||
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = cell_bg_rgba));
|
||||
UI_Box *cell_box = ui_build_box_from_key(UI_BoxFlag_DrawText|cell_flags, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(cell_box, &byte_fancy_strings[byte_value]);
|
||||
{
|
||||
F32 off = 0;
|
||||
for(Annotation *a = annotation; a != 0; a = a->next)
|
||||
{
|
||||
if(global_byte_idx == a->vaddr_range.min) UI_Parent(row_overlay_box)
|
||||
cell_flags |= UI_BoxFlag_DrawBackground;
|
||||
cell_bg_rgba = annotation->color;
|
||||
if(contains_1u64(annotation->vaddr_range, mouse_hover_byte_num-1))
|
||||
{
|
||||
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = annotation->color));
|
||||
ui_set_next_fixed_x(big_glyph_advance*18.f + col_idx*cell_width_px + -cell_width_px/8.f + off);
|
||||
ui_set_next_fixed_y((row_idx-viz_range_rows.min)*row_height_px + -cell_width_px/8.f);
|
||||
ui_set_next_fixed_width(cell_width_px/4.f);
|
||||
ui_set_next_fixed_height(cell_width_px/4.f);
|
||||
ui_set_next_corner_radius_00(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_01(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_10(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_11(cell_width_px/8.f);
|
||||
ui_build_box_from_key(UI_BoxFlag_Floating|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawDropShadow, ui_key_zero());
|
||||
off += cell_width_px/8.f + cell_width_px/16.f;
|
||||
cell_bg_rgba.w *= 0.15f;
|
||||
}
|
||||
else
|
||||
{
|
||||
cell_bg_rgba.w *= 0.08f;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(annotation != 0 && mouse_hover_byte_num == global_byte_num) UI_Tooltip UI_FontSize(ui_top_font_size()) UI_PrefHeight(ui_px(ui_top_font_size()*1.75f, 1.f))
|
||||
{
|
||||
for(Annotation *a = annotation; a != 0; a = a->next)
|
||||
if(selection.min <= global_byte_idx && global_byte_idx <= selection.max)
|
||||
{
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(10, 1))
|
||||
cell_flags |= UI_BoxFlag_DrawBackground;
|
||||
cell_bg_rgba = rd_rgba_from_theme_color(RD_ThemeColor_SelectionOverlay);
|
||||
}
|
||||
|
||||
// rjf: build
|
||||
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = cell_bg_rgba));
|
||||
UI_Box *cell_box = ui_build_box_from_key(UI_BoxFlag_DrawText|cell_flags, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(cell_box, &byte_fancy_strings[byte_value]);
|
||||
{
|
||||
F32 off = 0;
|
||||
for(Annotation *a = annotation; a != 0; a = a->next)
|
||||
{
|
||||
RD_Font(RD_FontSlot_Code) ui_label(a->name_string);
|
||||
RD_Font(RD_FontSlot_Main) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(a->kind_string);
|
||||
if(global_byte_idx == a->vaddr_range.min) UI_Parent(row_overlay_box)
|
||||
{
|
||||
ui_set_next_palette(ui_build_palette(ui_top_palette(), .background = annotation->color));
|
||||
ui_set_next_fixed_x(big_glyph_advance*18.f + col_idx*cell_width_px + -cell_width_px/8.f + off);
|
||||
ui_set_next_fixed_y((row_idx-viz_range_rows.min)*row_height_px + -cell_width_px/8.f);
|
||||
ui_set_next_fixed_width(cell_width_px/4.f);
|
||||
ui_set_next_fixed_height(cell_width_px/4.f);
|
||||
ui_set_next_corner_radius_00(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_01(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_10(cell_width_px/8.f);
|
||||
ui_set_next_corner_radius_11(cell_width_px/8.f);
|
||||
ui_build_box_from_key(UI_BoxFlag_Floating|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawDropShadow, ui_key_zero());
|
||||
off += cell_width_px/8.f + cell_width_px/16.f;
|
||||
}
|
||||
}
|
||||
if(a->type_string.size != 0)
|
||||
}
|
||||
if(annotation != 0 && mouse_hover_byte_num == global_byte_num) UI_Tooltip UI_FontSize(ui_top_font_size()) UI_PrefHeight(ui_px(ui_top_font_size()*1.75f, 1.f))
|
||||
{
|
||||
for(Annotation *a = annotation; a != 0; a = a->next)
|
||||
{
|
||||
rd_code_label(1.f, 1, rd_rgba_from_theme_color(RD_ThemeColor_CodeType), a->type_string);
|
||||
}
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(str8_from_memory_size(scratch.arena, dim_1u64(a->vaddr_range)));
|
||||
if(a->next != 0)
|
||||
{
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(10, 1))
|
||||
{
|
||||
RD_Font(RD_FontSlot_Code) ui_label(a->name_string);
|
||||
RD_Font(RD_FontSlot_Main) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(a->kind_string);
|
||||
}
|
||||
if(a->type_string.size != 0)
|
||||
{
|
||||
rd_code_label(1.f, 1, rd_rgba_from_theme_color(RD_ThemeColor_CodeType), a->type_string);
|
||||
}
|
||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak) ui_label(str8_from_memory_size(scratch.arena, dim_1u64(a->vaddr_range)));
|
||||
if(a->next != 0)
|
||||
{
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7176,16 +7207,22 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
UI_WidthFill
|
||||
{
|
||||
MemoryZero(row_ascii_buffer, num_columns);
|
||||
U64 num_bytes_this_row = 0;
|
||||
for(U64 col_idx = 0; col_idx < num_columns; col_idx += 1)
|
||||
{
|
||||
U8 byte_value = visible_memory[(row_idx-viz_range_rows.min)*num_columns + col_idx];
|
||||
row_ascii_buffer[col_idx] = byte_value;
|
||||
if(byte_value <= 32 || 127 < byte_value)
|
||||
U64 visible_byte_idx = (row_idx-viz_range_rows.min)*num_columns + col_idx;
|
||||
if(visible_byte_idx < visible_memory_size)
|
||||
{
|
||||
row_ascii_buffer[col_idx] = '.';
|
||||
U8 byte_value = visible_memory[visible_byte_idx];
|
||||
row_ascii_buffer[col_idx] = byte_value;
|
||||
if(byte_value <= 32 || 127 < byte_value)
|
||||
{
|
||||
row_ascii_buffer[col_idx] = '.';
|
||||
}
|
||||
num_bytes_this_row += 1;
|
||||
}
|
||||
}
|
||||
String8 ascii_text = str8(row_ascii_buffer, num_columns);
|
||||
String8 ascii_text = str8(row_ascii_buffer, num_bytes_this_row);
|
||||
UI_Box *ascii_box = ui_build_box_from_stringf(UI_BoxFlag_DrawText, "%S###ascii_row_%I64x", ascii_text, row_range_bytes.min);
|
||||
if(selection.max >= row_range_bytes.min && selection.min < row_range_bytes.max)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user