adjust thread extra string rendering to account for missing modules/rdi frames

This commit is contained in:
Ryan Fleury
2025-06-18 10:40:50 -07:00
parent bee2570d39
commit a1f71379f4
2 changed files with 22 additions and 9 deletions
+4 -1
View File
@@ -3472,7 +3472,10 @@ ctrl_call_stack_from_thread(CTRL_Scope *scope, CTRL_EntityCtx *entity_ctx, CTRL_
did_request = 1;
is_working = 1;
ins_atomic_u64_inc_eval(&node->working_count);
async_push_work(ctrl_call_stack_build_work, .priority = high_priority ? ASYNC_Priority_High : ASYNC_Priority_Low);
DeferLoop(os_rw_mutex_drop_r(stripe->rw_mutex), os_rw_mutex_take_r(stripe->rw_mutex))
{
async_push_work(ctrl_call_stack_build_work, .priority = high_priority ? ASYNC_Priority_High : ASYNC_Priority_Low);
}
}
}
+18 -8
View File
@@ -548,22 +548,32 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
Arch arch = entity->arch;
B32 call_stack_high_priority = ctrl_handle_match(entity->handle, rd_base_regs()->thread);
CTRL_CallStack call_stack = ctrl_call_stack_from_thread(ctrl_scope, &d_state->ctrl_entity_store->ctx, entity, call_stack_high_priority, call_stack_high_priority ? rd_state->frame_eval_memread_endt_us : 0);
for(U64 idx = 0, limit = 10; idx < call_stack.frames_count && idx < limit; idx += 1)
B32 did_first_known = 0;
for(U64 idx = 0, limit = 10;
idx < call_stack.frames_count && idx < limit;
idx += 1)
{
CTRL_CallStackFrame *f = &call_stack.frames[call_stack.frames_count - 1 - idx];
U64 rip_vaddr = regs_rip_from_arch_block(arch, f->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, 1, 0);
if(rdi != &rdi_parsed_nil)
String8 name = {0};
{
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, rip_voff);
String8 name = {0};
name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &name.size);
name = push_str8_copy(arena, name);
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, 0);
if(rdi != &rdi_parsed_nil)
{
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, rip_voff);
name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &name.size);
name = push_str8_copy(arena, name);
}
if(name.size == 0 && did_first_known)
{
name = str8_lit("???");
}
if(name.size != 0)
{
did_first_known = 1;
dr_fstrs_push_new(arena, &result, &params, name, .size = extras_size, .color = symbol_color);
if(idx+1 < call_stack.frames_count)
{