mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-02 12:08:11 +00:00
data member offset sorting -> take into account base offset, when doing inheritance graph search; visualize inheritance chain for inherited members; use contextual base color in code labels, do not assume default code color implicitly
This commit is contained in:
@@ -818,6 +818,7 @@ struct DF_EvalVizRow
|
||||
String8 expr;
|
||||
String8 display_value;
|
||||
String8 edit_value;
|
||||
TG_KeyList inherited_type_key_chain;
|
||||
|
||||
// rjf: variable-size & hook info
|
||||
U64 size_in_rows;
|
||||
|
||||
+25
-13
@@ -4172,7 +4172,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
}
|
||||
UI_PrefWidth(ui_em(30.f, 1.f))
|
||||
{
|
||||
UI_PrefWidth(ui_text_dim(10, 1.f)) df_code_label(1.f, 1, row->expr);
|
||||
UI_PrefWidth(ui_text_dim(10, 1.f)) df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), row->expr);
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
if(row->flags & DF_EvalVizRowFlag_CanEditValue)
|
||||
{
|
||||
@@ -4197,7 +4197,7 @@ df_window_update_and_render(Arena *arena, OS_EventList *events, DF_Window *ws, D
|
||||
}
|
||||
else
|
||||
{
|
||||
df_code_label(1.f, 1, row->display_value);
|
||||
df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), row->display_value);
|
||||
}
|
||||
}
|
||||
ui_spacer(ui_em(0.75f, 1.f));
|
||||
@@ -7207,6 +7207,7 @@ df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DBGI_Scope *scop
|
||||
row->expr = push_str8_copy(arena, member->name);
|
||||
row->display_value = str8_list_join(arena, &display_strings, 0);
|
||||
row->edit_value = str8_list_join(arena, &edit_strings, 0);
|
||||
row->inherited_type_key_chain = tg_key_list_copy(arena, &member->inheritance_key_chain);
|
||||
row->value_ui_rule_node = value_ui_rule_node;
|
||||
row->value_ui_rule_spec = value_ui_rule_spec;
|
||||
row->expand_ui_rule_node = expand_ui_rule_node;
|
||||
@@ -8646,14 +8647,14 @@ df_entity_tooltips(DF_Entity *entity)
|
||||
stop_condition = str8_lit("true");
|
||||
}
|
||||
UI_PrefWidth(ui_em(12.f, 1.f)) UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) ui_labelf("Stop Condition: ");
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1, stop_condition);
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), stop_condition);
|
||||
}
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row
|
||||
{
|
||||
U64 hit_count = entity->u64;
|
||||
String8 hit_count_text = str8_from_u64(scratch.arena, hit_count, 10, 0, 0);
|
||||
UI_PrefWidth(ui_em(12.f, 1.f)) UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) ui_labelf("Hit Count: ");
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1, hit_count_text);
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), hit_count_text);
|
||||
}
|
||||
}break;
|
||||
case DF_EntityKind_WatchPin: UI_Font(df_font_from_slot(DF_FontSlot_Code))
|
||||
@@ -8664,7 +8665,7 @@ df_entity_tooltips(DF_Entity *entity)
|
||||
ui_set_next_text_color(color);
|
||||
}
|
||||
String8 display_string = df_display_string_from_entity(scratch.arena, entity);
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) df_code_label(1.f, 1, display_string);
|
||||
UI_PrefWidth(ui_text_dim(10, 1)) df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), display_string);
|
||||
}break;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
@@ -9554,8 +9555,8 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
ws->entity_ctx_menu_entity = df_handle_from_entity(pin);
|
||||
}
|
||||
}
|
||||
df_code_label(0.8f, 1, pin_expr);
|
||||
df_code_label(0.6f, 1, eval_string);
|
||||
df_code_label(0.8f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), pin_expr);
|
||||
df_code_label(0.6f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), eval_string);
|
||||
}
|
||||
UI_Signal pin_sig = ui_signal_from_box(pin_box);
|
||||
if(ui_key_match(pin_box_key, ui_hot_key()))
|
||||
@@ -10466,7 +10467,7 @@ df_help_label(String8 string)
|
||||
}
|
||||
|
||||
internal D_FancyStringList
|
||||
df_fancy_string_list_from_code_string(Arena *arena, F32 alpha, B32 indirection_size_change, String8 string)
|
||||
df_fancy_string_list_from_code_string(Arena *arena, F32 alpha, B32 indirection_size_change, Vec4F32 base_color, String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
D_FancyStringList fancy_strings = {0};
|
||||
@@ -10495,6 +10496,17 @@ df_fancy_string_list_from_code_string(Arena *arena, F32 alpha, B32 indirection_s
|
||||
};
|
||||
d_fancy_string_list_push(arena, &fancy_strings, &fancy_string);
|
||||
}break;
|
||||
case TXTI_TokenKind_Identifier:
|
||||
{
|
||||
D_FancyString fancy_string =
|
||||
{
|
||||
ui_top_font(),
|
||||
token_string,
|
||||
base_color,
|
||||
ui_top_font_size() * (1.f - !!indirection_size_change*(indirection_counter/10.f)),
|
||||
};
|
||||
d_fancy_string_list_push(arena, &fancy_strings, &fancy_string);
|
||||
}break;
|
||||
case TXTI_TokenKind_Numeric:
|
||||
{
|
||||
Vec4F32 token_color_rgba_alt = token_color_rgba;
|
||||
@@ -10606,10 +10618,10 @@ df_fancy_string_list_from_code_string(Arena *arena, F32 alpha, B32 indirection_s
|
||||
}
|
||||
|
||||
internal void
|
||||
df_code_label(F32 alpha, B32 indirection_size_change, String8 string)
|
||||
df_code_label(F32 alpha, B32 indirection_size_change, Vec4F32 base_color, String8 string)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
D_FancyStringList fancy_strings = df_fancy_string_list_from_code_string(scratch.arena, alpha, indirection_size_change, string);
|
||||
D_FancyStringList fancy_strings = df_fancy_string_list_from_code_string(scratch.arena, alpha, indirection_size_change, base_color, string);
|
||||
UI_Box *box = ui_build_box_from_key(UI_BoxFlag_DrawText, ui_key_zero());
|
||||
ui_box_equip_display_fancy_strings(box, &fancy_strings);
|
||||
scratch_end(scratch);
|
||||
@@ -10815,11 +10827,11 @@ df_line_edit(DF_LineEditFlags flags, S32 depth, TxtPt *cursor, TxtPt *mark, U8 *
|
||||
if(!(flags & DF_LineEditFlag_PreferDisplayString) && pre_edit_value.size != 0)
|
||||
{
|
||||
display_string = pre_edit_value;
|
||||
df_code_label(1.f, 1, display_string);
|
||||
df_code_label(1.f, 1, ui_top_text_color(), display_string);
|
||||
}
|
||||
else if(flags & DF_LineEditFlag_DisplayStringIsCode)
|
||||
{
|
||||
df_code_label(1.f, 1, display_string);
|
||||
df_code_label(1.f, 1, ui_top_text_color(), display_string);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -10848,7 +10860,7 @@ df_line_edit(DF_LineEditFlags flags, S32 depth, TxtPt *cursor, TxtPt *mark, U8 *
|
||||
F32 total_editstr_width = total_text_width - !!(flags & (DF_LineEditFlag_Expander|DF_LineEditFlag_ExpanderSpace|DF_LineEditFlag_ExpanderPlaceholder)) * expander_size_px;
|
||||
ui_set_next_pref_width(ui_px(total_editstr_width+ui_top_font_size()*2, 0.f));
|
||||
UI_Box *editstr_box = ui_build_box_from_stringf(UI_BoxFlag_DrawText|UI_BoxFlag_DisableTextTrunc, "###editstr");
|
||||
D_FancyStringList code_fancy_strings = df_fancy_string_list_from_code_string(scratch.arena, 1.f, 0, edit_string);
|
||||
D_FancyStringList code_fancy_strings = df_fancy_string_list_from_code_string(scratch.arena, 1.f, 0, ui_top_text_color(), edit_string);
|
||||
ui_box_equip_display_fancy_strings(editstr_box, &code_fancy_strings);
|
||||
UI_LineEditDrawData *draw_data = push_array(ui_build_arena(), UI_LineEditDrawData, 1);
|
||||
draw_data->edited_string = push_str8_copy(ui_build_arena(), edit_string);
|
||||
|
||||
+2
-2
@@ -1031,8 +1031,8 @@ internal B32 df_do_dasm_controls(DASM_Handle handle, U64 line_count_per_page, Tx
|
||||
|
||||
internal UI_Signal df_error_label(String8 string);
|
||||
internal B32 df_help_label(String8 string);
|
||||
internal D_FancyStringList df_fancy_string_list_from_code_string(Arena *arena, F32 alpha, B32 indirection_size_change, String8 string);
|
||||
internal void df_code_label(F32 alpha, B32 indirection_size_change, String8 string);
|
||||
internal D_FancyStringList df_fancy_string_list_from_code_string(Arena *arena, F32 alpha, B32 indirection_size_change, Vec4F32 base_color, String8 string);
|
||||
internal void df_code_label(F32 alpha, B32 indirection_size_change, Vec4F32 base_color, String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: UI Widgets: Line Edit
|
||||
|
||||
+44
-17
@@ -1051,22 +1051,49 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
|
||||
// rjf: build
|
||||
UI_Signal sig = {0};
|
||||
B32 next_expanded = row_expanded;
|
||||
UI_TableCell UI_Font(code_font)
|
||||
UI_TextColor(row->depth > 0 ? df_rgba_from_theme_color(DF_ThemeColor_WeakText) : ui_top_text_color())
|
||||
UI_FocusHot(cell_selected) UI_FocusActive(cell_selected && ewv->input_editing)
|
||||
UI_TableCell UI_FocusHot(cell_selected) UI_FocusActive(cell_selected && ewv->input_editing)
|
||||
{
|
||||
B32 expr_editing_active = ui_is_focus_active();
|
||||
sig = df_line_editf((DF_LineEditFlag_CodeContents|
|
||||
DF_LineEditFlag_NoBackground|
|
||||
DF_LineEditFlag_DisableEdit*(!can_edit_expr)|
|
||||
DF_LineEditFlag_Expander*!!(row->flags & DF_EvalVizRowFlag_CanExpand)|
|
||||
DF_LineEditFlag_ExpanderPlaceholder*(row->depth==0)|
|
||||
DF_LineEditFlag_ExpanderSpace*(row->depth!=0)),
|
||||
row->depth,
|
||||
&ewv->input_cursor, &ewv->input_mark, ewv->input_buffer, sizeof(ewv->input_buffer), &ewv->input_size, &next_expanded,
|
||||
row->expr,
|
||||
"###row_%I64x", row_hash);
|
||||
B32 is_inherited = (row->inherited_type_key_chain.count != 0);
|
||||
UI_Font(code_font) UI_TextColor(row->depth > 0 ? df_rgba_from_theme_color(DF_ThemeColor_WeakText) : ui_top_text_color())
|
||||
{
|
||||
if(is_inherited)
|
||||
{
|
||||
Vec4F32 inherited_bg_color = df_rgba_from_theme_color(DF_ThemeColor_Highlight1);
|
||||
inherited_bg_color.w *= 0.2f;
|
||||
ui_set_next_background_color(inherited_bg_color);
|
||||
}
|
||||
sig = df_line_editf((DF_LineEditFlag_CodeContents|
|
||||
DF_LineEditFlag_NoBackground*(!is_inherited)|
|
||||
DF_LineEditFlag_DisableEdit*(!can_edit_expr)|
|
||||
DF_LineEditFlag_Expander*!!(row->flags & DF_EvalVizRowFlag_CanExpand)|
|
||||
DF_LineEditFlag_ExpanderPlaceholder*(row->depth==0)|
|
||||
DF_LineEditFlag_ExpanderSpace*(row->depth!=0)),
|
||||
row->depth,
|
||||
&ewv->input_cursor, &ewv->input_mark, ewv->input_buffer, sizeof(ewv->input_buffer), &ewv->input_size, &next_expanded,
|
||||
row->expr,
|
||||
"###row_%I64x", row_hash);
|
||||
}
|
||||
edit_commit = edit_commit || sig.commit;
|
||||
if(sig.hovering && is_inherited) UI_Tooltip
|
||||
{
|
||||
String8List inheritance_chain_type_names = {0};
|
||||
for(TG_KeyNode *n = row->inherited_type_key_chain.first; n != 0; n = n->next)
|
||||
{
|
||||
String8 inherited_type_name = tg_string_from_key(scratch.arena, parse_ctx.type_graph, parse_ctx.rdbg, n->v);
|
||||
inherited_type_name = str8_skip_chop_whitespace(inherited_type_name);
|
||||
str8_list_push(scratch.arena, &inheritance_chain_type_names, inherited_type_name);
|
||||
}
|
||||
StringJoin join = {0};
|
||||
join.sep = str8_lit("::");
|
||||
String8 inheritance_type = str8_list_join(scratch.arena, &inheritance_chain_type_names, &join);
|
||||
ui_set_next_pref_width(ui_children_sum(1));
|
||||
UI_Row
|
||||
{
|
||||
ui_labelf("Inherited from ");
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1.f, df_rgba_from_theme_color(DF_ThemeColor_CodeType), inheritance_type);
|
||||
}
|
||||
}
|
||||
if(sig.hovering && DEV_eval_watch_key_tooltips) UI_Tooltip UI_Font(df_font_from_slot(DF_FontSlot_Code))
|
||||
{
|
||||
ui_labelf("Parent Key: %I64x, %I64x, %I64x", row->parent_key.uniquifier, row->parent_key.parent_hash, row->parent_key.child_num);
|
||||
@@ -1217,7 +1244,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
|
||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###val_%I64x", row_hash);
|
||||
UI_Parent(box)
|
||||
{
|
||||
df_code_label(1.f, 1, row->display_value);
|
||||
df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), row->display_value);
|
||||
}
|
||||
sig = ui_signal_from_box(box);
|
||||
}
|
||||
@@ -1261,7 +1288,7 @@ df_eval_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_EvalW
|
||||
UI_Box *box = ui_build_box_from_stringf(UI_BoxFlag_Clip|UI_BoxFlag_Clickable, "###type_%I64x", row_hash);
|
||||
if(!tg_key_match(key, tg_key_zero())) UI_Parent(box)
|
||||
{
|
||||
df_code_label(1.f, 1, string);
|
||||
df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeType), string);
|
||||
}
|
||||
UI_Signal sig = ui_signal_from_box(box);
|
||||
if(sig.pressed)
|
||||
@@ -7928,7 +7955,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
}
|
||||
if(a->type_string.size != 0)
|
||||
{
|
||||
df_code_label(1.f, 1, a->type_string);
|
||||
df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeType), a->type_string);
|
||||
}
|
||||
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) ui_label(str8_from_memory_size(scratch.arena, dim_1u64(a->vaddr_range)));
|
||||
if(a->next != 0)
|
||||
@@ -8197,7 +8224,7 @@ DF_VIEW_UI_FUNCTION_DEF(Breakpoints)
|
||||
UI_Parent(box)
|
||||
{
|
||||
String8 hit_count_string = str8_from_u64(scratch.arena, entity->u64, 10, 0, 0);
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1, hit_count_string);
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code)) df_code_label(1.f, 1, df_rgba_from_theme_color(DF_ThemeColor_CodeDefault), hit_count_string);
|
||||
}
|
||||
UI_Signal sig = ui_signal_from_box(box);
|
||||
if(sig.pressed)
|
||||
|
||||
Reference in New Issue
Block a user