Skip to content

Commit c318c10

Browse files
committed
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
1 parent e83a95f commit c318c10

File tree

15 files changed

+125
-51
lines changed

15 files changed

+125
-51
lines changed

src/eval/eval_core.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,12 @@ enum
384384
E_TypeFlag_IsCodeText = (1<<4),
385385
E_TypeFlag_IsPathText = (1<<5),
386386
E_TypeFlag_IsNotText = (1<<6),
387-
E_TypeFlag_EditableChildren = (1<<7),
388-
E_TypeFlag_InheritedByMembers = (1<<8),
389-
E_TypeFlag_InheritedByElements = (1<<9),
390-
E_TypeFlag_ArrayLikeExpansion = (1<<10),
391-
E_TypeFlag_StubSingleLineExpansion = (1<<11),
387+
E_TypeFlag_IsNotEditable = (1<<7),
388+
E_TypeFlag_EditableChildren = (1<<8),
389+
E_TypeFlag_InheritedByMembers = (1<<9),
390+
E_TypeFlag_InheritedByElements = (1<<10),
391+
E_TypeFlag_ArrayLikeExpansion = (1<<11),
392+
E_TypeFlag_StubSingleLineExpansion = (1<<12),
392393
};
393394

394395
typedef struct E_Member E_Member;

