mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-01 19:48:11 +00:00
rich unwind -> callstack, defined by ctrl layer, so we can begin floating meta evaluation cache to ctrl layer
This commit is contained in:
@@ -1140,63 +1140,6 @@ d_tls_base_vaddr_from_process_root_rip(CTRL_Entity *process, U64 root_vaddr, U64
|
||||
return base_vaddr;
|
||||
}
|
||||
|
||||
internal E_String2NumMap *
|
||||
d_push_locals_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff)
|
||||
{
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
|
||||
E_String2NumMap *result = e_push_locals_map_from_rdi_voff(arena, rdi, voff);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal E_String2NumMap *
|
||||
d_push_member_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff)
|
||||
{
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
|
||||
E_String2NumMap *result = e_push_member_map_from_rdi_voff(arena, rdi, voff);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal D_Unwind
|
||||
d_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, CTRL_Entity *process, CTRL_Unwind *base_unwind)
|
||||
{
|
||||
Arch arch = process->arch;
|
||||
D_Unwind result = {0};
|
||||
result.frames.concrete_frame_count = base_unwind->frames.count;
|
||||
result.frames.total_frame_count = result.frames.concrete_frame_count;
|
||||
result.frames.v = push_array(arena, D_UnwindFrame, result.frames.concrete_frame_count);
|
||||
for(U64 idx = 0; idx < result.frames.concrete_frame_count; idx += 1)
|
||||
{
|
||||
CTRL_UnwindFrame *src = &base_unwind->frames.v[idx];
|
||||
D_UnwindFrame *dst = &result.frames.v[idx];
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(arch, src->regs);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
|
||||
U64 rip_voff = ctrl_voff_from_vaddr(module, rip_vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 0);
|
||||
RDI_Scope *scope = rdi_scope_from_voff(rdi, rip_voff);
|
||||
|
||||
// rjf: fill concrete frame info
|
||||
dst->regs = src->regs;
|
||||
dst->rdi = rdi;
|
||||
dst->procedure = rdi_element_from_name_idx(rdi, Procedures, scope->proc_idx);
|
||||
|
||||
// rjf: push inline frames
|
||||
for(RDI_Scope *s = scope;
|
||||
s->inline_site_idx != 0;
|
||||
s = rdi_element_from_name_idx(rdi, Scopes, s->parent_scope_idx))
|
||||
{
|
||||
RDI_InlineSite *site = rdi_element_from_name_idx(rdi, InlineSites, s->inline_site_idx);
|
||||
D_UnwindInlineFrame *inline_frame = push_array(arena, D_UnwindInlineFrame, 1);
|
||||
DLLPushFront(dst->first_inline_frame, dst->last_inline_frame, inline_frame);
|
||||
inline_frame->inline_site = site;
|
||||
dst->inline_frame_count += 1;
|
||||
result.frames.inline_frame_count += 1;
|
||||
result.frames.total_frame_count += 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Target Controls
|
||||
|
||||
@@ -1421,7 +1364,8 @@ d_query_cached_locals_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff)
|
||||
if(node == 0)
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
E_String2NumMap *map = d_push_locals_map_from_dbgi_key_voff(cache->arena, scope, dbgi_key, voff);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
|
||||
E_String2NumMap *map = e_push_locals_map_from_rdi_voff(cache->arena, rdi, voff);
|
||||
if(map->slots_count != 0)
|
||||
{
|
||||
node = push_array(cache->arena, D_RunLocalsCacheNode, 1);
|
||||
@@ -1474,7 +1418,8 @@ d_query_cached_member_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff)
|
||||
if(node == 0)
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
E_String2NumMap *map = d_push_member_map_from_dbgi_key_voff(cache->arena, scope, dbgi_key, voff);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
|
||||
E_String2NumMap *map = e_push_member_map_from_rdi_voff(cache->arena, rdi, voff);
|
||||
if(map->slots_count != 0)
|
||||
{
|
||||
node = push_array(cache->arena, D_RunLocalsCacheNode, 1);
|
||||
|
||||
@@ -60,8 +60,8 @@ struct D_PathMapArray
|
||||
|
||||
typedef enum D_EventKind
|
||||
{
|
||||
D_EventKind_Null,
|
||||
D_EventKind_ProcessEnd,
|
||||
D_EventKind_Null,
|
||||
D_EventKind_ProcessEnd,
|
||||
D_EventKind_Stop,
|
||||
D_EventKind_COUNT
|
||||
}
|
||||
@@ -81,9 +81,9 @@ struct D_Event
|
||||
{
|
||||
D_EventKind kind;
|
||||
D_EventCause cause;
|
||||
CTRL_Handle thread;
|
||||
U64 vaddr;
|
||||
U64 code;
|
||||
CTRL_Handle thread;
|
||||
U64 vaddr;
|
||||
U64 code;
|
||||
};
|
||||
|
||||
typedef struct D_EventNode D_EventNode;
|
||||
@@ -189,43 +189,6 @@ struct D_ViewRuleSpec
|
||||
D_ViewRuleSpecInfo info;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Rich (Including Inline) Unwind Types
|
||||
|
||||
typedef struct D_UnwindInlineFrame D_UnwindInlineFrame;
|
||||
struct D_UnwindInlineFrame
|
||||
{
|
||||
D_UnwindInlineFrame *next;
|
||||
D_UnwindInlineFrame *prev;
|
||||
RDI_InlineSite *inline_site;
|
||||
};
|
||||
|
||||
typedef struct D_UnwindFrame D_UnwindFrame;
|
||||
struct D_UnwindFrame
|
||||
{
|
||||
D_UnwindInlineFrame *first_inline_frame;
|
||||
D_UnwindInlineFrame *last_inline_frame;
|
||||
U64 inline_frame_count;
|
||||
void *regs;
|
||||
RDI_Parsed *rdi;
|
||||
RDI_Procedure *procedure;
|
||||
};
|
||||
|
||||
typedef struct D_UnwindFrameArray D_UnwindFrameArray;
|
||||
struct D_UnwindFrameArray
|
||||
{
|
||||
D_UnwindFrame *v;
|
||||
U64 concrete_frame_count;
|
||||
U64 inline_frame_count;
|
||||
U64 total_frame_count;
|
||||
};
|
||||
|
||||
typedef struct D_Unwind D_Unwind;
|
||||
struct D_Unwind
|
||||
{
|
||||
D_UnwindFrameArray frames;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Command Types
|
||||
|
||||
@@ -475,7 +438,7 @@ internal U64 d_type_num_from_dbgi_key_name(DI_Key *dbgi_key, String8 name);
|
||||
//- rjf: voff -> line info
|
||||
internal D_LineList d_lines_from_dbgi_key_voff(Arena *arena, DI_Key *dbgi_key, U64 voff);
|
||||
|
||||
//- rjf: file:line -> line info
|
||||
//- rjf: file:line -> line info
|
||||
// TODO(rjf): this depends on file path maps, needs to move
|
||||
internal D_LineListArray d_lines_array_from_file_path_line_range(Arena *arena, String8 file_path, Rng1S64 line_num_range);
|
||||
internal D_LineList d_lines_from_file_path_line_num(Arena *arena, String8 file_path, S64 line_num);
|
||||
@@ -484,9 +447,6 @@ internal D_LineList d_lines_from_file_path_line_num(Arena *arena, String8 file_p
|
||||
//~ rjf: Process/Thread/Module Info Lookups
|
||||
|
||||
internal U64 d_tls_base_vaddr_from_process_root_rip(CTRL_Entity *process, U64 root_vaddr, U64 rip_vaddr);
|
||||
internal E_String2NumMap *d_push_locals_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff);
|
||||
internal E_String2NumMap *d_push_member_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff);
|
||||
internal D_Unwind d_unwind_from_ctrl_unwind(Arena *arena, DI_Scope *di_scope, CTRL_Entity *process, CTRL_Unwind *base_unwind);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Target Controls
|
||||
|
||||
Reference in New Issue
Block a user