mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-07-28 18:20:02 +00:00
notes on 'eval space'; first step to evaluating debugger-space things
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user