first pass at per-target output log labels

This commit is contained in:
Ryan Fleury
2026-06-02 12:10:47 -07:00
parent eb90ddc739
commit 1c29112e9c
16 changed files with 161 additions and 61 deletions
+3 -2
View File
@@ -62,7 +62,7 @@ str8_lit_comp(""),
str8_lit_comp(""),
};
RD_VocabInfo rd_vocab_info_table[360] =
RD_VocabInfo rd_vocab_info_table[361] =
{
{str8_lit_comp("type_view"), str8_lit_comp("type_views"), str8_lit_comp("Type View"), str8_lit_comp("Type Views"), RD_IconKind_Binoculars},
{str8_lit_comp("file_path_map"), str8_lit_comp("file_path_maps"), str8_lit_comp("File Path Map"), str8_lit_comp("File Path Maps"), RD_IconKind_FileOutline},
@@ -176,6 +176,7 @@ RD_VocabInfo rd_vocab_info_table[360] =
{str8_lit_comp("path"), str8_lit_comp(""), str8_lit_comp("Path"), str8_lit_comp(""), RD_IconKind_FileOutline},
{str8_lit_comp("guid"), str8_lit_comp(""), str8_lit_comp("GUID"), str8_lit_comp(""), RD_IconKind_Null},
{str8_lit_comp("peek_type"), str8_lit_comp("peek_types"), str8_lit_comp("Peek Type"), str8_lit_comp("Peek Types"), RD_IconKind_Null},
{str8_lit_comp("output_label"), str8_lit_comp("output_labels"), str8_lit_comp("Output Label"), str8_lit_comp("Output Labels"), RD_IconKind_List},
{str8_lit_comp("launch_and_run"), str8_lit_comp(""), str8_lit_comp("Launch and Run"), str8_lit_comp(""), RD_IconKind_Play},
{str8_lit_comp("launch_and_step_into"), str8_lit_comp(""), str8_lit_comp("Launch and Step Into"), str8_lit_comp(""), RD_IconKind_PlayStepForward},
{str8_lit_comp("kill"), str8_lit_comp(""), str8_lit_comp("Kill"), str8_lit_comp(""), RD_IconKind_X},
@@ -456,7 +457,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[39] =
{str8_lit_comp("color"), 1, str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Value\") @description(\"An expression to describe the value or location of the color.\")\n 'expression': expr_string,\n}\n")},
{str8_lit_comp("geo3d"), 1, str8_lit_comp("@inherit(tab) x:\n{\n @display_name(\"Expression\") @description(\"An expression to describe the base address of the index buffer.\")\n 'expression': expr_string,\n 'count': expr_string,\n 'vtx': expr_string,\n 'vtx_size': expr_string,\n 'yaw': @range[0, 1] f32,\n 'pitch': @range[-0.5, 0] f32,\n 'zoom': @range[0, 100] f32,\n}\n")},
{str8_lit_comp("getting_started"), 0, str8_lit_comp("@inherit(tab) x:\n{\n}\n")},
{str8_lit_comp("target"), 0, str8_lit_comp("@row_commands(@cmd_line save_cfg_to_project, enable_cfg, launch_and_run, launch_and_step_into, duplicate_cfg, remove_cfg)\n@collection_commands(add_target)\nx:\n{\n 'label': code_string,\n 'executable': path,\n 'arguments': string,\n 'working_directory': path,\n 'entry_point': expr_string,\n 'stdout_path': @no_relativize path,\n 'stderr_path': @no_relativize path,\n 'stdin_path': @no_relativize path,\n 'environment': set,\n 'debug_subprocesses': bool,\n @no_revert @no_expand @default(0) 'enabled': bool,\n}\n")},
{str8_lit_comp("target"), 0, str8_lit_comp("@row_commands(@cmd_line save_cfg_to_project, enable_cfg, launch_and_run, launch_and_step_into, duplicate_cfg, remove_cfg)\n@collection_commands(add_target)\nx:\n{\n 'label': code_string,\n 'executable': path,\n 'arguments': string,\n 'working_directory': path,\n 'entry_point': expr_string,\n @default(\"output\") 'output_label': code_string,\n 'stdout_path': @no_relativize path,\n 'stderr_path': @no_relativize path,\n 'stdin_path': @no_relativize path,\n 'environment': set,\n 'debug_subprocesses': bool,\n @no_revert @no_expand @default(0) 'enabled': bool,\n}\n")},
{str8_lit_comp("breakpoint"), 0, str8_lit_comp("@row_commands(enable_cfg, duplicate_cfg, remove_cfg)\n@collection_commands(toggle_breakpoint, add_breakpoint, add_address_breakpoint, add_function_breakpoint, clear_breakpoints)\nx:\n{\n 'label': code_string,\n 'condition': expr_string,\n 'source_location': path_pt,\n 'address_location': expr_string,\n 'hit_count': u64,\n 'address_range_size': @or(0, 1, 2, 4, 8) u64,\n 'break_on_write': bool,\n 'break_on_read': bool,\n 'break_on_execute': bool,\n @no_revert @no_expand @default(1) 'enabled': bool,\n}\n")},
{str8_lit_comp("watch_pin"), 0, str8_lit_comp("@row_commands(duplicate_cfg, remove_cfg)\n@collection_commands(add_watch_pin, toggle_watch_pin)\nx:\n{\n 'expression': expr_string,\n 'source_location': path_pt,\n 'address_location': expr_string,\n}\n")},
{str8_lit_comp("debug_info"), 0, str8_lit_comp("@row_commands(enable_cfg, duplicate_cfg, remove_cfg)\n@collection_commands(load_debug_info)\nx:\n{\n 'path': @no_relativize path,\n @query 'guid': string,\n @no_revert @no_expand @default(1) 'enabled': bool,\n}\n")},
+1 -1
View File
@@ -603,7 +603,7 @@ Z(getting_started)\
C_LINKAGE_BEGIN
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[360];
extern RD_VocabInfo rd_vocab_info_table[361];
extern RD_NameSchemaInfo rd_name_schema_info_table[39];
extern String8 rd_reg_slot_code_name_table[49];
extern Rng1U64 rd_reg_slot_range_table[49];
+2
View File
@@ -201,6 +201,7 @@ RD_VocabTable:
{path "" "Path" "" FileOutline }
{guid "" "GUID" "" Null }
{peek_type _ "Peek Type" _ Null }
{output_label _ "Output Label" _ List }
}
@struct RD_VocabInfo:
@@ -707,6 +708,7 @@ RD_VocabTable:
'arguments': string,
'working_directory': path,
'entry_point': expr_string,
@default("output") 'output_label': code_string,
'stdout_path': @no_relativize path,
'stderr_path': @no_relativize path,
'stdin_path': @no_relativize path,
+87 -16
View File
@@ -270,6 +270,7 @@ rd_target_from_cfg(Arena *arena, CFG_Node *cfg)
target.stdout_path = cfg_node_child_from_string(cfg, str8_lit("stdout_path"))->first->string;
target.stderr_path = cfg_node_child_from_string(cfg, str8_lit("stderr_path"))->first->string;
target.stdin_path = cfg_node_child_from_string(cfg, str8_lit("stdin_path"))->first->string;
target.msg_id = cfg->id;
target.debug_subprocesses = !!e_value_from_string(cfg_node_child_from_string(cfg, str8_lit("debug_subprocesses"))->first->string).u64;
for(CFG_Node *child = cfg->first; child != &cfg_nil_node; child = child->next)
{
@@ -12332,21 +12333,33 @@ rd_frame(void)
e_string2expr_map_insert(scratch.arena, macro_map, name, expr);
}
//- rjf: add macro for output log
//- rjf: add macro for output logs
{
Access *access = access_open();
C_Key key = d_user_state->output_log_key;
U128 hash = c_hash_from_key(key, 0);
String8 data = c_data_from_hash(access, hash);
E_Space space = e_space_make(E_SpaceKind_HashStoreKey);
space.u64_0 = key.root.u64[0];
space.u128 = key.id.u128[0];
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, r1u64(0, 0));
expr->space = space;
expr->mode = E_Mode_Offset;
expr->type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), data.size, 0);
e_string2expr_map_insert(scratch.arena, macro_map, str8_lit("output"), expr);
access_close(access);
CFG_NodePtrList targets = cfg_node_top_level_list_from_string(scratch.arena, s("target"));
for EachNode(n, CFG_NodePtrNode, targets.first)
{
Access *access = access_open();
CFG_Node *target = n->v;
CFG_Node *output_label = cfg_node_child_from_string(target, s("output_label"));
String8 output_label_string = output_label->first->string;
if(output_label_string.size == 0)
{
output_label_string = rd_default_setting_from_names(s("target"), s("output_label"));
}
C_ID id = {u128_hash_from_str8(output_label_string)};
C_Key key = c_key_make(d_user_state->output_log_root, id);
U128 hash = c_hash_from_key(key, 0);
String8 data = c_data_from_hash(access, hash);
E_Space space = e_space_make(E_SpaceKind_HashStoreKey);
space.u64_0 = key.root.u64[0];
space.u128 = key.id.u128[0];
E_Expr *expr = e_push_expr(scratch.arena, E_ExprKind_LeafOffset, r1u64(0, 0));
expr->space = space;
expr->mode = E_Mode_Offset;
expr->type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), data.size, 0);
e_string2expr_map_insert(scratch.arena, macro_map, output_label_string, expr);
access_close(access);
}
}
//- rjf: (DEBUG) add macro for cfg strings
@@ -15810,8 +15823,16 @@ rd_frame(void)
//- rjf: output
case RD_CmdKind_ClearOutput:
{
// rjf: get output label
String8 output_label = rd_regs()->string;
// rjf: output label -> key
C_ID id = {u128_hash_from_str8(output_label)};
C_Key key = c_key_make(d_user_state->output_log_root, id);
// rjf: clear
MTX_Op op = {r1u64(0, 0xffffffffffffffffull), str8_lit("")};
mtx_push_op(d_user_state->output_log_key, op);
mtx_push_op(key, op);
}break;
//- rjf: watch pins
@@ -16955,6 +16976,11 @@ rd_frame(void)
////////////////////////////
//- rjf: tick debug engine
//
U64 process_count_pre_tick = 0;
{
D_EntityArray all_processes = d_entity_array_from_kind(D_EntityKind_Process);
process_count_pre_tick = all_processes.count;
}
U64 cmd_count_pre_tick = rd_state->cmds[0].count;
B32 soft_halt_issued = d_user_state->ctrl_soft_halt_issued;
D_EventList engine_events = d_tick(scratch.arena, &targets, &breakpoints, &path_maps, exception_code_filters);
@@ -16971,9 +16997,34 @@ rd_frame(void)
case D_EventKind_NewProc:
{
D_EntityArray all_processes = d_entity_array_from_kind(D_EntityKind_Process);
if(all_processes.count == 1)
// rjf: no processes before this one -> new session
if(process_count_pre_tick == 0)
{
D_Entity *process = all_processes.v[0];
CFG_Node *target = cfg_node_from_id(process->src_msg_id);
// rjf: target -> output label
String8 output_label = cfg_node_child_from_string(target, s("output_label"))->first->string;
if(output_label.size == 0)
{
output_label = rd_default_setting_from_names(s("target"), s("output_label"));
}
// rjf: output label -> key
C_ID id = {u128_hash_from_str8(output_label)};
C_Key key = c_key_make(d_user_state->output_log_root, id);
// rjf: reset output log for associated target
{
MTX_Op op = {r1u64(0, 0xffffffffffffffffull), str8_lit("[new session]\n")};
mtx_push_op(key, op);
}
// rjf: reset external window
MemoryZeroStruct(&rd_state->prestop_focused_window);
// rjf: eliminate all previously 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)
{
@@ -17138,6 +17189,26 @@ rd_frame(void)
rd_state->last_stop_selected_thread_sp = new_sp;
}
}break;
case D_EventKind_DebugString:
{
// rjf: process -> src target's output label
D_Entity *process = d_entity_from_handle(evt->parent);
D_MsgID src_msg_id = process->src_msg_id;
CFG_Node *target = cfg_node_from_id(src_msg_id);
String8 output_label = cfg_node_child_from_string(target, s("output_label"))->first->string;
if(output_label.size == 0)
{
output_label = rd_default_setting_from_names(s("target"), s("output_label"));
}
// rjf: output label -> key
C_ID id = {u128_hash_from_str8(output_label)};
C_Key key = c_key_make(d_user_state->output_log_root, id);
// rjf: push to keyed output
MTX_Op op = {r1u64(max_U64, max_U64), evt->string};
mtx_push_op(key, op);
}break;
}
}