src/eval_visualization/eval_visualization_core.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,14 @@ ev_type_key_is_editable(E_TypeKey type_key)
150150
B32 done = 0;
151151
for(E_TypeKey t = type_key; !result && !done; t = e_type_key_direct(t))
152152
{
153-
E_TypeKind kind = e_type_kind_from_key(t);
154-
switch(kind)
153+
E_Type *type = e_type_from_key(t);
154+
E_TypeKind kind = type->kind;
155+
if(type->flags & E_TypeFlag_IsNotEditable)
156+
{
157+
result = 0;
158+
done = 1;
159+
}
160+
else switch(kind)
155161
{
156162
case E_TypeKind_Null:
157163
case E_TypeKind_Function:
@@ -167,7 +173,6 @@ ev_type_key_is_editable(E_TypeKey type_key)
167173
}break;
168174
case E_TypeKind_Array:
169175
{
170-
E_Type *type = e_type_from_key(t);
171176
if(type->flags & E_TypeFlag_IsNotText)
172177
{
173178
result = 0;

src/lib_rdi/rdi.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ union RDI_SHA1 {RDI_U8 u8[20];};
5252
typedef union RDI_SHA256 RDI_SHA256;
5353
union RDI_SHA256 {RDI_U8 u8[32]; RDI_U64 u64[4];};
5454

55+
typedef union RDI_GUID RDI_GUID;
56+
union RDI_GUID {RDI_U8 u8[16]; RDI_U64 u64[2];};
57+
5558
////////////////////////////////////////////////////////////////
5659
//~ Overridable Enabling/Disabling Of Table Index Typechecking
5760

@@ -64,7 +67,7 @@ union RDI_SHA256 {RDI_U8 u8[32]; RDI_U64 u64[4];};
6467

6568
// "raddbg\0\0"
6669
#define RDI_MAGIC_CONSTANT 0x0000676264646172
67-
#define RDI_ENCODING_VERSION 16
70+
#define RDI_ENCODING_VERSION 17
6871

6972
////////////////////////////////////////////////////////////////
7073
//~ Format Types & Functions
@@ -807,6 +810,7 @@ X(RDI_Arch, arch)\
807810
X(RDI_U32, exe_name_string_idx)\
808811
X(RDI_U64, exe_hash)\
809812
X(RDI_U64, voff_max)\
813+
X(RDI_GUID, guid)\
810814
X(RDI_U32, producer_name_string_idx)\
811815

812816
#define RDI_BinarySectionFlags_XList \
@@ -1283,6 +1287,7 @@ RDI_Arch arch;
12831287
RDI_U32 exe_name_string_idx;
12841288
RDI_U64 exe_hash;
12851289
RDI_U64 voff_max;
1290+
RDI_GUID guid;
12861291
RDI_U32 producer_name_string_idx;
12871292
};
12881293

src/lib_rdi_make/rdi_make.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,6 +1196,11 @@ rdim_bake_params_concat_in_place(RDIM_BakeParams *dst, RDIM_BakeParams *src)
11961196
{
11971197
dst->top_level_info.voff_max = src->top_level_info.voff_max;
11981198
}
1199+
if(dst->top_level_info.guid.u64[0] == 0 &&
1200+
dst->top_level_info.guid.u64[1] == 0)
1201+
{
1202+
dst->top_level_info.guid = src->top_level_info.guid;
1203+
}
11991204
if(dst->top_level_info.producer_name.size == 0)
12001205
{
12011206
dst->top_level_info.producer_name = src->top_level_info.producer_name;

src/lib_rdi_make/rdi_make.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,7 @@ struct RDIM_TopLevelInfo
499499
RDIM_String8 exe_name;
500500
RDI_U64 exe_hash;
501501
RDI_U64 voff_max;
502+
RDI_GUID guid;
502503
RDIM_String8 producer_name;
503504
};
504505

src/radbin/radbin.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ rb_thread_entry_point(void *p)
851851
{
852852
unique_identifier_string = str8f(arena, "%I64x", bake_params->top_level_info.exe_hash);
853853
}
854-
if(unique_identifier_string.size == 0 && input_files.first != 0 && input_files.first->v->format == RB_FileFormat_PDB)
854+
if(unique_identifier_string.size == 0)
855855
{
856856
Temp scratch = scratch_begin(&arena, 1);
857857
String8 msf_data = input_files.first->v->data;

src/raddbg/generated/raddbg.meta.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ str8_lit_comp(""),
6262
str8_lit_comp(""),
6363
};
6464

65-
RD_VocabInfo rd_vocab_info_table[357] =
65+
RD_VocabInfo rd_vocab_info_table[358] =
6666
{
6767
{str8_lit_comp("type_view"), str8_lit_comp("type_views"), str8_lit_comp("Type View"), str8_lit_comp("Type Views"), RD_IconKind_Binoculars},
6868
{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] =
174174
{str8_lit_comp("tab_height"), str8_lit_comp(""), str8_lit_comp("Tab Height"), str8_lit_comp(""), RD_IconKind_Null},
175175
{str8_lit_comp("rgba"), str8_lit_comp(""), str8_lit_comp("RGBA"), str8_lit_comp(""), RD_IconKind_Palette},
176176
{str8_lit_comp("path"), str8_lit_comp(""), str8_lit_comp("Path"), str8_lit_comp(""), RD_IconKind_FileOutline},
177+
{str8_lit_comp("guid"), str8_lit_comp(""), str8_lit_comp("GUID"), str8_lit_comp(""), RD_IconKind_Null},
177178
{str8_lit_comp("launch_and_run"), str8_lit_comp(""), str8_lit_comp("Launch and Run"), str8_lit_comp(""), RD_IconKind_Play},
178179
{str8_lit_comp("launch_and_step_into"), str8_lit_comp(""), str8_lit_comp("Launch and Step Into"), str8_lit_comp(""), RD_IconKind_PlayStepForward},
179180
{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] =
442443
{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")},
443444
{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")},
444445
{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")},
445-
{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")},
446+
{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")},
446447
{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}")},
447448
{str8_lit_comp("type_view"), str8_lit_comp("@collection_commands(add_type_view) @row_commands(remove_cfg) x:{'type':expr_string, 'expr':expr_string}")},
448449
{str8_lit_comp("recent_project"), str8_lit_comp("x:{'path':path}")},

src/raddbg/generated/raddbg.meta.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ Z(getting_started)\
595595
C_LINKAGE_BEGIN
596596
extern String8 rd_tab_fast_path_view_name_table[25];
597597
extern String8 rd_tab_fast_path_query_name_table[25];
598-
extern RD_VocabInfo rd_vocab_info_table[357];
598+
extern RD_VocabInfo rd_vocab_info_table[358];
599599
extern RD_NameSchemaInfo rd_name_schema_info_table[26];
600600
extern String8 rd_reg_slot_code_name_table[47];
601601
extern Rng1U64 rd_reg_slot_range_table[47];

src/raddbg/raddbg.mdesk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ RD_VocabTable:
199199
{tab_height "" "Tab Height" "" Null }
200200
{rgba "" "RGBA" "" Palette }
201201
{path "" "Path" "" FileOutline }
202+
{guid "" "GUID" "" Null }
202203
}
203204

204205
@struct RD_VocabInfo:
@@ -669,6 +670,7 @@ RD_VocabTable:
669670
x:
670671
{
671672
'path': @no_relativize path,
673+
@query 'guid': string,
672674
@no_revert @no_expand @default(1) 'enabled': bool,
673675
}
674676
```,

src/raddbg/raddbg_core.c

Lines changed: 74 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ rd_eval_space_read(E_Space space, void *out, Rng1U64 range)
789789
//- rjf: meta-config reads
790790
case RD_EvalSpaceKind_MetaCfg:
791791
{
792-
// rjf: unpack cfg
792+
//- rjf: unpack cfg
793793
CFG_Node *root_cfg = rd_cfg_from_eval_space(space);
794794
String8 child_key = e_string_from_id(space.u64s[1]);
795795
CFG_Node *cfg = root_cfg;
@@ -798,54 +798,85 @@ rd_eval_space_read(E_Space space, void *out, Rng1U64 range)
798798
cfg = cfg_node_child_from_string(root_cfg, child_key);
799799
}
800800

801-
// rjf: determine data to read from, depending on child type in schema
801+
//- rjf: determine data to read from, depending on child type in schema
802802
String8 read_data = {0};
803803
if(child_key.size != 0)
804804
{
805-
MD_NodePtrList schemas = cfg_schemas_from_name(scratch.arena, rd_state->cfg_schema_table, root_cfg->string);
806-
MD_Node *expr_child_schema = &md_nil_node;
805+
// rjf: get schemas for the accessed child
807806
MD_Node *child_schema = &md_nil_node;
808-
for(MD_NodePtrNode *n = schemas.first; n != 0 && child_schema == &md_nil_node; n = n->next)
807+
MD_Node *expr_child_schema = &md_nil_node;
809808
{
810-
child_schema = md_child_from_string(n->v, child_key, 0);
811-
if(child_schema != &md_nil_node)
809+
MD_NodePtrList schemas = cfg_schemas_from_name(scratch.arena, rd_state->cfg_schema_table, root_cfg->string);
810+
for(MD_NodePtrNode *n = schemas.first; n != 0 && child_schema == &md_nil_node; n = n->next)
812811
{
813-
expr_child_schema = md_child_from_string(n->v, str8_lit("expression"), 0);
812+
child_schema = md_child_from_string(n->v, child_key, 0);
813+
if(child_schema != &md_nil_node)
814+
{
815+
expr_child_schema = md_child_from_string(n->v, str8_lit("expression"), 0);
816+
}
814817
}
815818
}
816819
String8 child_type_name = child_schema->first->string;
820+
821+
// rjf: get value string (or default fallback)
822+
String8 value_string = cfg->first->string;
823+
if(value_string.size == 0)
824+
{
825+
value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string;
826+
}
827+
828+
// rjf: if this is an override child to a parent, fall back on defaults from parents
829+
if(value_string.size == 0 && !md_node_is_nil(md_tag_from_string(child_schema, str8_lit("override"), 0)))
830+
{
831+
for(CFG_Node *parent = root_cfg->parent; parent != &cfg_nil_node; parent = parent->parent)
832+
{
833+
CFG_Node *parent_child_w_key = cfg_node_child_from_string(parent, child_key);
834+
if(parent_child_w_key != &cfg_nil_node)
835+
{
836+
value_string = parent_child_w_key->first->string;
837+
break;
838+
}
839+
value_string = rd_default_setting_from_names(parent->string, child_key);
840+
if(value_string.size != 0)
841+
{
842+
break;
843+
}
844+
}
845+
}
846+
847+
// rjf: if this is a query -> compute the value string based on query path
848+
if(md_node_has_tag(child_schema, str8_lit("query"), 0))
849+
{
850+
// TODO(rjf): this needs to be replaced by hooks
851+
if(str8_match(child_schema->string, str8_lit("guid"), 0))
852+
{
853+
Access *access = access_open();
854+
String8 path = rd_path_from_cfg(root_cfg);
855+
U64 timestamp = 0;
856+
try_u64_from_str8_c_rules(cfg_node_child_from_string(root_cfg, str8_lit("timestamp"))->first->string, &timestamp);
857+
DI_Key key = di_key_from_path_timestamp(path, timestamp);
858+
RDI_Parsed *rdi = di_rdi_from_key(access, key, 0, 0);
859+
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
860+
Guid guid = {0};
861+
MemoryCopy(&guid, &tli->guid, Min(sizeof guid, sizeof tli->guid));
862+
value_string = string_from_guid(scratch.arena, guid);
863+
access_close(access);
864+
}
865+
}
866+
867+
// rjf: textual data
817868
if(str8_match(child_type_name, str8_lit("path"), 0) ||
818869
str8_match(child_type_name, str8_lit("path_pt"), 0) ||
819870
str8_match(child_type_name, str8_lit("code_string"), 0) ||
820871
str8_match(child_type_name, str8_lit("expr_string"), 0) ||
821872
str8_match(child_type_name, str8_lit("string"), 0))
822873
{
823-
read_data = cfg->first->string;
874+
read_data = value_string;
824875
}
876+
877+
// rjf: non-textual data
825878
else
826879
{
827-
String8 value_string = cfg->first->string;
828-
if(value_string.size == 0)
829-
{
830-
value_string = md_tag_from_string(child_schema, str8_lit("default"), 0)->first->string;
831-
}
832-
if(value_string.size == 0 && !md_node_is_nil(md_tag_from_string(child_schema, str8_lit("override"), 0)))
833-
{
834-
for(CFG_Node *parent = root_cfg->parent; parent != &cfg_nil_node; parent = parent->parent)
835-
{
836-
CFG_Node *parent_child_w_key = cfg_node_child_from_string(parent, child_key);
837-
if(parent_child_w_key != &cfg_nil_node)
838-
{
839-
value_string = parent_child_w_key->first->string;
840-
break;
841-
}
842-
value_string = rd_default_setting_from_names(parent->string, child_key);
843-
if(value_string.size != 0)
844-
{
845-
break;
846-
}
847-
}
848-
}
849880
E_Key parent_key = {0};
850881
if(expr_child_schema != &md_nil_node && child_schema != expr_child_schema)
851882
{
@@ -11471,6 +11502,18 @@ rd_frame(void)
1147111502
.id_from_num = E_TYPE_EXPAND_ID_FROM_NUM_FUNCTION_NAME(cfgs_slice),
1147211503
.num_from_id = E_TYPE_EXPAND_NUM_FROM_ID_FUNCTION_NAME(cfgs_slice),
1147311504
}));
11505+
e_string2typekey_map_insert(rd_frame_arena(), rd_state->meta_name2type_map, str8_lit("environment"),
11506+
e_type_key_cons(.kind = E_TypeKind_Set,
11507+
.name = str8_lit("environment"),
11508+
.irext = E_TYPE_IREXT_FUNCTION_NAME(environment),
11509+
.access = E_TYPE_ACCESS_FUNCTION_NAME(environment),
11510+
.expand =
11511+
{
11512+
.info = E_TYPE_EXPAND_INFO_FUNCTION_NAME(environment),
11513+
.range = E_TYPE_EXPAND_RANGE_FUNCTION_NAME(environment),
11514+
.id_from_num = E_TYPE_EXPAND_ID_FROM_NUM_FUNCTION_NAME(environment),
11515+
.num_from_id = E_TYPE_EXPAND_NUM_FROM_ID_FUNCTION_NAME(environment),
11516+
}));
1147411517
}
1147511518

1147611519
//- rjf: add macro for collections with specific lookup rules (but no unique id rules)

0 commit comments

Comments
 (0)