mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
sketch out thread color events & client-driven thread color state, plug thread colors back into ui
This commit is contained in:
@@ -562,6 +562,7 @@ ctrl_serialized_string_from_event(Arena *arena, CTRL_Event *event, U64 max)
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->stack_base);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->tls_root);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->timestamp);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->rgba);
|
||||
str8_serial_push_struct(scratch.arena, &srl, &event->exception_code);
|
||||
String8 string = event->string;
|
||||
string.size = Min(string.size, max-srl.total_size);
|
||||
@@ -594,6 +595,7 @@ ctrl_event_from_serialized_string(Arena *arena, String8 string)
|
||||
read_off += str8_deserial_read_struct(string, read_off, &event.tls_root);
|
||||
read_off += str8_deserial_read_struct(string, read_off, &event.timestamp);
|
||||
read_off += str8_deserial_read_struct(string, read_off, &event.exception_code);
|
||||
read_off += str8_deserial_read_struct(string, read_off, &event.rgba);
|
||||
read_off += str8_deserial_read_struct(string, read_off, &event.string.size);
|
||||
event.string.str = push_array_no_zero(arena, U8, event.string.size);
|
||||
read_off += str8_deserial_read(string, read_off, event.string.str, event.string.size, 1);
|
||||
@@ -1156,6 +1158,11 @@ ctrl_entity_store_apply_events(CTRL_EntityStore *store, CTRL_EventList *list)
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(store, event->entity);
|
||||
ctrl_entity_equip_string(store, thread, event->string);
|
||||
}break;
|
||||
case CTRL_EventKind_ThreadColor:
|
||||
{
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(store, event->entity);
|
||||
thread->rgba = event->rgba;
|
||||
}break;
|
||||
case CTRL_EventKind_ThreadFrozen:
|
||||
{
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(store, event->entity);
|
||||
|
||||
@@ -404,9 +404,10 @@ typedef enum CTRL_EventKind
|
||||
//- rjf: debug info changes
|
||||
CTRL_EventKind_ModuleDebugInfoPathChange,
|
||||
|
||||
//- rjf: debug strings
|
||||
//- rjf: debug strings / decorations
|
||||
CTRL_EventKind_DebugString,
|
||||
CTRL_EventKind_ThreadName,
|
||||
CTRL_EventKind_ThreadColor,
|
||||
|
||||
//- rjf: memory
|
||||
CTRL_EventKind_MemReserve,
|
||||
@@ -461,6 +462,7 @@ struct CTRL_Event
|
||||
U64 tls_root;
|
||||
U64 timestamp;
|
||||
U32 exception_code;
|
||||
U32 rgba;
|
||||
String8 string;
|
||||
};
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: Built-In Command Tables
|
||||
|
||||
@table(name ui_vis ipc_docs_vis q_slot q_view q_ent_kind q_allow_files q_allow_folders q_keep_oi q_select_oi q_is_code q_required canonical_icon string display_name desc search_tags )
|
||||
// / | | | \___ ____________________________________/ | | | | |
|
||||
// / | | | \ / | | | | |
|
||||
D_CmdTable: // | | | | | | | | | |
|
||||
@table(name ui_vis ipc_docs_vis q_slot q_view q_ent_kind q_allow_files q_allow_folders q_keep_oi q_select_oi q_is_code q_required canonical_icon string display_name desc search_tags )
|
||||
// / | | | \___ ____________________________________/ | | | | |
|
||||
// / | | | \ / | | | | |
|
||||
D_CmdTable: // | | | | | | | | | |
|
||||
{
|
||||
//- rjf: low-level target control operations
|
||||
{LaunchAndRun 1 1 EntityList null Target 0 0 0 0 0 1 Play "launch_and_run" "Launch and Run" "Starts debugging a new instance of a target, then runs." "launch,start,run,target" }
|
||||
@@ -45,6 +45,9 @@ D_CmdTable: // | | | |
|
||||
{FreezeEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "freeze_entity" "Freeze Entity" "Freezes an entity." "" }
|
||||
{ThawEntity 0 0 Null null Nil 0 0 0 0 0 0 Null "thaw_entity" "Thaw Entity" "Thaws an entity." "" }
|
||||
|
||||
//- rjf: entity decoration
|
||||
{SetEntityColor 0 0 Null null Nil 0 0 0 0 0 0 Null "set_thread_color" "Set Thread Color" "Sets the passed entity's color." "" }
|
||||
|
||||
//- rjf: attaching
|
||||
{Attach 1 1 PID null Nil 0 0 0 0 0 1 Null "attach" "Attach" "Attaches to a process that is already running on the local machine." "" }
|
||||
}
|
||||
|
||||
@@ -2447,6 +2447,13 @@ d_tick(Arena *arena, D_TargetArray *targets, D_BreakpointArray *breakpoints, D_P
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: entity decoration
|
||||
case D_CmdKind_SetEntityColor:
|
||||
{
|
||||
CTRL_Entity *entity = ctrl_entity_from_handle(d_state->ctrl_entity_store, params->entity);
|
||||
entity->rgba = params->rgba;
|
||||
}break;
|
||||
|
||||
//- rjf: attaching
|
||||
case D_CmdKind_Attach:
|
||||
{
|
||||
|
||||
@@ -238,6 +238,7 @@ struct D_CmdParams
|
||||
U64 vaddr;
|
||||
B32 prefer_disasm;
|
||||
U32 pid;
|
||||
U32 rgba;
|
||||
D_TargetArray targets;
|
||||
};
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ D_CmdKind_FreezeLocalMachine,
|
||||
D_CmdKind_ThawLocalMachine,
|
||||
D_CmdKind_FreezeEntity,
|
||||
D_CmdKind_ThawEntity,
|
||||
D_CmdKind_SetEntityColor,
|
||||
D_CmdKind_Attach,
|
||||
D_CmdKind_COUNT,
|
||||
} D_CmdKind;
|
||||
|
||||
@@ -242,7 +242,7 @@ Rng1U64 rd_reg_slot_range_table[32] =
|
||||
{OffsetOf(RD_Regs, os_event), OffsetOf(RD_Regs, os_event) + sizeof(OS_Event *)},
|
||||
};
|
||||
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[217] =
|
||||
RD_CmdKindInfo rd_cmd_kind_info_table[218] =
|
||||
{
|
||||
{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}},
|
||||
@@ -275,6 +275,7 @@ RD_CmdKindInfo rd_cmd_kind_info_table[217] =
|
||||
{ str8_lit_comp("thaw_local_machine"), str8_lit_comp("Thaws the local machine."), str8_lit_comp(""), str8_lit_comp("Thaw Local Machine"), RD_IconKind_Machine, (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("freeze_entity"), str8_lit_comp("Freezes an entity."), str8_lit_comp(""), str8_lit_comp("Freeze 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("thaw_entity"), str8_lit_comp("Thaws an entity."), str8_lit_comp(""), str8_lit_comp("Thaw 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("set_thread_color"), str8_lit_comp("Sets the passed entity's color."), str8_lit_comp(""), str8_lit_comp("Set Thread Color"), 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("attach"), str8_lit_comp("Attaches to a process that is already running on the local machine."), str8_lit_comp(""), str8_lit_comp("Attach"), RD_IconKind_Null, (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_PID, str8_lit_comp(""), RD_EntityKind_Nil}},
|
||||
{ str8_lit_comp("exit"), str8_lit_comp("Exits the debugger."), str8_lit_comp("quit,close,abort"), str8_lit_comp("Exit"), RD_IconKind_X, (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("run_command"), str8_lit_comp("Runs a command from the command palette."), str8_lit_comp("help,cmd"), str8_lit_comp("Run Command"), RD_IconKind_Null, (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_String, str8_lit_comp("commands"), RD_EntityKind_Nil}},
|
||||
|
||||
@@ -120,6 +120,7 @@ RD_CmdKind_FreezeLocalMachine,
|
||||
RD_CmdKind_ThawLocalMachine,
|
||||
RD_CmdKind_FreezeEntity,
|
||||
RD_CmdKind_ThawEntity,
|
||||
RD_CmdKind_SetEntityColor,
|
||||
RD_CmdKind_Attach,
|
||||
RD_CmdKind_Exit,
|
||||
RD_CmdKind_RunCommand,
|
||||
|
||||
@@ -8324,6 +8324,26 @@ rd_theme_color_from_txt_token_kind(TXT_TokenKind kind)
|
||||
return color;
|
||||
}
|
||||
|
||||
internal Vec4F32
|
||||
rd_rgba_from_thread(CTRL_Entity *thread)
|
||||
{
|
||||
Vec4F32 result = rd_rgba_from_theme_color(RD_ThemeColor_Thread0);
|
||||
if(thread->rgba != 0)
|
||||
{
|
||||
result = rgba_from_u32(thread->rgba);
|
||||
}
|
||||
else
|
||||
{
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Entity *main_thread = ctrl_entity_child_from_kind(process, CTRL_EntityKind_Thread);
|
||||
if(main_thread != thread)
|
||||
{
|
||||
result = rd_rgba_from_theme_color(RD_ThemeColor_Thread1);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//- rjf: code -> palette
|
||||
|
||||
internal UI_Palette *
|
||||
|
||||
@@ -1309,6 +1309,7 @@ internal String8List rd_cmd_name_list_from_binding(Arena *arena, RD_Binding bind
|
||||
//- rjf: colors
|
||||
internal Vec4F32 rd_rgba_from_theme_color(RD_ThemeColor color);
|
||||
internal RD_ThemeColor rd_theme_color_from_txt_token_kind(TXT_TokenKind kind);
|
||||
internal Vec4F32 rd_rgba_from_thread(CTRL_Entity *thread);
|
||||
|
||||
//- rjf: code -> palette
|
||||
internal UI_Palette *rd_palette_from_code(RD_PaletteCode code);
|
||||
|
||||
@@ -2504,10 +2504,7 @@ rd_watch_view_build(RD_WatchViewState *ewv, B32 modifiable, U32 default_radix, R
|
||||
{
|
||||
cell_icon = RD_IconKind_RightArrow;
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_regs()->thread);
|
||||
if(thread->rgba != 0)
|
||||
{
|
||||
cell_base_color = rgba_from_u32(thread->rgba);
|
||||
}
|
||||
cell_base_color = rd_rgba_from_thread(thread);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
@@ -7193,7 +7190,7 @@ RD_VIEW_RULE_UI_FUNCTION_DEF(memory)
|
||||
Annotation *annotation = push_array(scratch.arena, Annotation, 1);
|
||||
annotation->name_string = thread->string.size ? thread->string : push_str8f(scratch.arena, "TID: %I64u", thread->id);
|
||||
annotation->kind_string = str8_lit("Stack");
|
||||
annotation->color = (thread->rgba != 0) ? rgba_from_u32(thread->rgba) : rd_rgba_from_theme_color(RD_ThemeColor_Text);
|
||||
annotation->color = rd_rgba_from_thread(thread);
|
||||
annotation->vaddr_range = stack_vaddr_range;
|
||||
for(U64 vaddr = stack_vaddr_range_in_viz.min; vaddr < stack_vaddr_range_in_viz.max; vaddr += 1)
|
||||
{
|
||||
|
||||
@@ -1059,7 +1059,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
U64 thread_rip_voff = ctrl_voff_from_vaddr(module, thread_rip_vaddr);
|
||||
|
||||
// rjf: thread info => color
|
||||
Vec4F32 color = rd_rgba_from_theme_color(RD_ThemeColor_Text);
|
||||
Vec4F32 color = rd_rgba_from_thread(thread);
|
||||
{
|
||||
if(unwind_count != 0)
|
||||
{
|
||||
@@ -1072,10 +1072,6 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
{
|
||||
color = rd_rgba_from_theme_color(RD_ThemeColor_ThreadError);
|
||||
}
|
||||
else if(thread->rgba != 0)
|
||||
{
|
||||
color = rgba_from_u32(thread->rgba);
|
||||
}
|
||||
if(d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < rd_state->frame_index)
|
||||
{
|
||||
color.w *= 0.5f;
|
||||
@@ -1219,7 +1215,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
U64 thread_rip_voff = ctrl_voff_from_vaddr(module, thread_rip_vaddr);
|
||||
|
||||
// rjf: thread info => color
|
||||
Vec4F32 color = v4f32(1, 1, 1, 1);
|
||||
Vec4F32 color = rd_rgba_from_thread(thread);
|
||||
{
|
||||
if(unwind_count != 0)
|
||||
{
|
||||
@@ -1232,10 +1228,6 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
{
|
||||
color = rd_rgba_from_theme_color(RD_ThemeColor_ThreadError);
|
||||
}
|
||||
else if(thread->rgba != 0)
|
||||
{
|
||||
color = rgba_from_u32(thread->rgba);
|
||||
}
|
||||
if(d_ctrl_targets_running() && d_ctrl_last_run_frame_idx() < rd_state->frame_index)
|
||||
{
|
||||
color.w *= 0.5f;
|
||||
|
||||
Reference in New Issue
Block a user