mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-10-15 21:39:41 -07:00
explicit process address space evaluation
This commit is contained in:
1 parent
f7ba4b2ebe
commit
645cf46e55
13 files changed
+292
-27
No files matched your search
@@ -869,6 +869,74 @@ e_dbg_info_from_type_key(E_TypeKey type_key)
|
||||
////////////////////////////////
|
||||
//~ rjf: Cache Accessing Functions
|
||||
|
||||
//- rjf: locals/members maps
|
||||
|
||||
internal E_String2NumMap *
|
||||
e_locals_map_from_dbgi_key_voff(DI_Key dbgi_key, U64 voff)
|
||||
{
|
||||
if(e_cache->locals_map_map_slots_count == 0)
|
||||
{
|
||||
e_cache->locals_map_map_slots_count = 8;
|
||||
e_cache->locals_map_map_slots = push_array(e_cache->arena, E_LocalMapCacheSlot, e_cache->locals_map_map_slots_count);
|
||||
}
|
||||
U64 hash = u64_hash_from_seed_str8(voff, str8_struct(&dbgi_key));
|
||||
U64 slot_idx = hash%e_cache->locals_map_map_slots_count;
|
||||
E_LocalMapCacheSlot *slot = &e_cache->locals_map_map_slots[slot_idx];
|
||||
E_LocalMapCacheNode *node = 0;
|
||||
for(E_LocalMapCacheNode *n = slot->first; n != 0; n = n->next)
|
||||
{
|
||||
if(di_key_match(n->dbgi_key, dbgi_key) && n->voff == voff)
|
||||
{
|
||||
node = n;
|
||||
}
|
||||
}
|
||||
if(node == 0)
|
||||
{
|
||||
Access *access = access_open();
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
node = push_array(e_cache->arena, E_LocalMapCacheNode, 1);
|
||||
SLLQueuePush(slot->first, slot->last, node);
|
||||
node->dbgi_key = dbgi_key;
|
||||
node->voff = voff;
|
||||
node->map = e_push_locals_map_from_rdi_voff(e_cache->arena, rdi, voff);
|
||||
access_close(access);
|
||||
}
|
||||
return node->map;
|
||||
}
|
||||
|
||||
internal E_String2NumMap *
|
||||
e_member_map_from_dbgi_key_voff(DI_Key dbgi_key, U64 voff)
|
||||
{
|
||||
if(e_cache->member_map_map_slots_count == 0)
|
||||
{
|
||||
e_cache->member_map_map_slots_count = 8;
|
||||
e_cache->member_map_map_slots = push_array(e_cache->arena, E_LocalMapCacheSlot, e_cache->member_map_map_slots_count);
|
||||
}
|
||||
U64 hash = u64_hash_from_seed_str8(voff, str8_struct(&dbgi_key));
|
||||
U64 slot_idx = hash%e_cache->member_map_map_slots_count;
|
||||
E_LocalMapCacheSlot *slot = &e_cache->member_map_map_slots[slot_idx];
|
||||
E_LocalMapCacheNode *node = 0;
|
||||
for(E_LocalMapCacheNode *n = slot->first; n != 0; n = n->next)
|
||||
{
|
||||
if(di_key_match(n->dbgi_key, dbgi_key) && n->voff == voff)
|
||||
{
|
||||
node = n;
|
||||
}
|
||||
}
|
||||
if(node == 0)
|
||||
{
|
||||
Access *access = access_open();
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
node = push_array(e_cache->arena, E_LocalMapCacheNode, 1);
|
||||
SLLQueuePush(slot->first, slot->last, node);
|
||||
node->dbgi_key = dbgi_key;
|
||||
node->voff = voff;
|
||||
node->map = e_push_member_map_from_rdi_voff(e_cache->arena, rdi, voff);
|
||||
access_close(access);
|
||||
}
|
||||
return node->map;
|
||||
}
|
||||
|
||||
//- rjf: parent key stack
|
||||
|
||||
internal E_Key
|
||||
|
||||
@@ -1065,6 +1065,24 @@ struct E_CacheSlot
|
||||
E_CacheNode *last;
|
||||
};
|
||||
|
||||
//- rjf: locals/members cache types
|
||||
|
||||
typedef struct E_LocalMapCacheNode E_LocalMapCacheNode;
|
||||
struct E_LocalMapCacheNode
|
||||
{
|
||||
E_LocalMapCacheNode *next;
|
||||
DI_Key dbgi_key;
|
||||
U64 voff;
|
||||
E_String2NumMap *map;
|
||||
};
|
||||
|
||||
typedef struct E_LocalMapCacheSlot E_LocalMapCacheSlot;
|
||||
struct E_LocalMapCacheSlot
|
||||
{
|
||||
E_LocalMapCacheNode *first;
|
||||
E_LocalMapCacheNode *last;
|
||||
};
|
||||
|
||||
//- rjf: parent stack
|
||||
|
||||
typedef struct E_CacheParentNode E_CacheParentNode;
|
||||
@@ -1122,6 +1140,12 @@ struct E_Cache
|
||||
U64 type_cache_slots_count;
|
||||
E_TypeCacheSlot *type_cache_slots;
|
||||
|
||||
//- rjf: [locals / members] locals/members map maps
|
||||
E_LocalMapCacheSlot *locals_map_map_slots;
|
||||
U64 locals_map_map_slots_count;
|
||||
E_LocalMapCacheSlot *member_map_map_slots;
|
||||
U64 member_map_map_slots_count;
|
||||
|
||||
//- rjf: [ir] ir gen options
|
||||
B32 disallow_autohooks;
|
||||
B32 disallow_chained_fastpaths;
|
||||
@@ -1278,6 +1302,10 @@ internal E_DbgInfo *e_dbg_info_from_type_key(E_TypeKey type_key);
|
||||
// "parent key stack" also implicitly parameterizes all of these (partly
|
||||
// because it is not relevant in 99% of cases).
|
||||
|
||||
//- rjf: locals/members maps
|
||||
internal E_String2NumMap *e_locals_map_from_dbgi_key_voff(DI_Key dbgi_key, U64 voff);
|
||||
internal E_String2NumMap *e_member_map_from_dbgi_key_voff(DI_Key dbgi_key, U64 voff);
|
||||
|
||||
//- rjf: parent key stack
|
||||
internal E_Key e_parent_key_push(E_Key key);
|
||||
internal E_Key e_parent_key_pop(void);
|
||||
|
||||
@@ -339,9 +339,9 @@ e_interpret(String8 bytecode)
|
||||
|
||||
case RDI_EvalOp_RegRead:
|
||||
{
|
||||
U8 rdi_reg_code = (imm.u64&0x0000FF)>>0;
|
||||
U8 byte_size = (imm.u64&0x00FF00)>>8;
|
||||
U8 byte_off = (imm.u64&0xFF0000)>>16;
|
||||
U8 rdi_reg_code = (imm.u64&0x0000FF)>>0;
|
||||
U8 byte_size = (imm.u64&0x00FF00)>>8;
|
||||
U8 byte_off = (imm.u64&0xFF0000)>>16;
|
||||
Arch arch = e_interpret_ctx->reg_arch;
|
||||
ARCH_Info *arch_info = arch_info_from_arch(arch);
|
||||
ARCH_RegCode base_reg_code = arch_reg_code_from_rdi(arch, rdi_reg_code);
|
||||
|
||||
@@ -1305,6 +1305,13 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
int_root = e_irtree_binary_op_u(arena, RDI_EvalOp_Mul, ptr_size, int_root, const_root);
|
||||
}
|
||||
E_TypeKey ptr_type = ptr_tree->type_key;
|
||||
{
|
||||
E_Type *ptr_type_info = e_type_from_key(ptr_type);
|
||||
if(ptr_type_info->flags != 0)
|
||||
{
|
||||
ptr_type = e_type_key_cons_ptr(ptr_type_info->arch, ptr_type_info->direct_type_key, 1, 0);
|
||||
}
|
||||
}
|
||||
if(ptr_is_decay)
|
||||
{
|
||||
ptr_type = e_type_key_cons_ptr(e_base_ctx->primary_module->arch, direct_type, 1, 0);
|
||||
|
||||
Reference in new issue
Block a user