mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-20 10:54:59 -07:00
notes on 'eval space'; first step to evaluating debugger-space things
This commit is contained in:
@@ -3696,7 +3696,7 @@ df_eval_memory_read(void *u, void *out, Rng1U64 vaddr_range)
|
||||
if(process->kind == DF_EntityKind_Process)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
CTRL_ProcessMemorySlice slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, process->ctrl_machine_id, process->ctrl_handle, vaddr_range, 0);
|
||||
CTRL_ProcessMemorySlice slice = ctrl_query_cached_data_from_process_vaddr_range(scratch.arena, process->ctrl_machine_id, process->ctrl_handle, vaddr_range, df_state->frame_eval_memread_endt_us);
|
||||
String8 data = slice.data;
|
||||
if(data.size == dim_1u64(vaddr_range))
|
||||
{
|
||||
@@ -6128,6 +6128,7 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
df_state->frame_index += 1;
|
||||
arena_clear(df_frame_arena());
|
||||
df_state->frame_di_scope = di_scope_open();
|
||||
df_state->frame_eval_memread_endt_us = os_now_microseconds() + 10000;
|
||||
df_state->dt = dt;
|
||||
df_state->time_in_seconds += dt;
|
||||
df_state->top_interact_regs = &df_state->base_interact_regs;
|
||||
|
||||
@@ -1110,6 +1110,7 @@ struct DF_State
|
||||
// rjf: top-level state
|
||||
Arena *arena;
|
||||
U64 frame_index;
|
||||
U64 frame_eval_memread_endt_us;
|
||||
F64 time_in_seconds;
|
||||
F32 dt;
|
||||
F32 seconds_til_autosave;
|
||||
|
||||
@@ -956,6 +956,7 @@ e_parse_type_from_text_tokens(Arena *arena, String8 text, E_TokenArray *tokens)
|
||||
// rjf: construct leaf type
|
||||
parse.expr = e_push_expr(arena, E_ExprKind_TypeIdent, token_string.str);
|
||||
parse.expr->type_key = type_key;
|
||||
parse.expr->space = E_Space_Types;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1199,6 +1200,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
REGS_AliasCode alias_code = 0;
|
||||
E_TypeKey type_key = zero_struct;
|
||||
String8 local_lookup_string = token_string;
|
||||
E_Space space = 0;
|
||||
|
||||
//- rjf: form namespaceified fallback versions of this lookup string
|
||||
String8List namespaceified_token_strings = {0};
|
||||
@@ -1258,6 +1260,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
if(block->scope_off_first <= e_parse_ctx->ip_voff && e_parse_ctx->ip_voff < block->scope_off_opl)
|
||||
{
|
||||
mapped_identifier = 1;
|
||||
// space = e_parse_ctx->rdis_spaces[e_parse_ctx->rdis_primary_idx];
|
||||
U64 all_location_data_size = 0;
|
||||
U8 *all_location_data = rdi_table_from_name(e_parse_ctx->rdis[e_parse_ctx->rdis_primary_idx], LocationData, &all_location_data_size);
|
||||
loc_kind = *((RDI_LocationKind *)(all_location_data + block->location_data_off));
|
||||
@@ -1305,6 +1308,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
{
|
||||
reg_code = reg_num;
|
||||
mapped_identifier = 1;
|
||||
space = E_Space_Regs;
|
||||
type_key = e_type_key_reg(e_parse_ctx->arch, reg_code);
|
||||
}
|
||||
}
|
||||
@@ -1318,6 +1322,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
alias_code = (REGS_AliasCode)alias_num;
|
||||
type_key = e_type_key_reg_alias(e_parse_ctx->arch, alias_code);
|
||||
mapped_identifier = 1;
|
||||
space = E_Space_Regs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1475,6 +1480,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
e_oplist_push_uconst(arena, &oplist, reg_rng.byte_off);
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafBytecode, token_string.str);
|
||||
atom->mode = E_Mode_Reg;
|
||||
atom->space = space;
|
||||
atom->type_key = type_key;
|
||||
atom->string = e_bytecode_from_oplist(arena, &oplist);
|
||||
}
|
||||
@@ -1486,6 +1492,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
e_oplist_push_uconst(arena, &oplist, alias_reg_rng.byte_off + alias_slice.byte_off);
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafBytecode, token_string.str);
|
||||
atom->mode = E_Mode_Reg;
|
||||
atom->space = space;
|
||||
atom->type_key = type_key;
|
||||
atom->string = e_bytecode_from_oplist(arena, &oplist);
|
||||
}
|
||||
@@ -1498,6 +1505,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
{
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafBytecode, token_string.str);
|
||||
atom->mode = E_Mode_Addr;
|
||||
atom->space = space;
|
||||
atom->type_key = type_key;
|
||||
atom->string = loc_bytecode;
|
||||
}break;
|
||||
@@ -1518,6 +1526,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
e_oplist_push_op(arena, &oplist, RDI_EvalOp_Add, 0);
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafBytecode, token_string.str);
|
||||
atom->mode = E_Mode_Addr;
|
||||
atom->space = space;
|
||||
atom->type_key = type_key;
|
||||
atom->string = e_bytecode_from_oplist(arena, &oplist);
|
||||
}break;
|
||||
@@ -1532,6 +1541,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
e_oplist_push_op(arena, &oplist, RDI_EvalOp_MemRead, bit_size_from_arch(e_parse_ctx->arch)/8);
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafBytecode, token_string.str);
|
||||
atom->mode = E_Mode_Addr;
|
||||
atom->space = space;
|
||||
atom->type_key = type_key;
|
||||
atom->string = e_bytecode_from_oplist(arena, &oplist);
|
||||
}break;
|
||||
@@ -1546,6 +1556,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
||||
e_oplist_push_op(arena, &oplist, RDI_EvalOp_RegRead, regread_param);
|
||||
atom = e_push_expr(arena, E_ExprKind_LeafBytecode, token_string.str);
|
||||
atom->mode = E_Mode_Value;
|
||||
atom->space = E_Space_Values;
|
||||
atom->type_key = type_key;
|
||||
atom->string = e_bytecode_from_oplist(arena, &oplist);
|
||||
}break;
|
||||
|
||||
@@ -79,6 +79,27 @@ struct E_TokenArray
|
||||
////////////////////////////////
|
||||
//~ rjf: Expression Tree Types
|
||||
|
||||
typedef U64 E_Space;
|
||||
//
|
||||
// NOTE(rjf): Evaluations occur within the context of a "space". Each "space"
|
||||
// refers to a different offset or address space, but it's a bit looser of a
|
||||
// concept than just address space, since it can also refer to offsets into
|
||||
// a register block, only type information, or the "space" of all possibly
|
||||
// values. It is also used to refer to spaces of unique IDs for key-value
|
||||
// stores, e.g. for information in the debugger.
|
||||
//
|
||||
// Effectively, when considering the result of an evaluation, you use the
|
||||
// value for understanding a key *into* a space, e.g. 1+2 -> 3, in the space
|
||||
// of all values, or &foo, in the space of all addresses in PID: 1234.
|
||||
//
|
||||
enum
|
||||
{
|
||||
E_Space_Null,
|
||||
E_Space_Types, // values are not used; evaluation only contain type content
|
||||
E_Space_Values, // values do not refer to any space, but are standalone numeric values
|
||||
E_Space_Regs, // values index into evaluator thread's register block
|
||||
};
|
||||
|
||||
typedef enum E_Mode
|
||||
{
|
||||
E_Mode_Null,
|
||||
@@ -97,6 +118,7 @@ struct E_Expr
|
||||
void *location;
|
||||
E_ExprKind kind;
|
||||
E_Mode mode;
|
||||
E_Space space;
|
||||
E_TypeKey type_key;
|
||||
U32 u32;
|
||||
F32 f32;
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
//~ rjf: Frontend/UI Pass Tasks
|
||||
//
|
||||
// [x] fix HRESULTs
|
||||
//
|
||||
// [ ] EVAL LOOKUP RULES -> currently going 0 -> rdis_count, but we need
|
||||
// to prioritize the primary rdi
|
||||
// [ ] EVAL SPACES - each rdi gets an rdi space, rdi space is passed to
|
||||
// memory reads & so on, used to resolve to value space; REPLACES "mode"
|
||||
//
|
||||
// [ ] file overrides -> always pick most specific one! found with conflicting
|
||||
// overrides, e.g. C:/devel/ -> D:/devel/, but also C:/devel/foo ->
|
||||
// C:/devel/bar, etc.
|
||||
|
||||
Reference in New Issue
Block a user