mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
rich unwind -> callstack, defined by ctrl layer, so we can begin floating meta evaluation cache to ctrl layer
This commit is contained in:
@@ -2978,6 +2978,50 @@ ctrl_unwind_from_thread(Arena *arena, CTRL_EntityStore *store, CTRL_Handle threa
|
||||
return unwind;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Call Stack Building Functions
|
||||
|
||||
internal CTRL_CallStack
|
||||
ctrl_call_stack_from_unwind(Arena *arena, DI_Scope *di_scope, CTRL_Entity *process, CTRL_Unwind *base_unwind)
|
||||
{
|
||||
Arch arch = process->arch;
|
||||
CTRL_CallStack result = {0};
|
||||
result.concrete_frame_count = base_unwind->frames.count;
|
||||
result.total_frame_count = result.concrete_frame_count;
|
||||
result.frames = push_array(arena, CTRL_CallStackFrame, result.concrete_frame_count);
|
||||
for(U64 idx = 0; idx < result.concrete_frame_count; idx += 1)
|
||||
{
|
||||
CTRL_UnwindFrame *src = &base_unwind->frames.v[idx];
|
||||
CTRL_CallStackFrame *dst = &result.frames[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);
|
||||
CTRL_CallStackInlineFrame *inline_frame = push_array(arena, CTRL_CallStackInlineFrame, 1);
|
||||
DLLPushFront(dst->first_inline_frame, dst->last_inline_frame, inline_frame);
|
||||
inline_frame->inline_site = site;
|
||||
dst->inline_frame_count += 1;
|
||||
result.inline_frame_count += 1;
|
||||
result.total_frame_count += 1;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Halting All Attached Processes
|
||||
|
||||
|
||||
@@ -370,6 +370,37 @@ struct CTRL_Unwind
|
||||
CTRL_UnwindFlags flags;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Call Stack Types
|
||||
|
||||
typedef struct CTRL_CallStackInlineFrame CTRL_CallStackInlineFrame;
|
||||
struct CTRL_CallStackInlineFrame
|
||||
{
|
||||
CTRL_CallStackInlineFrame *next;
|
||||
CTRL_CallStackInlineFrame *prev;
|
||||
RDI_InlineSite *inline_site;
|
||||
};
|
||||
|
||||
typedef struct CTRL_CallStackFrame CTRL_CallStackFrame;
|
||||
struct CTRL_CallStackFrame
|
||||
{
|
||||
CTRL_CallStackInlineFrame *first_inline_frame;
|
||||
CTRL_CallStackInlineFrame *last_inline_frame;
|
||||
U64 inline_frame_count;
|
||||
void *regs;
|
||||
RDI_Parsed *rdi;
|
||||
RDI_Procedure *procedure;
|
||||
};
|
||||
|
||||
typedef struct CTRL_CallStack CTRL_CallStack;
|
||||
struct CTRL_CallStack
|
||||
{
|
||||
CTRL_CallStackFrame *frames;
|
||||
U64 concrete_frame_count;
|
||||
U64 inline_frame_count;
|
||||
U64 total_frame_count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Trap Types
|
||||
|
||||
@@ -1034,6 +1065,11 @@ internal CTRL_UnwindStepResult ctrl_unwind_step(CTRL_EntityStore *store, CTRL_Ha
|
||||
//- rjf: abstracted full unwind
|
||||
internal CTRL_Unwind ctrl_unwind_from_thread(Arena *arena, CTRL_EntityStore *store, CTRL_Handle thread, U64 endt_us);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Call Stack Building Functions
|
||||
|
||||
internal CTRL_CallStack ctrl_call_stack_from_unwind(Arena *arena, DI_Scope *di_scope, CTRL_Entity *process, CTRL_Unwind *base_unwind);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Halting All Attached Processes
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+47
-29
@@ -1902,13 +1902,27 @@ rd_title_fstrs_from_entity(Arena *arena, RD_Entity *entity, Vec4F32 secondary_co
|
||||
dr_fancy_string_list_concat_in_place(&result, &cnd_fstrs);
|
||||
}
|
||||
}
|
||||
if(!rd_entity_is_nil(src) && !rd_entity_is_nil(dst))
|
||||
if(entity->kind == RD_EntityKind_FilePathMap)
|
||||
{
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), size, color, src->string);
|
||||
String8 src_string = src->string;
|
||||
Vec4F32 src_color = color;
|
||||
String8 dst_string = dst->string;
|
||||
Vec4F32 dst_color = color;
|
||||
if(src_string.size == 0)
|
||||
{
|
||||
src_string = str8_lit("no path");
|
||||
src_color = secondary_color;
|
||||
}
|
||||
if(dst_string.size == 0)
|
||||
{
|
||||
dst_string = str8_lit("no path");
|
||||
dst_color = secondary_color;
|
||||
}
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), size, src_color, src_string);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, v4f32(0, 0, 0, 0), str8_lit(" "));
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Icons), size, secondary_color, rd_icon_kind_text_table[RD_IconKind_RightArrow]);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Code), size, v4f32(0, 0, 0, 0), str8_lit(" "));
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), size, color, dst->string);
|
||||
dr_fancy_string_list_push_new(arena, &result, rd_font_from_slot(RD_FontSlot_Main), size, dst_color, dst_string);
|
||||
}
|
||||
if((entity->kind == RD_EntityKind_Target || entity->kind == RD_EntityKind_Breakpoint) && entity->disabled)
|
||||
{
|
||||
@@ -2131,6 +2145,7 @@ rd_eval_space_from_ctrl_entity(CTRL_Entity *entity, E_SpaceKind kind)
|
||||
internal CTRL_MetaEval *
|
||||
rd_ctrl_meta_eval_from_entity(Arena *arena, RD_Entity *entity)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
CTRL_MetaEval *meval = push_array(arena, CTRL_MetaEval, 1);
|
||||
RD_Entity *exe = rd_entity_child_from_kind(entity, RD_EntityKind_Executable);
|
||||
RD_Entity *args= rd_entity_child_from_kind(entity, RD_EntityKind_Arguments);
|
||||
@@ -2171,12 +2186,14 @@ rd_ctrl_meta_eval_from_entity(Arena *arena, RD_Entity *entity)
|
||||
meval->source_path = src->string;
|
||||
meval->destination_path = dst->string;
|
||||
meval->condition = cnd_string;
|
||||
ProfEnd();
|
||||
return meval;
|
||||
}
|
||||
|
||||
internal CTRL_MetaEval *
|
||||
rd_ctrl_meta_eval_from_ctrl_entity(Arena *arena, CTRL_Entity *entity)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
CTRL_MetaEval *meval = push_array(arena, CTRL_MetaEval, 1);
|
||||
meval->frozen = entity->is_frozen;
|
||||
meval->vaddr_range = entity->vaddr_range;
|
||||
@@ -2188,20 +2205,20 @@ rd_ctrl_meta_eval_from_ctrl_entity(Arena *arena, CTRL_Entity *entity)
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(entity, CTRL_EntityKind_Process);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(entity);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(arena, di_scope, process, &base_unwind);
|
||||
meval->callstack.count = rich_unwind.frames.total_frame_count;
|
||||
CTRL_CallStack rich_unwind = ctrl_call_stack_from_unwind(arena, di_scope, process, &base_unwind);
|
||||
meval->callstack.count = rich_unwind.total_frame_count;
|
||||
meval->callstack.v = push_array(arena, CTRL_MetaEvalFrame, meval->callstack.count);
|
||||
U64 idx = 0;
|
||||
for(U64 base_idx = 0; base_idx < rich_unwind.frames.concrete_frame_count; base_idx += 1)
|
||||
for(U64 base_idx = 0; base_idx < rich_unwind.concrete_frame_count; base_idx += 1)
|
||||
{
|
||||
U64 inline_idx = 0;
|
||||
for(D_UnwindInlineFrame *f = rich_unwind.frames.v[base_idx].first_inline_frame; f != 0; f = f->next, inline_idx += 1)
|
||||
for(CTRL_CallStackInlineFrame *f = rich_unwind.frames[base_idx].first_inline_frame; f != 0; f = f->next, inline_idx += 1)
|
||||
{
|
||||
meval->callstack.v[idx].vaddr = regs_rip_from_arch_block(entity->arch, rich_unwind.frames.v[base_idx].regs);
|
||||
meval->callstack.v[idx].vaddr = regs_rip_from_arch_block(entity->arch, rich_unwind.frames[base_idx].regs);
|
||||
meval->callstack.v[idx].inline_depth = inline_idx + 1;
|
||||
idx += 1;
|
||||
}
|
||||
meval->callstack.v[idx].vaddr = regs_rip_from_arch_block(entity->arch, rich_unwind.frames.v[base_idx].regs);
|
||||
meval->callstack.v[idx].vaddr = regs_rip_from_arch_block(entity->arch, rich_unwind.frames[base_idx].regs);
|
||||
idx += 1;
|
||||
}
|
||||
di_scope_close(di_scope);
|
||||
@@ -2213,6 +2230,7 @@ rd_ctrl_meta_eval_from_ctrl_entity(Arena *arena, CTRL_Entity *entity)
|
||||
meval->exe = path_normalized_from_string(arena, entity->string);
|
||||
meval->dbg = path_normalized_from_string(arena, dbgi_key.path);
|
||||
}
|
||||
ProfEnd();
|
||||
return meval;
|
||||
}
|
||||
|
||||
@@ -3572,14 +3590,14 @@ rd_window_frame(RD_Window *ws)
|
||||
{
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(ctrl_entity, CTRL_EntityKind_Process);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(ctrl_entity);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
if(rich_unwind.frames.concrete_frame_count != 0)
|
||||
CTRL_CallStack rich_unwind = ctrl_call_stack_from_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
if(rich_unwind.concrete_frame_count != 0)
|
||||
{
|
||||
ui_spacer(ui_em(1.5f, 1.f));
|
||||
}
|
||||
for(U64 idx = 0; idx < rich_unwind.frames.concrete_frame_count; idx += 1)
|
||||
for(U64 idx = 0; idx < rich_unwind.concrete_frame_count; idx += 1)
|
||||
{
|
||||
D_UnwindFrame *f = &rich_unwind.frames.v[idx];
|
||||
CTRL_CallStackFrame *f = &rich_unwind.frames[idx];
|
||||
RDI_Parsed *rdi = f->rdi;
|
||||
RDI_Procedure *procedure = f->procedure;
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(arch, f->regs);
|
||||
@@ -3587,7 +3605,7 @@ rd_window_frame(RD_Window *ws)
|
||||
String8 module_name = module == &ctrl_entity_nil ? str8_lit("???") : str8_skip_last_slash(module->string);
|
||||
|
||||
// rjf: inline frames
|
||||
for(D_UnwindInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
|
||||
for(CTRL_CallStackInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row
|
||||
{
|
||||
String8 name = {0};
|
||||
@@ -4199,16 +4217,16 @@ rd_window_frame(RD_Window *ws)
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(ctrl_entity, CTRL_EntityKind_Process);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(ctrl_entity);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
CTRL_CallStack rich_unwind = ctrl_call_stack_from_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
String8List lines = {0};
|
||||
for(U64 frame_idx = 0; frame_idx < rich_unwind.frames.concrete_frame_count; frame_idx += 1)
|
||||
for(U64 frame_idx = 0; frame_idx < rich_unwind.concrete_frame_count; frame_idx += 1)
|
||||
{
|
||||
D_UnwindFrame *concrete_frame = &rich_unwind.frames.v[frame_idx];
|
||||
CTRL_CallStackFrame *concrete_frame = &rich_unwind.frames[frame_idx];
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(ctrl_entity->arch, concrete_frame->regs);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
|
||||
RDI_Parsed *rdi = concrete_frame->rdi;
|
||||
RDI_Procedure *procedure = concrete_frame->procedure;
|
||||
for(D_UnwindInlineFrame *inline_frame = concrete_frame->last_inline_frame;
|
||||
for(CTRL_CallStackInlineFrame *inline_frame = concrete_frame->last_inline_frame;
|
||||
inline_frame != 0;
|
||||
inline_frame = inline_frame->prev)
|
||||
{
|
||||
@@ -4260,10 +4278,10 @@ rd_window_frame(RD_Window *ws)
|
||||
CTRL_Entity *thread = ctrl_entity;
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(thread);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
for(U64 idx = 0; idx < rich_unwind.frames.concrete_frame_count; idx += 1)
|
||||
CTRL_CallStack rich_unwind = ctrl_call_stack_from_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
for(U64 idx = 0; idx < rich_unwind.concrete_frame_count; idx += 1)
|
||||
{
|
||||
D_UnwindFrame *f = &rich_unwind.frames.v[idx];
|
||||
CTRL_CallStackFrame *f = &rich_unwind.frames[idx];
|
||||
RDI_Parsed *rdi = f->rdi;
|
||||
RDI_Procedure *procedure = f->procedure;
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(thread->arch, f->regs);
|
||||
@@ -4271,7 +4289,7 @@ rd_window_frame(RD_Window *ws)
|
||||
String8 module_name = module == &ctrl_entity_nil ? str8_lit("???") : str8_skip_last_slash(module->string);
|
||||
|
||||
// rjf: inline frames
|
||||
for(D_UnwindInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
|
||||
for(CTRL_CallStackInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
|
||||
{
|
||||
UI_Box *row = ui_build_box_from_stringf(UI_BoxFlag_Clickable|UI_BoxFlag_ClickToFocus, "###callstack_row_%I64x", idx);
|
||||
UI_Signal sig = ui_signal_from_box(row);
|
||||
@@ -15162,10 +15180,10 @@ rd_frame(void)
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_base_regs()->thread);
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(thread);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
if(rd_regs()->unwind_count < rich_unwind.frames.concrete_frame_count)
|
||||
CTRL_CallStack rich_unwind = ctrl_call_stack_from_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
if(rd_regs()->unwind_count < rich_unwind.concrete_frame_count)
|
||||
{
|
||||
D_UnwindFrame *frame = &rich_unwind.frames.v[rd_regs()->unwind_count];
|
||||
CTRL_CallStackFrame *frame = &rich_unwind.frames[rd_regs()->unwind_count];
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(thread->arch, frame->regs);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
|
||||
rd_state->base_regs.v.module = module->handle;
|
||||
@@ -15186,14 +15204,14 @@ rd_frame(void)
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(d_state->ctrl_entity_store, rd_base_regs()->thread);
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(thread);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
CTRL_CallStack rich_unwind = ctrl_call_stack_from_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
U64 crnt_unwind_idx = rd_state->base_regs.v.unwind_count;
|
||||
U64 crnt_inline_dpt = rd_state->base_regs.v.inline_depth;
|
||||
U64 next_unwind_idx = crnt_unwind_idx;
|
||||
U64 next_inline_dpt = crnt_inline_dpt;
|
||||
if(crnt_unwind_idx < rich_unwind.frames.concrete_frame_count)
|
||||
if(crnt_unwind_idx < rich_unwind.concrete_frame_count)
|
||||
{
|
||||
D_UnwindFrame *f = &rich_unwind.frames.v[crnt_unwind_idx];
|
||||
CTRL_CallStackFrame *f = &rich_unwind.frames[crnt_unwind_idx];
|
||||
switch(kind)
|
||||
{
|
||||
default:{}break;
|
||||
@@ -15215,7 +15233,7 @@ rd_frame(void)
|
||||
{
|
||||
next_inline_dpt -= 1;
|
||||
}
|
||||
else if(crnt_unwind_idx < rich_unwind.frames.concrete_frame_count)
|
||||
else if(crnt_unwind_idx < rich_unwind.concrete_frame_count)
|
||||
{
|
||||
next_unwind_idx += 1;
|
||||
next_inline_dpt = (f+1)->inline_frame_count;
|
||||
|
||||
+28
-21
@@ -916,17 +916,17 @@ rd_watch_view_row_info_from_row(EV_Row *row)
|
||||
{
|
||||
U64 block_relative_num = block->expand_view_rule_info->expr_expand_num_from_id(key.child_id, block->expand_view_rule_info_user_data);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(thread);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process), &base_unwind);
|
||||
CTRL_CallStack rich_unwind = ctrl_call_stack_from_unwind(scratch.arena, di_scope, ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process), &base_unwind);
|
||||
U64 frame_num = 1;
|
||||
for(U64 base_frame_idx = 0; base_frame_idx < rich_unwind.frames.concrete_frame_count; base_frame_idx += 1, frame_num += 1)
|
||||
for(U64 base_frame_idx = 0; base_frame_idx < rich_unwind.concrete_frame_count; base_frame_idx += 1, frame_num += 1)
|
||||
{
|
||||
if(frame_num <= block_relative_num && block_relative_num < frame_num+1+rich_unwind.frames.v[base_frame_idx].inline_frame_count)
|
||||
if(frame_num <= block_relative_num && block_relative_num < frame_num+1+rich_unwind.frames[base_frame_idx].inline_frame_count)
|
||||
{
|
||||
unwind_count = base_frame_idx;
|
||||
inline_depth = block_relative_num - frame_num;
|
||||
break;
|
||||
}
|
||||
frame_num += rich_unwind.frames.v[base_frame_idx].inline_frame_count;
|
||||
frame_num += rich_unwind.frames[base_frame_idx].inline_frame_count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3065,26 +3065,33 @@ rd_watch_view_build(RD_WatchViewState *ewv, RD_WatchViewFlags flags, String8 roo
|
||||
}
|
||||
|
||||
// rjf: cannot edit, has addr info? -> go to address
|
||||
else
|
||||
else if(row_kind == RD_WatchViewRowKind_Normal &&
|
||||
(col->kind == RD_WatchViewColumnKind_Value ||
|
||||
col->kind == RD_WatchViewColumnKind_Member) &&
|
||||
cell_eval.space.kind == RD_EvalSpaceKind_CtrlEntity)
|
||||
{
|
||||
U64 vaddr = cell_eval.value.u64;
|
||||
CTRL_Entity *process = rd_ctrl_entity_from_eval_space(cell_eval.space);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, &dbgi_key, voff);
|
||||
String8 file_path = {0};
|
||||
TxtPt pt = {0};
|
||||
if(lines.first != 0)
|
||||
CTRL_Entity *entity = rd_ctrl_entity_from_eval_space(cell_eval.space);
|
||||
CTRL_Entity *process = ctrl_process_from_entity(entity);
|
||||
if(process != &ctrl_entity_nil)
|
||||
{
|
||||
file_path = lines.first->v.file_path;
|
||||
pt = lines.first->v.pt;
|
||||
U64 vaddr = cell_eval.value.u64;
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, &dbgi_key, voff);
|
||||
String8 file_path = {0};
|
||||
TxtPt pt = {0};
|
||||
if(lines.first != 0)
|
||||
{
|
||||
file_path = lines.first->v.file_path;
|
||||
pt = lines.first->v.pt;
|
||||
}
|
||||
rd_cmd(RD_CmdKind_FindCodeLocation,
|
||||
.process = process->handle,
|
||||
.vaddr = vaddr,
|
||||
.file_path = file_path,
|
||||
.cursor = pt);
|
||||
}
|
||||
rd_cmd(RD_CmdKind_FindCodeLocation,
|
||||
.process = process->handle,
|
||||
.vaddr = vaddr,
|
||||
.file_path = file_path,
|
||||
.cursor = pt);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -488,10 +488,10 @@ rd_entity_tooltips(RD_Entity *entity)
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(entity_ctrl, CTRL_EntityKind_Process);
|
||||
CTRL_Unwind base_unwind = d_query_cached_unwind_from_thread(entity_ctrl);
|
||||
D_Unwind rich_unwind = d_unwind_from_ctrl_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
for(U64 idx = 0; idx < rich_unwind.frames.concrete_frame_count; idx += 1)
|
||||
CTRL_CallStack rich_unwind = ctrl_call_stack_from_unwind(scratch.arena, di_scope, process, &base_unwind);
|
||||
for(U64 idx = 0; idx < rich_unwind.concrete_frame_count; idx += 1)
|
||||
{
|
||||
D_UnwindFrame *f = &rich_unwind.frames.v[idx];
|
||||
CTRL_CallStackFrame *f = &rich_unwind.frames[idx];
|
||||
RDI_Parsed *rdi = f->rdi;
|
||||
RDI_Procedure *procedure = f->procedure;
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, f->regs);
|
||||
@@ -499,7 +499,7 @@ rd_entity_tooltips(RD_Entity *entity)
|
||||
String8 module_name = module == &ctrl_entity_nil ? str8_lit("???") : str8_skip_last_slash(module->string);
|
||||
|
||||
// rjf: inline frames
|
||||
for(D_UnwindInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
|
||||
for(CTRL_CallStackInlineFrame *fin = f->last_inline_frame; fin != 0; fin = fin->prev)
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row
|
||||
{
|
||||
String8 name = {0};
|
||||
|
||||
Reference in New Issue
Block a user