mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-24 12:44:59 -07:00
sketch out unattached process evaluation
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
//- GENERATED CODE
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
RD_VocabInfo rd_vocab_info_table[288] =
|
||||
RD_VocabInfo rd_vocab_info_table[289] =
|
||||
{
|
||||
{str8_lit_comp("auto_view_rule"), str8_lit_comp("auto_view_rules"), str8_lit_comp("Auto View Rule"), str8_lit_comp("Auto View Rules"), 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},
|
||||
@@ -82,6 +82,7 @@ RD_VocabInfo rd_vocab_info_table[288] =
|
||||
{str8_lit_comp("last_modified_time"), str8_lit_comp("last_modified_times"), str8_lit_comp("Last Modified Time"), str8_lit_comp("Last Modified Times"), RD_IconKind_Null},
|
||||
{str8_lit_comp("creation_time"), str8_lit_comp("creation_times"), str8_lit_comp("Creation Time"), str8_lit_comp("Creation Times"), RD_IconKind_Null},
|
||||
{str8_lit_comp("data"), str8_lit_comp("datas"), str8_lit_comp("Data"), str8_lit_comp("Datas"), RD_IconKind_Null},
|
||||
{str8_lit_comp("unattached_processes"), str8_lit_comp(""), str8_lit_comp("Unattached Processes"), str8_lit_comp(""), RD_IconKind_Scheduler},
|
||||
{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_init"), str8_lit_comp(""), str8_lit_comp("Launch and Initialize"), str8_lit_comp(""), RD_IconKind_PlayStepForward},
|
||||
{str8_lit_comp("kill"), str8_lit_comp(""), str8_lit_comp("Kill"), str8_lit_comp(""), RD_IconKind_X},
|
||||
@@ -304,7 +305,7 @@ RD_NameSchemaInfo rd_name_schema_info_table[10] =
|
||||
{str8_lit_comp("watch_pin"), str8_lit_comp("@commands(remove_cfg)\n@collection_commands(add_watch_pin)\nx:\n{\n 'expression': code_string,\n 'view_rule': code_string,\n 'location': location,\n}\n")},
|
||||
{str8_lit_comp("file_path_map"), str8_lit_comp("@collection_commands(add_file_path_map) @commands(remove_cfg) x:{'source':path, 'dest':path}")},
|
||||
{str8_lit_comp("auto_view_rule"), str8_lit_comp("@collection_commands(add_auto_view_rule) @commands(remove_cfg) x:{'source':code_string, 'dest':code_string}")},
|
||||
{str8_lit_comp("machine"), str8_lit_comp("x:{'label':code_string, 'frozen':bool, 'processes':query}")},
|
||||
{str8_lit_comp("machine"), str8_lit_comp("x:{'label':code_string, 'frozen':bool, 'unattached_processes':query, 'processes':query}")},
|
||||
{str8_lit_comp("process"), str8_lit_comp("x:{'label':code_string, 'id':u64, 'frozen':bool, 'modules':query, 'threads':query}")},
|
||||
{str8_lit_comp("module"), str8_lit_comp("x:{'exe':path, 'dbg':path, 'vaddr_range':vaddr_range}")},
|
||||
{str8_lit_comp("thread"), str8_lit_comp("x:{'label':code_string, 'id':u64, 'frozen':bool, 'call_stack':query}")},
|
||||
|
||||
@@ -555,7 +555,7 @@ RD_Query query;
|
||||
.os_event = rd_regs()->os_event,\
|
||||
|
||||
C_LINKAGE_BEGIN
|
||||
extern RD_VocabInfo rd_vocab_info_table[288];
|
||||
extern RD_VocabInfo rd_vocab_info_table[289];
|
||||
extern RD_NameSchemaInfo rd_name_schema_info_table[10];
|
||||
extern Rng1U64 rd_reg_slot_range_table[38];
|
||||
extern String8 rd_binding_version_remap_old_name_table[8];
|
||||
|
||||
@@ -94,6 +94,7 @@ RD_VocabTable:
|
||||
{last_modified_time _ "Last Modified Time" _ Null }
|
||||
{creation_time _ "Creation Time" _ Null }
|
||||
{data _ "Data" _ Null }
|
||||
{unattached_processes "" "Unattached Processes" "" Scheduler }
|
||||
}
|
||||
|
||||
@struct RD_VocabInfo:
|
||||
@@ -214,7 +215,7 @@ RD_VocabTable:
|
||||
//- rjf: control entities
|
||||
{
|
||||
machine,
|
||||
```x:{'label':code_string, 'frozen':bool, 'processes':query}```,
|
||||
```x:{'label':code_string, 'frozen':bool, 'unattached_processes':query, 'processes':query}```,
|
||||
}
|
||||
{
|
||||
process,
|
||||
|
||||
@@ -575,6 +575,97 @@ E_LOOKUP_NUM_FROM_ID_FUNCTION_DEF(environment)
|
||||
return num;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Unattached System Process List Eval Hooks
|
||||
|
||||
typedef struct RD_UnattachedProcessesAccel RD_UnattachedProcessesAccel;
|
||||
struct RD_UnattachedProcessesAccel
|
||||
{
|
||||
DMN_ProcessInfo *infos;
|
||||
U64 infos_count;
|
||||
};
|
||||
|
||||
E_LOOKUP_INFO_FUNCTION_DEF(unattached_processes)
|
||||
{
|
||||
E_LookupInfo info = {0};
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
//- rjf: evaluate lhs machine
|
||||
E_OpList lhs_oplist = e_oplist_from_irtree(scratch.arena, lhs->root);
|
||||
String8 lhs_bytecode = e_bytecode_from_oplist(scratch.arena, &lhs_oplist);
|
||||
E_Interpretation lhs_interp = e_interpret(lhs_bytecode);
|
||||
CTRL_Entity *lhs_entity = rd_ctrl_entity_from_eval_space(lhs_interp.space);
|
||||
|
||||
//- rjf: gather system processes from this machine
|
||||
typedef struct Node Node;
|
||||
struct Node
|
||||
{
|
||||
Node *next;
|
||||
DMN_ProcessInfo info;
|
||||
};
|
||||
Node *first = 0;
|
||||
Node *last = 0;
|
||||
if(lhs_entity->kind == CTRL_EntityKind_Machine)
|
||||
{
|
||||
DMN_ProcessIter iter = {0};
|
||||
dmn_process_iter_begin(&iter);
|
||||
for(DMN_ProcessInfo info = {0}; dmn_process_iter_next(scratch.arena, &iter, &info);)
|
||||
{
|
||||
Node *node = push_array(scratch.arena, Node, 1);
|
||||
SLLQueuePush(first, last, node);
|
||||
node->info = info;
|
||||
}
|
||||
dmn_process_iter_end(&iter);
|
||||
}
|
||||
|
||||
//- rjf: list -> filtered list
|
||||
Node *first_filtered = 0;
|
||||
Node *last_filtered = 0;
|
||||
U64 filtered_count = 0;
|
||||
for(Node *n = first; n != 0; n = n->next)
|
||||
{
|
||||
Node *node = push_array(scratch.arena, Node, 1);
|
||||
SLLQueuePush(first_filtered, last_filtered, node);
|
||||
node->info = n->info;
|
||||
filtered_count += 1;
|
||||
}
|
||||
|
||||
//- rjf: list -> array
|
||||
U64 infos_count = filtered_count;
|
||||
DMN_ProcessInfo *infos = push_array(arena, DMN_ProcessInfo, infos_count);
|
||||
{
|
||||
U64 idx = 0;
|
||||
for(Node *n = first_filtered; n != 0; n = n->next, idx += 1)
|
||||
{
|
||||
infos[idx] = n->info;
|
||||
infos[idx].name = push_str8_copy(arena, infos[idx].name);
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: build accelerator
|
||||
RD_UnattachedProcessesAccel *accel = push_array(arena, RD_UnattachedProcessesAccel, 1);
|
||||
accel->infos = infos;
|
||||
accel->infos_count = infos_count;
|
||||
info.user_data = accel;
|
||||
info.idxed_expr_count = infos_count;
|
||||
scratch_end(scratch);
|
||||
}
|
||||
return info;
|
||||
}
|
||||
|
||||
E_LOOKUP_RANGE_FUNCTION_DEF(unattached_processes)
|
||||
{
|
||||
RD_UnattachedProcessesAccel *accel = (RD_UnattachedProcessesAccel *)user_data;
|
||||
U64 out_idx = 0;
|
||||
for(U64 idx = idx_range.min; idx < idx_range.max; idx += 1, out_idx += 1)
|
||||
{
|
||||
E_Expr *expr = e_push_expr(arena, E_ExprKind_LeafU64, 0);
|
||||
expr->value.u64 = accel->infos[idx].pid;
|
||||
exprs[out_idx] = expr;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Control Entity Eval Hooks
|
||||
|
||||
@@ -12319,6 +12410,10 @@ rd_frame(void)
|
||||
{
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, entity->string, expr);
|
||||
}
|
||||
if(kind == CTRL_EntityKind_Machine && entity->handle.machine_id == CTRL_MachineID_Local)
|
||||
{
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, str8_lit("local_machine"), expr);
|
||||
}
|
||||
if(kind == CTRL_EntityKind_Thread && ctrl_handle_match(rd_base_regs()->thread, entity->handle))
|
||||
{
|
||||
e_string2expr_map_insert(scratch.arena, ctx->macro_map, str8_lit("current_thread"), expr);
|
||||
@@ -12449,6 +12544,13 @@ rd_frame(void)
|
||||
.access = E_LOOKUP_ACCESS_FUNCTION_NAME(ctrl_entities));
|
||||
}
|
||||
|
||||
//- rjf: add lookup rules for unattached processes on a machine
|
||||
{
|
||||
e_lookup_rule_map_insert_new(scratch.arena, ctx->lookup_rule_map, str8_lit("unattached_processes"),
|
||||
.info = E_LOOKUP_INFO_FUNCTION_NAME(unattached_processes),
|
||||
.range = E_LOOKUP_RANGE_FUNCTION_NAME(unattached_processes));
|
||||
}
|
||||
|
||||
//- rjf: add macro for commands
|
||||
{
|
||||
String8 name = str8_lit("commands");
|
||||
|
||||
Reference in New Issue
Block a user