processless debug info loading/unloading; separate modules from dbg infos in eval; keep dbg infos around after debugging via config, correllate to new modules, evict when necessary, when generating new versions

This commit is contained in:
Ryan Fleury
2025-10-22 16:39:29 -07:00
parent f9d1ffa5fc
commit c8c25c0f98
21 changed files with 1289 additions and 899 deletions
File diff suppressed because one or more lines are too long
+8 -4
View File
@@ -252,6 +252,8 @@ RD_CmdKind_ListBreakpoints,
RD_CmdKind_ClearOutput,
RD_CmdKind_AddWatchPin,
RD_CmdKind_ToggleWatchPin,
RD_CmdKind_LoadDebugInfo,
RD_CmdKind_UnloadDebugInfo,
RD_CmdKind_AddTypeView,
RD_CmdKind_AddFilePathMap,
RD_CmdKind_EditUserTheme,
@@ -292,6 +294,7 @@ RD_CmdKind_OpenCallStack,
RD_CmdKind_OpenTargets,
RD_CmdKind_OpenBreakpoints,
RD_CmdKind_OpenWatchPins,
RD_CmdKind_OpenDebugInfos,
RD_CmdKind_OpenThreads,
RD_CmdKind_OpenProcesses,
RD_CmdKind_OpenMachines,
@@ -525,6 +528,7 @@ X(call_stack) \
X(targets) \
X(breakpoints) \
X(watch_pins) \
X(debug_infos) \
X(threads) \
X(processes) \
X(machines) \
@@ -589,10 +593,10 @@ Z(getting_started)\
.os_event = rd_regs()->os_event,\
C_LINKAGE_BEGIN
extern String8 rd_tab_fast_path_view_name_table[24];
extern String8 rd_tab_fast_path_query_name_table[24];
extern RD_VocabInfo rd_vocab_info_table[352];
extern RD_NameSchemaInfo rd_name_schema_info_table[25];
extern String8 rd_tab_fast_path_view_name_table[25];
extern String8 rd_tab_fast_path_query_name_table[25];
extern RD_VocabInfo rd_vocab_info_table[357];
extern RD_NameSchemaInfo rd_name_schema_info_table[26];
extern String8 rd_reg_slot_code_name_table[47];
extern Rng1U64 rd_reg_slot_range_table[47];
extern String8 rd_binding_version_remap_old_name_table[8];
+21
View File
@@ -33,6 +33,7 @@ RD_WatchTabFastPathTable:
{Targets "Targets" targets 1 Target "Displays, and allows editing of, the list of all targets."}
{Breakpoints "Breakpoints" breakpoints 1 CircleFilled "Displays, and allows editing of, the list of all breakpoints."}
{WatchPins "Watch Pins" watch_pins 1 Pin "Displays, and allows editing of, the list of all watch pins."}
{DebugInfos "Debug Info" debug_infos 1 Module "Displays, and allows editing of, the list of all debug info files that the debugger has loaded."}
{Threads "Threads" threads 1 Threads "Displays the list of all threads in all processes to which the debugger is attached."}
{Processes "Processes" processes 1 Scheduler "Displays the list of all processes to which the debugger is attached."}
{Machines "Machines" machines 1 Machine "Displays the list of all machines to which the debugger is connected."}
@@ -91,6 +92,7 @@ RD_VocabTable:
{type_view _ "Type View" _ Binoculars }
{file_path_map _ "File Path Map" _ FileOutline }
{watch_pin _ "Watch Pin" _ Pin }
{debug_info _ "Debug Info" "Debug Info" Module }
{watch watches "Watch" "Watches" Binoculars }
{view _ "View" _ Binoculars }
{breakpoint _ "Breakpoint" _ CircleFilled }
@@ -196,6 +198,7 @@ RD_VocabTable:
{row_height "" "Row Height" "" Null }
{tab_height "" "Tab Height" "" Null }
{rgba "" "RGBA" "" Palette }
{path "" "Path" "" FileOutline }
}
@struct RD_VocabInfo:
@@ -657,6 +660,20 @@ RD_VocabTable:
```,
}
//- rjf: debug infos
{
debug_info,
```
@row_commands(enable_cfg, duplicate_cfg, remove_cfg)
@collection_commands(load_debug_info)
x:
{
'path': @no_relativize path,
@no_revert @no_expand @default(1) 'enabled': bool,
}
```,
}
//- rjf: file path maps
{
file_path_map,
@@ -1044,6 +1061,10 @@ RD_CmdTable: // | | | |
{AddWatchPin 1 1 0 0 "" Expr null Nil Null 0 0 0 0 1 1 1 Pin "add_watch_pin" "Add Watch Pin" "Places a watch pin at a given location (file path and line number or address)." "" "$watch_pins," }
{ToggleWatchPin 1 0 0 0 "" Expr null Nil Null 0 0 0 0 1 1 1 Pin "toggle_watch_pin" "Toggle Watch Pin" "Places or removes a watch pin at a given location (file path and line number or address)." "" "" }
//- rjf: debug infos
{LoadDebugInfo 1 1 0 0 `folder:\\"$input\\"` FilePath null Nil Null 1 0 0 0 0 1 1 Module "load_debug_info" "Load Debug Info" "Loads a debug info file." "" "$debug_infos," }
{UnloadDebugInfo 1 1 0 0 "query:debug_infos" Cfg null Nil Null 0 0 0 0 1 1 1 Module "unload_debug_info" "Unload Debug Info" "Unloads a debug info file." "" "$debug_infos," }
//- rjf: type views
{AddTypeView 0 0 0 0 "" String null Nil Null 0 0 0 0 0 0 0 Binoculars "add_type_view" "Add Type View" "Adds a new type view." "" "" }
+235 -16
View File
@@ -3998,7 +3998,9 @@ rd_view_ui(Rng2F32 rect)
// rjf: apply type note
if(!(cell_info.flags & RD_WatchCellFlag_NoEval) &&
cell->eval.space.kind == CTRL_EvalSpaceKind_Entity &&
e_type_kind_from_key(cell->eval.irtree.type_key) != E_TypeKind_Null &&
(cell->eval.space.kind == E_SpaceKind_Null ||
cell->eval.space.kind == CTRL_EvalSpaceKind_Entity) &&
row_info->callstack_thread == &ctrl_entity_nil &&
e_type_kind_from_key(cell->eval.irtree.type_key) != E_TypeKind_Function)
UI_FontSize(ui_top_font_size()*0.9f)
@@ -9310,7 +9312,7 @@ rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8
// rjf: try to map using asynchronous matching system
if(!mapped && kind == TXT_TokenKind_Identifier)
{
DI_Match match = di_match_from_string(string, 0, e_base_ctx->primary_module->dbgi_key, 0);
DI_Match match = di_match_from_string(string, 0, di_key_zero(), 0);
RDI_SectionKind section_kind = match.section_kind;
mapped = 1;
switch(section_kind)
@@ -10310,6 +10312,73 @@ rd_frame(void)
scratch_end(scratch);
}
//////////////////////////////
//- rjf: iterate all loaded debug infos, remove hot markers
//
if(rd_state->frame_depth == 1)
{
CFG_Node *transient = cfg_node_child_from_string(cfg_node_root(), str8_lit("transient"));
CFG_Node *loaded_debug_infos = cfg_node_child_from_string_or_alloc(rd_state->cfg, transient, str8_lit("loaded_debug_infos"));
for(CFG_Node *child = loaded_debug_infos->first; child != &cfg_nil_node; child = child->next)
{
cfg_node_release(rd_state->cfg, cfg_node_child_from_string(child, str8_lit("hot")));
}
}
//////////////////////////////
//- rjf: iterate all loaded debug infos, touch their dbgi load markers
//
if(rd_state->frame_depth == 1)
{
CFG_Node *transient = cfg_node_child_from_string(cfg_node_root(), str8_lit("transient"));
CFG_Node *loaded_debug_infos = cfg_node_child_from_string_or_alloc(rd_state->cfg, transient, str8_lit("loaded_debug_infos"));
CFG_NodePtrList dbg_infos = cfg_node_top_level_list_from_string(scratch.arena, str8_lit("debug_info"));
for EachNode(n, CFG_NodePtrNode, dbg_infos.first)
{
CFG_Node *di = n->v;
String8 path = rd_path_from_cfg(di);
CFG_Node *di_timestamp = cfg_node_child_from_string(di, str8_lit("timestamp"));
U64 timestamp = 0;
try_u64_from_str8_c_rules(di_timestamp->first->string, &timestamp);
String8 loaded_di_key = push_str8f(scratch.arena, "$%I64x `%S` `%I64u`", di->id, path, timestamp);
CFG_Node *loaded_di = cfg_node_child_from_string(loaded_debug_infos, loaded_di_key);
if(loaded_di == &cfg_nil_node)
{
loaded_di = cfg_node_new(rd_state->cfg, loaded_debug_infos, loaded_di_key);
CFG_Node *path_node = cfg_node_new(rd_state->cfg, loaded_di, str8_lit("path"));
cfg_node_new(rd_state->cfg, path_node, path);
CFG_Node *timestamp_node = cfg_node_new(rd_state->cfg, loaded_di, str8_lit("timestamp"));
cfg_node_new(rd_state->cfg, timestamp_node, di_timestamp->first->string);
DI_Key dbgi_key = di_key_from_path_timestamp(path, timestamp);
di_open(dbgi_key);
}
cfg_node_child_from_string_or_alloc(rd_state->cfg, loaded_di, str8_lit("hot"));
}
}
//////////////////////////////
//- rjf: iterate all loaded debug infos, close those without hot markers
//
if(rd_state->frame_depth == 1)
{
CFG_Node *transient = cfg_node_child_from_string(cfg_node_root(), str8_lit("transient"));
CFG_Node *loaded_debug_infos = cfg_node_child_from_string_or_alloc(rd_state->cfg, transient, str8_lit("loaded_debug_infos"));
for(CFG_Node *child = loaded_debug_infos->first, *next = &cfg_nil_node; child != &cfg_nil_node; child = next)
{
next = child->next;
if(cfg_node_child_from_string(child, str8_lit("hot")) == &cfg_nil_node)
{
CFG_Node *path_node = cfg_node_child_from_string(child, str8_lit("path"));
CFG_Node *timestamp_node = cfg_node_child_from_string(child, str8_lit("timestamp"));
U64 timestamp = 0;
try_u64_from_str8_c_rules(timestamp_node->first->string, &timestamp);
DI_Key dbgi_key = di_key_from_path_timestamp(path_node->first->string, timestamp);
di_close(dbgi_key, 0);
cfg_node_release(rd_state->cfg, child);
}
}
}
//////////////////////////////
//- rjf: garbage collect untouched immediate cfg trees
//
@@ -10776,7 +10845,56 @@ rd_frame(void)
ProfScope("loop - consume events in core, tick engine, and repeat") for(U64 cmd_process_loop_idx = 0; cmd_process_loop_idx < 3; cmd_process_loop_idx += 1)
{
////////////////////////////
//- rjf: unpack eval-dependent info
//- rjf: gather all unique debug info keys, build map
//
typedef struct DbgInfoNode DbgInfoNode;
struct DbgInfoNode
{
DbgInfoNode *hash_next;
DbgInfoNode *order_next;
DI_Key key;
U64 idx;
};
U64 dbg_info_slots_count = 4096;
DbgInfoNode **dbg_info_slots = push_array(scratch.arena, DbgInfoNode *, dbg_info_slots_count);
DbgInfoNode *first_dbg_info = 0;
DbgInfoNode *last_dbg_info = 0;
U64 dbg_infos_count = 0;
{
CFG_NodePtrList dbg_infos = cfg_node_top_level_list_from_string(scratch.arena, str8_lit("debug_info"));
for EachNode(n, CFG_NodePtrNode, dbg_infos.first)
{
CFG_Node *di = n->v;
String8 path = rd_path_from_cfg(di);
CFG_Node *timestamp_node = cfg_node_child_from_string(di, str8_lit("timestamp"));
U64 timestamp = 0;
try_u64_from_str8_c_rules(timestamp_node->first->string, &timestamp);
DI_Key key = di_key_from_path_timestamp(path, timestamp);
U64 hash = u64_hash_from_str8(str8_struct(&key));
U64 slot_idx = hash%dbg_info_slots_count;
DbgInfoNode *node = 0;
for(DbgInfoNode *n = dbg_info_slots[slot_idx]; n != 0; n = n->hash_next)
{
if(di_key_match(n->key, key))
{
node = n;
break;
}
}
if(node == 0)
{
node = push_array(scratch.arena, DbgInfoNode, 1);
SLLStackPush_N(dbg_info_slots[slot_idx], node, hash_next);
SLLQueuePush_N(first_dbg_info, last_dbg_info, node, order_next);
node->key = key;
node->idx = dbg_infos_count;
dbg_infos_count += 1;
}
}
}
////////////////////////////
//- rjf: unpack basic evaluation context
//
ProfBegin("unpack eval-dependent info");
CTRL_Entity *process = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->process);
@@ -10787,32 +10905,67 @@ rd_frame(void)
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
U64 rip_voff = ctrl_voff_from_vaddr(module, rip_vaddr);
U64 tls_root_vaddr = ctrl_tls_root_vaddr_from_thread(&d_state->ctrl_entity_store->ctx, thread->handle);
ProfEnd();
////////////////////////////
//- rjf: produce all debug infos
//
U64 eval_dbg_infos_count = Max(1, dbg_infos_count);
E_DbgInfo *eval_dbg_infos = push_array(scratch.arena, E_DbgInfo, eval_dbg_infos_count);
E_DbgInfo *eval_dbg_infos_primary = &eval_dbg_infos[0];
MemoryCopyStruct(eval_dbg_infos_primary, &e_dbg_info_nil);
{
U64 idx = 0;
for(DbgInfoNode *n = first_dbg_info; n != 0; n = n->order_next)
{
eval_dbg_infos[idx].dbgi_key = n->key;
eval_dbg_infos[idx].rdi = di_rdi_from_key(rd_state->frame_access, n->key, 0, 0);
idx += 1;
}
}
////////////////////////////
//- rjf: produce all eval modules
//
CTRL_EntityArray all_modules = ctrl_entity_array_from_kind(&d_state->ctrl_entity_store->ctx, CTRL_EntityKind_Module);
U64 eval_modules_count = Max(1, all_modules.count);
E_Module *eval_modules = push_array(scratch.arena, E_Module, eval_modules_count);
E_Module *eval_modules_primary = &eval_modules[0];
eval_modules_primary->rdi = &rdi_parsed_nil;
eval_modules_primary->vaddr_range = r1u64(0, max_U64);
DI_Key primary_dbgi_key = {0};
ProfScope("produce all eval modules")
{
for EachIndex(eval_module_idx, all_modules.count)
{
CTRL_Entity *m = all_modules.v[eval_module_idx];
DI_Key dbgi_key = ctrl_dbgi_key_from_module(m);
eval_modules[eval_module_idx].arch = m->arch;
eval_modules[eval_module_idx].dbgi_key = dbgi_key;
eval_modules[eval_module_idx].rdi = di_rdi_from_key(rd_state->frame_access, dbgi_key, 0, 0);
eval_modules[eval_module_idx].vaddr_range = m->vaddr_range;
eval_modules[eval_module_idx].space = rd_eval_space_from_ctrl_entity(ctrl_entity_ancestor_from_kind(m, CTRL_EntityKind_Process), CTRL_EvalSpaceKind_Entity);
// rjf: dbgi key -> eval dbg info num
U32 dbg_info_num = 0;
{
U64 hash = u64_hash_from_str8(str8_struct(&dbgi_key));
U64 slot_idx = hash%dbg_info_slots_count;
for(DbgInfoNode *n = dbg_info_slots[slot_idx]; n != 0; n = n->hash_next)
{
if(di_key_match(n->key, dbgi_key))
{
dbg_info_num = n->idx+1;
break;
}
}
}
// rjf: fill
eval_modules[eval_module_idx].vaddr_range = m->vaddr_range;
eval_modules[eval_module_idx].arch = m->arch;
eval_modules[eval_module_idx].dbg_info_num = dbg_info_num;
eval_modules[eval_module_idx].space = rd_eval_space_from_ctrl_entity(ctrl_entity_ancestor_from_kind(m, CTRL_EntityKind_Process), CTRL_EvalSpaceKind_Entity);
if(module == m)
{
eval_modules_primary = &eval_modules[eval_module_idx];
primary_dbgi_key = dbgi_key;
eval_dbg_infos_primary = (0 < dbg_info_num && dbg_info_num <= eval_dbg_infos_count) ? &eval_dbg_infos[dbg_info_num-1] : &e_dbg_info_nil;
}
}
}
ProfEnd();
////////////////////////////
//- rjf: begin evaluation
@@ -10833,6 +10986,11 @@ rd_frame(void)
ctx->thread_arch = thread->arch;
ctx->thread_unwind_count = unwind_count;
//- rjf: fill debug infos
ctx->dbg_infos = eval_dbg_infos;
ctx->dbg_infos_count = eval_dbg_infos_count;
ctx->primary_dbg_info = eval_dbg_infos_primary;
//- rjf: fill modules
ctx->modules = eval_modules;
ctx->modules_count = eval_modules_count;
@@ -10959,6 +11117,7 @@ rd_frame(void)
str8_lit("breakpoint"),
str8_lit("watch_pin"),
str8_lit("target"),
str8_lit("debug_info"),
str8_lit("file_path_map"),
str8_lit("type_view"),
str8_lit("recent_project"),
@@ -11608,8 +11767,8 @@ rd_frame(void)
E_IRCtx *ctx = ir_ctx;
ctx->regs_map = ctrl_string2reg_from_arch(eval_base_ctx->primary_module->arch);
ctx->reg_alias_map = ctrl_string2alias_from_arch(eval_base_ctx->primary_module->arch);
ctx->locals_map = d_query_cached_locals_map_from_dbgi_key_voff(primary_dbgi_key, rip_voff);
ctx->member_map = d_query_cached_member_map_from_dbgi_key_voff(primary_dbgi_key, rip_voff);
ctx->locals_map = d_query_cached_locals_map_from_dbgi_key_voff(eval_base_ctx->primary_dbg_info->dbgi_key, rip_voff);
ctx->member_map = d_query_cached_member_map_from_dbgi_key_voff(eval_base_ctx->primary_dbg_info->dbgi_key, rip_voff);
ctx->macro_map = macro_map;
ctx->auto_hook_map = auto_hook_map;
}
@@ -11631,7 +11790,7 @@ rd_frame(void)
ctx->tls_base = push_array(scratch.arena, U64, 1);
ctx->tls_base[0] = d_query_cached_tls_base_vaddr_from_process_root_rip(process, tls_root_vaddr, rip_vaddr);
}
e_select_interpret_ctx(interpret_ctx, eval_modules_primary->rdi, rip_voff);
e_select_interpret_ctx(interpret_ctx, eval_dbg_infos_primary->rdi, rip_voff);
////////////////////////////
//- rjf: evaluate unpacked settings (must be used earlier than this point in the frame,
@@ -13683,7 +13842,15 @@ rd_frame(void)
DI_Key voff_dbgi_key = {0};
if(!name_resolved)
{
DI_Match match = di_match_from_string(name, 0, e_base_ctx->primary_module->dbgi_key, 0);
DI_Match match = {0};
if(match.idx == 0)
{
match = di_match_from_string(name, 0, e_base_ctx->primary_dbg_info->dbgi_key, rd_state->frame_eval_memread_endt_us);
}
if(match.idx == 0)
{
match = di_match_from_string(name, 0, di_key_zero(), rd_state->frame_eval_memread_endt_us);
}
if(match.section_kind == RDI_SectionKind_Procedures)
{
Access *access = access_open();
@@ -14812,6 +14979,21 @@ rd_frame(void)
}
}break;
//- rjf: debug infos
case RD_CmdKind_LoadDebugInfo:
{
CFG_Node *project = cfg_node_child_from_string(cfg_node_root(), str8_lit("project"));
CFG_Node *di = cfg_node_new(rd_state->cfg, project, str8_lit("debug_info"));
CFG_Node *path = cfg_node_new(rd_state->cfg, di, str8_lit("path"));
cfg_node_new(rd_state->cfg, path, rd_regs()->file_path);
}break;
case RD_CmdKind_UnloadDebugInfo:
{
CFG_Node *di = cfg_node_from_id(rd_regs()->cfg);
CFG_Node *path = cfg_node_child_from_string(di, str8_lit("path"));
cfg_node_release(rd_state->cfg, di);
}break;
//- rjf: type views
case RD_CmdKind_AddTypeView:
{
@@ -15897,6 +16079,43 @@ rd_frame(void)
switch(evt->kind)
{
default:{}break;
case D_EventKind_ModuleLoad:
{
CTRL_Entity *module = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, evt->module);
CTRL_Entity *debug_info_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
String8 new_path = debug_info_path->string;
if(new_path.size != 0 && os_file_path_exists(new_path))
{
CFG_NodePtrList dbg_infos = cfg_node_top_level_list_from_string(scratch.arena, str8_lit("debug_info"));
B32 path_found = 0;
CFG_Node *found_di = &cfg_nil_node;
for EachNode(n, CFG_NodePtrNode, dbg_infos.first)
{
CFG_Node *di = n->v;
String8 path = rd_path_from_cfg(di);
if(str8_match(path, new_path, 0))
{
path_found = 1;
found_di = di;
break;
}
}
if(!path_found)
{
CFG_Node *project = cfg_node_child_from_string(cfg_node_root(), str8_lit("project"));
CFG_Node *di = cfg_node_new(rd_state->cfg, project, str8_lit("debug_info"));
CFG_Node *path_root = cfg_node_new(rd_state->cfg, di, str8_lit("path"));
CFG_Node *timestamp_root = cfg_node_new(rd_state->cfg, di, str8_lit("timestamp"));
cfg_node_new(rd_state->cfg, path_root, new_path);
cfg_node_newf(rd_state->cfg, timestamp_root, "%I64u", debug_info_path->timestamp);
}
else
{
CFG_Node *timestamp_root = cfg_node_child_from_string_or_alloc(rd_state->cfg, found_di, str8_lit("timestamp"));
cfg_node_new_replacef(rd_state->cfg, timestamp_root, "%I64u", debug_info_path->timestamp);
}
}
}break;
case D_EventKind_ProcessEnd:
if(rd_state->quit_after_success)
{
+3 -6
View File
@@ -1251,9 +1251,6 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
CTRL_Entity *selected_thread_process = ctrl_entity_ancestor_from_kind(selected_thread, CTRL_EntityKind_Process);
U64 selected_thread_rip_unwind_vaddr = d_query_cached_rip_from_thread_unwind(selected_thread, rd_regs()->unwind_count);
CTRL_Entity *selected_thread_module = ctrl_module_from_process_vaddr(selected_thread_process, selected_thread_rip_unwind_vaddr);
F32 selected_thread_alive_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "###selected_thread_alive_t_%p", selected_thread), 1.f);
F32 selected_thread_module_alive_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "###selected_thread_module_alive_t_%p", selected_thread_module), 1.f);
F32 selected_thread_arch_alive_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "###selected_thread_arch_alive_t_%i", selected_thread->arch), 1.f);
CTRL_Event stop_event = d_ctrl_last_stop_event();
CTRL_Entity *stopper_thread = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, stop_event.entity);
B32 is_focused = ui_is_focus_active();
@@ -1552,9 +1549,9 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
line_num <= params->line_num_range.max;
line_num += 1, line_idx += 1)
{
CTRL_EntityList line_ips = params->line_ips[line_idx];
CFG_NodePtrList line_bps = params->line_bps[line_idx];
CFG_NodePtrList line_pins = params->line_pins[line_idx];
CTRL_EntityList line_ips = params->line_ips[line_idx];
CFG_NodePtrList line_bps = params->line_bps[line_idx];
CFG_NodePtrList line_pins = params->line_pins[line_idx];
ui_set_next_hover_cursor(OS_Cursor_HandPoint);
ui_set_next_background_color(v4f32(0, 0, 0, 0));
UI_Box *line_margin_box = ui_build_box_from_stringf(UI_BoxFlag_Clickable*!!(params->flags & RD_CodeSliceFlag_Clickable)|UI_BoxFlag_DrawBackground|UI_BoxFlag_DrawActiveEffects, "line_margin_%I64x", line_num);