mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-24 00:17:52 +00:00
extend file streaming cache to support range-based file stream queries; begin plugging in file stream queries as alternative to ctrl stream queries; further bugfixes & unification in eval system
This commit is contained in:
@@ -3905,6 +3905,48 @@ df_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal Rng1U64
|
||||
df_range_from_eval_cfg(E_Eval eval, DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
DF_CfgNode *size_cfg = df_cfg_node_child_from_string(cfg, str8_lit("size"), 0);
|
||||
String8 size_expr = df_string_from_cfg_node_children(scratch.arena, size_cfg);
|
||||
E_Eval size_eval = e_eval_from_string(scratch.arena, size_expr);
|
||||
E_Eval size_value_eval = e_value_eval_from_eval(size_eval);
|
||||
Rng1U64 result = {0};
|
||||
result.min = value_eval.value.u64;
|
||||
result.max = max_U64;
|
||||
if(size_eval.msgs.max_kind == E_MsgKind_Null)
|
||||
{
|
||||
result.max = result.min + size_value_eval.value.u64;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U128
|
||||
df_key_from_eval_space_range(E_Space space, Rng1U64 range)
|
||||
{
|
||||
U128 result = {0};
|
||||
DF_Entity *entity = df_entity_from_eval_space(space);
|
||||
switch(entity->kind)
|
||||
{
|
||||
//- rjf: nil space -> filesystem key encoded inside of `space`
|
||||
case DF_EntityKind_Nil:
|
||||
{
|
||||
result = space;
|
||||
}break;
|
||||
|
||||
//- rjf: process space -> query
|
||||
case DF_EntityKind_Process:
|
||||
{
|
||||
result = ctrl_hash_store_key_from_process_vaddr_range(entity->ctrl_machine_id, entity->ctrl_handle, range, 0);
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
internal E_Eval
|
||||
df_eval_from_eval_cfg_table(Arena *arena, E_Eval eval, DF_CfgTable *cfg)
|
||||
{
|
||||
|
||||
@@ -1577,6 +1577,8 @@ internal DF_Entity *df_entity_from_eval_space(E_Space space);
|
||||
internal E_Space df_eval_space_from_entity(DF_Entity *entity);
|
||||
internal B32 df_eval_space_read(void *u, E_Space space, void *out, Rng1U64 range);
|
||||
internal B32 df_eval_space_write(void *u, E_Space space, void *in, Rng1U64 range);
|
||||
internal Rng1U64 df_range_from_eval_cfg(E_Eval eval, DF_CfgNode *cfg);
|
||||
internal U128 df_key_from_eval_space_range(E_Space space, Rng1U64 range);
|
||||
internal E_Eval df_eval_from_eval_cfg_table(Arena *arena, E_Eval eval, DF_CfgTable *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -662,20 +662,10 @@ df_vr_txt_topology_info_from_cfg(DF_CfgNode *cfg)
|
||||
{
|
||||
StringJoin join = {0};
|
||||
join.sep = str8_lit(" ");
|
||||
DF_CfgNode *size_cfg = df_cfg_node_child_from_string(cfg, str8_lit("size"), 0);
|
||||
DF_CfgNode *lang_cfg = df_cfg_node_child_from_string(cfg, str8_lit("lang"), 0);
|
||||
String8List size_expr_strs = {0};
|
||||
String8 lang_string = {0};
|
||||
for(DF_CfgNode *child = size_cfg->first; child != &df_g_nil_cfg_node; child = child->next)
|
||||
{
|
||||
str8_list_push(scratch.arena, &size_expr_strs, child->string);
|
||||
}
|
||||
lang_string = lang_cfg->first->string;
|
||||
String8 size_expr = str8_list_join(scratch.arena, &size_expr_strs, &join);
|
||||
E_Eval size_eval = e_eval_from_string(scratch.arena, size_expr);
|
||||
E_Eval size_val_eval = e_value_eval_from_eval(size_eval);
|
||||
result.lang = txt_lang_kind_from_extension(lang_string);
|
||||
result.size_cap = size_val_eval.value.u64;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
@@ -711,12 +701,8 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
//////////////////////////////
|
||||
//- rjf: unpack evaluation / view rule params
|
||||
//
|
||||
DF_Entity *thread = df_entity_from_handle(df_interact_regs()->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
Rng1U64 range = df_range_from_eval_cfg(eval, cfg);
|
||||
DF_TxtTopologyInfo top = df_vr_txt_topology_info_from_cfg(cfg);
|
||||
E_Eval value_eval = e_value_eval_from_eval(eval);
|
||||
U64 base_vaddr = value_eval.value.u64;
|
||||
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr + (top.size_cap ? top.size_cap : 2048));
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: evaluation info -> text visualization info
|
||||
@@ -724,10 +710,9 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
String8 data = {0};
|
||||
TXT_TextInfo info = {0};
|
||||
TXT_LineTokensSlice line_tokens_slice = {0};
|
||||
U128 text_key = {0};
|
||||
U128 text_key = df_key_from_eval_space_range(eval.space, range);
|
||||
{
|
||||
U128 text_hash = {0};
|
||||
text_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 1);
|
||||
info = txt_text_info_from_key_lang(txt_scope, text_key, top.lang, &text_hash);
|
||||
data = hs_data_from_hash(hs_scope, text_hash);
|
||||
line_tokens_slice = txt_line_tokens_slice_from_info_data_line_range(scratch.arena, &info, data, r1s64(1, info.lines_count));
|
||||
|
||||
@@ -24,7 +24,6 @@ typedef struct DF_TxtTopologyInfo DF_TxtTopologyInfo;
|
||||
struct DF_TxtTopologyInfo
|
||||
{
|
||||
TXT_LangKind lang;
|
||||
U64 size_cap;
|
||||
};
|
||||
|
||||
typedef struct DF_VR_TextState DF_VR_TextState;
|
||||
|
||||
@@ -6448,7 +6448,7 @@ DF_VIEW_CMD_FUNCTION_DEF(Code)
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
String8 path = df_interact_regs()->file_path;
|
||||
df_interact_regs()->text_key = fs_key_from_path(path);
|
||||
df_interact_regs()->text_key = fs_key_from_path_range(path, r1u64(0, max_U64));
|
||||
df_interact_regs()->lang_kind = txt_lang_kind_from_extension(str8_skip_last_dot(path));
|
||||
U128 hash = {0};
|
||||
TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, df_interact_regs()->text_key, df_interact_regs()->lang_kind, &hash);
|
||||
@@ -6519,7 +6519,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
//- rjf: unpack entity info
|
||||
//
|
||||
String8 path = df_interact_regs()->file_path;
|
||||
df_interact_regs()->text_key = fs_key_from_path(path);
|
||||
df_interact_regs()->text_key = fs_key_from_path_range(path, r1u64(0, max_U64));
|
||||
df_interact_regs()->lang_kind = txt_lang_kind_from_extension(str8_skip_last_dot(path));
|
||||
U128 hash = {0};
|
||||
TXT_TextInfo info = txt_text_info_from_key_lang(txt_scope, df_interact_regs()->text_key, df_interact_regs()->lang_kind, &hash);
|
||||
|
||||
Reference in New Issue
Block a user