mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 13:28:40 +00:00
finish sketching out complex synthetic type construction; tear out unneeded leaf external evaluation (we can just use the macro map & separate address spaces); sketch out scaffolding for a thread evaluation type
This commit is contained in:
+22
-2
@@ -8846,8 +8846,6 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
|||||||
ctx->reg_alias_map = ctrl_string2alias_from_arch(ctx->arch);
|
ctx->reg_alias_map = ctrl_string2alias_from_arch(ctx->arch);
|
||||||
ctx->locals_map = df_query_cached_locals_map_from_dbgi_key_voff(&primary_dbgi_key, rip_voff);
|
ctx->locals_map = df_query_cached_locals_map_from_dbgi_key_voff(&primary_dbgi_key, rip_voff);
|
||||||
ctx->member_map = df_query_cached_member_map_from_dbgi_key_voff(&primary_dbgi_key, rip_voff);
|
ctx->member_map = df_query_cached_member_map_from_dbgi_key_voff(&primary_dbgi_key, rip_voff);
|
||||||
ctx->ext_map = push_array(arena, E_String2NumMap, 1);
|
|
||||||
*ctx->ext_map = e_string2num_map_make(arena, 512);
|
|
||||||
}
|
}
|
||||||
e_select_parse_ctx(parse_ctx);
|
e_select_parse_ctx(parse_ctx);
|
||||||
|
|
||||||
@@ -8875,6 +8873,28 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
|||||||
expr->u64 = thread->ctrl_id;
|
expr->u64 = thread->ctrl_id;
|
||||||
e_string2expr_map_insert(arena, ctx->macro_map, str8_lit("tid"), expr);
|
e_string2expr_map_insert(arena, ctx->macro_map, str8_lit("tid"), expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// rjf: thread -> current thread info
|
||||||
|
if(!df_entity_is_nil(thread))
|
||||||
|
{
|
||||||
|
E_MemberList members_list = {0};
|
||||||
|
{
|
||||||
|
E_Member tid_member =
|
||||||
|
{
|
||||||
|
.kind = E_MemberKind_DataField,
|
||||||
|
.type_key = e_type_key_basic(E_TypeKind_U32),
|
||||||
|
.name = str8_lit("tid"),
|
||||||
|
.off = 0,
|
||||||
|
};
|
||||||
|
e_member_list_push(arena, &members_list, &tid_member);
|
||||||
|
}
|
||||||
|
E_MemberArray members = e_member_array_from_list(arena, &members_list);
|
||||||
|
E_TypeKey thread_type_key = e_type_key_cons(.kind = E_TypeKind_Struct, .count = members.count, .members = members.v, .name = str8_lit("Thread"));
|
||||||
|
E_Expr *expr = e_push_expr(arena, E_ExprKind_LeafBytecode, 0);
|
||||||
|
expr->u64 = thread->ctrl_id;
|
||||||
|
expr->type_key = thread_type_key;
|
||||||
|
e_string2expr_map_insert(arena, ctx->macro_map, str8_lit("thread"), expr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: add macros for all watches which define identifiers
|
//- rjf: add macros for all watches which define identifiers
|
||||||
|
|||||||
@@ -106,7 +106,6 @@ E_ExprKindTable:
|
|||||||
{ LeafF64 "F64" }
|
{ LeafF64 "F64" }
|
||||||
{ LeafF32 "F32" }
|
{ LeafF32 "F32" }
|
||||||
{ LeafIdent "leaf_ident" }
|
{ LeafIdent "leaf_ident" }
|
||||||
{ LeafExt "leaf_ext" }
|
|
||||||
|
|
||||||
{ TypeIdent "type_ident" }
|
{ TypeIdent "type_ident" }
|
||||||
{ Ptr "ptr" }
|
{ Ptr "ptr" }
|
||||||
|
|||||||
+2
-7
@@ -1097,13 +1097,6 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
|
|||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
//- rjf: leaf externals
|
|
||||||
case E_ExprKind_LeafExt:
|
|
||||||
{
|
|
||||||
result.root = e_irtree_const_u(arena, expr->u64);
|
|
||||||
result.mode = E_Mode_Ext;
|
|
||||||
}break;
|
|
||||||
|
|
||||||
//- rjf: types
|
//- rjf: types
|
||||||
case E_ExprKind_TypeIdent:
|
case E_ExprKind_TypeIdent:
|
||||||
{
|
{
|
||||||
@@ -1163,6 +1156,7 @@ e_append_oplist_from_irtree(Arena *arena, E_IRNode *root, E_OpList *out)
|
|||||||
// 1. generate a const-u64 value on the stack, encoding the offset of the
|
// 1. generate a const-u64 value on the stack, encoding the offset of the
|
||||||
// data within the bytecode stream
|
// data within the bytecode stream
|
||||||
// 2. generate a 'skip' instruction, to skip past the data
|
// 2. generate a 'skip' instruction, to skip past the data
|
||||||
|
// 3. generate the actual data
|
||||||
//
|
//
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
E_OpList header_calcsize_ops = {0};
|
E_OpList header_calcsize_ops = {0};
|
||||||
@@ -1170,6 +1164,7 @@ e_append_oplist_from_irtree(Arena *arena, E_IRNode *root, E_OpList *out)
|
|||||||
e_oplist_push_op(scratch.arena, &header_calcsize_ops, RDI_EvalOp_Skip, 0);
|
e_oplist_push_op(scratch.arena, &header_calcsize_ops, RDI_EvalOp_Skip, 0);
|
||||||
e_oplist_push_op(arena, out, RDI_EvalOp_ConstU64, out->encoded_size + header_calcsize_ops.encoded_size);
|
e_oplist_push_op(arena, out, RDI_EvalOp_ConstU64, out->encoded_size + header_calcsize_ops.encoded_size);
|
||||||
e_oplist_push_op(arena, out, RDI_EvalOp_Skip, root->string.size);
|
e_oplist_push_op(arena, out, RDI_EvalOp_Skip, root->string.size);
|
||||||
|
e_oplist_push_data(arena, out, root->string);
|
||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}break;
|
}break;
|
||||||
|
|
||||||
|
|||||||
+1
-19
@@ -1174,7 +1174,6 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
|||||||
REGS_AliasCode alias_code = 0;
|
REGS_AliasCode alias_code = 0;
|
||||||
E_TypeKey type_key = zero_struct;
|
E_TypeKey type_key = zero_struct;
|
||||||
String8 local_lookup_string = token_string;
|
String8 local_lookup_string = token_string;
|
||||||
U64 ext_num = 0;
|
|
||||||
|
|
||||||
//- rjf: form namespaceified fallback versions of this lookup string
|
//- rjf: form namespaceified fallback versions of this lookup string
|
||||||
String8List namespaceified_token_strings = {0};
|
String8List namespaceified_token_strings = {0};
|
||||||
@@ -1414,16 +1413,6 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: try external map
|
|
||||||
if(mapped_identifier == 0)
|
|
||||||
{
|
|
||||||
ext_num = e_num_from_string(e_parse_ctx->ext_map, token_string);
|
|
||||||
if(ext_num != 0)
|
|
||||||
{
|
|
||||||
mapped_identifier = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//- rjf: try types
|
//- rjf: try types
|
||||||
if(mapped_identifier == 0)
|
if(mapped_identifier == 0)
|
||||||
{
|
{
|
||||||
@@ -1445,14 +1434,7 @@ e_parse_expr_from_text_tokens__prec(Arena *arena, String8 text, E_TokenArray *to
|
|||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
if(ext_num != 0)
|
if(identifier_looks_like_type_expr)
|
||||||
{
|
|
||||||
atom = e_push_expr(arena, E_ExprKind_LeafExt, token_string.str);
|
|
||||||
atom->mode = E_Mode_Ext;
|
|
||||||
atom->string = token_string;
|
|
||||||
atom->u64 = ext_num;
|
|
||||||
}
|
|
||||||
else if(identifier_looks_like_type_expr)
|
|
||||||
{
|
{
|
||||||
E_TokenArray type_parse_tokens = e_token_array_make_first_opl(it-1, it_opl);
|
E_TokenArray type_parse_tokens = e_token_array_make_first_opl(it-1, it_opl);
|
||||||
E_Parse type_parse = e_parse_type_from_text_tokens(arena, text, &type_parse_tokens);
|
E_Parse type_parse = e_parse_type_from_text_tokens(arena, text, &type_parse_tokens);
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ typedef enum E_Mode
|
|||||||
E_Mode_Addr,
|
E_Mode_Addr,
|
||||||
E_Mode_Reg,
|
E_Mode_Reg,
|
||||||
E_Mode_InlineData,
|
E_Mode_InlineData,
|
||||||
E_Mode_Ext,
|
|
||||||
}
|
}
|
||||||
E_Mode;
|
E_Mode;
|
||||||
|
|
||||||
@@ -206,7 +205,6 @@ struct E_ParseCtx
|
|||||||
E_String2NumMap *reg_alias_map;
|
E_String2NumMap *reg_alias_map;
|
||||||
E_String2NumMap *locals_map; // (within `rdis[rdis_primary_idx]`)
|
E_String2NumMap *locals_map; // (within `rdis[rdis_primary_idx]`)
|
||||||
E_String2NumMap *member_map; // (within `rdis[rdis_primary_idx]`)
|
E_String2NumMap *member_map; // (within `rdis[rdis_primary_idx]`)
|
||||||
E_String2NumMap *ext_map;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
|
|||||||
@@ -155,6 +155,34 @@ e_type_kind_is_basic_or_enum(E_TypeKind kind)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Member List Building Functions
|
||||||
|
|
||||||
|
internal void
|
||||||
|
e_member_list_push(Arena *arena, E_MemberList *list, E_Member *member)
|
||||||
|
{
|
||||||
|
E_MemberNode *n = push_array(arena, E_MemberNode, 1);
|
||||||
|
MemoryCopyStruct(&n->v, member);
|
||||||
|
SLLQueuePush(list->first, list->last, n);
|
||||||
|
list->count += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal E_MemberArray
|
||||||
|
e_member_array_from_list(Arena *arena, E_MemberList *list)
|
||||||
|
{
|
||||||
|
E_MemberArray array = {0};
|
||||||
|
array.count = list->count;
|
||||||
|
array.v = push_array(arena, E_Member, array.count);
|
||||||
|
{
|
||||||
|
U64 idx = 0;
|
||||||
|
for(E_MemberNode *n = list->first; n != 0; n = n->next, idx += 1)
|
||||||
|
{
|
||||||
|
MemoryCopyStruct(&array.v[idx], &n->v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return array;
|
||||||
|
}
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Context Selection Functions (Selection Required For All Subsequent APIs)
|
//~ rjf: Context Selection Functions (Selection Required For All Subsequent APIs)
|
||||||
|
|
||||||
|
|||||||
@@ -212,6 +212,12 @@ internal B32 e_type_kind_is_integer(E_TypeKind kind);
|
|||||||
internal B32 e_type_kind_is_signed(E_TypeKind kind);
|
internal B32 e_type_kind_is_signed(E_TypeKind kind);
|
||||||
internal B32 e_type_kind_is_basic_or_enum(E_TypeKind kind);
|
internal B32 e_type_kind_is_basic_or_enum(E_TypeKind kind);
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
//~ rjf: Member List Building Functions
|
||||||
|
|
||||||
|
internal void e_member_list_push(Arena *arena, E_MemberList *list, E_Member *member);
|
||||||
|
internal E_MemberArray e_member_array_from_list(Arena *arena, E_MemberList *list);
|
||||||
|
|
||||||
////////////////////////////////
|
////////////////////////////////
|
||||||
//~ rjf: Context Selection Functions (Selection Required For All Subsequent APIs)
|
//~ rjf: Context Selection Functions (Selection Required For All Subsequent APIs)
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
//- GENERATED CODE
|
//- GENERATED CODE
|
||||||
|
|
||||||
C_LINKAGE_BEGIN
|
C_LINKAGE_BEGIN
|
||||||
String8 e_expr_kind_strings[42] =
|
String8 e_expr_kind_strings[41] =
|
||||||
{
|
{
|
||||||
str8_lit_comp("Nil"),
|
str8_lit_comp("Nil"),
|
||||||
str8_lit_comp("ArrayIndex"),
|
str8_lit_comp("ArrayIndex"),
|
||||||
@@ -42,7 +42,6 @@ str8_lit_comp("LeafU64"),
|
|||||||
str8_lit_comp("LeafF64"),
|
str8_lit_comp("LeafF64"),
|
||||||
str8_lit_comp("LeafF32"),
|
str8_lit_comp("LeafF32"),
|
||||||
str8_lit_comp("LeafIdent"),
|
str8_lit_comp("LeafIdent"),
|
||||||
str8_lit_comp("LeafExt"),
|
|
||||||
str8_lit_comp("TypeIdent"),
|
str8_lit_comp("TypeIdent"),
|
||||||
str8_lit_comp("Ptr"),
|
str8_lit_comp("Ptr"),
|
||||||
str8_lit_comp("Array"),
|
str8_lit_comp("Array"),
|
||||||
@@ -65,7 +64,7 @@ str8_lit_comp("Insufficient evaluation machine stack space."),
|
|||||||
str8_lit_comp("Malformed bytecode."),
|
str8_lit_comp("Malformed bytecode."),
|
||||||
};
|
};
|
||||||
|
|
||||||
String8 e_expr_op_strings[42] =
|
String8 e_expr_op_strings[41] =
|
||||||
{
|
{
|
||||||
str8_lit_comp(""),
|
str8_lit_comp(""),
|
||||||
str8_lit_comp("[]"),
|
str8_lit_comp("[]"),
|
||||||
@@ -103,7 +102,6 @@ str8_lit_comp("U64"),
|
|||||||
str8_lit_comp("F64"),
|
str8_lit_comp("F64"),
|
||||||
str8_lit_comp("F32"),
|
str8_lit_comp("F32"),
|
||||||
str8_lit_comp("leaf_ident"),
|
str8_lit_comp("leaf_ident"),
|
||||||
str8_lit_comp("leaf_ext"),
|
|
||||||
str8_lit_comp("type_ident"),
|
str8_lit_comp("type_ident"),
|
||||||
str8_lit_comp("ptr"),
|
str8_lit_comp("ptr"),
|
||||||
str8_lit_comp("array"),
|
str8_lit_comp("array"),
|
||||||
|
|||||||
@@ -114,7 +114,6 @@ E_ExprKind_LeafU64,
|
|||||||
E_ExprKind_LeafF64,
|
E_ExprKind_LeafF64,
|
||||||
E_ExprKind_LeafF32,
|
E_ExprKind_LeafF32,
|
||||||
E_ExprKind_LeafIdent,
|
E_ExprKind_LeafIdent,
|
||||||
E_ExprKind_LeafExt,
|
|
||||||
E_ExprKind_TypeIdent,
|
E_ExprKind_TypeIdent,
|
||||||
E_ExprKind_Ptr,
|
E_ExprKind_Ptr,
|
||||||
E_ExprKind_Array,
|
E_ExprKind_Array,
|
||||||
@@ -140,9 +139,9 @@ E_InterpretationCode_COUNT,
|
|||||||
} E_InterpretationCode;
|
} E_InterpretationCode;
|
||||||
|
|
||||||
C_LINKAGE_BEGIN
|
C_LINKAGE_BEGIN
|
||||||
extern String8 e_expr_kind_strings[42];
|
extern String8 e_expr_kind_strings[41];
|
||||||
extern String8 e_interpretation_code_display_strings[11];
|
extern String8 e_interpretation_code_display_strings[11];
|
||||||
extern String8 e_expr_op_strings[42];
|
extern String8 e_expr_op_strings[41];
|
||||||
extern U8 e_kind_basic_byte_size_table[54];
|
extern U8 e_kind_basic_byte_size_table[54];
|
||||||
extern String8 e_kind_basic_string_table[54];
|
extern String8 e_kind_basic_string_table[54];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user