pipe through guids in rdi conversion; sketch out 'query' meta cfg evaluation members, which are not stored but computed, but are not sets; plug in debug info guid evaluation that way

This commit is contained in:
Ryan Fleury
2025-10-23 12:10:23 -07:00
parent e83a95f370
commit c318c10486
15 changed files with 125 additions and 51 deletions
+6 -5
View File
@@ -384,11 +384,12 @@ enum
E_TypeFlag_IsCodeText = (1<<4),
E_TypeFlag_IsPathText = (1<<5),
E_TypeFlag_IsNotText = (1<<6),
E_TypeFlag_EditableChildren = (1<<7),
E_TypeFlag_InheritedByMembers = (1<<8),
E_TypeFlag_InheritedByElements = (1<<9),
E_TypeFlag_ArrayLikeExpansion = (1<<10),
E_TypeFlag_StubSingleLineExpansion = (1<<11),
E_TypeFlag_IsNotEditable = (1<<7),
E_TypeFlag_EditableChildren = (1<<8),
E_TypeFlag_InheritedByMembers = (1<<9),
E_TypeFlag_InheritedByElements = (1<<10),
E_TypeFlag_ArrayLikeExpansion = (1<<11),
E_TypeFlag_StubSingleLineExpansion = (1<<12),
};
typedef struct E_Member E_Member;
@@ -150,8 +150,14 @@ ev_type_key_is_editable(E_TypeKey type_key)
B32 done = 0;
for(E_TypeKey t = type_key; !result && !done; t = e_type_key_direct(t))
{
E_TypeKind kind = e_type_kind_from_key(t);
switch(kind)
E_Type *type = e_type_from_key(t);
E_TypeKind kind = type->kind;
if(type->flags & E_TypeFlag_IsNotEditable)
{
result = 0;
done = 1;
}
else switch(kind)
{
case E_TypeKind_Null:
case E_TypeKind_Function:
@@ -167,7 +173,6 @@ ev_type_key_is_editable(E_TypeKey type_key)
}break;
case E_TypeKind_Array:
{
E_Type *type = e_type_from_key(t);
if(type->flags & E_TypeFlag_IsNotText)
{
result = 0;
+6 -1
View File
@@ -52,6 +52,9 @@ union RDI_SHA1 {RDI_U8 u8[20];};
typedef union RDI_SHA256 RDI_SHA256;
union RDI_SHA256 {RDI_U8 u8[32]; RDI_U64 u64[4];};
typedef union RDI_GUID RDI_GUID;
union RDI_GUID {RDI_U8 u8[16]; RDI_U64 u64[2];};
////////////////////////////////////////////////////////////////
//~ Overridable Enabling/Disabling Of Table Index Typechecking
@@ -64,7 +67,7 @@ union RDI_SHA256 {RDI_U8 u8[32]; RDI_U64 u64[4];};
// "raddbg\0\0"
#define RDI_MAGIC_CONSTANT 0x0000676264646172
#define RDI_ENCODING_VERSION 16
#define RDI_ENCODING_VERSION 17
////////////////////////////////////////////////////////////////
//~ Format Types & Functions
@@ -807,6 +810,7 @@ X(RDI_Arch, arch)\
X(RDI_U32, exe_name_string_idx)\
X(RDI_U64, exe_hash)\
X(RDI_U64, voff_max)\
X(RDI_GUID, guid)\
X(RDI_U32, producer_name_string_idx)\
#define RDI_BinarySectionFlags_XList \
@@ -1283,6 +1287,7 @@ RDI_Arch arch;
RDI_U32 exe_name_string_idx;
RDI_U64 exe_hash;
RDI_U64 voff_max;
RDI_GUID guid;
RDI_U32 producer_name_string_idx;
};
+5
View File
@@ -1196,6 +1196,11 @@ rdim_bake_params_concat_in_place(RDIM_BakeParams *dst, RDIM_BakeParams *src)
{
dst->top_level_info.voff_max = src->top_level_info.voff_max;
}
if(dst->top_level_info.guid.u64[0] == 0 &&
dst->top_level_info.guid.u64[1] == 0)
{
dst->top_level_info.guid = src->top_level_info.guid;
}
if(dst->top_level_info.producer_name.size == 0)
{
dst->top_level_info.producer_name = src->top_level_info.producer_name;
+1
View File
@@ -499,6 +499,7 @@ struct RDIM_TopLevelInfo
RDIM_String8 exe_name;
RDI_U64 exe_hash;
RDI_U64 voff_max;
RDI_GUID guid;
RDIM_String8 producer_name;
};
+1 -1
View File
@@ -851,7 +851,7 @@ rb_thread_entry_point(void *p)
{
unique_identifier_string = str8f(arena, "%I64x", bake_params->top_level_info.exe_hash);
}
if(unique_identifier_string.size == 0 && input_files.first != 0 && input_files.first->v->format == RB_FileFormat_PDB)
if(unique_identifier_string.size == 0)
{
Temp scratch = scratch_begin(&arena, 1);
String8 msf_data = input_files.first->v->data;
+3 -2
View File
@@ -62,7 +62,7 @@ str8_lit_comp(""),
str8_lit_comp(""),
};
RD_VocabInfo rd_vocab_info_table[357] =
RD_VocabInfo rd_vocab_info_table[358] =
{
{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},
@@ -174,6 +174,7 @@ RD_VocabInfo rd_vocab_info_table[357] =
{str8_lit_comp("tab_height"), str8_lit_comp(""), str8_lit_comp("Tab Height"), str8_lit_comp(""), RD_IconKind_Null},
{str8_lit_comp("rgba"), str8_lit_comp(""), str8_lit_comp("RGBA"), str8_lit_comp(""), RD_IconKind_Palette},
{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("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},
@@ -442,7 +443,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[26] =
{str8_lit_comp("target"), 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': query,\n 'debug_subprocesses': bool,\n @no_revert @no_expand @default(0) 'enabled': bool,\n}\n")},
{str8_lit_comp("breakpoint"), 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"), 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"), 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 @no_revert @no_expand @default(1) 'enabled': bool,\n}\n")},
{str8_lit_comp("debug_info"), 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")},
{str8_lit_comp("file_path_map"), str8_lit_comp("@collection_commands(add_file_path_map) @row_commands(remove_cfg) x:{'source': @no_relativize path, 'dest': @no_relativize path}")},
{str8_lit_comp("type_view"), str8_lit_comp("@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':expr_string, 'expr':expr_string}")},
{str8_lit_comp("recent_project"), str8_lit_comp("x:{'path':path}")},
+1 -1
View File
@@ -595,7 +595,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[357];
extern RD_VocabInfo rd_vocab_info_table[358];
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];
+2
View File
@@ -199,6 +199,7 @@ RD_VocabTable:
{tab_height "" "Tab Height" "" Null }
{rgba "" "RGBA" "" Palette }
{path "" "Path" "" FileOutline }
{guid "" "GUID" "" Null }
}
@struct RD_VocabInfo:
@@ -669,6 +670,7 @@ RD_VocabTable:
x:
{
'path': @no_relativize path,
@query 'guid': string,
@no_revert @no_expand @default(1) 'enabled': bool,
}
```,
+74 -31
View File
@@ -789,7 +789,7 @@ rd_eval_space_read(E_Space space, void *out, Rng1U64 range)
//- rjf: meta-config reads
case RD_EvalSpaceKind_MetaCfg:
{
// rjf: unpack cfg
//- rjf: unpack cfg
CFG_Node *root_cfg = rd_cfg_from_eval_space(space);
String8 child_key = e_string_from_id(space.u64s[1]);
CFG_Node *cfg = root_cfg;
@@ -798,54 +798,85 @@ rd_eval_space_read(E_Space space, void *out, Rng1U64 range)
cfg = cfg_node_child_from_string(root_cfg, child_key);
}
// rjf: determine data to read from, depending on child type in schema
//- rjf: determine data to read from, depending on child type in schema
String8 read_data = {0};
if(child_key.size != 0)
{
MD_NodePtrList schemas = cfg_schemas_from_name(scratch.arena, rd_state->cfg_schema_table, root_cfg->string);
MD_Node *expr_child_schema = &md_nil_node;
// rjf: get schemas for the accessed child
MD_Node *child_schema = &md_nil_node;
for(MD_NodePtrNode *n = schemas.first; n != 0 && child_schema == &md_nil_node; n = n->next)
MD_Node *expr_child_schema = &md_nil_node;
{
child_schema = md_child_from_string(n->v, child_key, 0);
if(child_schema != &md_nil_node)
MD_NodePtrList schemas = cfg_schemas_from_name(scratch.arena, rd_state->cfg_schema_table, root_cfg->string);
for(MD_NodePtrNode *n = schemas.first; n != 0 && child_schema == &md_nil_node; n = n->next)
{
expr_child_schema = md_child_from_string(n->v, str8_lit("expression"), 0);
child_schema = md_child_from_string(n->v, child_key, 0);
if(child_schema != &md_nil_node)
{
expr_child_schema = md_child_from_string(n->v, str8_lit("expression"), 0);
}
}
}
String8 child_type_name = child_schema->first->string;
// rjf: get value string (or default fallback)
String8 value_string = cfg->first->string;
if(value_string.size == 0)
{
value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string;
}
// rjf: if this is an override child to a parent, fall back on defaults from parents
if(value_string.size == 0 && !md_node_is_nil(md_tag_from_string(child_schema, str8_lit("override"), 0)))
{
for(CFG_Node *parent = root_cfg->parent; parent != &cfg_nil_node; parent = parent->parent)
{
CFG_Node *parent_child_w_key = cfg_node_child_from_string(parent, child_key);
if(parent_child_w_key != &cfg_nil_node)
{
value_string = parent_child_w_key->first->string;
break;
}
value_string = rd_default_setting_from_names(parent->string, child_key);
if(value_string.size != 0)
{
break;
}
}
}
// rjf: if this is a query -> compute the value string based on query path
if(md_node_has_tag(child_schema, str8_lit("query"), 0))
{
// TODO(rjf): this needs to be replaced by hooks
if(str8_match(child_schema->string, str8_lit("guid"), 0))
{
Access *access = access_open();
String8 path = rd_path_from_cfg(root_cfg);
U64 timestamp = 0;
try_u64_from_str8_c_rules(cfg_node_child_from_string(root_cfg, str8_lit("timestamp"))->first->string, &timestamp);
DI_Key key = di_key_from_path_timestamp(path, timestamp);
RDI_Parsed *rdi = di_rdi_from_key(access, key, 0, 0);
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
Guid guid = {0};
MemoryCopy(&guid, &tli->guid, Min(sizeof guid, sizeof tli->guid));
value_string = string_from_guid(scratch.arena, guid);
access_close(access);
}
}
// rjf: textual data
if(str8_match(child_type_name, str8_lit("path"), 0) ||
str8_match(child_type_name, str8_lit("path_pt"), 0) ||
str8_match(child_type_name, str8_lit("code_string"), 0) ||
str8_match(child_type_name, str8_lit("expr_string"), 0) ||
str8_match(child_type_name, str8_lit("string"), 0))
{
read_data = cfg->first->string;
read_data = value_string;
}
// rjf: non-textual data
else
{
String8 value_string = cfg->first->string;
if(value_string.size == 0)
{
value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string;
}
if(value_string.size == 0 && !md_node_is_nil(md_tag_from_string(child_schema, str8_lit("override"), 0)))
{
for(CFG_Node *parent = root_cfg->parent; parent != &cfg_nil_node; parent = parent->parent)
{
CFG_Node *parent_child_w_key = cfg_node_child_from_string(parent, child_key);
if(parent_child_w_key != &cfg_nil_node)
{
value_string = parent_child_w_key->first->string;
break;
}
value_string = rd_default_setting_from_names(parent->string, child_key);
if(value_string.size != 0)
{
break;
}
}
}
E_Key parent_key = {0};
if(expr_child_schema != &md_nil_node && child_schema != expr_child_schema)
{
@@ -11471,6 +11502,18 @@ rd_frame(void)
.id_from_num = E_TYPE_EXPAND_ID_FROM_NUM_FUNCTION_NAME(cfgs_slice),
.num_from_id = E_TYPE_EXPAND_NUM_FROM_ID_FUNCTION_NAME(cfgs_slice),
}));
e_string2typekey_map_insert(rd_frame_arena(), rd_state->meta_name2type_map, str8_lit("environment"),
e_type_key_cons(.kind = E_TypeKind_Set,
.name = str8_lit("environment"),
.irext = E_TYPE_IREXT_FUNCTION_NAME(environment),
.access = E_TYPE_ACCESS_FUNCTION_NAME(environment),
.expand =
{
.info = E_TYPE_EXPAND_INFO_FUNCTION_NAME(environment),
.range = E_TYPE_EXPAND_RANGE_FUNCTION_NAME(environment),
.id_from_num = E_TYPE_EXPAND_ID_FROM_NUM_FUNCTION_NAME(environment),
.num_from_id = E_TYPE_EXPAND_NUM_FROM_ID_FUNCTION_NAME(environment),
}));
}
//- rjf: add macro for collections with specific lookup rules (but no unique id rules)
+8 -6
View File
@@ -294,38 +294,40 @@ E_TYPE_ACCESS_FUNCTION_DEF(schema)
CFG_Node *child = cfg_node_child_from_string(cfg, child_schema->string);
E_TypeKey child_type_key = zero_struct;
B32 wrap_child_w_meta_expr = 0;
B32 is_query_child = md_node_has_tag(child_schema, str8_lit("query"), 0);
E_TypeFlags type_flags = (!!is_query_child * E_TypeFlag_IsNotEditable);
if(0){}
//- rjf: ctrl entity members
else if(entity != &ctrl_entity_nil && str8_match(child_schema->string, str8_lit("label"), 0))
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), entity->string.size, E_TypeFlag_IsCodeText);
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), entity->string.size, type_flags|E_TypeFlag_IsCodeText);
}
else if(entity != &ctrl_entity_nil && str8_match(child_schema->string, str8_lit("exe"), 0))
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), entity->string.size, E_TypeFlag_IsPathText);
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), entity->string.size, type_flags|E_TypeFlag_IsPathText);
}
else if(entity != &ctrl_entity_nil && str8_match(child_schema->string, str8_lit("dbg"), 0))
{
CTRL_Entity *dbg = ctrl_entity_child_from_kind(entity, CTRL_EntityKind_DebugInfoPath);
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), dbg->string.size, E_TypeFlag_IsPathText);
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), dbg->string.size, type_flags|E_TypeFlag_IsPathText);
}
//- rjf: cfg members
else if(str8_match(child_schema->first->string, str8_lit("code_string"), 0) ||
str8_match(child_schema->first->string, str8_lit("expr_string"), 0))
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, E_TypeFlag_IsCodeText);
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, type_flags|E_TypeFlag_IsCodeText);
}
else if(str8_match(child_schema->first->string, str8_lit("path"), 0) ||
str8_match(child_schema->first->string, str8_lit("path_pt"), 0))
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, E_TypeFlag_IsPathText);
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, type_flags|E_TypeFlag_IsPathText);
}
else if(str8_match(child_schema->first->string, str8_lit("string"), 0))
{
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, E_TypeFlag_IsPlainText);
child_type_key = e_type_key_cons_array(e_type_key_basic(E_TypeKind_U8), child->first->string.size, type_flags|E_TypeFlag_IsPlainText);
}
//- rjf: catchall cases
+5 -1
View File
@@ -62,6 +62,9 @@
"typedef union RDI_SHA256 RDI_SHA256;";
"union RDI_SHA256 {RDI_U8 u8[32]; RDI_U64 u64[4];};";
"";
"typedef union RDI_GUID RDI_GUID;";
"union RDI_GUID {RDI_U8 u8[16]; RDI_U64 u64[2];};";
"";
"////////////////////////////////////////////////////////////////";
"//~ Overridable Enabling/Disabling Of Table Index Typechecking";
"";
@@ -74,7 +77,7 @@
"";
"// \"raddbg\\0\\0\"";
"#define RDI_MAGIC_CONSTANT 0x0000676264646172";
"#define RDI_ENCODING_VERSION 16";
"#define RDI_ENCODING_VERSION 17";
"";
"////////////////////////////////////////////////////////////////";
"//~ Format Types & Functions";
@@ -495,6 +498,7 @@ RDI_TopLevelInfoMemberTable:
{exe_name_string_idx RDI_U32 ""}
{exe_hash RDI_U64 ""}
{voff_max RDI_U64 ""}
{guid RDI_GUID ""}
{producer_name_string_idx RDI_U32 ""}
}
+3
View File
@@ -587,11 +587,14 @@ lane_sync(); if(flags & RDI_DumpSubsetFlag_##name) ProfScope(#name)
{
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
Temp scratch = scratch_begin(&arena, 1);
Guid guid = {0};
MemoryCopy(&guid, &tli->guid, Min(sizeof guid, sizeof tli->guid));
dumpf("\n");
dumpf(" arch: %S\n", rdi_string_from_arch(scratch.arena, tli->arch));
dumpf(" exe_name: '%S'\n", str8_from_rdi_string_idx(rdi, tli->exe_name_string_idx));
dumpf(" voff_max: %#08llx\n", tli->voff_max);
dumpf(" producer_name: '%S'\n", str8_from_rdi_string_idx(rdi, tli->producer_name_string_idx));
dumpf(" guid: %S\n", string_from_guid(scratch.arena, guid));
scratch_end(scratch);
}
}
+1
View File
@@ -4395,6 +4395,7 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params)
top_level_info.voff_max = exe_voff_max;
if(!params->deterministic)
{
MemoryCopy(&top_level_info.guid.u8[0], &pdb_info->auth_guid.v[0], Min(sizeof top_level_info.guid.u8, sizeof pdb_info->auth_guid.v));
top_level_info.producer_name = str8_lit(BUILD_TITLE_STRING_LITERAL);
}
}
+1
View File
@@ -2994,6 +2994,7 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
rdim_shared->baked_top_level_info.top_level_info.exe_name_string_idx = rdim_bake_idx_from_string(bake_strings, params->top_level_info.exe_name);
rdim_shared->baked_top_level_info.top_level_info.exe_hash = params->top_level_info.exe_hash;
rdim_shared->baked_top_level_info.top_level_info.voff_max = params->top_level_info.voff_max;
rdim_shared->baked_top_level_info.top_level_info.guid = params->top_level_info.guid;
rdim_shared->baked_top_level_info.top_level_info.producer_name_string_idx = rdim_bake_idx_from_string(bake_strings, params->top_level_info.producer_name);
}
if(lane_idx() == lane_from_task_idx(1)) ProfScope("bake binary sections")