mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-01 03:40:02 +00:00
targets, breakpoints, watch pins, etc. collections; fix . access on enum types; add more information to meta evaluations
This commit is contained in:
+39
-5
@@ -519,7 +519,8 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
|
||||
// rjf: look up member
|
||||
B32 r_found = 0;
|
||||
E_TypeKey r_type = zero_struct;
|
||||
U32 r_off = 0;
|
||||
U64 r_value = 0;
|
||||
B32 r_is_constant_value = 0;
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
E_MemberArray check_type_members = e_type_data_members_from_key(scratch.arena, check_type_key);
|
||||
@@ -541,7 +542,34 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
|
||||
{
|
||||
r_found = 1;
|
||||
r_type = match->type_key;
|
||||
r_off = match->off;
|
||||
r_value = match->off;
|
||||
}
|
||||
if(match == 0)
|
||||
{
|
||||
E_Type *type = e_type_from_key(scratch.arena, check_type_key);
|
||||
if(type->enum_vals != 0)
|
||||
{
|
||||
E_EnumVal *enum_val_match = 0;
|
||||
for EachIndex(idx, type->count)
|
||||
{
|
||||
if(str8_match(type->enum_vals[idx].name, exprr->string, 0))
|
||||
{
|
||||
enum_val_match = &type->enum_vals[idx];
|
||||
break;
|
||||
}
|
||||
else if(str8_match(type->enum_vals[idx].name, exprr->string, StringMatchFlag_CaseInsensitive))
|
||||
{
|
||||
enum_val_match = &type->enum_vals[idx];
|
||||
}
|
||||
}
|
||||
if(enum_val_match != 0)
|
||||
{
|
||||
r_found = 1;
|
||||
r_type = check_type_key;
|
||||
r_value = enum_val_match->val;
|
||||
r_is_constant_value = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
@@ -563,7 +591,8 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
|
||||
}
|
||||
else if(check_type_kind != E_TypeKind_Struct &&
|
||||
check_type_kind != E_TypeKind_Class &&
|
||||
check_type_kind != E_TypeKind_Union)
|
||||
check_type_kind != E_TypeKind_Union &&
|
||||
check_type_kind != E_TypeKind_Enum)
|
||||
{
|
||||
e_msgf(arena, &result.msgs, E_MsgKind_MalformedInput, exprl->location, "Cannot perform member access on this type.");
|
||||
break;
|
||||
@@ -583,12 +612,17 @@ e_irtree_and_type_from_expr(Arena *arena, E_Expr *expr)
|
||||
new_tree = e_irtree_resolve_to_value(arena, l.space, l.mode, new_tree, l_restype);
|
||||
mode = E_Mode_Offset;
|
||||
}
|
||||
if(r_off != 0)
|
||||
if(r_value != 0 && !r_is_constant_value)
|
||||
{
|
||||
E_IRNode *const_tree = e_irtree_const_u(arena, r_off);
|
||||
E_IRNode *const_tree = e_irtree_const_u(arena, r_value);
|
||||
new_tree = e_irtree_binary_op_u(arena, RDI_EvalOp_Add, new_tree, const_tree);
|
||||
}
|
||||
}
|
||||
else if(r_is_constant_value)
|
||||
{
|
||||
new_tree = e_irtree_const_u(arena, r_value);
|
||||
mode = E_Mode_Value;
|
||||
}
|
||||
|
||||
// rjf: fill
|
||||
result.root = new_tree;
|
||||
|
||||
@@ -437,7 +437,7 @@ e_type_key_cons_ptr(Arch arch, E_TypeKey element_type_key)
|
||||
}
|
||||
|
||||
internal E_TypeKey
|
||||
e_type_key_cons_base(Type *type, String8 name)
|
||||
e_type_key_cons_base(Type *type)
|
||||
{
|
||||
E_TypeKey result = e_type_key_zero();
|
||||
switch(type->kind)
|
||||
@@ -450,12 +450,12 @@ e_type_key_cons_base(Type *type, String8 name)
|
||||
}break;
|
||||
case TypeKind_Ptr:
|
||||
{
|
||||
E_TypeKey direct_type = e_type_key_cons_base(type->direct, str8_zero());
|
||||
E_TypeKey direct_type = e_type_key_cons_base(type->direct);
|
||||
result = e_type_key_cons_ptr(arch_from_context(), direct_type);
|
||||
}break;
|
||||
case TypeKind_Array:
|
||||
{
|
||||
E_TypeKey direct_type = e_type_key_cons_base(type->direct, str8_zero());
|
||||
E_TypeKey direct_type = e_type_key_cons_base(type->direct);
|
||||
result = e_type_key_cons_array(direct_type, type->count);
|
||||
}break;
|
||||
case TypeKind_Struct:
|
||||
@@ -464,13 +464,13 @@ e_type_key_cons_base(Type *type, String8 name)
|
||||
E_MemberList members = {0};
|
||||
for(U64 idx = 0; idx < type->count; idx += 1)
|
||||
{
|
||||
E_TypeKey member_type_key = e_type_key_cons_base(type->members[idx].type, str8_zero());
|
||||
E_TypeKey member_type_key = e_type_key_cons_base(type->members[idx].type);
|
||||
e_member_list_push_new(scratch.arena, &members, .name = type->members[idx].name, .off = type->members[idx].value, .type_key = member_type_key);
|
||||
}
|
||||
E_MemberArray members_array = e_member_array_from_list(scratch.arena, &members);
|
||||
result = e_type_key_cons(.arch = arch_from_context(),
|
||||
.kind = E_TypeKind_Struct,
|
||||
.name = name.size ? name : type->name,
|
||||
.name = type->name,
|
||||
.members = members_array.v,
|
||||
.count = members_array.count);
|
||||
scratch_end(scratch);
|
||||
|
||||
@@ -243,7 +243,7 @@ internal E_TypeKey e_type_key_cons_(E_ConsTypeParams *params);
|
||||
//- rjf: constructed type construction helpers
|
||||
internal E_TypeKey e_type_key_cons_array(E_TypeKey element_type_key, U64 count);
|
||||
internal E_TypeKey e_type_key_cons_ptr(Arch arch, E_TypeKey element_type_key);
|
||||
internal E_TypeKey e_type_key_cons_base(Type *type, String8 name);
|
||||
internal E_TypeKey e_type_key_cons_base(Type *type);
|
||||
|
||||
//- rjf: basic type key functions
|
||||
internal B32 e_type_key_match(E_TypeKey l, E_TypeKey r);
|
||||
|
||||
Reference in New Issue
Block a user