mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-06 05:48:40 +00:00
more work on universal rich hover / ctx menu systems
This commit is contained in:
+63
-14
@@ -3300,7 +3300,7 @@ rd_window_frame(RD_Window *ws)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
//- rjf: rich hover tooltips
|
//- rjf: rich hover, drag/drop tooltips
|
||||||
//
|
//
|
||||||
if(rd_state->hover_regs_slot != RD_RegSlot_Null ||
|
if(rd_state->hover_regs_slot != RD_RegSlot_Null ||
|
||||||
(rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active()))
|
(rd_state->drag_drop_regs_slot != RD_RegSlot_Null && rd_drag_is_active()))
|
||||||
@@ -3308,20 +3308,26 @@ rd_window_frame(RD_Window *ws)
|
|||||||
Temp scratch = scratch_begin(0, 0);
|
Temp scratch = scratch_begin(0, 0);
|
||||||
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_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));
|
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)
|
UI_Tooltip RD_Palette(RD_PaletteCode_Floating) switch(slot)
|
||||||
{
|
{
|
||||||
default:{}break;
|
default:{}break;
|
||||||
|
|
||||||
//- rjf: thread tooltips
|
////////////////////////
|
||||||
case RD_RegSlot_Thread:
|
//- rjf: control entity tooltips
|
||||||
|
//
|
||||||
|
case RD_RegSlot_Machine: {ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->machine); }goto ctrl_entity_tooltip;
|
||||||
|
case RD_RegSlot_Process: {ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->process); }goto ctrl_entity_tooltip;
|
||||||
|
case RD_RegSlot_Module: {ctrl_entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->module); }goto ctrl_entity_tooltip;
|
||||||
|
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:;
|
||||||
{
|
{
|
||||||
// rjf: unpack
|
// rjf: unpack
|
||||||
DI_Scope *di_scope = di_scope_open();
|
DI_Scope *di_scope = di_scope_open();
|
||||||
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, regs->thread);
|
Arch arch = ctrl_entity->arch;
|
||||||
U64 rip_vaddr = d_query_cached_rip_from_thread(thread);
|
|
||||||
Arch arch = thread->arch;
|
|
||||||
String8 arch_str = string_from_arch(arch);
|
String8 arch_str = string_from_arch(arch);
|
||||||
DR_FancyStringList fstrs = rd_title_fstrs_from_ctrl_entity(scratch.arena, thread,
|
DR_FancyStringList fstrs = rd_title_fstrs_from_ctrl_entity(scratch.arena, ctrl_entity,
|
||||||
rd_rgba_from_theme_color(RD_ThemeColor_TextWeak),
|
rd_rgba_from_theme_color(RD_ThemeColor_TextWeak),
|
||||||
ui_top_font_size(), 0);
|
ui_top_font_size(), 0);
|
||||||
|
|
||||||
@@ -3339,22 +3345,44 @@ rd_window_frame(RD_Window *ws)
|
|||||||
{
|
{
|
||||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak|UI_BoxFlag_DrawBorder) ui_label(arch_str);
|
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak|UI_BoxFlag_DrawBorder) ui_label(arch_str);
|
||||||
ui_spacer(ui_em(0.5f, 1.f));
|
ui_spacer(ui_em(0.5f, 1.f));
|
||||||
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak|UI_BoxFlag_DrawBorder) ui_labelf("TID: %i", (U32)thread->id);
|
if(ctrl_entity->kind == CTRL_EntityKind_Thread ||
|
||||||
|
ctrl_entity->kind == CTRL_EntityKind_Process)
|
||||||
|
{
|
||||||
|
UI_FlagsAdd(UI_BoxFlag_DrawTextWeak|UI_BoxFlag_DrawBorder) ui_labelf("ID: %i", (U32)ctrl_entity->id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ui_spacer(ui_em(1.5f, 1.f));
|
// rjf: debug info status
|
||||||
|
if(ctrl_entity->kind == CTRL_EntityKind_Module) UI_FlagsAdd(UI_BoxFlag_DrawTextWeak)
|
||||||
|
{
|
||||||
|
DI_Scope *di_scope = di_scope_open();
|
||||||
|
DI_Key dbgi_key = ctrl_dbgi_key_from_module(ctrl_entity);
|
||||||
|
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 0);
|
||||||
|
if(rdi->raw_data_size != 0)
|
||||||
|
{
|
||||||
|
ui_labelf("Symbols successfully loaded from %S", dbgi_key.path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui_labelf("Symbols not found at %S", dbgi_key.path);
|
||||||
|
}
|
||||||
|
di_scope_close(di_scope);
|
||||||
|
}
|
||||||
|
|
||||||
// rjf: unwind
|
// rjf: unwind
|
||||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
if(ctrl_entity->kind == CTRL_EntityKind_Thread)
|
||||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(thread);
|
{
|
||||||
|
ui_spacer(ui_em(1.5f, 1.f));
|
||||||
|
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(ctrl_entity, CTRL_EntityKind_Process);
|
||||||
|
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(ctrl_entity);
|
||||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||||
for(U64 idx = 0; idx < rich_unwind.frames.concrete_frame_count; idx += 1)
|
for(U64 idx = 0; idx < rich_unwind.frames.concrete_frame_count; idx += 1)
|
||||||
{
|
{
|
||||||
D_UnwindFrame *f = &rich_unwind.frames.v[idx];
|
D_UnwindFrame *f = &rich_unwind.frames.v[idx];
|
||||||
RDI_Parsed *rdi = f->rdi;
|
RDI_Parsed *rdi = f->rdi;
|
||||||
RDI_Procedure *procedure = f->procedure;
|
RDI_Procedure *procedure = f->procedure;
|
||||||
U64 rip_vaddr = regs_rip_from_arch_block(thread->arch, f->regs);
|
U64 rip_vaddr = regs_rip_from_arch_block(arch, f->regs);
|
||||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
|
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
|
||||||
String8 module_name = module == &ctrl_entity_nil ? str8_lit("???") : str8_skip_last_slash(module->string);
|
String8 module_name = module == &ctrl_entity_nil ? str8_lit("???") : str8_skip_last_slash(module->string);
|
||||||
|
|
||||||
@@ -3398,6 +3426,7 @@ rd_window_frame(RD_Window *ws)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
di_scope_close(di_scope);
|
di_scope_close(di_scope);
|
||||||
}break;
|
}break;
|
||||||
@@ -3502,13 +3531,33 @@ rd_window_frame(RD_Window *ws)
|
|||||||
|
|
||||||
ui_divider(ui_em(1.f, 1.f));
|
ui_divider(ui_em(1.f, 1.f));
|
||||||
|
|
||||||
//- rjf: draw current interaction regs
|
//- rjf: draw registers
|
||||||
|
ui_labelf("hover_reg_slot: %i", rd_state->hover_regs_slot);
|
||||||
|
struct
|
||||||
{
|
{
|
||||||
RD_Regs *regs = rd_regs();
|
String8 name;
|
||||||
|
RD_Regs *regs;
|
||||||
|
}
|
||||||
|
regs_info[] =
|
||||||
|
{
|
||||||
|
{str8_lit("regs"), rd_regs()},
|
||||||
|
{str8_lit("hover_regs"), rd_state->hover_regs},
|
||||||
|
};
|
||||||
|
for EachElement(idx, regs_info)
|
||||||
|
{
|
||||||
|
ui_divider(ui_em(1.f, 1.f));
|
||||||
|
ui_label(regs_info[idx].name);
|
||||||
|
RD_Regs *regs = regs_info[idx].regs;
|
||||||
#define Handle(name) ui_labelf("%s: [0x%I64x, 0x%I64x]", #name, (regs->name).u64[0], (regs->name).u64[1])
|
#define Handle(name) ui_labelf("%s: [0x%I64x, 0x%I64x]", #name, (regs->name).u64[0], (regs->name).u64[1])
|
||||||
Handle(window);
|
Handle(window);
|
||||||
Handle(panel);
|
Handle(panel);
|
||||||
Handle(view);
|
Handle(view);
|
||||||
|
#undef Handle
|
||||||
|
#define Handle(name) ui_labelf("%s: [0x%I64x, 0x%I64x]", #name, (regs->name).machine_id, (regs->name).dmn_handle.u64[0])
|
||||||
|
Handle(machine);
|
||||||
|
Handle(process);
|
||||||
|
Handle(module);
|
||||||
|
Handle(thread);
|
||||||
#undef Handle
|
#undef Handle
|
||||||
ui_labelf("file_path: \"%S\"", regs->file_path);
|
ui_labelf("file_path: \"%S\"", regs->file_path);
|
||||||
ui_labelf("cursor: (L:%I64d, C:%I64d)", regs->cursor.line, regs->cursor.column);
|
ui_labelf("cursor: (L:%I64d, C:%I64d)", regs->cursor.line, regs->cursor.column);
|
||||||
|
|||||||
@@ -2471,14 +2471,14 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
|||||||
(ctrl_handle_match(rd_state->hover_regs->process, ctrl_entity->handle) && rd_state->hover_regs_slot == RD_RegSlot_Process));
|
(ctrl_handle_match(rd_state->hover_regs->process, ctrl_entity->handle) && rd_state->hover_regs_slot == RD_RegSlot_Process));
|
||||||
|
|
||||||
//- rjf: pick palette
|
//- rjf: pick palette
|
||||||
UI_Palette *palette = ui_top_palette();
|
UI_Palette *palette = ui_build_palette(ui_top_palette());
|
||||||
if(entity->kind == RD_EntityKind_Target && !entity->disabled)
|
if(entity->kind == RD_EntityKind_Target && !entity->disabled)
|
||||||
{
|
{
|
||||||
palette = rd_palette_from_code(RD_PaletteCode_NeutralPopButton);
|
palette = ui_build_palette(rd_palette_from_code(RD_PaletteCode_NeutralPopButton));
|
||||||
}
|
}
|
||||||
if(ctrl_entity->kind == CTRL_EntityKind_Thread && ctrl_handle_match(ctrl_entity->handle, rd_regs()->thread))
|
if(ctrl_entity->kind == CTRL_EntityKind_Thread && ctrl_handle_match(ctrl_entity->handle, rd_regs()->thread))
|
||||||
{
|
{
|
||||||
palette = rd_palette_from_code(RD_PaletteCode_NeutralPopButton);
|
palette = ui_build_palette(rd_palette_from_code(RD_PaletteCode_NeutralPopButton));
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: build add-new buttons
|
//- rjf: build add-new buttons
|
||||||
@@ -2505,7 +2505,8 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
|||||||
{
|
{
|
||||||
fstrs = rd_title_fstrs_from_ctrl_entity(scratch.arena, ctrl_entity, ui_top_palette()->text_weak, ui_top_font_size(), 1);
|
fstrs = rd_title_fstrs_from_ctrl_entity(scratch.arena, ctrl_entity, ui_top_palette()->text_weak, ui_top_font_size(), 1);
|
||||||
}
|
}
|
||||||
F32 hover_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "###entity_hover_t_%p_%p", entity, ctrl_entity), (F32)!!is_hovering, .rate = entity_hover_t_rate);
|
UI_Key hover_t_key = ui_key_from_stringf(ui_key_zero(), "entity_hover_t_%p_%p", entity, ctrl_entity);
|
||||||
|
F32 hover_t = ui_anim(hover_t_key, (F32)!!is_hovering, .rate = entity_hover_t_rate);
|
||||||
if(!rd_entity_is_nil(entity))
|
if(!rd_entity_is_nil(entity))
|
||||||
{
|
{
|
||||||
palette->overlay = rd_rgba_from_entity(entity);
|
palette->overlay = rd_rgba_from_entity(entity);
|
||||||
@@ -2535,9 +2536,10 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
|||||||
RD_RegSlot slot = RD_RegSlot_Entity;
|
RD_RegSlot slot = RD_RegSlot_Entity;
|
||||||
switch(ctrl_entity->kind)
|
switch(ctrl_entity->kind)
|
||||||
{
|
{
|
||||||
case CTRL_EntityKind_Thread:{slot = RD_RegSlot_Thread; rd_regs()->thread = ctrl_entity->handle;}break;
|
default:{}break;
|
||||||
|
case CTRL_EntityKind_Thread: {slot = RD_RegSlot_Thread; rd_regs()->thread = ctrl_entity->handle;}break;
|
||||||
case CTRL_EntityKind_Process:{slot = RD_RegSlot_Process; rd_regs()->process = ctrl_entity->handle;}break;
|
case CTRL_EntityKind_Process:{slot = RD_RegSlot_Process; rd_regs()->process = ctrl_entity->handle;}break;
|
||||||
case CTRL_EntityKind_Module:{slot = RD_RegSlot_Module; rd_regs()->module = ctrl_entity->handle;}break;
|
case CTRL_EntityKind_Module: {slot = RD_RegSlot_Module; rd_regs()->module = ctrl_entity->handle;}break;
|
||||||
}
|
}
|
||||||
UI_PrefWidth(ui_em(2.f, 1.f)) if(ui_pressed(ui_expander(row_expanded, str8_lit("###expanded"))))
|
UI_PrefWidth(ui_em(2.f, 1.f)) if(ui_pressed(ui_expander(row_expanded, str8_lit("###expanded"))))
|
||||||
{
|
{
|
||||||
@@ -2550,6 +2552,10 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
|||||||
{
|
{
|
||||||
rd_set_hover_regs(slot);
|
rd_set_hover_regs(slot);
|
||||||
}
|
}
|
||||||
|
if(ui_right_clicked(sig))
|
||||||
|
{
|
||||||
|
rd_open_ctx_menu(entity_box->key, v2f32(0, dim_2f32(entity_box->rect).y), slot);
|
||||||
|
}
|
||||||
if(ui_dragging(sig) && !contains_2f32(sig.box->rect, ui_mouse()))
|
if(ui_dragging(sig) && !contains_2f32(sig.box->rect, ui_mouse()))
|
||||||
{
|
{
|
||||||
rd_drag_begin(slot);
|
rd_drag_begin(slot);
|
||||||
|
|||||||
Reference in New Issue
Block a user