mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 13:28:40 +00:00
transition to dbg_info2
This commit is contained in:
@@ -520,7 +520,7 @@ Rng1U64 rd_reg_slot_range_table[47] =
|
||||
{OffsetOf(RD_Regs, text_key), OffsetOf(RD_Regs, text_key) + sizeof(C_Key)},
|
||||
{OffsetOf(RD_Regs, lang_kind), OffsetOf(RD_Regs, lang_kind) + sizeof(TXT_LangKind)},
|
||||
{OffsetOf(RD_Regs, lines), OffsetOf(RD_Regs, lines) + sizeof(D_LineList)},
|
||||
{OffsetOf(RD_Regs, dbgi_key), OffsetOf(RD_Regs, dbgi_key) + sizeof(DI_Key)},
|
||||
{OffsetOf(RD_Regs, dbgi_key), OffsetOf(RD_Regs, dbgi_key) + sizeof(DI2_Key)},
|
||||
{OffsetOf(RD_Regs, vaddr), OffsetOf(RD_Regs, vaddr) + sizeof(U64)},
|
||||
{OffsetOf(RD_Regs, voff), OffsetOf(RD_Regs, voff) + sizeof(U64)},
|
||||
{OffsetOf(RD_Regs, vaddr_range), OffsetOf(RD_Regs, vaddr_range) + sizeof(Rng1U64)},
|
||||
|
||||
@@ -466,7 +466,7 @@ TxtPt mark;
|
||||
C_Key text_key;
|
||||
TXT_LangKind lang_kind;
|
||||
D_LineList lines;
|
||||
DI_Key dbgi_key;
|
||||
DI2_Key dbgi_key;
|
||||
U64 vaddr;
|
||||
U64 voff;
|
||||
Rng1U64 vaddr_range;
|
||||
|
||||
@@ -733,10 +733,10 @@ RD_RegTable:
|
||||
{String8 file_path FilePath }
|
||||
{TxtPt cursor Cursor }
|
||||
{TxtPt mark Mark }
|
||||
{C_Key text_key TextKey }
|
||||
{C_Key text_key TextKey }
|
||||
{TXT_LangKind lang_kind LangKind }
|
||||
{D_LineList lines Lines }
|
||||
{DI_Key dbgi_key DbgiKey }
|
||||
{DI2_Key dbgi_key DbgiKey }
|
||||
{U64 vaddr Vaddr }
|
||||
{U64 voff Voff }
|
||||
{Rng1U64 vaddr_range VaddrRange }
|
||||
|
||||
+52
-74
@@ -42,7 +42,6 @@ rd_regs_copy_contents(Arena *arena, RD_Regs *dst, RD_Regs *src)
|
||||
dst->cfg_list = rd_cfg_id_list_copy(arena, &src->cfg_list);
|
||||
dst->file_path = push_str8_copy(arena, src->file_path);
|
||||
dst->lines = d_line_list_copy(arena, &src->lines);
|
||||
dst->dbgi_key = di_key_copy(arena, &src->dbgi_key);
|
||||
dst->expr = push_str8_copy(arena, src->expr);
|
||||
dst->string = push_str8_copy(arena, src->string);
|
||||
dst->cmd_name = push_str8_copy(arena, src->cmd_name);
|
||||
@@ -3274,11 +3273,11 @@ rd_view_ui(Rng2F32 rect)
|
||||
U64 vaddr = eval.value.u64;
|
||||
CTRL_Entity *process = rd_ctrl_entity_from_eval_space(eval.space);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
|
||||
Access *access = access_open();
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
String8 name = {0};
|
||||
if(name.size == 0)
|
||||
{
|
||||
@@ -3294,7 +3293,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
{
|
||||
rd_cmd(RD_CmdKind_CompleteQuery, .string = name);
|
||||
}
|
||||
di_scope_close(scope);
|
||||
access_close(access);
|
||||
}
|
||||
}break;
|
||||
case E_SpaceKind_File:
|
||||
@@ -3361,11 +3360,11 @@ rd_view_ui(Rng2F32 rect)
|
||||
U64 vaddr = eval.value.u64;
|
||||
CTRL_Entity *process = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->process);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
|
||||
Access *access = access_open();
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 1, 0);
|
||||
if(name.size == 0)
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
@@ -3376,7 +3375,7 @@ rd_view_ui(Rng2F32 rect)
|
||||
RDI_GlobalVariable *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
name.str = rdi_string_from_idx(rdi, gvar->name_string_idx, &name.size);
|
||||
}
|
||||
di_scope_close(scope);
|
||||
access_close(access);
|
||||
}
|
||||
}
|
||||
if(name.size != 0)
|
||||
@@ -5299,9 +5298,9 @@ rd_view_ui(Rng2F32 rect)
|
||||
{
|
||||
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);
|
||||
DI2_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);
|
||||
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)
|
||||
@@ -6443,22 +6442,23 @@ rd_window_frame(void)
|
||||
// rjf: debug info status
|
||||
if(ctrl_entity->kind == CTRL_EntityKind_Module) UI_TagF("weak")
|
||||
{
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(ctrl_entity);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, 0);
|
||||
Access *access = access_open();
|
||||
CTRL_Entity *dbg_info_entity = ctrl_entity_child_from_kind(ctrl_entity, CTRL_EntityKind_DebugInfoPath);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(ctrl_entity);
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
if(rdi->raw_data_size != 0)
|
||||
{
|
||||
ui_labelf("Symbols successfully loaded from %S", dbgi_key.path);
|
||||
ui_labelf("Symbols successfully loaded from %S", dbg_info_entity->string);
|
||||
}
|
||||
else if(dbgi_key.path.size != 0)
|
||||
else if(dbg_info_entity->string.size != 0)
|
||||
{
|
||||
ui_labelf("Symbols not found at %S", dbgi_key.path);
|
||||
ui_labelf("Symbols not found at %S", dbg_info_entity->string);
|
||||
}
|
||||
else if(dbgi_key.path.size == 0)
|
||||
else if(dbg_info_entity->string.size == 0)
|
||||
{
|
||||
ui_labelf("Symbol information not found in module file");
|
||||
}
|
||||
di_scope_close(di_scope);
|
||||
access_close(access);
|
||||
}
|
||||
|
||||
// rjf: unwind
|
||||
@@ -6611,11 +6611,6 @@ rd_window_frame(void)
|
||||
|
||||
ui_divider(ui_em(1.f, 1.f));
|
||||
|
||||
//- rjf: draw match store stats
|
||||
ui_labelf("name match nodes: %I64u", rd_state->match_store->active_match_name_nodes_count);
|
||||
|
||||
ui_divider(ui_em(1.f, 1.f));
|
||||
|
||||
//- rjf: draw registers
|
||||
ui_labelf("hover_reg_slot: %i", rd_state->hover_regs_slot);
|
||||
struct
|
||||
@@ -10267,8 +10262,6 @@ rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8
|
||||
RD_CodeColorSlot color = RD_CodeColorSlot_CodeDefault;
|
||||
if(kind == TXT_TokenKind_Identifier || kind == TXT_TokenKind_Keyword)
|
||||
{
|
||||
CTRL_Entity *module = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->module);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
B32 mapped = 0;
|
||||
|
||||
// rjf: try to map as local
|
||||
@@ -10318,7 +10311,8 @@ rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8
|
||||
// rjf: try to map using asynchronous matching system
|
||||
if(!mapped && kind == TXT_TokenKind_Identifier)
|
||||
{
|
||||
RDI_SectionKind section_kind = di_match_from_name(rd_state->match_store, string, 0).section;
|
||||
DI2_Match match = di2_match_from_string(string, 0, 0);
|
||||
RDI_SectionKind section_kind = match.section_kind;
|
||||
mapped = 1;
|
||||
switch(section_kind)
|
||||
{
|
||||
@@ -10885,7 +10879,6 @@ rd_init(CmdLine *cmdln)
|
||||
}
|
||||
rd_state->num_frames_requested = 2;
|
||||
rd_state->seconds_until_autosave = 0.5f;
|
||||
rd_state->match_store = di_match_store_alloc();
|
||||
rd_state->eval_cache = e_cache_alloc();
|
||||
for(U64 idx = 0; idx < ArrayCount(rd_state->cmds_arenas); idx += 1)
|
||||
{
|
||||
@@ -11406,6 +11399,7 @@ rd_frame(void)
|
||||
//////////////////////////////
|
||||
//- rjf: sync with di parsers
|
||||
//
|
||||
#if 0 // TODO(rjf): @dbgi2
|
||||
ProfScope("sync with di parsers")
|
||||
{
|
||||
DI_EventList events = di_p2u_pop_events(scratch.arena, 0);
|
||||
@@ -11436,6 +11430,7 @@ rd_frame(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: animate all views
|
||||
@@ -11496,9 +11491,7 @@ rd_frame(void)
|
||||
//- rjf: push frame scopes
|
||||
//
|
||||
Access *frame_access_restore = rd_state->frame_access;
|
||||
DI_Scope *frame_di_scope_restore = rd_state->frame_di_scope;
|
||||
rd_state->frame_access = access_open();
|
||||
rd_state->frame_di_scope = di_scope_open();
|
||||
rd_state->got_frame_call_stack_tree = 0;
|
||||
|
||||
//////////////////////////////
|
||||
@@ -11854,15 +11847,6 @@ rd_frame(void)
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: set name matching parameters; begin matching
|
||||
//
|
||||
{
|
||||
DI_KeyList keys_list = d_push_active_dbgi_key_list(scratch.arena);
|
||||
DI_KeyArray keys = di_key_array_from_list(scratch.arena, &keys_list);
|
||||
di_match_store_begin(rd_state->match_store, keys);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: loop - consume events in core, tick engine, and repeat
|
||||
//
|
||||
@@ -11888,15 +11872,15 @@ rd_frame(void)
|
||||
E_Module *eval_modules_primary = &eval_modules[0];
|
||||
eval_modules_primary->rdi = &rdi_parsed_nil;
|
||||
eval_modules_primary->vaddr_range = r1u64(0, max_U64);
|
||||
DI_Key primary_dbgi_key = {0};
|
||||
DI2_Key primary_dbgi_key = {0};
|
||||
ProfScope("produce all eval modules")
|
||||
{
|
||||
for EachIndex(eval_module_idx, all_modules.count)
|
||||
{
|
||||
CTRL_Entity *m = all_modules.v[eval_module_idx];
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(m);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(m);
|
||||
eval_modules[eval_module_idx].arch = m->arch;
|
||||
eval_modules[eval_module_idx].rdi = di_rdi_from_key(rd_state->frame_di_scope, &dbgi_key, 1, 0);
|
||||
eval_modules[eval_module_idx].rdi = di2_rdi_from_key(rd_state->frame_access, dbgi_key, 0, 0);
|
||||
eval_modules[eval_module_idx].vaddr_range = m->vaddr_range;
|
||||
eval_modules[eval_module_idx].space = rd_eval_space_from_ctrl_entity(ctrl_entity_ancestor_from_kind(m, CTRL_EntityKind_Process), RD_EvalSpaceKind_CtrlEntity);
|
||||
if(module == m)
|
||||
@@ -11931,7 +11915,6 @@ rd_frame(void)
|
||||
ctx->modules = eval_modules;
|
||||
ctx->modules_count = eval_modules_count;
|
||||
ctx->primary_module = eval_modules_primary;
|
||||
ctx->dbgi_match_store = rd_state->match_store;
|
||||
|
||||
//- rjf: fill space hooks
|
||||
ctx->space_gen = rd_eval_space_gen;
|
||||
@@ -12702,8 +12685,8 @@ rd_frame(void)
|
||||
E_IRCtx *ctx = ir_ctx;
|
||||
ctx->regs_map = ctrl_string2reg_from_arch(eval_base_ctx->primary_module->arch);
|
||||
ctx->reg_alias_map = ctrl_string2alias_from_arch(eval_base_ctx->primary_module->arch);
|
||||
ctx->locals_map = d_query_cached_locals_map_from_dbgi_key_voff(&primary_dbgi_key, rip_voff);
|
||||
ctx->member_map = d_query_cached_member_map_from_dbgi_key_voff(&primary_dbgi_key, rip_voff);
|
||||
ctx->locals_map = d_query_cached_locals_map_from_dbgi_key_voff(primary_dbgi_key, rip_voff);
|
||||
ctx->member_map = d_query_cached_member_map_from_dbgi_key_voff(primary_dbgi_key, rip_voff);
|
||||
ctx->macro_map = macro_map;
|
||||
ctx->auto_hook_map = auto_hook_map;
|
||||
}
|
||||
@@ -14405,7 +14388,7 @@ rd_frame(void)
|
||||
U64 vaddr = 0;
|
||||
for(D_LineNode *n = rd_regs()->lines.first; n != 0; n = n->next)
|
||||
{
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, &n->v.dbgi_key);
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, n->v.dbgi_key);
|
||||
CTRL_Entity *module = ctrl_module_from_thread_candidates(&d_state->ctrl_entity_store->ctx, thread, &modules);
|
||||
if(module != &ctrl_entity_nil)
|
||||
{
|
||||
@@ -14686,7 +14669,7 @@ rd_frame(void)
|
||||
//- rjf: thread finding
|
||||
case RD_CmdKind_FindThread:
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
Access *access = access_open();
|
||||
|
||||
//- rjf: unpack thread info
|
||||
CTRL_Entity *thread = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->thread);
|
||||
@@ -14695,10 +14678,10 @@ rd_frame(void)
|
||||
U64 rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_index);
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
U64 rip_voff = ctrl_voff_from_vaddr(module, rip_vaddr);
|
||||
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, &dbgi_key, rip_voff);
|
||||
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, dbgi_key, rip_voff);
|
||||
D_Line line = {0};
|
||||
{
|
||||
U64 idx = 0;
|
||||
@@ -14712,7 +14695,7 @@ rd_frame(void)
|
||||
}
|
||||
}
|
||||
B32 missing_rip = (rip_vaddr == 0);
|
||||
B32 dbgi_missing = (dbgi_key.min_timestamp == 0 || dbgi_key.path.size == 0);
|
||||
B32 dbgi_missing = (di2_key_match(di2_key_zero(), dbgi_key));
|
||||
B32 dbgi_pending = !dbgi_missing && rdi == &rdi_parsed_nil;
|
||||
B32 has_line_info = (line.voff_range.max != 0);
|
||||
B32 has_module = (module != &ctrl_entity_nil);
|
||||
@@ -14749,7 +14732,7 @@ rd_frame(void)
|
||||
{
|
||||
find_thread_retry = thread->handle;
|
||||
}
|
||||
di_scope_close(scope);
|
||||
access_close(access);
|
||||
}break;
|
||||
case RD_CmdKind_FindSelectedThread:
|
||||
{
|
||||
@@ -14776,20 +14759,21 @@ rd_frame(void)
|
||||
|
||||
// rjf: try to resolve name as a symbol
|
||||
U64 voff = 0;
|
||||
DI_Key voff_dbgi_key = {0};
|
||||
DI2_Key voff_dbgi_key = {0};
|
||||
if(!name_resolved)
|
||||
{
|
||||
DI_KeyList keys = d_push_active_dbgi_key_list(scratch.arena);
|
||||
for(DI_KeyNode *n = keys.first; n != 0; n = n->next)
|
||||
DI2_Match match = di2_match_from_string(name, 0, 0);
|
||||
if(match.section_kind == RDI_SectionKind_Procedures)
|
||||
{
|
||||
U64 binary_voff = d_voff_from_dbgi_key_symbol_name(&n->v, name);
|
||||
if(binary_voff != 0)
|
||||
Access *access = access_open();
|
||||
{
|
||||
voff = binary_voff;
|
||||
voff_dbgi_key = n->v;
|
||||
name_resolved = 1;
|
||||
break;
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, match.key, 0, 0);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, match.idx);
|
||||
voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
voff_dbgi_key = match.key;
|
||||
}
|
||||
access_close(access);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14848,20 +14832,17 @@ rd_frame(void)
|
||||
// rjf: name resolved to voff * dbg info
|
||||
if(name_resolved && voff != 0)
|
||||
{
|
||||
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, &voff_dbgi_key, voff);
|
||||
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, voff_dbgi_key, voff);
|
||||
if(lines.first != 0)
|
||||
{
|
||||
CTRL_Entity *process = &ctrl_entity_nil;
|
||||
U64 vaddr = 0;
|
||||
if(voff_dbgi_key.path.size != 0)
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, voff_dbgi_key);
|
||||
CTRL_Entity *module = ctrl_entity_list_first(&modules);
|
||||
process = ctrl_entity_ancestor_from_kind(module, CTRL_EntityKind_Process);
|
||||
if(process != &ctrl_entity_nil)
|
||||
{
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, &voff_dbgi_key);
|
||||
CTRL_Entity *module = ctrl_entity_list_first(&modules);
|
||||
process = ctrl_entity_ancestor_from_kind(module, CTRL_EntityKind_Process);
|
||||
if(process != &ctrl_entity_nil)
|
||||
{
|
||||
vaddr = module->vaddr_range.min + lines.first->v.voff_range.min;
|
||||
}
|
||||
vaddr = module->vaddr_range.min + lines.first->v.voff_range.min;
|
||||
}
|
||||
rd_cmd(RD_CmdKind_FindCodeLocation,
|
||||
.file_path = lines.first->v.file_path,
|
||||
@@ -14951,7 +14932,7 @@ rd_frame(void)
|
||||
D_LineList lines = d_lines_from_file_path_line_num(scratch.arena, file_path, point.line);
|
||||
for(D_LineNode *n = lines.first; n != 0; n = n->next)
|
||||
{
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, &n->v.dbgi_key);
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, n->v.dbgi_key);
|
||||
CTRL_Entity *module = ctrl_module_from_thread_candidates(&d_state->ctrl_entity_store->ctx, thread, &modules);
|
||||
vaddr = ctrl_vaddr_from_voff(module, n->v.voff_range.min);
|
||||
break;
|
||||
@@ -16126,7 +16107,7 @@ rd_frame(void)
|
||||
D_LineList *lines = &rd_regs()->lines;
|
||||
for(D_LineNode *n = lines->first; n != 0; n = n->next)
|
||||
{
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, &n->v.dbgi_key);
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, n->v.dbgi_key);
|
||||
CTRL_Entity *module = ctrl_module_from_thread_candidates(&d_state->ctrl_entity_store->ctx, thread, &modules);
|
||||
if(module != &ctrl_entity_nil)
|
||||
{
|
||||
@@ -17015,7 +16996,6 @@ rd_frame(void)
|
||||
U64 vaddr = evt->vaddr;
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
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);
|
||||
U64 test_cached_vaddr = ctrl_rip_from_thread(&d_state->ctrl_entity_store->ctx, thread->handle);
|
||||
|
||||
@@ -17325,9 +17305,7 @@ rd_frame(void)
|
||||
// since eviction threads may be waiting to get rid of stuff.
|
||||
//
|
||||
access_close(rd_state->frame_access);
|
||||
di_scope_close(rd_state->frame_di_scope);
|
||||
rd_state->frame_access = frame_access_restore;
|
||||
rd_state->frame_di_scope = frame_di_scope_restore;
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: submit rendering to all windows
|
||||
|
||||
@@ -600,13 +600,9 @@ struct RD_State
|
||||
// rjf: frame parameters
|
||||
F32 frame_dt;
|
||||
Access *frame_access;
|
||||
DI_Scope *frame_di_scope;
|
||||
CTRL_CallStackTree frame_call_stack_tree;
|
||||
B32 got_frame_call_stack_tree;
|
||||
|
||||
// rjf: dbgi match store
|
||||
DI_MatchStore *match_store;
|
||||
|
||||
// rjf: evaluation cache
|
||||
E_Cache *eval_cache;
|
||||
|
||||
|
||||
+37
-55
@@ -1634,9 +1634,7 @@ typedef struct RD_DebugInfoTableLookupAccel RD_DebugInfoTableLookupAccel;
|
||||
struct RD_DebugInfoTableLookupAccel
|
||||
{
|
||||
RDI_SectionKind section;
|
||||
U64 rdis_count;
|
||||
RDI_Parsed **rdis;
|
||||
DI_SearchItemArray items;
|
||||
DI2_SearchItemArray items;
|
||||
};
|
||||
|
||||
E_TYPE_EXPAND_INFO_FUNCTION_DEF(debug_info_table)
|
||||
@@ -1663,28 +1661,10 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(debug_info_table)
|
||||
{
|
||||
U64 endt_us = rd_state->frame_eval_memread_endt_us;
|
||||
|
||||
//- rjf: unpack context
|
||||
DI_KeyList dbgi_keys_list = d_push_active_dbgi_key_list(scratch.arena);
|
||||
DI_KeyArray dbgi_keys = di_key_array_from_list(scratch.arena, &dbgi_keys_list);
|
||||
U64 rdis_count = dbgi_keys.count;
|
||||
RDI_Parsed **rdis = push_array(arena, RDI_Parsed *, rdis_count);
|
||||
for(U64 idx = 0; idx < rdis_count; idx += 1)
|
||||
{
|
||||
rdis[idx] = di_rdi_from_key(rd_state->frame_di_scope, &dbgi_keys.v[idx], 1, endt_us);
|
||||
}
|
||||
|
||||
//- rjf: query all filtered items from dbgi searching system
|
||||
U128 fuzzy_search_key = {d_hash_from_string(str8_struct(&rd_regs()->view)), (U64)section};
|
||||
B32 items_stale = 0;
|
||||
DI_SearchParams params = {section, dbgi_keys};
|
||||
accel->section = section;
|
||||
accel->rdis_count = rdis_count;
|
||||
accel->rdis = rdis;
|
||||
accel->items = di_search_items_from_key_params_query(rd_state->frame_di_scope, fuzzy_search_key, ¶ms, filter, endt_us, &items_stale);
|
||||
if(items_stale)
|
||||
{
|
||||
rd_request_frame();
|
||||
}
|
||||
accel->items = di2_search_item_array_from_target_query(rd_state->frame_access, section, filter, endt_us);
|
||||
}
|
||||
E_TypeExpandInfo info = {accel, accel->items.count};
|
||||
scratch_end(scratch);
|
||||
@@ -1698,18 +1678,11 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(debug_info_table)
|
||||
U64 needed_row_count = dim_1u64(idx_range);
|
||||
for EachIndex(idx, needed_row_count)
|
||||
{
|
||||
Access *access = access_open();
|
||||
|
||||
// rjf: unpack row
|
||||
DI_SearchItem *item = &accel->items.v[idx_range.min + idx];
|
||||
|
||||
// rjf: skip bad elements
|
||||
if(item->dbgi_idx >= accel->rdis_count)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// rjf: unpack row info
|
||||
RDI_Parsed *rdi = accel->rdis[item->dbgi_idx];
|
||||
E_Module *module = &e_base_ctx->modules[item->dbgi_idx];
|
||||
DI2_SearchItem *item = &accel->items.v[idx_range.min + idx];
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, item->key, 0, 0);
|
||||
|
||||
// rjf: get item's string
|
||||
String8 item_string = {0};
|
||||
@@ -1721,51 +1694,43 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(debug_info_table)
|
||||
default:{}break;
|
||||
case RDI_SectionKind_Procedures:
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(module->rdi, Procedures, element_idx);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(module->rdi, Scopes, procedure->root_scope_idx);
|
||||
U64 voff = *rdi_element_from_name_idx(module->rdi, ScopeVOffData, scope->voff_range_first);
|
||||
E_OpList oplist = {0};
|
||||
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU64, e_value_u64(module->vaddr_range.min + voff));
|
||||
String8 bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
U32 type_idx = procedure->type_idx;
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, type_idx);
|
||||
E_TypeKey type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, (U32)(module - e_base_ctx->modules));
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(module->rdi, procedure->name_string_idx, &symbol_name.size);
|
||||
symbol_name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_GlobalVariables:
|
||||
{
|
||||
RDI_GlobalVariable *gvar = rdi_element_from_name_idx(module->rdi, GlobalVariables, element_idx);
|
||||
RDI_GlobalVariable *gvar = rdi_element_from_name_idx(rdi, GlobalVariables, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(module->rdi, gvar->name_string_idx, &symbol_name.size);
|
||||
symbol_name.str = rdi_string_from_idx(rdi, gvar->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_ThreadVariables:
|
||||
{
|
||||
RDI_ThreadVariable *tvar = rdi_element_from_name_idx(module->rdi, ThreadVariables, element_idx);
|
||||
RDI_ThreadVariable *tvar = rdi_element_from_name_idx(rdi, ThreadVariables, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(module->rdi, tvar->name_string_idx, &symbol_name.size);
|
||||
symbol_name.str = rdi_string_from_idx(rdi, tvar->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_Constants:
|
||||
{
|
||||
RDI_Constant *cnst = rdi_element_from_name_idx(module->rdi, Constants, element_idx);
|
||||
RDI_Constant *cnst = rdi_element_from_name_idx(rdi, Constants, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(module->rdi, cnst->name_string_idx, &symbol_name.size);
|
||||
symbol_name.str = rdi_string_from_idx(rdi, cnst->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_UDTs:
|
||||
{
|
||||
RDI_UDT *udt = rdi_element_from_name_idx(module->rdi, UDTs, element_idx);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(module->rdi, TypeNodes, udt->self_type_idx);
|
||||
RDI_UDT *udt = rdi_element_from_name_idx(rdi, UDTs, element_idx);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, udt->self_type_idx);
|
||||
String8 name = {0};
|
||||
name.str = rdi_string_from_idx(module->rdi, type_node->user_defined.name_string_idx, &name.size);
|
||||
name.str = rdi_string_from_idx(rdi, type_node->user_defined.name_string_idx, &name.size);
|
||||
item_string = name;
|
||||
}break;
|
||||
case RDI_SectionKind_SourceFiles:
|
||||
{
|
||||
RDI_SourceFile *sf = rdi_element_from_name_idx(module->rdi, SourceFiles, element_idx);
|
||||
RDI_SourceFile *sf = rdi_element_from_name_idx(rdi, SourceFiles, element_idx);
|
||||
String8List path_parts = {0};
|
||||
for(RDI_FilePathNode *fpn = rdi_element_from_name_idx(rdi, FilePathNodes, sf->file_path_node_idx);
|
||||
fpn != rdi_element_from_name_idx(rdi, FilePathNodes, 0);
|
||||
@@ -1815,6 +1780,8 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(debug_info_table)
|
||||
// rjf: fill
|
||||
evals_out[idx] = item_eval;
|
||||
temp_end(scratch);
|
||||
|
||||
access_close(access);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
@@ -1825,7 +1792,10 @@ E_TYPE_EXPAND_ID_FROM_NUM_FUNCTION_DEF(debug_info_table)
|
||||
U64 id = 0;
|
||||
if(0 < num && num <= accel->items.count)
|
||||
{
|
||||
id = accel->items.v[num-1].idx+1;
|
||||
U64 hash = 5381;
|
||||
hash = u64_hash_from_seed_str8(hash, str8_struct(&accel->items.v[num-1].key.u64[0]));
|
||||
hash = u64_hash_from_seed_str8(hash, str8_struct(&accel->items.v[num-1].key.u64[1]));
|
||||
hash = u64_hash_from_seed_str8(hash, str8_struct(&accel->items.v[num-1].idx));
|
||||
}
|
||||
return id;
|
||||
}
|
||||
@@ -1833,6 +1803,18 @@ E_TYPE_EXPAND_ID_FROM_NUM_FUNCTION_DEF(debug_info_table)
|
||||
E_TYPE_EXPAND_NUM_FROM_ID_FUNCTION_DEF(debug_info_table)
|
||||
{
|
||||
RD_DebugInfoTableLookupAccel *accel = (RD_DebugInfoTableLookupAccel *)user_data;
|
||||
U64 num = di_search_item_num_from_array_element_idx__linear_search(&accel->items, id-1);
|
||||
U64 num = 0;
|
||||
for EachIndex(idx, accel->items.count)
|
||||
{
|
||||
U64 hash = 5381;
|
||||
hash = u64_hash_from_seed_str8(hash, str8_struct(&accel->items.v[idx].key.u64[0]));
|
||||
hash = u64_hash_from_seed_str8(hash, str8_struct(&accel->items.v[idx].key.u64[1]));
|
||||
hash = u64_hash_from_seed_str8(hash, str8_struct(&accel->items.v[idx].idx));
|
||||
if(hash == id)
|
||||
{
|
||||
num = idx+1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
@@ -248,7 +248,7 @@
|
||||
#include "radbin/radbin.h"
|
||||
#include "regs/regs.h"
|
||||
#include "regs/rdi/regs_rdi.h"
|
||||
#include "dbg_info/dbg_info.h"
|
||||
// #include "dbg_info/dbg_info.h"
|
||||
#include "dbg_info/dbg_info2.h"
|
||||
#include "disasm/disasm.h"
|
||||
#include "demon/demon_inc.h"
|
||||
@@ -296,7 +296,7 @@
|
||||
#include "radbin/radbin.c"
|
||||
#include "regs/regs.c"
|
||||
#include "regs/rdi/regs_rdi.c"
|
||||
#include "dbg_info/dbg_info.c"
|
||||
// #include "dbg_info/dbg_info.c"
|
||||
#include "dbg_info/dbg_info2.c"
|
||||
#include "disasm/disasm.c"
|
||||
#include "demon/demon_inc.c"
|
||||
|
||||
+31
-31
@@ -20,7 +20,7 @@ rd_code_view_init(RD_CodeViewState *cv)
|
||||
}
|
||||
|
||||
internal RD_CodeViewBuildResult
|
||||
rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags flags, Rng2F32 rect, String8 text_data, TXT_TextInfo *text_info, DASM_LineArray *dasm_lines, Rng1U64 dasm_vaddr_range, DI_Key dasm_dbgi_key)
|
||||
rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags flags, Rng2F32 rect, String8 text_data, TXT_TextInfo *text_info, DASM_LineArray *dasm_lines, Rng1U64 dasm_vaddr_range, DI2_Key dasm_dbgi_key)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
@@ -289,8 +289,8 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
|
||||
U64 last_inst_on_unwound_rip_vaddr = rip_vaddr - !!unwind_count;
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, last_inst_on_unwound_rip_vaddr);
|
||||
U64 rip_voff = ctrl_voff_from_vaddr(module, last_inst_on_unwound_rip_vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, &dbgi_key, rip_voff);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, dbgi_key, rip_voff);
|
||||
for(D_LineNode *n = lines.first; n != 0; n = n->next)
|
||||
{
|
||||
if(visible_line_num_range.min <= n->v.pt.line && n->v.pt.line <= visible_line_num_range.max)
|
||||
@@ -341,7 +341,7 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
|
||||
{
|
||||
String8 file_path = rd_regs()->file_path;
|
||||
CTRL_Entity *module = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->module);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
D_LineListArray lines_array = d_lines_array_from_dbgi_key_file_path_line_range(scratch.arena, dbgi_key, file_path, visible_line_num_range);
|
||||
if(lines_array.count != 0)
|
||||
{
|
||||
@@ -423,21 +423,21 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
|
||||
if(dasm_lines)
|
||||
{
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, dasm_vaddr_range.min);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
for(S64 line_num = visible_line_num_range.min; line_num < visible_line_num_range.max; line_num += 1)
|
||||
{
|
||||
U64 vaddr = dasm_vaddr_range.min + dasm_line_array_code_off_from_idx(dasm_lines, line_num-1);
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
U64 slice_idx = line_num-visible_line_num_range.min;
|
||||
code_slice_params.line_vaddrs[slice_idx] = vaddr;
|
||||
code_slice_params.line_infos[slice_idx] = d_lines_from_dbgi_key_voff(scratch.arena, &dbgi_key, voff);
|
||||
code_slice_params.line_infos[slice_idx] = d_lines_from_dbgi_key_voff(scratch.arena, dbgi_key, voff);
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: add dasm dbgi key to relevant dbgis
|
||||
if(dasm_lines != 0)
|
||||
{
|
||||
di_key_list_push(scratch.arena, &code_slice_params.relevant_dbgi_keys, &dasm_dbgi_key);
|
||||
di2_key_list_push(scratch.arena, &code_slice_params.relevant_dbgi_keys, dasm_dbgi_key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -813,10 +813,9 @@ rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags fla
|
||||
//
|
||||
RD_CodeViewBuildResult result = {0};
|
||||
{
|
||||
for(DI_KeyNode *n = code_slice_params.relevant_dbgi_keys.first; n != 0; n = n->next)
|
||||
for(DI2_KeyNode *n = code_slice_params.relevant_dbgi_keys.first; n != 0; n = n->next)
|
||||
{
|
||||
DI_Key copy = di_key_copy(arena, &n->v);
|
||||
di_key_list_push(arena, &result.dbgi_keys, ©);
|
||||
di2_key_list_push(arena, &result.dbgi_keys, n->v);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2148,7 +2147,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
|
||||
//////////////////////////////
|
||||
//- rjf: build code contents
|
||||
//
|
||||
DI_KeyList dbgi_keys = {0};
|
||||
DI2_KeyList dbgi_keys = {0};
|
||||
if(!file_is_missing)
|
||||
{
|
||||
RD_CodeViewBuildFlags flags = RD_CodeViewBuildFlag_All;
|
||||
@@ -2156,7 +2155,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
|
||||
{
|
||||
flags &= ~RD_CodeViewBuildFlag_Margins;
|
||||
}
|
||||
RD_CodeViewBuildResult result = rd_code_view_build(scratch.arena, cv, flags, code_area_rect, data, &info, 0, r1u64(0, 0), di_key_zero());
|
||||
RD_CodeViewBuildResult result = rd_code_view_build(scratch.arena, cv, flags, code_area_rect, data, &info, 0, r1u64(0, 0), di2_key_zero());
|
||||
dbgi_keys = result.dbgi_keys;
|
||||
}
|
||||
|
||||
@@ -2166,7 +2165,7 @@ RD_VIEW_UI_FUNCTION_DEF(text)
|
||||
if(rd_regs()->file_path.size != 0)
|
||||
{
|
||||
CTRL_Entity *module = ctrl_entity_from_handle(&d_state->ctrl_entity_store->ctx, rd_regs()->module);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
rd_regs()->lines = d_lines_from_dbgi_key_file_path_line_num(rd_frame_arena(), dbgi_key, rd_regs()->file_path, rd_regs()->cursor.line);
|
||||
}
|
||||
|
||||
@@ -2179,15 +2178,18 @@ RD_VIEW_UI_FUNCTION_DEF(text)
|
||||
U64 file_timestamp = os_properties_from_file_path(rd_regs()->file_path).modified;
|
||||
if(file_timestamp != 0)
|
||||
{
|
||||
for(DI_KeyNode *n = dbgi_keys.first; n != 0; n = n->next)
|
||||
for(DI2_KeyNode *n = dbgi_keys.first; n != 0; n = n->next)
|
||||
{
|
||||
DI_Key key = n->v;
|
||||
DI2_Key key = n->v;
|
||||
// TODO(rjf): @dbgi2
|
||||
#if 0
|
||||
if(key.min_timestamp < file_timestamp && key.min_timestamp != 0 && key.path.size != 0)
|
||||
{
|
||||
file_is_out_of_date = 1;
|
||||
out_of_date_dbgi_name = str8_skip_last_slash(key.path);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2356,7 +2358,7 @@ RD_VIEW_UI_FUNCTION_DEF(disasm)
|
||||
Arch arch = rd_arch_from_eval(eval);
|
||||
CTRL_Entity *space_entity = rd_ctrl_entity_from_eval_space(space);
|
||||
CTRL_Entity *dasm_module = &ctrl_entity_nil;
|
||||
DI_Key dbgi_key = {0};
|
||||
DI2_Key dbgi_key = {0};
|
||||
U64 base_vaddr = 0;
|
||||
switch(space_entity->kind)
|
||||
{
|
||||
@@ -2455,7 +2457,7 @@ RD_VIEW_UI_FUNCTION_DEF(disasm)
|
||||
rd_regs()->vaddr = range.min+off;
|
||||
rd_regs()->vaddr_range = r1u64(range.min+off, range.min+off);
|
||||
rd_regs()->voff_range = ctrl_voff_range_from_vaddr_range(dasm_module, rd_regs()->vaddr_range);
|
||||
rd_regs()->lines = d_lines_from_dbgi_key_voff(rd_frame_arena(), &dbgi_key, rd_regs()->voff_range.min);
|
||||
rd_regs()->lines = d_lines_from_dbgi_key_voff(rd_frame_arena(), dbgi_key, rd_regs()->voff_range.min);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -2952,16 +2954,16 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
last_stack_top = f_stack_top;
|
||||
if(dim_1u64(frame_vaddr_range_in_viz) != 0)
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
Access *access = access_open();
|
||||
U64 f_rip_vaddr = regs_rip_from_arch_block(selected_thread->arch, f->regs);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(selected_process, f_rip_vaddr);
|
||||
U64 f_rip_voff = ctrl_voff_from_vaddr(module, f_rip_vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, f_rip_voff);
|
||||
String8 procedure_name = {0};
|
||||
procedure_name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &procedure_name.size);
|
||||
di_scope_close(scope);
|
||||
access_close(access);
|
||||
if(procedure_name.size != 0)
|
||||
{
|
||||
Annotation *annotation = push_array(scratch.arena, Annotation, 1);
|
||||
@@ -3008,7 +3010,6 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
//- rjf: fill local variable annotations
|
||||
if(e_space_match(rd_eval_space_from_ctrl_entity(selected_process, RD_EvalSpaceKind_CtrlEntity), eval.space))
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
Vec4F32 local_color = ui_color_from_name(str8_lit("code_local"));
|
||||
Vec4F32 color_gen_table[] =
|
||||
{
|
||||
@@ -3047,7 +3048,6 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
}
|
||||
}
|
||||
}
|
||||
di_scope_close(scope);
|
||||
}
|
||||
|
||||
//- rjf: fill procedures annotations
|
||||
@@ -3066,13 +3066,13 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
vaddr = next_vaddr)
|
||||
{
|
||||
next_vaddr = vaddr+1;
|
||||
DI_Scope *scope = di_scope_open();
|
||||
Access *access = access_open();
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(eval_process, vaddr);
|
||||
if(module != &ctrl_entity_nil)
|
||||
{
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
RDI_Scope *root_scope = rdi_element_from_name_idx(rdi, Scopes, procedure->root_scope_idx);
|
||||
if(procedure->root_scope_idx != 0)
|
||||
@@ -3103,7 +3103,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
}
|
||||
}
|
||||
}
|
||||
di_scope_close(scope);
|
||||
access_close(access);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3123,13 +3123,13 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
vaddr = next_vaddr)
|
||||
{
|
||||
next_vaddr = vaddr+1;
|
||||
DI_Scope *scope = di_scope_open();
|
||||
Access *access = access_open();
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(eval_process, vaddr);
|
||||
if(module != &ctrl_entity_nil)
|
||||
{
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
RDI_GlobalVariable *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
if(gvar->voff != 0)
|
||||
{
|
||||
@@ -3159,7 +3159,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
}
|
||||
}
|
||||
}
|
||||
di_scope_close(scope);
|
||||
access_close(access);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ struct RD_CodeViewState
|
||||
typedef struct RD_CodeViewBuildResult RD_CodeViewBuildResult;
|
||||
struct RD_CodeViewBuildResult
|
||||
{
|
||||
DI_KeyList dbgi_keys;
|
||||
DI2_KeyList dbgi_keys;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
@@ -199,7 +199,7 @@ struct RD_WatchViewState
|
||||
//~ rjf: Code View Functions
|
||||
|
||||
internal void rd_code_view_init(RD_CodeViewState *cv);
|
||||
internal RD_CodeViewBuildResult rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags flags, Rng2F32 rect, String8 text_data, TXT_TextInfo *text_info, DASM_LineArray *dasm_lines, Rng1U64 dasm_vaddr_range, DI_Key dasm_dbgi_key);
|
||||
internal RD_CodeViewBuildResult rd_code_view_build(Arena *arena, RD_CodeViewState *cv, RD_CodeViewBuildFlags flags, Rng2F32 rect, String8 text_data, TXT_TextInfo *text_info, DASM_LineArray *dasm_lines, Rng1U64 dasm_vaddr_range, DI2_Key dasm_dbgi_key);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Watch View Functions
|
||||
|
||||
+15
-24
@@ -548,7 +548,6 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
|
||||
Vec4F32 symbol_color = ui_color_from_name(str8_lit("code_symbol"));
|
||||
dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
|
||||
Access *access = access_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(entity, CTRL_EntityKind_Process);
|
||||
Arch arch = entity->arch;
|
||||
B32 call_stack_high_priority = ctrl_handle_match(entity->handle, rd_base_regs()->thread);
|
||||
@@ -564,8 +563,8 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
|
||||
U64 rip_voff = ctrl_voff_from_vaddr(module, rip_vaddr);
|
||||
String8 name = {0};
|
||||
{
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, 0);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
if(rdi != &rdi_parsed_nil)
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, rip_voff);
|
||||
@@ -591,22 +590,21 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
|
||||
}
|
||||
}
|
||||
}
|
||||
di_scope_close(di_scope);
|
||||
access_close(access);
|
||||
}
|
||||
|
||||
//- rjf: modules get debug info status extras
|
||||
if(entity->kind == CTRL_EntityKind_Module && include_extras)
|
||||
{
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(entity);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, 0);
|
||||
Access *access = access_open();
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(entity);
|
||||
RDI_Parsed *rdi = di2_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
if(rdi->raw_data_size == 0)
|
||||
{
|
||||
dr_fstrs_push_new(arena, &result, ¶ms, str8_lit(" "));
|
||||
dr_fstrs_push_new(arena, &result, ¶ms, str8_lit("(Symbols not found)"), .font = rd_font_from_slot(RD_FontSlot_Main), .raster_flags = rd_raster_flags_from_slot(RD_FontSlot_Main), .size = extras_size, .color = secondary_color);
|
||||
}
|
||||
di_scope_close(di_scope);
|
||||
access_close(access);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -1419,7 +1417,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count);
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, thread_rip_vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
U64 thread_rip_voff = ctrl_voff_from_vaddr(module, thread_rip_vaddr);
|
||||
|
||||
// rjf: thread info => color
|
||||
@@ -1490,7 +1488,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
D_Line *line = 0;
|
||||
for(D_LineNode *n = lines->first; n != 0; n = n->next)
|
||||
{
|
||||
if(di_key_match(&n->v.dbgi_key, &dbgi_key))
|
||||
if(di2_key_match(n->v.dbgi_key, dbgi_key))
|
||||
{
|
||||
line = &n->v;
|
||||
break;
|
||||
@@ -1575,7 +1573,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
U64 thread_rip_vaddr = d_query_cached_rip_from_thread_unwind(thread, unwind_count);
|
||||
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
|
||||
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, thread_rip_vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
DI2_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
U64 thread_rip_voff = ctrl_voff_from_vaddr(module, thread_rip_vaddr);
|
||||
|
||||
// rjf: thread info => color
|
||||
@@ -1644,7 +1642,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
D_Line *line = 0;
|
||||
for(D_LineNode *n = lines->first; n != 0; n = n->next)
|
||||
{
|
||||
if(di_key_match(&n->v.dbgi_key, &dbgi_key))
|
||||
if(di2_key_match(n->v.dbgi_key, dbgi_key))
|
||||
{
|
||||
line = &n->v;
|
||||
break;
|
||||
@@ -1867,19 +1865,14 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
// rjf: line info on this line -> adjust bg color to visualize
|
||||
B32 has_line_info = 0;
|
||||
{
|
||||
U64 best_stamp = 0;
|
||||
S64 line_info_line_num = 0;
|
||||
F32 line_info_t = 0;
|
||||
D_LineList *lines = ¶ms->line_infos[line_idx];
|
||||
for(D_LineNode *n = lines->first; n != 0; n = n->next)
|
||||
{
|
||||
if(n->v.dbgi_key.min_timestamp >= best_stamp)
|
||||
{
|
||||
has_line_info = (n->v.pt.line == line_num || params->line_vaddrs[line_idx] != 0);
|
||||
line_info_line_num = n->v.pt.line;
|
||||
best_stamp = n->v.dbgi_key.min_timestamp;
|
||||
line_info_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "dbgi_alive_t_%S", n->v.dbgi_key.path), 1.f);
|
||||
}
|
||||
has_line_info = (has_line_info || n->v.pt.line == line_num || params->line_vaddrs[line_idx] != 0);
|
||||
line_info_line_num = n->v.pt.line;
|
||||
line_info_t = ui_anim(ui_key_from_stringf(ui_key_zero(), "dbgi_alive_t_%I64x_%I64x", n->v.dbgi_key.u64[0], n->v.dbgi_key.u64[1]), 1.f);
|
||||
}
|
||||
if(has_line_info)
|
||||
{
|
||||
@@ -2019,7 +2012,6 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
//
|
||||
UI_Focus(UI_FocusKind_Off)
|
||||
{
|
||||
DI_Scope *scope = di_scope_open();
|
||||
U64 line_idx = 0;
|
||||
for(S64 line_num = params->line_num_range.min;
|
||||
line_num < params->line_num_range.max;
|
||||
@@ -2152,7 +2144,6 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
}
|
||||
}
|
||||
}
|
||||
di_scope_close(scope);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -2275,7 +2266,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
D_LineList *lines = ¶ms->line_infos[line_idx];
|
||||
for(D_LineNode *n = lines->first; n != 0; n = n->next)
|
||||
{
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, &n->v.dbgi_key);
|
||||
CTRL_EntityList modules = ctrl_modules_from_dbgi_key(scratch.arena, &d_state->ctrl_entity_store->ctx, n->v.dbgi_key);
|
||||
CTRL_Entity *module = ctrl_module_from_thread_candidates(&d_state->ctrl_entity_store->ctx, thread, &modules);
|
||||
if(module != &ctrl_entity_nil)
|
||||
{
|
||||
@@ -2805,7 +2796,7 @@ rd_code_slice(RD_CodeSliceParams *params, TxtPt *cursor, TxtPt *mark, S64 *prefe
|
||||
for(D_LineNode *n = lines->first; n != 0; n = n->next)
|
||||
{
|
||||
if((n->v.pt.line == line_num || params->line_vaddrs[line_idx] != 0) &&
|
||||
((di_key_match(&n->v.dbgi_key, &hover_regs->dbgi_key) &&
|
||||
((di2_key_match(n->v.dbgi_key, hover_regs->dbgi_key) &&
|
||||
n->v.voff_range.min <= hover_voff_range.min && hover_voff_range.min < n->v.voff_range.max) ||
|
||||
(params->line_vaddrs[line_idx] == hover_regs->vaddr_range.min && hover_regs->vaddr_range.min != 0)))
|
||||
{
|
||||
|
||||
@@ -104,7 +104,7 @@ struct RD_CodeSliceParams
|
||||
RD_CfgList *line_pins;
|
||||
U64 *line_vaddrs;
|
||||
D_LineList *line_infos;
|
||||
DI_KeyList relevant_dbgi_keys;
|
||||
DI2_KeyList relevant_dbgi_keys;
|
||||
TXT_TextInfo *text_info;
|
||||
String8 text_data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user