mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-06-13 07:32:23 -07:00
get ctrl and debug frontend layers onto new pdb-path-based debug info loader layer; sketch out standalone fuzzy search layer, to replace old dbgi searching functionality; shift all debug frontend code from referring to debug info via 'binaries' to referring to debug info via 'dbgis', just file entities at the location of o.g. debug info
This commit is contained in:
@@ -42,6 +42,9 @@ main_thread_base_entry_point(void (*entry_point)(CmdLine *cmdline), char **argum
|
||||
#if defined(DI_H)
|
||||
di_init();
|
||||
#endif
|
||||
#if defined(FUZZY_SEARCH_H)
|
||||
fzy_init();
|
||||
#endif
|
||||
#if defined(TXTI_H)
|
||||
txti_init();
|
||||
#endif
|
||||
|
||||
+51
-65
@@ -2879,11 +2879,10 @@ internal void
|
||||
ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CTRL_MachineID machine_id, DMN_Handle process, DMN_Handle module, CTRL_UserBreakpointList *user_bps, DMN_TrapChunkList *traps_out)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
CTRL_Entity *module_entity = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, machine_id, module);
|
||||
String8 exe_path = module_entity->string;
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, exe_path, max_U64);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
CTRL_Entity *debug_info_path_entity = ctrl_entity_child_from_kind(module_entity, CTRL_EntityKind_DebugInfoPath);
|
||||
RDI_Parsed *rdi = di_rdi_from_path_min_timestamp(di_scope, debug_info_path_entity->string, debug_info_path_entity->timestamp, max_U64);
|
||||
U64 base_vaddr = module_entity->vaddr_range.min;
|
||||
for(CTRL_UserBreakpointNode *n = user_bps->first; n != 0; n = n->next)
|
||||
{
|
||||
@@ -2972,7 +2971,7 @@ ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CTRL_MachineID m
|
||||
}break;
|
||||
}
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(di_scope);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -2995,11 +2994,6 @@ ctrl_thread__append_resolved_process_user_bp_traps(Arena *arena, CTRL_MachineID
|
||||
internal void
|
||||
ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Handle module, Rng1U64 vaddr_range, String8 path, U64 exe_timestamp)
|
||||
{
|
||||
//////////////////////////////
|
||||
//- rjf: open debug info
|
||||
//
|
||||
dbgi_binary_open(path);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: parse module image info
|
||||
//
|
||||
@@ -3237,11 +3231,6 @@ ctrl_thread__module_open(CTRL_MachineID machine_id, DMN_Handle process, DMN_Hand
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: open debug info
|
||||
//
|
||||
di_open(initial_debug_info_path, exe_timestamp);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: insert info into cache
|
||||
//
|
||||
@@ -3315,14 +3304,12 @@ ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module, String8
|
||||
{
|
||||
CTRL_Entity *module_ent = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, machine_id, module);
|
||||
CTRL_Entity *debug_info_path_ent = ctrl_entity_child_from_kind(module_ent, CTRL_EntityKind_DebugInfoPath);
|
||||
String8 debug_info_path = debug_info_path_ent->string;
|
||||
di_close(debug_info_path, debug_info_path_ent->timestamp);
|
||||
if(debug_info_path_ent != &ctrl_entity_nil)
|
||||
{
|
||||
String8 debug_info_path = debug_info_path_ent->string;
|
||||
di_close(debug_info_path, debug_info_path_ent->timestamp);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: close debug info
|
||||
//
|
||||
dbgi_binary_close(path);
|
||||
}
|
||||
|
||||
//- rjf: attached process running/event gathering
|
||||
@@ -3402,7 +3389,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
if(!should_filter_event && ev->code == 0xc0000005 &&
|
||||
(spoof == 0 || ev->instruction_pointer != spoof->new_ip_value))
|
||||
{
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
CTRL_Entity *process = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, CTRL_MachineID_Local, ev->process);
|
||||
CTRL_Entity *module = &ctrl_entity_nil;
|
||||
for(CTRL_Entity *child = process->first; child != &ctrl_entity_nil; child = child->next)
|
||||
@@ -3418,9 +3405,8 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
// rjf: determine base address of asan shadow space
|
||||
U64 asan_shadow_base_vaddr = 0;
|
||||
B32 asan_shadow_variable_exists_but_is_zero = 0;
|
||||
String8 module_path = module->string;
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, module_path, max_U64);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
CTRL_Entity *dbg_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
|
||||
RDI_Parsed *rdi = di_rdi_from_path_min_timestamp(di_scope, dbg_path->string, dbg_path->timestamp, max_U64);
|
||||
RDI_NameMap *unparsed_map = rdi_name_map_from_kind(rdi, RDI_NameMapKind_GlobalVariables);
|
||||
if(rdi->global_variables != 0 && unparsed_map != 0)
|
||||
{
|
||||
@@ -3463,7 +3449,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
}
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(di_scope);
|
||||
}
|
||||
}break;
|
||||
}
|
||||
@@ -3588,21 +3574,31 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
}break;
|
||||
case DMN_EventKind_LoadModule:
|
||||
{
|
||||
CTRL_Event *out_evt = ctrl_event_list_push(scratch.arena, &evts);
|
||||
CTRL_Event *out_evt1 = ctrl_event_list_push(scratch.arena, &evts);
|
||||
String8 module_path = event->string;
|
||||
U64 timestamp = os_properties_from_file_path(module_path).modified;
|
||||
ctrl_thread__module_open(CTRL_MachineID_Local, event->process, event->module, r1u64(event->address, event->address+event->size), module_path, timestamp);
|
||||
out_evt->kind = CTRL_EventKind_NewModule;
|
||||
out_evt->msg_id = msg->msg_id;
|
||||
out_evt->machine_id = CTRL_MachineID_Local;
|
||||
out_evt->entity = event->module;
|
||||
out_evt->parent = event->process;
|
||||
out_evt->arch = event->arch;
|
||||
out_evt->entity_id = event->code;
|
||||
out_evt->vaddr_rng = r1u64(event->address, event->address+event->size);
|
||||
out_evt->rip_vaddr = event->address;
|
||||
out_evt->timestamp = timestamp;
|
||||
out_evt->string = module_path;
|
||||
out_evt1->kind = CTRL_EventKind_NewModule;
|
||||
out_evt1->msg_id = msg->msg_id;
|
||||
out_evt1->machine_id = CTRL_MachineID_Local;
|
||||
out_evt1->entity = event->module;
|
||||
out_evt1->parent = event->process;
|
||||
out_evt1->arch = event->arch;
|
||||
out_evt1->entity_id = event->code;
|
||||
out_evt1->vaddr_rng = r1u64(event->address, event->address+event->size);
|
||||
out_evt1->rip_vaddr = event->address;
|
||||
out_evt1->timestamp = timestamp;
|
||||
out_evt1->string = module_path;
|
||||
CTRL_Event *out_evt2 = ctrl_event_list_push(scratch.arena, &evts);
|
||||
String8 initial_debug_info_path = ctrl_initial_debug_info_path_from_module(scratch.arena, CTRL_MachineID_Local, event->module);
|
||||
out_evt2->kind = CTRL_EventKind_ModuleDebugInfoPathChange;
|
||||
out_evt2->msg_id = msg->msg_id;
|
||||
out_evt2->machine_id = CTRL_MachineID_Local;
|
||||
out_evt2->entity = event->module;
|
||||
out_evt2->parent = event->process;
|
||||
out_evt2->timestamp = timestamp;
|
||||
out_evt2->string = initial_debug_info_path;
|
||||
di_open(initial_debug_info_path, timestamp);
|
||||
}break;
|
||||
case DMN_EventKind_ExitProcess:
|
||||
{
|
||||
@@ -3748,7 +3744,6 @@ ctrl_thread__attach(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
|
||||
//- rjf: attach
|
||||
B32 attach_successful = dmn_ctrl_attach(ctrl_ctx, msg->entity_id);
|
||||
@@ -3795,7 +3790,6 @@ ctrl_thread__attach(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
ctrl_c2u_push_events(&evts);
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -3805,7 +3799,6 @@ ctrl_thread__kill(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DMN_Handle process = msg->entity;
|
||||
U32 exit_code = msg->exit_code;
|
||||
|
||||
@@ -3849,7 +3842,6 @@ ctrl_thread__kill(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
ctrl_c2u_push_events(&evts);
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -3859,7 +3851,6 @@ ctrl_thread__detach(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DMN_Handle process = msg->entity;
|
||||
|
||||
//- rjf: detach
|
||||
@@ -3902,7 +3893,6 @@ ctrl_thread__detach(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
ctrl_c2u_push_events(&evts);
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -3912,7 +3902,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
DMN_Event *stop_event = 0;
|
||||
CTRL_EventCause stop_cause = CTRL_EventCause_Null;
|
||||
DMN_Handle target_thread = msg->entity;
|
||||
@@ -4214,9 +4204,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
}
|
||||
}
|
||||
U64 module_base_vaddr = module->vaddr_range.min;
|
||||
String8 exe_path = module->string;
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, exe_path, max_U64);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
CTRL_Entity *dbg_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
|
||||
RDI_Parsed *rdi = di_rdi_from_path_min_timestamp(di_scope, dbg_path->string, dbg_path->timestamp, max_U64);
|
||||
RDI_NameMap *unparsed_map = rdi_name_map_from_kind(rdi, RDI_NameMapKind_Procedures);
|
||||
RDI_ParsedNameMap map = {0};
|
||||
rdi_name_map_parse(rdi, unparsed_map, &map);
|
||||
@@ -4396,24 +4385,25 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
CTRL_Entity *thread = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, CTRL_MachineID_Local, event->thread);
|
||||
Architecture arch = thread->arch;
|
||||
U64 thread_rip_vaddr = dmn_rip_from_thread(event->thread);
|
||||
DMN_Handle module = {0};
|
||||
String8 module_name = {0};
|
||||
U64 module_base_vaddr = 0;
|
||||
U64 thread_rip_voff = 0;
|
||||
CTRL_Entity *module = &ctrl_entity_nil;
|
||||
{
|
||||
CTRL_Entity *process = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, CTRL_MachineID_Local, event->process);
|
||||
for(CTRL_Entity *module = process->first; module != &ctrl_entity_nil; module = module->next)
|
||||
for(CTRL_Entity *m = process->first; m != &ctrl_entity_nil; m = m->next)
|
||||
{
|
||||
if(module->kind == CTRL_EntityKind_Module && contains_1u64(module->vaddr_range, thread_rip_vaddr))
|
||||
if(m->kind == CTRL_EntityKind_Module && contains_1u64(m->vaddr_range, thread_rip_vaddr))
|
||||
{
|
||||
module_name = module->string;
|
||||
module_base_vaddr = module->vaddr_range.min;
|
||||
thread_rip_voff = thread_rip_vaddr - module->vaddr_range.min;
|
||||
module = m;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: extract module-dependent info
|
||||
//
|
||||
CTRL_Entity *dbg_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
|
||||
U64 thread_rip_voff = thread_rip_vaddr - module->vaddr_range.min;
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: stepping logic
|
||||
//
|
||||
@@ -4508,9 +4498,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
// rjf: evaluate hit stop conditions
|
||||
if(conditions.node_count != 0)
|
||||
{
|
||||
String8 exe_path = module_name;
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, exe_path, max_U64);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
RDI_Parsed *rdi = di_rdi_from_path_min_timestamp(di_scope, dbg_path->string, dbg_path->timestamp, max_U64);
|
||||
for(String8Node *condition_n = conditions.first; condition_n != 0; condition_n = condition_n->next)
|
||||
{
|
||||
String8 string = condition_n->string;
|
||||
@@ -4548,7 +4536,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
EVAL_Result eval = {0};
|
||||
if(bytecode.size != 0)
|
||||
{
|
||||
U64 module_base = module_base_vaddr;
|
||||
U64 module_base = module->vaddr_range.min;
|
||||
U64 tls_base = dmn_tls_root_vaddr_from_thread(event->thread);
|
||||
EVAL_Machine machine = {0};
|
||||
machine.u = &event->process;
|
||||
@@ -4855,7 +4843,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
ctrl_c2u_push_events(&evts);
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(di_scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -4865,7 +4853,6 @@ ctrl_thread__single_step(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
|
||||
//- rjf: record start
|
||||
{
|
||||
@@ -4918,7 +4905,6 @@ ctrl_thread__single_step(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
ctrl_c2u_push_events(&evts);
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
+23
-21
@@ -24,7 +24,8 @@ dasm_params_match(DASM_Params *a, DASM_Params *b)
|
||||
a->style_flags == b->style_flags &&
|
||||
a->syntax == b->syntax &&
|
||||
a->base_vaddr == b->base_vaddr &&
|
||||
str8_match(a->exe_path, b->exe_path, 0));
|
||||
str8_match(a->dbg_path, b->dbg_path, 0) &&
|
||||
a->dbg_timestamp == b->dbg_timestamp);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -189,7 +190,7 @@ dasm_scope_touch_node__stripe_r_guarded(DASM_Scope *scope, DASM_Node *node)
|
||||
ins_atomic_u64_eval_assign(&node->last_user_clock_idx_touched, dasm_user_clock_idx());
|
||||
touch->hash = node->hash;
|
||||
MemoryCopyStruct(&touch->params, &node->params);
|
||||
touch->params.exe_path = push_str8_copy(dasm_tctx->arena, touch->params.exe_path);
|
||||
touch->params.dbg_path = push_str8_copy(dasm_tctx->arena, touch->params.dbg_path);
|
||||
SLLStackPush(scope->top_touch, touch);
|
||||
}
|
||||
|
||||
@@ -250,7 +251,7 @@ dasm_info_from_hash_params(DASM_Scope *scope, U128 hash, DASM_Params *params)
|
||||
node->hash = hash;
|
||||
MemoryCopyStruct(&node->params, params);
|
||||
// TODO(rjf): need to make this releasable - currently all exe_paths just leak
|
||||
node->params.exe_path = push_str8_copy(stripe->arena, node->params.exe_path);
|
||||
node->params.dbg_path = push_str8_copy(stripe->arena, node->params.dbg_path);
|
||||
node_is_new = 1;
|
||||
}
|
||||
}
|
||||
@@ -294,7 +295,7 @@ dasm_u2p_enqueue_req(U128 hash, DASM_Params *params, U64 endt_us)
|
||||
{
|
||||
U64 unconsumed_size = dasm_shared->u2p_ring_write_pos - dasm_shared->u2p_ring_read_pos;
|
||||
U64 available_size = dasm_shared->u2p_ring_size - unconsumed_size;
|
||||
if(available_size >= sizeof(hash)+sizeof(U64)+sizeof(Architecture)+sizeof(DASM_StyleFlags)+sizeof(DASM_Syntax)+sizeof(U64)+sizeof(U64)+params->exe_path.size)
|
||||
if(available_size >= sizeof(hash)+sizeof(U64)+sizeof(Architecture)+sizeof(DASM_StyleFlags)+sizeof(DASM_Syntax)+sizeof(U64)+sizeof(U64)+params->dbg_path.size+sizeof(U64))
|
||||
{
|
||||
good = 1;
|
||||
dasm_shared->u2p_ring_write_pos += ring_write_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, &hash);
|
||||
@@ -303,8 +304,9 @@ dasm_u2p_enqueue_req(U128 hash, DASM_Params *params, U64 endt_us)
|
||||
dasm_shared->u2p_ring_write_pos += ring_write_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, ¶ms->style_flags);
|
||||
dasm_shared->u2p_ring_write_pos += ring_write_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, ¶ms->syntax);
|
||||
dasm_shared->u2p_ring_write_pos += ring_write_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, ¶ms->base_vaddr);
|
||||
dasm_shared->u2p_ring_write_pos += ring_write_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, ¶ms->exe_path.size);
|
||||
dasm_shared->u2p_ring_write_pos += ring_write(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, params->exe_path.str, params->exe_path.size);
|
||||
dasm_shared->u2p_ring_write_pos += ring_write_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, ¶ms->dbg_path.size);
|
||||
dasm_shared->u2p_ring_write_pos += ring_write(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, params->dbg_path.str, params->dbg_path.size);
|
||||
dasm_shared->u2p_ring_write_pos += ring_write_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_write_pos, ¶ms->dbg_timestamp);
|
||||
dasm_shared->u2p_ring_write_pos += 7;
|
||||
dasm_shared->u2p_ring_write_pos -= dasm_shared->u2p_ring_write_pos%8;
|
||||
break;
|
||||
@@ -328,7 +330,7 @@ dasm_u2p_dequeue_req(Arena *arena, U128 *hash_out, DASM_Params *params_out)
|
||||
OS_MutexScope(dasm_shared->u2p_ring_mutex) for(;;)
|
||||
{
|
||||
U64 unconsumed_size = dasm_shared->u2p_ring_write_pos - dasm_shared->u2p_ring_read_pos;
|
||||
if(unconsumed_size >= sizeof(*hash_out)+sizeof(U64)+sizeof(Architecture)+sizeof(DASM_StyleFlags)+sizeof(DASM_Syntax)+sizeof(U64)+sizeof(U64))
|
||||
if(unconsumed_size >= sizeof(*hash_out)+sizeof(U64)+sizeof(Architecture)+sizeof(DASM_StyleFlags)+sizeof(DASM_Syntax)+sizeof(U64)+sizeof(U64)+sizeof(U64))
|
||||
{
|
||||
dasm_shared->u2p_ring_read_pos += ring_read_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, hash_out);
|
||||
dasm_shared->u2p_ring_read_pos += ring_read_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, ¶ms_out->vaddr);
|
||||
@@ -336,9 +338,10 @@ dasm_u2p_dequeue_req(Arena *arena, U128 *hash_out, DASM_Params *params_out)
|
||||
dasm_shared->u2p_ring_read_pos += ring_read_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, ¶ms_out->style_flags);
|
||||
dasm_shared->u2p_ring_read_pos += ring_read_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, ¶ms_out->syntax);
|
||||
dasm_shared->u2p_ring_read_pos += ring_read_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, ¶ms_out->base_vaddr);
|
||||
dasm_shared->u2p_ring_read_pos += ring_read_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, ¶ms_out->exe_path.size);
|
||||
params_out->exe_path.str = push_array(arena, U8, params_out->exe_path.size);
|
||||
dasm_shared->u2p_ring_read_pos += ring_read(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, params_out->exe_path.str, params_out->exe_path.size);
|
||||
dasm_shared->u2p_ring_read_pos += ring_read_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, ¶ms_out->dbg_path.size);
|
||||
params_out->dbg_path.str = push_array(arena, U8, params_out->dbg_path.size);
|
||||
dasm_shared->u2p_ring_read_pos += ring_read(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, params_out->dbg_path.str, params_out->dbg_path.size);
|
||||
dasm_shared->u2p_ring_read_pos += ring_read_struct(dasm_shared->u2p_ring_base, dasm_shared->u2p_ring_size, dasm_shared->u2p_ring_read_pos, ¶ms_out->dbg_timestamp);
|
||||
dasm_shared->u2p_ring_read_pos += 7;
|
||||
dasm_shared->u2p_ring_read_pos -= dasm_shared->u2p_ring_read_pos%8;
|
||||
break;
|
||||
@@ -362,7 +365,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
dasm_u2p_dequeue_req(scratch.arena, &hash, ¶ms);
|
||||
U64 change_gen = fs_change_gen();
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
DBGI_Scope *dbgi_scope = dbgi_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
|
||||
//- rjf: unpack hash
|
||||
@@ -386,12 +389,11 @@ dasm_parse_thread__entry_point(void *p)
|
||||
}
|
||||
|
||||
//- rjf: get dbg info
|
||||
DBGI_Parse *dbgi = &dbgi_parse_nil;
|
||||
if(got_task && params.exe_path.size != 0)
|
||||
RDI_Parsed *rdi = &di_rdi_parsed_nil;
|
||||
if(got_task && params.dbg_path.size != 0)
|
||||
{
|
||||
dbgi = dbgi_parse_from_exe_path(dbgi_scope, params.exe_path, max_U64);
|
||||
rdi = di_rdi_from_path_min_timestamp(di_scope, params.dbg_path, params.dbg_timestamp, max_U64);
|
||||
}
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
|
||||
//- rjf: hash -> data
|
||||
String8 data = {0};
|
||||
@@ -442,7 +444,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
// rjf: push strings derived from voff -> line info
|
||||
if(params.style_flags & (DASM_StyleFlag_SourceFilesNames|DASM_StyleFlag_SourceLines))
|
||||
{
|
||||
if(dbgi != &dbgi_parse_nil)
|
||||
if(rdi != &di_rdi_parsed_nil)
|
||||
{
|
||||
U64 voff = (params.vaddr+off) - params.base_vaddr;
|
||||
U32 unit_idx = rdi_vmap_idx_from_voff(rdi->unit_vmap, rdi->unit_vmap_count, voff);
|
||||
@@ -517,7 +519,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
String8 addr_part = {0};
|
||||
if(params.style_flags & DASM_StyleFlag_Addresses)
|
||||
{
|
||||
addr_part = push_str8f(scratch.arena, "%s%016I64X ", dbgi != &dbgi_parse_nil ? " " : "", params.vaddr+off);
|
||||
addr_part = push_str8f(scratch.arena, "%s%016I64X ", rdi != &di_rdi_parsed_nil ? " " : "", params.vaddr+off);
|
||||
}
|
||||
String8 code_bytes_part = {0};
|
||||
if(params.style_flags & DASM_StyleFlag_CodeBytes)
|
||||
@@ -539,7 +541,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
code_bytes_part = str8_list_join(scratch.arena, &code_bytes_strings, 0);
|
||||
}
|
||||
String8 symbol_part = {0};
|
||||
if(jump_dst_vaddr != 0 && dbgi != &dbgi_parse_nil && params.style_flags & DASM_StyleFlag_SymbolNames)
|
||||
if(jump_dst_vaddr != 0 && rdi != &di_rdi_parsed_nil && params.style_flags & DASM_StyleFlag_SymbolNames)
|
||||
{
|
||||
RDI_U32 scope_idx = rdi_vmap_idx_from_voff(rdi->scope_vmap, rdi->scope_vmap_count, jump_dst_vaddr-params.base_vaddr);
|
||||
if(scope_idx != 0)
|
||||
@@ -590,7 +592,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
(U64)params.arch,
|
||||
(U64)params.style_flags,
|
||||
(U64)params.syntax,
|
||||
(U64)dbgi,
|
||||
(U64)rdi,
|
||||
0x4d534144,
|
||||
};
|
||||
text_key = hs_hash_from_data(str8((U8 *)hash_data, sizeof(hash_data)));
|
||||
@@ -614,7 +616,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
{
|
||||
n->info_arena = info_arena;
|
||||
MemoryCopyStruct(&n->info, &info);
|
||||
if(dbgi != &dbgi_parse_nil && params.style_flags & (DASM_StyleFlag_SourceLines|DASM_StyleFlag_SourceFilesNames))
|
||||
if(rdi != &di_rdi_parsed_nil && params.style_flags & (DASM_StyleFlag_SourceLines|DASM_StyleFlag_SourceFilesNames))
|
||||
{
|
||||
n->change_gen = change_gen;
|
||||
}
|
||||
@@ -630,7 +632,7 @@ dasm_parse_thread__entry_point(void *p)
|
||||
}
|
||||
|
||||
txt_scope_close(txt_scope);
|
||||
dbgi_scope_close(dbgi_scope);
|
||||
di_scope_close(di_scope);
|
||||
hs_scope_close(hs_scope);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,8 @@ struct DASM_Params
|
||||
DASM_StyleFlags style_flags;
|
||||
DASM_Syntax syntax;
|
||||
U64 base_vaddr;
|
||||
String8 exe_path;
|
||||
String8 dbg_path;
|
||||
U64 dbg_timestamp;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
+283
-11
@@ -38,6 +38,10 @@ di_init(void)
|
||||
di_shared->u2p_ring_cv = os_condition_variable_alloc();
|
||||
di_shared->u2p_ring_size = KB(64);
|
||||
di_shared->u2p_ring_base = push_array_no_zero(arena, U8, di_shared->u2p_ring_size);
|
||||
di_shared->p2u_ring_mutex = os_mutex_alloc();
|
||||
di_shared->p2u_ring_cv = os_condition_variable_alloc();
|
||||
di_shared->p2u_ring_size = KB(64);
|
||||
di_shared->p2u_ring_base = push_array_no_zero(arena, U8, di_shared->p2u_ring_size);
|
||||
di_shared->parse_thread_count = Max(2, os_logical_core_count()/2);
|
||||
di_shared->parse_threads = push_array(arena, OS_Handle, di_shared->parse_thread_count);
|
||||
for(U64 idx = 0; idx < di_shared->parse_thread_count; idx += 1)
|
||||
@@ -68,6 +72,7 @@ di_scope_open(void)
|
||||
scope = push_array_no_zero(di_tctx->arena, DI_Scope, 1);
|
||||
}
|
||||
MemoryZeroStruct(scope);
|
||||
return scope;
|
||||
}
|
||||
|
||||
internal void
|
||||
@@ -246,6 +251,11 @@ di_open(String8 path, U64 min_timestamp)
|
||||
//- rjf: allocate node if none exists; insert into slot
|
||||
if(node == 0)
|
||||
{
|
||||
U64 current_timestamp = os_properties_from_file_path(path).modified;
|
||||
if(current_timestamp == 0)
|
||||
{
|
||||
current_timestamp = min_timestamp;
|
||||
}
|
||||
node = stripe->free_node;
|
||||
if(node != 0)
|
||||
{
|
||||
@@ -259,14 +269,17 @@ di_open(String8 path, U64 min_timestamp)
|
||||
DLLPushBack(slot->first, slot->last, node);
|
||||
String8 path_stored = di_string_alloc__stripe_mutex_w_guarded(stripe, path_normalized);
|
||||
node->path = path_stored;
|
||||
node->min_timestamp;
|
||||
node->min_timestamp = current_timestamp;
|
||||
}
|
||||
|
||||
//- rjf: increment node reference count
|
||||
node->ref_count += 1;
|
||||
if(node->ref_count == 1)
|
||||
if(node != 0)
|
||||
{
|
||||
di_u2p_enqueue_key(path_normalized, min_timestamp, 0);
|
||||
node->ref_count += 1;
|
||||
if(node->ref_count == 1)
|
||||
{
|
||||
di_u2p_enqueue_key(path_normalized, node->min_timestamp, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -350,6 +363,12 @@ di_rdi_from_path_min_timestamp(DI_Scope *scope, String8 path, U64 min_timestamp,
|
||||
//- rjf: find existing node
|
||||
DI_Node *node = di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(slot, path_normalized, min_timestamp);
|
||||
|
||||
//- rjf: no node? this path is not opened
|
||||
if(node == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
//- rjf: parse done -> touch, grab result
|
||||
if(node != 0 && node->parse_done)
|
||||
{
|
||||
@@ -437,6 +456,57 @@ di_u2p_dequeue_key(Arena *arena, String8 *out_path, U64 *out_min_timestamp)
|
||||
os_condition_variable_broadcast(di_shared->u2p_ring_cv);
|
||||
}
|
||||
|
||||
internal void
|
||||
di_p2u_push_event(DI_Event *event)
|
||||
{
|
||||
OS_MutexScope(di_shared->p2u_ring_mutex) for(;;)
|
||||
{
|
||||
U64 unconsumed_size = (di_shared->p2u_ring_write_pos-di_shared->p2u_ring_read_pos);
|
||||
U64 available_size = di_shared->p2u_ring_size-unconsumed_size;
|
||||
U64 needed_size = sizeof(DI_EventKind) + sizeof(U64) + event->string.size;
|
||||
if(available_size >= needed_size)
|
||||
{
|
||||
di_shared->p2u_ring_write_pos += ring_write_struct(di_shared->p2u_ring_base, di_shared->p2u_ring_size, di_shared->p2u_ring_write_pos, &event->kind);
|
||||
di_shared->p2u_ring_write_pos += ring_write_struct(di_shared->p2u_ring_base, di_shared->p2u_ring_size, di_shared->p2u_ring_write_pos, &event->string.size);
|
||||
di_shared->p2u_ring_write_pos += ring_write(di_shared->p2u_ring_base, di_shared->p2u_ring_size, di_shared->p2u_ring_write_pos, event->string.str, event->string.size);
|
||||
di_shared->p2u_ring_write_pos += 7;
|
||||
di_shared->p2u_ring_write_pos -= di_shared->p2u_ring_write_pos%8;
|
||||
break;
|
||||
}
|
||||
os_condition_variable_wait(di_shared->p2u_ring_cv, di_shared->p2u_ring_mutex, max_U64);
|
||||
}
|
||||
os_condition_variable_broadcast(di_shared->p2u_ring_cv);
|
||||
}
|
||||
|
||||
internal DI_EventList
|
||||
di_p2u_pop_events(Arena *arena, U64 endt_us)
|
||||
{
|
||||
DI_EventList events = {0};
|
||||
OS_MutexScope(di_shared->p2u_ring_mutex) for(;;)
|
||||
{
|
||||
U64 unconsumed_size = (di_shared->p2u_ring_write_pos-di_shared->p2u_ring_read_pos);
|
||||
if(unconsumed_size >= sizeof(DI_EventKind) + sizeof(U64))
|
||||
{
|
||||
DI_EventNode *n = push_array(arena, DI_EventNode, 1);
|
||||
SLLQueuePush(events.first, events.last, n);
|
||||
events.count += 1;
|
||||
di_shared->p2u_ring_read_pos += ring_read_struct(di_shared->p2u_ring_base, di_shared->p2u_ring_size, di_shared->p2u_ring_read_pos, &n->v.kind);
|
||||
di_shared->p2u_ring_read_pos += ring_read_struct(di_shared->p2u_ring_base, di_shared->p2u_ring_size, di_shared->p2u_ring_read_pos, &n->v.string.size);
|
||||
n->v.string.str = push_array_no_zero(arena, U8, n->v.string.size);
|
||||
di_shared->p2u_ring_read_pos += ring_read(di_shared->p2u_ring_base, di_shared->p2u_ring_size, di_shared->p2u_ring_read_pos, n->v.string.str, n->v.string.size);
|
||||
di_shared->p2u_ring_read_pos += 7;
|
||||
di_shared->p2u_ring_read_pos -= di_shared->p2u_ring_read_pos%8;
|
||||
}
|
||||
else if(os_now_microseconds() >= endt_us)
|
||||
{
|
||||
break;
|
||||
}
|
||||
os_condition_variable_wait(di_shared->p2u_ring_cv, di_shared->p2u_ring_mutex, endt_us);
|
||||
}
|
||||
os_condition_variable_broadcast(di_shared->p2u_ring_cv);
|
||||
return events;
|
||||
}
|
||||
|
||||
internal void
|
||||
di_parse_thread__entry_point(void *p)
|
||||
{
|
||||
@@ -448,14 +518,14 @@ di_parse_thread__entry_point(void *p)
|
||||
////////////////////////////
|
||||
//- rjf: grab next key
|
||||
//
|
||||
String8 path = {0};
|
||||
String8 og_path = {0};
|
||||
U64 min_timestamp = 0;
|
||||
di_u2p_dequeue_key(scratch.arena, &path, &min_timestamp);
|
||||
di_u2p_dequeue_key(scratch.arena, &og_path, &min_timestamp);
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: unpack key
|
||||
//
|
||||
U64 hash = di_hash_from_string(path);
|
||||
U64 hash = di_hash_from_string(og_path);
|
||||
U64 slot_idx = hash%di_shared->slots_count;
|
||||
U64 stripe_idx = slot_idx%di_shared->stripes_count;
|
||||
DI_Slot *slot = &di_shared->slots[slot_idx];
|
||||
@@ -467,13 +537,214 @@ di_parse_thread__entry_point(void *p)
|
||||
B32 got_task = 0;
|
||||
OS_MutexScopeR(stripe->rw_mutex)
|
||||
{
|
||||
DI_Node *node = di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(slot, path, min_timestamp);
|
||||
DI_Node *node = di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(slot, og_path, min_timestamp);
|
||||
if(node != 0)
|
||||
{
|
||||
got_task = !ins_atomic_u64_eval_cond_assign(&node->is_working, 1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: got task -> open O.G. file (may or may not be RDI)
|
||||
//
|
||||
B32 og_format_is_known = 0;
|
||||
B32 og_is_pe = 0;
|
||||
B32 og_is_pdb = 0;
|
||||
B32 og_is_elf = 0;
|
||||
B32 og_is_rdi = 0;
|
||||
FileProperties og_props = {0};
|
||||
if(got_task) ProfScope("analyze %.*s", str8_varg(og_path))
|
||||
{
|
||||
OS_Handle file = os_file_open(OS_AccessFlag_Read|OS_AccessFlag_ShareRead, og_path);
|
||||
OS_Handle file_map = os_file_map_open(OS_AccessFlag_Read, file);
|
||||
FileProperties props = og_props = os_properties_from_file(file);
|
||||
void *base = os_file_map_view_open(file_map, OS_AccessFlag_Read, r1u64(0, props.size));
|
||||
String8 data = str8((U8 *)base, props.size);
|
||||
if(!og_format_is_known)
|
||||
{
|
||||
String8 msf20_magic = str8_lit("Microsoft C/C++ program database 2.00\r\n\x1aJG\0\0");
|
||||
String8 msf70_magic = str8_lit("Microsoft C/C++ MSF 7.00\r\n\032DS\0\0");
|
||||
String8 msfxx_magic = str8_lit("Microsoft C/C++");
|
||||
if((data.size >= msf20_magic.size && str8_match(data, msf20_magic, StringMatchFlag_RightSideSloppy)) ||
|
||||
(data.size >= msf70_magic.size && str8_match(data, msf70_magic, StringMatchFlag_RightSideSloppy)) ||
|
||||
(data.size >= msfxx_magic.size && str8_match(data, msfxx_magic, StringMatchFlag_RightSideSloppy)))
|
||||
{
|
||||
og_format_is_known = 1;
|
||||
og_is_pdb = 1;
|
||||
}
|
||||
}
|
||||
if(!og_format_is_known)
|
||||
{
|
||||
if(data.size >= 8 && *(U64 *)data.str == RDI_MAGIC_CONSTANT)
|
||||
{
|
||||
og_format_is_known = 1;
|
||||
og_is_rdi = 1;
|
||||
}
|
||||
}
|
||||
if(!og_format_is_known)
|
||||
{
|
||||
if(data.size >= 4 &&
|
||||
data.str[0] == 0x7f &&
|
||||
data.str[1] == 'E' &&
|
||||
data.str[2] == 'L' &&
|
||||
data.str[3] == 'F')
|
||||
{
|
||||
og_format_is_known = 1;
|
||||
og_is_elf = 1;
|
||||
}
|
||||
}
|
||||
if(!og_format_is_known)
|
||||
{
|
||||
if(data.size >= 2 && *(U16 *)data.str == PE_DOS_MAGIC)
|
||||
{
|
||||
og_format_is_known = 1;
|
||||
og_is_pe = 1;
|
||||
}
|
||||
}
|
||||
os_file_map_view_close(file_map, base);
|
||||
os_file_map_close(file_map);
|
||||
os_file_close(file);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: given O.G. path & analysis, determine RDI path
|
||||
//
|
||||
String8 rdi_path = {0};
|
||||
if(got_task)
|
||||
{
|
||||
if(og_is_rdi)
|
||||
{
|
||||
rdi_path = og_path;
|
||||
}
|
||||
else if(og_format_is_known && og_is_pdb)
|
||||
{
|
||||
rdi_path = push_str8f(scratch.arena, "%S.rdi", str8_chop_last_dot(og_path));
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: check if rdi file is up-to-date
|
||||
//
|
||||
B32 rdi_file_is_up_to_date = 0;
|
||||
if(got_task)
|
||||
{
|
||||
if(rdi_path.size != 0) ProfScope("check %.*s is up-to-date", str8_varg(rdi_path))
|
||||
{
|
||||
FileProperties props = os_properties_from_file_path(rdi_path);
|
||||
rdi_file_is_up_to_date = (props.modified > og_props.modified);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: if raddbg file is up to date based on timestamp, check the
|
||||
// encoding generation number & size, to see if we need to regenerate it
|
||||
// regardless
|
||||
//
|
||||
if(got_task && rdi_file_is_up_to_date) ProfScope("check %.*s version matches our's", str8_varg(rdi_path))
|
||||
{
|
||||
OS_Handle file = {0};
|
||||
OS_Handle file_map = {0};
|
||||
FileProperties file_props = {0};
|
||||
void *file_base = 0;
|
||||
file = os_file_open(OS_AccessFlag_Read|OS_AccessFlag_ShareRead, rdi_path);
|
||||
file_map = os_file_map_open(OS_AccessFlag_Read, file);
|
||||
file_props = os_properties_from_file(file);
|
||||
file_base = os_file_map_view_open(file_map, OS_AccessFlag_Read, r1u64(0, file_props.size));
|
||||
if(sizeof(RDI_Header) <= file_props.size)
|
||||
{
|
||||
RDI_Header *header = (RDI_Header*)file_base;
|
||||
if(header->encoding_version != RDI_ENCODING_VERSION)
|
||||
{
|
||||
rdi_file_is_up_to_date = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rdi_file_is_up_to_date = 0;
|
||||
}
|
||||
os_file_map_view_close(file_map, file_base);
|
||||
os_file_map_close(file_map);
|
||||
os_file_close(file);
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: heuristically choose compression settings
|
||||
//
|
||||
B32 should_compress = 0;
|
||||
#if 0
|
||||
if(og_dbg_props.size > MB(64))
|
||||
{
|
||||
should_compress = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: rdi file not up-to-date? we need to generate it
|
||||
//
|
||||
if(got_task && !rdi_file_is_up_to_date) ProfScope("generate %.*s", str8_varg(rdi_path))
|
||||
{
|
||||
if(og_is_pdb)
|
||||
{
|
||||
//- rjf: push conversion task begin event
|
||||
{
|
||||
DI_Event event = {DI_EventKind_ConversionStarted};
|
||||
event.string = rdi_path;
|
||||
di_p2u_push_event(&event);
|
||||
}
|
||||
|
||||
//- rjf: kick off process
|
||||
OS_Handle process = {0};
|
||||
{
|
||||
OS_LaunchOptions opts = {0};
|
||||
opts.path = os_string_from_system_path(scratch.arena, OS_SystemPath_Binary);
|
||||
opts.inherit_env = 1;
|
||||
opts.consoleless = 1;
|
||||
str8_list_pushf(scratch.arena, &opts.cmd_line, "raddbg");
|
||||
str8_list_pushf(scratch.arena, &opts.cmd_line, "--convert");
|
||||
str8_list_pushf(scratch.arena, &opts.cmd_line, "--quiet");
|
||||
if(should_compress)
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &opts.cmd_line, "--compress");
|
||||
}
|
||||
//str8_list_pushf(scratch.arena, &opts.cmd_line, "--capture");
|
||||
str8_list_pushf(scratch.arena, &opts.cmd_line, "--pdb:%S", og_path);
|
||||
str8_list_pushf(scratch.arena, &opts.cmd_line, "--out:%S", rdi_path);
|
||||
os_launch_process(&opts, &process);
|
||||
}
|
||||
|
||||
//- rjf: wait for process to complete
|
||||
{
|
||||
U64 start_wait_t = os_now_microseconds();
|
||||
for(;;)
|
||||
{
|
||||
B32 wait_done = os_process_wait(process, os_now_microseconds()+1000);
|
||||
if(wait_done)
|
||||
{
|
||||
rdi_file_is_up_to_date = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: push conversion task end event
|
||||
{
|
||||
DI_Event event = {DI_EventKind_ConversionEnded};
|
||||
event.string = rdi_path;
|
||||
di_p2u_push_event(&event);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// NOTE(rjf): we cannot convert from this O.G. debug info format right now.
|
||||
//- rjf: push conversion task failure event
|
||||
{
|
||||
DI_Event event = {DI_EventKind_ConversionFailureUnsupportedFormat};
|
||||
event.string = rdi_path;
|
||||
di_p2u_push_event(&event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////
|
||||
//- rjf: got task -> open file
|
||||
//
|
||||
@@ -483,7 +754,7 @@ di_parse_thread__entry_point(void *p)
|
||||
void *file_base = 0;
|
||||
if(got_task)
|
||||
{
|
||||
file = os_file_open(OS_AccessFlag_Read|OS_AccessFlag_ShareRead|OS_AccessFlag_ShareWrite, path);
|
||||
file = os_file_open(OS_AccessFlag_Read|OS_AccessFlag_ShareRead|OS_AccessFlag_ShareWrite, rdi_path);
|
||||
file_map = os_file_map_open(OS_AccessFlag_Read, file);
|
||||
file_props = os_properties_from_file(file);
|
||||
file_base = os_file_map_view_open(file_map, OS_AccessFlag_Read, r1u64(0, file_props.size));
|
||||
@@ -492,7 +763,7 @@ di_parse_thread__entry_point(void *p)
|
||||
////////////////////////////
|
||||
//- rjf: do initial parse of rdi
|
||||
//
|
||||
RDI_Parsed rdi_parsed_maybe_compressed = dbgi_parse_nil.rdi;
|
||||
RDI_Parsed rdi_parsed_maybe_compressed = di_rdi_parsed_nil;
|
||||
if(got_task)
|
||||
{
|
||||
RDI_ParseStatus parse_status = rdi_parse((U8 *)file_base, file_props.size, &rdi_parsed_maybe_compressed);
|
||||
@@ -569,7 +840,7 @@ di_parse_thread__entry_point(void *p)
|
||||
//
|
||||
if(got_task) OS_MutexScopeW(stripe->rw_mutex)
|
||||
{
|
||||
DI_Node *node = di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(slot, path, min_timestamp);
|
||||
DI_Node *node = di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(slot, og_path, min_timestamp);
|
||||
if(node != 0)
|
||||
{
|
||||
node->is_working = 0;
|
||||
@@ -582,6 +853,7 @@ di_parse_thread__entry_point(void *p)
|
||||
node->parse_done = 1;
|
||||
}
|
||||
}
|
||||
os_condition_variable_broadcast(stripe->cv);
|
||||
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,41 @@
|
||||
#ifndef DI_H
|
||||
#define DI_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Event Types
|
||||
|
||||
typedef enum DI_EventKind
|
||||
{
|
||||
DI_EventKind_Null,
|
||||
DI_EventKind_ConversionStarted,
|
||||
DI_EventKind_ConversionEnded,
|
||||
DI_EventKind_ConversionFailureUnsupportedFormat,
|
||||
DI_EventKind_COUNT
|
||||
}
|
||||
DI_EventKind;
|
||||
|
||||
typedef struct DI_Event DI_Event;
|
||||
struct DI_Event
|
||||
{
|
||||
DI_EventKind kind;
|
||||
String8 string;
|
||||
};
|
||||
|
||||
typedef struct DI_EventNode DI_EventNode;
|
||||
struct DI_EventNode
|
||||
{
|
||||
DI_EventNode *next;
|
||||
DI_Event v;
|
||||
};
|
||||
|
||||
typedef struct DI_EventList DI_EventList;
|
||||
struct DI_EventList
|
||||
{
|
||||
DI_EventNode *first;
|
||||
DI_EventNode *last;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cache Types
|
||||
|
||||
@@ -108,6 +143,14 @@ struct DI_Shared
|
||||
U64 u2p_ring_write_pos;
|
||||
U64 u2p_ring_read_pos;
|
||||
|
||||
// rjf: parse -> user event ring
|
||||
OS_Handle p2u_ring_mutex;
|
||||
OS_Handle p2u_ring_cv;
|
||||
U64 p2u_ring_size;
|
||||
U8 *p2u_ring_base;
|
||||
U64 p2u_ring_write_pos;
|
||||
U64 p2u_ring_read_pos;
|
||||
|
||||
// rjf: threads
|
||||
U64 parse_thread_count;
|
||||
OS_Handle *parse_threads;
|
||||
@@ -200,6 +243,9 @@ internal RDI_Parsed *di_rdi_from_path_min_timestamp(DI_Scope *scope, String8 pat
|
||||
internal B32 di_u2p_enqueue_key(String8 path, U64 min_timestamp, U64 endt_us);
|
||||
internal void di_u2p_dequeue_key(Arena *arena, String8 *out_path, U64 *out_min_timestamp);
|
||||
|
||||
internal void di_p2u_push_event(DI_Event *event);
|
||||
internal DI_EventList di_p2u_pop_events(Arena *arena, U64 endt_us);
|
||||
|
||||
internal void di_parse_thread__entry_point(void *p);
|
||||
|
||||
#endif // DI_H
|
||||
|
||||
+143
-178
@@ -1077,7 +1077,7 @@ df_cmd_params_apply_spec_query(Arena *arena, DF_CtrlCtx *ctrl_ctx, DF_CmdParams
|
||||
use_numeric_eval:
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
U64 vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx->unwind_count);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
@@ -1121,7 +1121,7 @@ df_cmd_params_apply_spec_query(Arena *arena, DF_CtrlCtx *ctrl_ctx, DF_CmdParams
|
||||
{
|
||||
error = push_str8f(scratch.arena, "Couldn't evaluate \"%S\" as an address", query);
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
}
|
||||
@@ -1541,8 +1541,8 @@ df_search_tags_from_entity(Arena *arena, DF_Entity *entity)
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, f->regs);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
|
||||
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
String8 procedure_name = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
|
||||
DF_Entity *debug = df_dbgi_from_module(module);
|
||||
String8 procedure_name = df_symbol_name_from_dbgi_voff(scratch.arena, debug, rip_voff);
|
||||
if(procedure_name.size != 0)
|
||||
{
|
||||
str8_list_push(scratch.arena, &strings, procedure_name);
|
||||
@@ -2008,6 +2008,14 @@ df_entity_equip_cfg_src(DF_Entity *entity, DF_CfgSrc cfg_src)
|
||||
df_entity_notify_mutation(entity);
|
||||
}
|
||||
|
||||
internal void
|
||||
df_entity_equip_timestamp(DF_Entity *entity, U64 timestamp)
|
||||
{
|
||||
df_require_entity_nonnil(entity, return);
|
||||
entity->timestamp = timestamp;
|
||||
df_entity_notify_mutation(entity);
|
||||
}
|
||||
|
||||
//- rjf: control layer correllation equipment
|
||||
|
||||
internal void
|
||||
@@ -2692,29 +2700,6 @@ df_core_view_rule_spec_from_string(String8 string)
|
||||
return spec;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Info Mapping
|
||||
|
||||
internal String8
|
||||
df_debug_info_path_from_module(Arena *arena, DF_Entity *module)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
String8 result = {0};
|
||||
DF_Entity *override_entity = df_entity_child_from_kind(module, DF_EntityKind_DebugInfoOverride);
|
||||
if(!df_entity_is_nil(override_entity) && override_entity->name.size != 0)
|
||||
{
|
||||
result = override_entity->name;
|
||||
}
|
||||
else
|
||||
{
|
||||
String8 exe_path = module->name;
|
||||
String8 dbg_path = push_str8f(arena, "%S.pdb", str8_chop_last_dot(exe_path));
|
||||
result = dbg_path;
|
||||
}
|
||||
ProfEnd();
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Stepping "Trap Net" Builders
|
||||
|
||||
@@ -2856,7 +2841,7 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
// rjf: thread => info
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
DF_Entity *module = df_module_from_thread(thread);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *debug = df_dbgi_from_module(module);
|
||||
Architecture arch = df_architecture_from_entity(thread);
|
||||
U64 ip_vaddr = ctrl_query_cached_rip_from_thread(df_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
|
||||
|
||||
@@ -2864,7 +2849,7 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
Rng1U64 line_vaddr_rng = {0};
|
||||
{
|
||||
U64 ip_voff = df_voff_from_vaddr(module, ip_vaddr);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_binary_voff(binary, ip_voff);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(debug, ip_voff);
|
||||
Rng1U64 line_voff_rng = line_info.voff_range;
|
||||
if(line_voff_rng.max != 0)
|
||||
{
|
||||
@@ -2878,7 +2863,7 @@ df_trap_net_from_thread__step_over_line(Arena *arena, DF_Entity *thread)
|
||||
// is enabled. This is enabled by default normally.
|
||||
{
|
||||
U64 opl_line_voff_rng = df_voff_from_vaddr(module, line_vaddr_rng.max);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_binary_voff(binary, opl_line_voff_rng);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(debug, opl_line_voff_rng);
|
||||
if(line_info.pt.line == 0xf00f00 || line_info.pt.line == 0xfeefee)
|
||||
{
|
||||
line_vaddr_rng.max = df_vaddr_from_voff(module, line_info.voff_range.max);
|
||||
@@ -2981,7 +2966,7 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread)
|
||||
// rjf: thread => info
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
DF_Entity *module = df_module_from_thread(thread);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *debug = df_dbgi_from_module(module);
|
||||
Architecture arch = df_architecture_from_entity(thread);
|
||||
U64 ip_vaddr = ctrl_query_cached_rip_from_thread(df_state->ctrl_entity_store, thread->ctrl_machine_id, thread->ctrl_handle);
|
||||
|
||||
@@ -2989,7 +2974,7 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread)
|
||||
Rng1U64 line_vaddr_rng = {0};
|
||||
{
|
||||
U64 ip_voff = df_voff_from_vaddr(module, ip_vaddr);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_binary_voff(binary, ip_voff);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(debug, ip_voff);
|
||||
Rng1U64 line_voff_rng = line_info.voff_range;
|
||||
if(line_voff_rng.max != 0)
|
||||
{
|
||||
@@ -3003,7 +2988,7 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread)
|
||||
// is enabled. This is enabled by default normally.
|
||||
{
|
||||
U64 opl_line_voff_rng = df_voff_from_vaddr(module, line_vaddr_rng.max);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_binary_voff(binary, opl_line_voff_rng);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(debug, opl_line_voff_rng);
|
||||
if(line_info.pt.line == 0xf00f00 || line_info.pt.line == 0xfeefee)
|
||||
{
|
||||
line_vaddr_rng.max = df_vaddr_from_voff(module, line_info.voff_range.max);
|
||||
@@ -3094,25 +3079,25 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread)
|
||||
////////////////////////////////
|
||||
//~ rjf: Modules & Debug Info Mappings
|
||||
|
||||
//- rjf: module <=> binary file
|
||||
//- rjf: module <=> debug info file
|
||||
|
||||
internal DF_Entity *
|
||||
df_binary_file_from_module(DF_Entity *module)
|
||||
df_dbgi_from_module(DF_Entity *module)
|
||||
{
|
||||
DF_Entity *binary = df_entity_from_handle(module->entity_handle);
|
||||
return binary;
|
||||
DF_Entity *debug = df_entity_from_handle(module->entity_handle);
|
||||
return debug;
|
||||
}
|
||||
|
||||
internal DF_EntityList
|
||||
df_modules_from_binary_file(Arena *arena, DF_Entity *binary_info)
|
||||
df_modules_from_dbgi(Arena *arena, DF_Entity *debug)
|
||||
{
|
||||
DF_EntityList list = {0};
|
||||
DF_EntityList all_modules = df_query_cached_entity_list_with_kind(DF_EntityKind_Module);
|
||||
for(DF_EntityNode *n = all_modules.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_Entity *module = n->entity;
|
||||
DF_Entity *module_binary_info = df_binary_file_from_module(module);
|
||||
if(module_binary_info == binary_info)
|
||||
DF_Entity *module_debug_info = df_dbgi_from_module(module);
|
||||
if(module_debug_info == debug)
|
||||
{
|
||||
df_entity_list_push(arena, &list, module);
|
||||
}
|
||||
@@ -3168,30 +3153,28 @@ df_vaddr_range_from_voff_range(DF_Entity *module, Rng1U64 voff_rng)
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Info Lookups
|
||||
|
||||
//- rjf: binary file -> dbgi parse
|
||||
//- rjf: debug file -> rdi
|
||||
|
||||
internal DBGI_Parse *
|
||||
df_dbgi_parse_from_binary_file(DBGI_Scope *scope, DF_Entity *binary)
|
||||
internal RDI_Parsed *
|
||||
df_rdi_from_dbgi(DI_Scope *scope, DF_Entity *dbgi)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
String8 exe_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, exe_path, 0);
|
||||
String8 path = df_full_path_from_entity(scratch.arena, dbgi);
|
||||
RDI_Parsed *rdi = di_rdi_from_path_min_timestamp(scope, path, dbgi->timestamp, 0);
|
||||
scratch_end(scratch);
|
||||
return dbgi;
|
||||
return rdi;
|
||||
}
|
||||
|
||||
//- rjf: symbol lookups
|
||||
|
||||
internal String8
|
||||
df_symbol_name_from_binary_voff(Arena *arena, DF_Entity *binary, U64 voff)
|
||||
df_symbol_name_from_dbgi_voff(Arena *arena, DF_Entity *dbgi, U64 voff)
|
||||
{
|
||||
String8 result = {0};
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
String8 path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
DI_Scope *scope = di_scope_open();
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
if(result.size == 0 && rdi->scope_vmap != 0)
|
||||
{
|
||||
U64 scope_idx = rdi_vmap_idx_from_voff(rdi->scope_vmap, rdi->scope_vmap_count, voff);
|
||||
@@ -3210,7 +3193,7 @@ df_symbol_name_from_binary_voff(Arena *arena, DF_Entity *binary, U64 voff)
|
||||
U8 *name_ptr = rdi_string_from_idx(rdi, global_var->name_string_idx, &name_size);
|
||||
result = push_str8_copy(arena, str8(name_ptr, name_size));
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
return result;
|
||||
@@ -3222,9 +3205,9 @@ df_symbol_name_from_process_vaddr(Arena *arena, DF_Entity *process, U64 vaddr)
|
||||
String8 result = {0};
|
||||
{
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
U64 voff = df_voff_from_vaddr(module, vaddr);
|
||||
result = df_symbol_name_from_binary_voff(arena, binary, voff);
|
||||
result = df_symbol_name_from_dbgi_voff(arena, dbgi, voff);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -3240,8 +3223,8 @@ df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entit
|
||||
src2dasm_array.v = push_array(arena, DF_TextLineSrc2DasmInfoList, src2dasm_array.count);
|
||||
}
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DF_EntityList binaries = df_push_active_binary_list(scratch.arena);
|
||||
DI_Scope *scope = di_scope_open();
|
||||
DF_EntityList dbgis = df_push_active_dbgi_list(scratch.arena);
|
||||
DF_EntityList overrides = df_possible_overrides_from_entity(scratch.arena, file);
|
||||
for(DF_EntityNode *override_n = overrides.first;
|
||||
override_n != 0;
|
||||
@@ -3250,20 +3233,18 @@ df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entit
|
||||
DF_Entity *override = override_n->entity;
|
||||
String8 file_path = df_full_path_from_entity(scratch.arena, override);
|
||||
String8 file_path_normalized = lower_from_str8(scratch.arena, file_path);
|
||||
for(DF_EntityNode *binary_n = binaries.first;
|
||||
binary_n != 0;
|
||||
binary_n = binary_n->next)
|
||||
for(DF_EntityNode *dbgi_n = dbgis.first;
|
||||
dbgi_n != 0;
|
||||
dbgi_n = dbgi_n->next)
|
||||
{
|
||||
// rjf: binary -> rdi
|
||||
DF_Entity *binary = binary_n->entity;
|
||||
String8 binary_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, binary_path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
DF_Entity *dbgi = dbgi_n->entity;
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
|
||||
// rjf: file_path_normalized * rdi -> src_id
|
||||
B32 good_src_id = 0;
|
||||
U32 src_id = 0;
|
||||
if(dbgi != &dbgi_parse_nil)
|
||||
if(rdi != &di_rdi_parsed_nil)
|
||||
{
|
||||
RDI_NameMap *mapptr = rdi_name_map_from_kind(rdi, RDI_NameMapKind_NormalSourcePaths);
|
||||
if(mapptr != 0)
|
||||
@@ -3313,7 +3294,7 @@ df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entit
|
||||
DF_TextLineSrc2DasmInfoNode *src2dasm_n = push_array(arena, DF_TextLineSrc2DasmInfoNode, 1);
|
||||
src2dasm_n->v.voff_range = range;
|
||||
src2dasm_n->v.remap_line = (S64)actual_line;
|
||||
src2dasm_n->v.binary = binary;
|
||||
src2dasm_n->v.dbgi = dbgi;
|
||||
SLLQueuePush(src2dasm_list->first, src2dasm_list->last, src2dasm_n);
|
||||
src2dasm_list->count += 1;
|
||||
}
|
||||
@@ -3324,11 +3305,11 @@ df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entit
|
||||
// rjf: good src id -> push to relevant binaries
|
||||
if(good_src_id)
|
||||
{
|
||||
df_entity_list_push(arena, &src2dasm_array.binaries, binary);
|
||||
df_entity_list_push(arena, &src2dasm_array.dbgis, dbgi);
|
||||
}
|
||||
}
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
return src2dasm_array;
|
||||
}
|
||||
@@ -3336,15 +3317,13 @@ df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entit
|
||||
//- rjf: voff -> src lookups
|
||||
|
||||
internal DF_TextLineDasm2SrcInfo
|
||||
df_text_line_dasm2src_info_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
df_text_line_dasm2src_info_from_dbgi_voff(DF_Entity *dbgi, U64 voff)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
String8 path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
DI_Scope *scope = di_scope_open();
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
DF_TextLineDasm2SrcInfo result = {0};
|
||||
result.file = result.binary = &df_g_nil_entity;
|
||||
result.file = result.dbgi = &df_g_nil_entity;
|
||||
if(rdi->unit_vmap != 0 && rdi->units != 0 && rdi->source_files != 0)
|
||||
{
|
||||
U64 unit_idx = rdi_vmap_idx_from_voff(rdi->unit_vmap, rdi->unit_vmap_count, voff);
|
||||
@@ -3359,7 +3338,7 @@ df_text_line_dasm2src_info_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
RDI_SourceFile *file = &rdi->source_files[line->file_idx];
|
||||
String8 file_normalized_full_path = {0};
|
||||
file_normalized_full_path.str = rdi_string_from_idx(rdi, file->normal_full_path_string_idx, &file_normalized_full_path.size);
|
||||
result.binary = binary;
|
||||
result.dbgi = dbgi;
|
||||
if(line->file_idx != 0 && file_normalized_full_path.size != 0)
|
||||
{
|
||||
result.file = df_entity_from_path(file_normalized_full_path, DF_EntityFromPathFlag_All);
|
||||
@@ -3368,8 +3347,7 @@ df_text_line_dasm2src_info_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
result.voff_range = r1u64(unit_line_info.voffs[line_info_idx], unit_line_info.voffs[line_info_idx+1]);
|
||||
}
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
@@ -3377,22 +3355,20 @@ df_text_line_dasm2src_info_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
//- rjf: symbol -> voff lookups
|
||||
|
||||
internal U64
|
||||
df_voff_from_binary_symbol_name(DF_Entity *binary, String8 symbol_name)
|
||||
df_voff_from_dbgi_symbol_name(DF_Entity *dbgi, String8 symbol_name)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
U64 result = 0;
|
||||
{
|
||||
String8 binary_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, binary_path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
RDI_NameMapKind name_map_kinds[] =
|
||||
{
|
||||
RDI_NameMapKind_GlobalVariables,
|
||||
RDI_NameMapKind_Procedures,
|
||||
};
|
||||
if(dbgi != &dbgi_parse_nil)
|
||||
if(rdi != &di_rdi_parsed_nil)
|
||||
{
|
||||
for(U64 name_map_kind_idx = 0;
|
||||
name_map_kind_idx < ArrayCount(name_map_kinds);
|
||||
@@ -3453,23 +3429,20 @@ df_voff_from_binary_symbol_name(DF_Entity *binary, String8 symbol_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return result;
|
||||
}
|
||||
|
||||
internal U64
|
||||
df_type_num_from_binary_name(DF_Entity *binary, String8 name)
|
||||
df_type_num_from_dbgi_name(DF_Entity *dbgi, String8 name)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DI_Scope *scope = di_scope_open();
|
||||
U64 result = 0;
|
||||
{
|
||||
String8 binary_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, binary_path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
RDI_NameMap *name_map = rdi_name_map_from_kind(rdi, RDI_NameMapKind_Types);
|
||||
RDI_ParsedNameMap parsed_name_map = {0};
|
||||
rdi_name_map_parse(rdi, name_map, &parsed_name_map);
|
||||
@@ -3496,16 +3469,13 @@ df_type_num_from_binary_name(DF_Entity *binary, String8 name)
|
||||
}
|
||||
result = entity_num;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
ProfEnd();
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Process/Thread Info Lookups
|
||||
|
||||
//- rjf: thread info extraction helpers
|
||||
//~ rjf: Process/Thread/Module Info Lookups
|
||||
|
||||
internal DF_Entity *
|
||||
df_module_from_process_vaddr(DF_Entity *process, U64 vaddr)
|
||||
@@ -3538,7 +3508,6 @@ df_tls_base_vaddr_from_process_root_rip(DF_Entity *process, U64 root_vaddr, U64
|
||||
ProfBeginFunction();
|
||||
U64 base_vaddr = 0;
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
if(!df_ctrl_targets_running())
|
||||
{
|
||||
//- rjf: unpack module info
|
||||
@@ -3611,7 +3580,6 @@ df_tls_base_vaddr_from_process_root_rip(DF_Entity *process, U64 root_vaddr, U64
|
||||
}
|
||||
#endif
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
return base_vaddr;
|
||||
@@ -3624,26 +3592,18 @@ df_architecture_from_entity(DF_Entity *entity)
|
||||
}
|
||||
|
||||
internal EVAL_String2NumMap *
|
||||
df_push_locals_map_from_binary_voff(Arena *arena, DBGI_Scope *scope, DF_Entity *binary, U64 voff)
|
||||
df_push_locals_map_from_dbgi_voff(Arena *arena, DI_Scope *scope, DF_Entity *dbgi, U64 voff)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8 binary_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, binary_path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
EVAL_String2NumMap *result = eval_push_locals_map_from_rdi_voff(arena, rdi, voff);
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal EVAL_String2NumMap *
|
||||
df_push_member_map_from_binary_voff(Arena *arena, DBGI_Scope *scope, DF_Entity *binary, U64 voff)
|
||||
df_push_member_map_from_dbgi_voff(Arena *arena, DI_Scope *scope, DF_Entity *dbgi, U64 voff)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8 binary_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, binary_path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
EVAL_String2NumMap *result = eval_push_member_map_from_rdi_voff(arena, rdi, voff);
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -3765,7 +3725,6 @@ df_push_ctrl_msg(CTRL_Msg *msg)
|
||||
internal void
|
||||
df_ctrl_run(DF_RunKind run, DF_Entity *run_thread, CTRL_RunFlags flags, CTRL_TrapList *run_traps)
|
||||
{
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
// rjf: build run message
|
||||
@@ -3881,7 +3840,6 @@ df_ctrl_run(DF_RunKind run, DF_Entity *run_thread, CTRL_RunFlags flags, CTRL_Tra
|
||||
df_state->ctrl_ctx.unwind_count = 0;
|
||||
|
||||
scratch_end(scratch);
|
||||
dbgi_scope_close(scope);
|
||||
}
|
||||
|
||||
//- rjf: stopped info from the control thread
|
||||
@@ -3914,22 +3872,20 @@ df_eval_memory_read(void *u, void *out, U64 addr, U64 size)
|
||||
}
|
||||
|
||||
internal EVAL_ParseCtx
|
||||
df_eval_parse_ctx_from_process_vaddr(DBGI_Scope *scope, DF_Entity *process, U64 vaddr)
|
||||
df_eval_parse_ctx_from_process_vaddr(DI_Scope *scope, DF_Entity *process, U64 vaddr)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
//- rjf: extract info
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
|
||||
U64 voff = df_voff_from_vaddr(module, vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
String8 binary_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, binary_path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
DF_Entity *debug = df_dbgi_from_module(module);
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, debug);
|
||||
Architecture arch = df_architecture_from_entity(process);
|
||||
EVAL_String2NumMap *reg_map = ctrl_string2reg_from_arch(arch);
|
||||
EVAL_String2NumMap *reg_alias_map = ctrl_string2alias_from_arch(arch);
|
||||
EVAL_String2NumMap *locals_map = df_query_cached_locals_map_from_binary_voff(binary, voff);
|
||||
EVAL_String2NumMap *member_map = df_query_cached_member_map_from_binary_voff(binary, voff);
|
||||
EVAL_String2NumMap *locals_map = df_query_cached_locals_map_from_dbgi_voff(debug, voff);
|
||||
EVAL_String2NumMap *member_map = df_query_cached_member_map_from_dbgi_voff(debug, voff);
|
||||
|
||||
//- rjf: build ctx
|
||||
EVAL_ParseCtx ctx = zero_struct;
|
||||
@@ -3948,11 +3904,11 @@ df_eval_parse_ctx_from_process_vaddr(DBGI_Scope *scope, DF_Entity *process, U64
|
||||
}
|
||||
|
||||
internal EVAL_ParseCtx
|
||||
df_eval_parse_ctx_from_src_loc(DBGI_Scope *scope, DF_Entity *file, TxtPt pt)
|
||||
df_eval_parse_ctx_from_src_loc(DI_Scope *scope, DF_Entity *file, TxtPt pt)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
EVAL_ParseCtx ctx = zero_struct;
|
||||
DF_EntityList binaries = df_push_active_binary_list(scratch.arena);
|
||||
DF_EntityList dbgis = df_push_active_dbgi_list(scratch.arena);
|
||||
DF_TextLineSrc2DasmInfoList src2dasm_list = {0};
|
||||
|
||||
//- rjf: search for line info in all binaries for this file:pt
|
||||
@@ -3964,15 +3920,13 @@ df_eval_parse_ctx_from_src_loc(DBGI_Scope *scope, DF_Entity *file, TxtPt pt)
|
||||
DF_Entity *override = override_n->entity;
|
||||
String8 file_path = df_full_path_from_entity(scratch.arena, override);
|
||||
String8 file_path_normalized = lower_from_str8(scratch.arena, file_path);
|
||||
for(DF_EntityNode *binary_n = binaries.first;
|
||||
binary_n != 0;
|
||||
binary_n = binary_n->next)
|
||||
for(DF_EntityNode *dbgi_n = dbgis.first;
|
||||
dbgi_n != 0;
|
||||
dbgi_n = dbgi_n->next)
|
||||
{
|
||||
// rjf: binary -> rdi
|
||||
DF_Entity *binary = binary_n->entity;
|
||||
String8 binary_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, binary_path, 0);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
// rjf: debug file -> rdi
|
||||
DF_Entity *dbgi = dbgi_n->entity;
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
|
||||
// rjf: file_path_normalized * rdi -> src_id
|
||||
B32 good_src_id = 0;
|
||||
@@ -4018,7 +3972,7 @@ df_eval_parse_ctx_from_src_loc(DBGI_Scope *scope, DF_Entity *file, TxtPt pt)
|
||||
DF_TextLineSrc2DasmInfoNode *src2dasm_n = push_array(scratch.arena, DF_TextLineSrc2DasmInfoNode, 1);
|
||||
src2dasm_n->v.voff_range = range;
|
||||
src2dasm_n->v.remap_line = (S64)actual_line;
|
||||
src2dasm_n->v.binary = binary;
|
||||
src2dasm_n->v.dbgi = dbgi;
|
||||
SLLQueuePush(src2dasm_list.first, src2dasm_list.last, src2dasm_n);
|
||||
src2dasm_list.count += 1;
|
||||
}
|
||||
@@ -4033,7 +3987,7 @@ df_eval_parse_ctx_from_src_loc(DBGI_Scope *scope, DF_Entity *file, TxtPt pt)
|
||||
for(DF_TextLineSrc2DasmInfoNode *n = src2dasm_list.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_TextLineSrc2DasmInfo *src2dasm = &n->v;
|
||||
DF_EntityList modules = df_modules_from_binary_file(scratch.arena, src2dasm->binary);
|
||||
DF_EntityList modules = df_modules_from_dbgi(scratch.arena, src2dasm->dbgi);
|
||||
if(modules.count != 0)
|
||||
{
|
||||
DF_Entity *module = modules.first->entity;
|
||||
@@ -4050,7 +4004,7 @@ df_eval_parse_ctx_from_src_loc(DBGI_Scope *scope, DF_Entity *file, TxtPt pt)
|
||||
//- rjf: bad ctx -> reset with graceful defaults
|
||||
if(good_ctx == 0)
|
||||
{
|
||||
ctx.rdi = &dbgi_parse_nil.rdi;
|
||||
ctx.rdi = &di_rdi_parsed_nil;
|
||||
ctx.type_graph = tg_graph_begin(8, 256);
|
||||
ctx.regs_map = &eval_string2num_map_nil;
|
||||
ctx.regs_map = &eval_string2num_map_nil;
|
||||
@@ -4064,7 +4018,7 @@ df_eval_parse_ctx_from_src_loc(DBGI_Scope *scope, DF_Entity *file, TxtPt pt)
|
||||
}
|
||||
|
||||
internal DF_Eval
|
||||
df_eval_from_string(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, String8 string)
|
||||
df_eval_from_string(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, String8 string)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
@@ -4179,9 +4133,9 @@ df_eval_from_string(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_
|
||||
{
|
||||
U64 vaddr = result.imm_u64;
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
U64 voff = df_voff_from_vaddr(module, vaddr);
|
||||
String8 symbol_name = df_symbol_name_from_binary_voff(scratch.arena, binary, voff);
|
||||
String8 symbol_name = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, voff);
|
||||
if(symbol_name.size != 0)
|
||||
{
|
||||
result.type_key = tg_cons_type_make(parse_ctx->type_graph, TG_Kind_Ptr, tg_key_basic(TG_Kind_Void), 0);
|
||||
@@ -4339,7 +4293,7 @@ df_dynamically_typed_eval_from_eval(TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx
|
||||
}
|
||||
|
||||
internal DF_Eval
|
||||
df_eval_from_eval_cfg_table(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, DF_CfgTable *cfg)
|
||||
df_eval_from_eval_cfg_table(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, DF_CfgTable *cfg)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
|
||||
@@ -4969,8 +4923,8 @@ df_eval_viz_block_split_and_continue(Arena *arena, DF_EvalVizBlockList *list, DF
|
||||
continue_block->string = split_block->string;
|
||||
continue_block->member = split_block->member;
|
||||
continue_block->visual_idx_range = continue_block->semantic_idx_range = r1u64(split_idx+1, total_count);
|
||||
continue_block->backing_search_items = split_block->backing_search_items;
|
||||
continue_block->dbgi_target = split_block->dbgi_target;
|
||||
continue_block->fzy_backing_items = split_block->fzy_backing_items;
|
||||
continue_block->fzy_target = split_block->fzy_target;
|
||||
continue_block->cfg_table = split_block->cfg_table;
|
||||
continue_block->link_member_type_key = split_block->link_member_type_key;
|
||||
continue_block->link_member_off = split_block->link_member_off;
|
||||
@@ -4988,7 +4942,7 @@ df_eval_viz_block_end(DF_EvalVizBlockList *list, DF_EvalVizBlock *block)
|
||||
}
|
||||
|
||||
internal void
|
||||
df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalView *eval_view, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_ExpandKey parent_key, DF_ExpandKey key, String8 string, DF_Eval eval, TG_Member *opt_member, DF_CfgTable *cfg_table, S32 depth, DF_EvalVizBlockList *list_out)
|
||||
df_append_viz_blocks_for_parent__rec(Arena *arena, DI_Scope *scope, DF_EvalView *eval_view, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_ExpandKey parent_key, DF_ExpandKey key, String8 string, DF_Eval eval, TG_Member *opt_member, DF_CfgTable *cfg_table, S32 depth, DF_EvalVizBlockList *list_out)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
@@ -5394,7 +5348,7 @@ df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalVie
|
||||
}
|
||||
|
||||
internal DF_EvalVizBlockList
|
||||
df_eval_viz_block_list_from_eval_view_expr_keys(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, String8 expr, DF_ExpandKey parent_key, DF_ExpandKey key)
|
||||
df_eval_viz_block_list_from_eval_view_expr_keys(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, String8 expr, DF_ExpandKey parent_key, DF_ExpandKey key)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
DF_EvalVizBlockList blocks = {0};
|
||||
@@ -5475,9 +5429,9 @@ df_row_num_from_viz_block_list_key(DF_EvalVizBlockList *blocks, DF_ExpandKey key
|
||||
{
|
||||
B32 this_block_contains_this_key = 0;
|
||||
{
|
||||
if(block->backing_search_items.v != 0)
|
||||
if(block->fzy_backing_items.v != 0)
|
||||
{
|
||||
U64 item_num = dbgi_fuzzy_item_num_from_array_element_idx__linear_search(&block->backing_search_items, key.child_num);
|
||||
U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&block->fzy_backing_items, key.child_num);
|
||||
this_block_contains_this_key = (item_num != 0 && contains_1u64(block->semantic_idx_range, item_num-1));
|
||||
}
|
||||
else
|
||||
@@ -5488,9 +5442,9 @@ df_row_num_from_viz_block_list_key(DF_EvalVizBlockList *blocks, DF_ExpandKey key
|
||||
if(this_block_contains_this_key)
|
||||
{
|
||||
found = 1;
|
||||
if(block->backing_search_items.v != 0)
|
||||
if(block->fzy_backing_items.v != 0)
|
||||
{
|
||||
U64 item_num = dbgi_fuzzy_item_num_from_array_element_idx__linear_search(&block->backing_search_items, key.child_num);
|
||||
U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&block->fzy_backing_items, key.child_num);
|
||||
row_num += item_num-1-block->semantic_idx_range.min;
|
||||
}
|
||||
else
|
||||
@@ -5524,12 +5478,12 @@ df_key_from_viz_block_list_row_num(DF_EvalVizBlockList *blocks, S64 row_num)
|
||||
if(contains_1s64(vb_row_num_range, row_num))
|
||||
{
|
||||
key = vb->key;
|
||||
if(vb->backing_search_items.v != 0)
|
||||
if(vb->fzy_backing_items.v != 0)
|
||||
{
|
||||
U64 item_idx = (U64)((row_num - vb_row_num_range.min) + vb->semantic_idx_range.min);
|
||||
if(item_idx < vb->backing_search_items.count)
|
||||
if(item_idx < vb->fzy_backing_items.count)
|
||||
{
|
||||
key.child_num = vb->backing_search_items.v[item_idx].idx;
|
||||
key.child_num = vb->fzy_backing_items.v[item_idx].idx;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -6159,17 +6113,17 @@ df_query_cached_entity_list_with_kind(DF_EntityKind kind)
|
||||
}
|
||||
|
||||
internal DF_EntityList
|
||||
df_push_active_binary_list(Arena *arena)
|
||||
df_push_active_dbgi_list(Arena *arena)
|
||||
{
|
||||
DF_EntityList binaries = {0};
|
||||
DF_EntityList dbgis = {0};
|
||||
DF_EntityList modules = df_query_cached_entity_list_with_kind(DF_EntityKind_Module);
|
||||
for(DF_EntityNode *n = modules.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_Entity *module = n->entity;
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
df_entity_list_push(arena, &binaries, binary);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
df_entity_list_push(arena, &dbgis, dbgi);
|
||||
}
|
||||
return binaries;
|
||||
return dbgis;
|
||||
}
|
||||
|
||||
internal DF_EntityList
|
||||
@@ -6328,7 +6282,7 @@ df_query_cached_tls_base_vaddr_from_process_root_rip(DF_Entity *process, U64 roo
|
||||
}
|
||||
|
||||
internal EVAL_String2NumMap *
|
||||
df_query_cached_locals_map_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
df_query_cached_locals_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
EVAL_String2NumMap *map = &eval_string2num_map_nil;
|
||||
@@ -6344,14 +6298,14 @@ df_query_cached_locals_map_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
{
|
||||
break;
|
||||
}
|
||||
DF_Handle handle = df_handle_from_entity(binary);
|
||||
DF_Handle handle = df_handle_from_entity(dbgi);
|
||||
U64 hash = df_hash_from_string(str8_struct(&handle));
|
||||
U64 slot_idx = hash % cache->table_size;
|
||||
DF_RunLocalsCacheSlot *slot = &cache->table[slot_idx];
|
||||
DF_RunLocalsCacheNode *node = 0;
|
||||
for(DF_RunLocalsCacheNode *n = slot->first; n != 0; n = n->hash_next)
|
||||
{
|
||||
if(df_handle_match(n->binary, handle) && n->voff == voff)
|
||||
if(df_handle_match(n->dbgi, handle) && n->voff == voff)
|
||||
{
|
||||
node = n;
|
||||
break;
|
||||
@@ -6359,17 +6313,17 @@ df_query_cached_locals_map_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
}
|
||||
if(node == 0)
|
||||
{
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
EVAL_String2NumMap *map = df_push_locals_map_from_binary_voff(cache->arena, scope, binary, voff);
|
||||
DI_Scope *scope = di_scope_open();
|
||||
EVAL_String2NumMap *map = df_push_locals_map_from_dbgi_voff(cache->arena, scope, dbgi, voff);
|
||||
if(map->slots_count != 0)
|
||||
{
|
||||
node = push_array(cache->arena, DF_RunLocalsCacheNode, 1);
|
||||
node->binary = handle;
|
||||
node->dbgi = handle;
|
||||
node->voff = voff;
|
||||
node->locals_map = map;
|
||||
SLLQueuePush_N(slot->first, slot->last, node, hash_next);
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
}
|
||||
if(node != 0 && node->locals_map->slots_count != 0)
|
||||
{
|
||||
@@ -6382,7 +6336,7 @@ df_query_cached_locals_map_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
}
|
||||
|
||||
internal EVAL_String2NumMap *
|
||||
df_query_cached_member_map_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
df_query_cached_member_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
EVAL_String2NumMap *map = &eval_string2num_map_nil;
|
||||
@@ -6398,14 +6352,14 @@ df_query_cached_member_map_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
{
|
||||
break;
|
||||
}
|
||||
DF_Handle handle = df_handle_from_entity(binary);
|
||||
DF_Handle handle = df_handle_from_entity(dbgi);
|
||||
U64 hash = df_hash_from_string(str8_struct(&handle));
|
||||
U64 slot_idx = hash % cache->table_size;
|
||||
DF_RunLocalsCacheSlot *slot = &cache->table[slot_idx];
|
||||
DF_RunLocalsCacheNode *node = 0;
|
||||
for(DF_RunLocalsCacheNode *n = slot->first; n != 0; n = n->hash_next)
|
||||
{
|
||||
if(df_handle_match(n->binary, handle) && n->voff == voff)
|
||||
if(df_handle_match(n->dbgi, handle) && n->voff == voff)
|
||||
{
|
||||
node = n;
|
||||
break;
|
||||
@@ -6413,17 +6367,17 @@ df_query_cached_member_map_from_binary_voff(DF_Entity *binary, U64 voff)
|
||||
}
|
||||
if(node == 0)
|
||||
{
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
EVAL_String2NumMap *map = df_push_member_map_from_binary_voff(cache->arena, scope, binary, voff);
|
||||
DI_Scope *scope = di_scope_open();
|
||||
EVAL_String2NumMap *map = df_push_member_map_from_dbgi_voff(cache->arena, scope, dbgi, voff);
|
||||
if(map->slots_count != 0)
|
||||
{
|
||||
node = push_array(cache->arena, DF_RunLocalsCacheNode, 1);
|
||||
node->binary = handle;
|
||||
node->dbgi = handle;
|
||||
node->voff = voff;
|
||||
node->locals_map = map;
|
||||
SLLQueuePush_N(slot->first, slot->last, node, hash_next);
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
}
|
||||
if(node != 0 && node->locals_map->slots_count != 0)
|
||||
{
|
||||
@@ -6745,9 +6699,9 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
U64 stop_thread_vaddr = ctrl_query_cached_rip_from_thread(df_state->ctrl_entity_store, stop_thread->ctrl_machine_id, stop_thread->ctrl_handle);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(stop_thread, DF_EntityKind_Process);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, stop_thread_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *debug = df_dbgi_from_module(module);
|
||||
U64 stop_thread_voff = df_voff_from_vaddr(module, stop_thread_vaddr);
|
||||
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_binary_voff(binary, stop_thread_voff);
|
||||
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_voff(debug, stop_thread_voff);
|
||||
DF_EntityList user_bps = df_query_cached_entity_list_with_kind(DF_EntityKind_Breakpoint);
|
||||
for(DF_EntityNode *n = user_bps.first; n != 0; n = n->next)
|
||||
{
|
||||
@@ -6926,11 +6880,13 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
df_entity_equip_name(0, module, event->string);
|
||||
df_entity_equip_vaddr_rng(module, event->vaddr_rng);
|
||||
df_entity_equip_vaddr(module, event->rip_vaddr);
|
||||
df_entity_equip_timestamp(module, event->timestamp);
|
||||
|
||||
// rjf: create & attach binary file
|
||||
String8 bin_path = module->name;
|
||||
DF_Entity *binary = df_entity_from_path(bin_path, DF_EntityFromPathFlag_All);
|
||||
df_entity_equip_entity_handle(module, df_handle_from_entity(binary));
|
||||
// rjf: create & attach debug info path
|
||||
CTRL_Entity *ctrl_module = ctrl_entity_from_machine_id_handle(df_state->ctrl_entity_store, event->machine_id, event->entity);
|
||||
CTRL_Entity *ctrl_debug_info = ctrl_entity_child_from_kind(ctrl_module, CTRL_EntityKind_DebugInfoPath);
|
||||
DF_Entity *debug_info = df_entity_from_path(ctrl_debug_info->string, DF_EntityFromPathFlag_OpenAsNeeded|DF_EntityFromPathFlag_OpenMissing);
|
||||
df_entity_equip_entity_handle(module, df_handle_from_entity(debug_info));
|
||||
|
||||
// rjf: is first -> find target, equip process & module & first thread with target color
|
||||
if(is_first)
|
||||
@@ -6977,6 +6933,15 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
df_entity_mark_for_deletion(module);
|
||||
}break;
|
||||
|
||||
//- rjf: debug info changes
|
||||
|
||||
case CTRL_EventKind_ModuleDebugInfoPathChange:
|
||||
{
|
||||
DF_Entity *module = df_entity_from_ctrl_handle(event->machine_id, event->entity);
|
||||
DF_Entity *debug_info = df_entity_from_path(event->string, DF_EntityFromPathFlag_OpenAsNeeded|DF_EntityFromPathFlag_OpenMissing);
|
||||
df_entity_equip_entity_handle(module, df_handle_from_entity(debug_info));
|
||||
}break;
|
||||
|
||||
//- rjf: debug strings
|
||||
|
||||
case CTRL_EventKind_DebugString:
|
||||
@@ -7089,23 +7054,23 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
//- rjf: sync with dbgi parsers
|
||||
ProfScope("sync with dbgi parsers")
|
||||
//- rjf: sync with di parsers
|
||||
ProfScope("sync with di parsers")
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
DBGI_EventList events = dbgi_p2u_pop_events(scratch.arena, 0);
|
||||
for(DBGI_EventNode *n = events.first; n != 0; n = n->next)
|
||||
DI_EventList events = di_p2u_pop_events(scratch.arena, 0);
|
||||
for(DI_EventNode *n = events.first; n != 0; n = n->next)
|
||||
{
|
||||
DBGI_Event *event = &n->v;
|
||||
DI_Event *event = &n->v;
|
||||
switch(event->kind)
|
||||
{
|
||||
default:{}break;
|
||||
case DBGI_EventKind_ConversionStarted:
|
||||
case DI_EventKind_ConversionStarted:
|
||||
{
|
||||
DF_Entity *task = df_entity_alloc(0, df_entity_root(), DF_EntityKind_ConversionTask);
|
||||
df_entity_equip_name(0, task, event->string);
|
||||
}break;
|
||||
case DBGI_EventKind_ConversionEnded:
|
||||
case DI_EventKind_ConversionEnded:
|
||||
{
|
||||
DF_Entity *task = df_entity_from_name_and_kind(event->string, DF_EntityKind_ConversionTask);
|
||||
if(!df_entity_is_nil(task))
|
||||
@@ -7113,7 +7078,7 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
|
||||
df_entity_mark_for_deletion(task);
|
||||
}
|
||||
}break;
|
||||
case DBGI_EventKind_ConversionFailureUnsupportedFormat:
|
||||
case DI_EventKind_ConversionFailureUnsupportedFormat:
|
||||
{
|
||||
// DF_Entity *task = df_entity_alloc(df_entity_root(), DF_EntityKind_ConversionFail);
|
||||
// df_entity_equip_name(task, event->string);
|
||||
|
||||
+30
-35
@@ -265,10 +265,10 @@ struct DF_Eval
|
||||
////////////////////////////////
|
||||
//~ rjf: View Rule Hook Types
|
||||
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(name) DF_Eval name(Arena *arena, DBGI_Scope *dbgi_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, struct DF_CfgVal *val)
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(name) DF_Eval name(Arena *arena, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, struct DF_CfgVal *val)
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(name) df_core_view_rule_eval_resolution__##name
|
||||
#define DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_NAME(name))
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, DBGI_Scope *dbgi_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_EvalView *eval_view, DF_Eval eval, String8 string, struct DF_CfgTable *cfg_table, DF_ExpandKey parent_key, DF_ExpandKey key, S32 depth, struct DF_CfgNode *cfg, struct DF_EvalVizBlockList *out)
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(name) void name(Arena *arena, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_EvalView *eval_view, DF_Eval eval, String8 string, struct DF_CfgTable *cfg_table, DF_ExpandKey parent_key, DF_ExpandKey key, S32 depth, struct DF_CfgNode *cfg, struct DF_EvalVizBlockList *out)
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name) df_core_view_rule_viz_block_prod__##name
|
||||
#define DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_DEF(name) internal DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_SIG(DF_CORE_VIEW_RULE_VIZ_BLOCK_PROD_FUNCTION_NAME(name))
|
||||
typedef DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_SIG(DF_CoreViewRuleEvalResolutionHookFunctionType);
|
||||
@@ -521,7 +521,7 @@ struct DF_TextLineSrc2DasmInfo
|
||||
{
|
||||
Rng1U64 voff_range;
|
||||
S64 remap_line;
|
||||
DF_Entity *binary;
|
||||
DF_Entity *dbgi;
|
||||
};
|
||||
|
||||
typedef struct DF_TextLineSrc2DasmInfoNode DF_TextLineSrc2DasmInfoNode;
|
||||
@@ -543,7 +543,7 @@ typedef struct DF_TextLineSrc2DasmInfoListArray DF_TextLineSrc2DasmInfoListArray
|
||||
struct DF_TextLineSrc2DasmInfoListArray
|
||||
{
|
||||
DF_TextLineSrc2DasmInfoList *v;
|
||||
DF_EntityList binaries;
|
||||
DF_EntityList dbgis;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
@@ -552,7 +552,7 @@ struct DF_TextLineSrc2DasmInfoListArray
|
||||
typedef struct DF_TextLineDasm2SrcInfo DF_TextLineDasm2SrcInfo;
|
||||
struct DF_TextLineDasm2SrcInfo
|
||||
{
|
||||
DF_Entity *binary;
|
||||
DF_Entity *dbgi;
|
||||
DF_Entity *file;
|
||||
TxtPt pt;
|
||||
Rng1U64 voff_range;
|
||||
@@ -708,8 +708,8 @@ struct DF_EvalVizBlock
|
||||
// rjf: info about ranges that this block spans
|
||||
Rng1U64 visual_idx_range;
|
||||
Rng1U64 semantic_idx_range;
|
||||
DBGI_FuzzySearchTarget dbgi_target;
|
||||
DBGI_FuzzySearchItemArray backing_search_items;
|
||||
FZY_Target fzy_target;
|
||||
FZY_ItemArray fzy_backing_items;
|
||||
|
||||
// rjf: visualization config extensions
|
||||
DF_CfgTable cfg_table;
|
||||
@@ -1004,7 +1004,7 @@ typedef struct DF_RunLocalsCacheNode DF_RunLocalsCacheNode;
|
||||
struct DF_RunLocalsCacheNode
|
||||
{
|
||||
DF_RunLocalsCacheNode *hash_next;
|
||||
DF_Handle binary;
|
||||
DF_Handle dbgi;
|
||||
U64 voff;
|
||||
EVAL_String2NumMap *locals_map;
|
||||
};
|
||||
@@ -1459,6 +1459,7 @@ internal void df_entity_equip_color_rgba(DF_Entity *entity, Vec4F32 rgba);
|
||||
internal void df_entity_equip_color_hsva(DF_Entity *entity, Vec4F32 hsva);
|
||||
internal void df_entity_equip_death_timer(DF_Entity *entity, F32 seconds_til_death);
|
||||
internal void df_entity_equip_cfg_src(DF_Entity *entity, DF_CfgSrc cfg_src);
|
||||
internal void df_entity_equip_timestamp(DF_Entity *entity, U64 timestamp);
|
||||
|
||||
//- rjf: control layer correllation equipment
|
||||
internal void df_entity_equip_ctrl_machine_id(DF_Entity *entity, CTRL_MachineID machine_id);
|
||||
@@ -1507,11 +1508,6 @@ internal DF_CmdSpecList df_push_cmd_spec_list(Arena *arena);
|
||||
internal void df_register_core_view_rule_specs(DF_CoreViewRuleSpecInfoArray specs);
|
||||
internal DF_CoreViewRuleSpec *df_core_view_rule_spec_from_string(String8 string);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Info Mapping
|
||||
|
||||
internal String8 df_debug_info_path_from_module(Arena *arena, DF_Entity *module);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Stepping "Trap Net" Builders
|
||||
|
||||
@@ -1522,9 +1518,9 @@ internal CTRL_TrapList df_trap_net_from_thread__step_into_line(Arena *arena, DF_
|
||||
////////////////////////////////
|
||||
//~ rjf: Modules & Debug Info Mappings
|
||||
|
||||
//- rjf: module <=> binary file
|
||||
internal DF_Entity *df_binary_file_from_module(DF_Entity *module);
|
||||
internal DF_EntityList df_modules_from_binary_file(Arena *arena, DF_Entity *binary_info);
|
||||
//- rjf: module <=> debug info file
|
||||
internal DF_Entity *df_dbgi_from_module(DF_Entity *module);
|
||||
internal DF_EntityList df_modules_from_dbgi(Arena *arena, DF_Entity *debug);
|
||||
|
||||
//- rjf: voff <=> vaddr
|
||||
internal U64 df_base_vaddr_from_module(DF_Entity *module);
|
||||
@@ -1536,33 +1532,32 @@ internal Rng1U64 df_vaddr_range_from_voff_range(DF_Entity *module, Rng1U64 voff_
|
||||
////////////////////////////////
|
||||
//~ rjf: Debug Info Lookups
|
||||
|
||||
//- rjf: binary file -> dbgi parse
|
||||
internal DBGI_Parse *df_dbgi_parse_from_binary_file(DBGI_Scope *scope, DF_Entity *binary);
|
||||
//- rjf: debug file -> rdi
|
||||
internal RDI_Parsed *df_rdi_from_dbgi(DI_Scope *scope, DF_Entity *dbgi);
|
||||
|
||||
//- rjf: voff|vaddr -> symbol lookups
|
||||
internal String8 df_symbol_name_from_binary_voff(Arena *arena, DF_Entity *binary, U64 voff);
|
||||
internal String8 df_symbol_name_from_dbgi_voff(Arena *arena, DF_Entity *dbgi, U64 voff);
|
||||
internal String8 df_symbol_name_from_process_vaddr(Arena *arena, DF_Entity *process, U64 vaddr);
|
||||
|
||||
//- rjf: src -> voff lookups
|
||||
internal DF_TextLineSrc2DasmInfoListArray df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entity *file, Rng1S64 line_num_range);
|
||||
|
||||
//- rjf: voff -> src lookups
|
||||
internal DF_TextLineDasm2SrcInfo df_text_line_dasm2src_info_from_binary_voff(DF_Entity *binary, U64 voff);
|
||||
internal DF_TextLineDasm2SrcInfo df_text_line_dasm2src_info_from_dbgi_voff(DF_Entity *dbgi, U64 voff);
|
||||
|
||||
//- rjf: symbol -> voff lookups
|
||||
internal U64 df_voff_from_binary_symbol_name(DF_Entity *binary, String8 symbol_name);
|
||||
internal U64 df_type_num_from_binary_name(DF_Entity *binary, String8 name);
|
||||
internal U64 df_voff_from_dbgi_symbol_name(DF_Entity *dbgi, String8 symbol_name);
|
||||
internal U64 df_type_num_from_dbgi_name(DF_Entity *dbgi, String8 name);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Process/Thread Info Lookups
|
||||
//~ rjf: Process/Thread/Module Info Lookups
|
||||
|
||||
//- rjf: thread info extraction helpers
|
||||
internal DF_Entity *df_module_from_process_vaddr(DF_Entity *process, U64 vaddr);
|
||||
internal DF_Entity *df_module_from_thread(DF_Entity *thread);
|
||||
internal U64 df_tls_base_vaddr_from_process_root_rip(DF_Entity *process, U64 root_vaddr, U64 rip_vaddr);
|
||||
internal Architecture df_architecture_from_entity(DF_Entity *entity);
|
||||
internal EVAL_String2NumMap *df_push_locals_map_from_binary_voff(Arena *arena, DBGI_Scope *scope, DF_Entity *binary, U64 voff);
|
||||
internal EVAL_String2NumMap *df_push_member_map_from_binary_voff(Arena *arena, DBGI_Scope *scope, DF_Entity *binary, U64 voff);
|
||||
internal EVAL_String2NumMap *df_push_locals_map_from_dbgi_voff(Arena *arena, DI_Scope *scope, DF_Entity *dbgi, U64 voff);
|
||||
internal EVAL_String2NumMap *df_push_member_map_from_dbgi_voff(Arena *arena, DI_Scope *scope, DF_Entity *dbgi, U64 voff);
|
||||
internal B32 df_set_thread_rip(DF_Entity *thread, U64 vaddr);
|
||||
internal DF_Entity *df_module_from_thread_candidates(DF_Entity *thread, DF_EntityList *candidates);
|
||||
|
||||
@@ -1587,12 +1582,12 @@ internal CTRL_Event df_ctrl_last_stop_event(void);
|
||||
//~ rjf: Evaluation
|
||||
|
||||
internal B32 df_eval_memory_read(void *u, void *out, U64 addr, U64 size);
|
||||
internal EVAL_ParseCtx df_eval_parse_ctx_from_process_vaddr(DBGI_Scope *scope, DF_Entity *process, U64 vaddr);
|
||||
internal EVAL_ParseCtx df_eval_parse_ctx_from_src_loc(DBGI_Scope *scope, DF_Entity *file, TxtPt pt);
|
||||
internal DF_Eval df_eval_from_string(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, String8 string);
|
||||
internal EVAL_ParseCtx df_eval_parse_ctx_from_process_vaddr(DI_Scope *scope, DF_Entity *process, U64 vaddr);
|
||||
internal EVAL_ParseCtx df_eval_parse_ctx_from_src_loc(DI_Scope *scope, DF_Entity *file, TxtPt pt);
|
||||
internal DF_Eval df_eval_from_string(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, String8 string);
|
||||
internal DF_Eval df_value_mode_eval_from_eval(TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_ctx, DF_Eval eval);
|
||||
internal DF_Eval df_dynamically_typed_eval_from_eval(TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_ctx, DF_Eval eval);
|
||||
internal DF_Eval df_eval_from_eval_cfg_table(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, DF_CfgTable *cfg);
|
||||
internal DF_Eval df_eval_from_eval_cfg_table(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_Eval eval, DF_CfgTable *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Evaluation Views
|
||||
@@ -1630,8 +1625,8 @@ internal DF_EvalLinkBaseArray df_eval_link_base_array_from_chunk_list(Arena *are
|
||||
internal DF_EvalVizBlock *df_eval_viz_block_begin(Arena *arena, DF_EvalVizBlockKind kind, DF_ExpandKey parent_key, DF_ExpandKey key, S32 depth);
|
||||
internal DF_EvalVizBlock *df_eval_viz_block_split_and_continue(Arena *arena, DF_EvalVizBlockList *list, DF_EvalVizBlock *split_block, U64 split_idx);
|
||||
internal void df_eval_viz_block_end(DF_EvalVizBlockList *list, DF_EvalVizBlock *block);
|
||||
internal void df_append_viz_blocks_for_parent__rec(Arena *arena, DBGI_Scope *scope, DF_EvalView *view, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_ExpandKey parent_key, DF_ExpandKey key, String8 string, DF_Eval eval, TG_Member *opt_member, DF_CfgTable *cfg_table, S32 depth, DF_EvalVizBlockList *list_out);
|
||||
internal DF_EvalVizBlockList df_eval_viz_block_list_from_eval_view_expr_keys(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, String8 expr, DF_ExpandKey parent_key, DF_ExpandKey key);
|
||||
internal void df_append_viz_blocks_for_parent__rec(Arena *arena, DI_Scope *scope, DF_EvalView *view, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_ExpandKey parent_key, DF_ExpandKey key, String8 string, DF_Eval eval, TG_Member *opt_member, DF_CfgTable *cfg_table, S32 depth, DF_EvalVizBlockList *list_out);
|
||||
internal DF_EvalVizBlockList df_eval_viz_block_list_from_eval_view_expr_keys(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, String8 expr, DF_ExpandKey parent_key, DF_ExpandKey key);
|
||||
internal void df_eval_viz_block_list_concat__in_place(DF_EvalVizBlockList *dst, DF_EvalVizBlockList *to_push);
|
||||
|
||||
//- rjf: viz block list <-> table coordinates
|
||||
@@ -1684,7 +1679,7 @@ internal String8 df_info_summary_from_string(Architecture arch, String8 string);
|
||||
|
||||
//- rjf: entity kind cache
|
||||
internal DF_EntityList df_query_cached_entity_list_with_kind(DF_EntityKind kind);
|
||||
internal DF_EntityList df_push_active_binary_list(Arena *arena);
|
||||
internal DF_EntityList df_push_active_dbgi_list(Arena *arena);
|
||||
internal DF_EntityList df_push_active_target_list(Arena *arena);
|
||||
|
||||
//- rjf: per-run caches
|
||||
@@ -1692,8 +1687,8 @@ internal CTRL_Unwind df_query_cached_unwind_from_thread(DF_Entity *thread);
|
||||
internal U64 df_query_cached_rip_from_thread(DF_Entity *thread);
|
||||
internal U64 df_query_cached_rip_from_thread_unwind(DF_Entity *thread, U64 unwind_count);
|
||||
internal U64 df_query_cached_tls_base_vaddr_from_process_root_rip(DF_Entity *process, U64 root_vaddr, U64 rip_vaddr);
|
||||
internal EVAL_String2NumMap *df_query_cached_locals_map_from_binary_voff(DF_Entity *binary, U64 voff);
|
||||
internal EVAL_String2NumMap *df_query_cached_member_map_from_binary_voff(DF_Entity *binary, U64 voff);
|
||||
internal EVAL_String2NumMap *df_query_cached_locals_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff);
|
||||
internal EVAL_String2NumMap *df_query_cached_member_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff);
|
||||
|
||||
//- rjf: top-level command dispatch
|
||||
internal void df_push_cmd__root(DF_CmdParams *params, DF_CmdSpec *spec);
|
||||
|
||||
+61
-69
@@ -583,17 +583,17 @@ df_queue_drag_drop(void)
|
||||
}
|
||||
|
||||
internal void
|
||||
df_set_hovered_line_info(DF_Entity *binary, U64 voff)
|
||||
df_set_hovered_line_info(DF_Entity *dbgi, U64 voff)
|
||||
{
|
||||
df_gfx_state->hover_line_binary = df_handle_from_entity(binary);
|
||||
df_gfx_state->hover_line_dbgi = df_handle_from_entity(dbgi);
|
||||
df_gfx_state->hover_line_voff = voff;
|
||||
df_gfx_state->hover_line_set_this_frame = 1;
|
||||
}
|
||||
|
||||
internal DF_Entity *
|
||||
df_get_hovered_line_info_binary(void)
|
||||
df_get_hovered_line_info_dbgi(void)
|
||||
{
|
||||
return df_entity_from_handle(df_gfx_state->hover_line_binary);
|
||||
return df_entity_from_handle(df_gfx_state->hover_line_dbgi);
|
||||
}
|
||||
|
||||
internal U64
|
||||
@@ -2488,7 +2488,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
//- rjf: thread finding
|
||||
case DF_CoreCmdKind_FindThread:
|
||||
{
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
DF_Entity *thread = df_entity_from_handle(params.entity);
|
||||
U64 unwind_count = params.index;
|
||||
if(thread->kind == DF_EntityKind_Thread)
|
||||
@@ -2499,15 +2499,15 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
// rjf: extract thread/rip info
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *debug = df_dbgi_from_module(module);
|
||||
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
|
||||
DBGI_Parse *dbgi = df_dbgi_parse_from_binary_file(scope, binary);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_binary_voff(binary, rip_voff);
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, debug);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(debug, rip_voff);
|
||||
|
||||
// rjf: snap to resolved line
|
||||
B32 missing_rip = (rip_vaddr == 0);
|
||||
B32 binary_missing = (binary->flags & DF_EntityFlag_IsMissing);
|
||||
B32 dbg_info_pending = !binary_missing && dbgi == &dbgi_parse_nil;
|
||||
B32 binary_missing = (debug->flags & DF_EntityFlag_IsMissing);
|
||||
B32 dbg_info_pending = !binary_missing && rdi == &di_rdi_parsed_nil;
|
||||
B32 has_line_info = (line_info.voff_range.max != line_info.voff_range.min);
|
||||
B32 has_module = !df_entity_is_nil(module);
|
||||
B32 has_dbg_info = has_module && !binary_missing;
|
||||
@@ -2537,7 +2537,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindThread));
|
||||
}
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
}break;
|
||||
case DF_CoreCmdKind_FindSelectedThread:
|
||||
{
|
||||
@@ -2561,17 +2561,17 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
|
||||
// rjf: try to resolve name as a symbol
|
||||
U64 voff = 0;
|
||||
DF_Entity *voff_binary = &df_g_nil_entity;
|
||||
DF_Entity *voff_dbgi = &df_g_nil_entity;
|
||||
if(name_resolved == 0)
|
||||
{
|
||||
DF_EntityList binaries = df_push_active_binary_list(scratch.arena);
|
||||
for(DF_EntityNode *n = binaries.first; n != 0; n = n->next)
|
||||
DF_EntityList dbgis = df_push_active_dbgi_list(scratch.arena);
|
||||
for(DF_EntityNode *n = dbgis.first; n != 0; n = n->next)
|
||||
{
|
||||
U64 binary_voff = df_voff_from_binary_symbol_name(n->entity, name);
|
||||
U64 binary_voff = df_voff_from_dbgi_symbol_name(n->entity, name);
|
||||
if(binary_voff != 0)
|
||||
{
|
||||
voff = binary_voff;
|
||||
voff_binary = n->entity;
|
||||
voff_dbgi = n->entity;
|
||||
name_resolved = 1;
|
||||
break;
|
||||
}
|
||||
@@ -2680,19 +2680,25 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
// rjf: name resolved to voff * dbg info
|
||||
if(name_resolved != 0 && voff != 0)
|
||||
{
|
||||
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_binary_voff(voff_binary, voff);
|
||||
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_voff(voff_dbgi, voff);
|
||||
DF_CmdParams p = params;
|
||||
{
|
||||
p.file_path = df_full_path_from_entity(scratch.arena, dasm2src_info.file);
|
||||
p.text_point = dasm2src_info.pt;
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_FilePath);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_TextPoint);
|
||||
if(!df_entity_is_nil(voff_binary))
|
||||
if(!df_entity_is_nil(voff_dbgi))
|
||||
{
|
||||
p.entity = df_handle_from_entity(voff_binary);
|
||||
p.voff = dasm2src_info.voff_range.min;
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_VirtualOff);
|
||||
DF_EntityList modules = df_modules_from_dbgi(scratch.arena, voff_dbgi);
|
||||
DF_Entity *module = df_first_entity_from_list(&modules);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(module, DF_EntityKind_Process);
|
||||
if(!df_entity_is_nil(process))
|
||||
{
|
||||
p.entity = df_handle_from_entity(process);
|
||||
p.vaddr = module->vaddr_rng.min + dasm2src_info.voff_range.min;
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_Entity);
|
||||
df_cmd_params_mark_slot(&p, DF_CmdParamSlot_VirtualAddr);
|
||||
}
|
||||
}
|
||||
}
|
||||
df_cmd_list_push(arena, cmds, &p, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_FindCodeLocation));
|
||||
@@ -2911,7 +2917,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
for(DF_TextLineSrc2DasmInfoNode *n = src2dasm.v[src2dasm_idx].first; n != 0; n = n->next)
|
||||
{
|
||||
DF_EntityList modules = df_modules_from_binary_file(scratch.arena, n->v.binary);
|
||||
DF_EntityList modules = df_modules_from_dbgi(scratch.arena, n->v.dbgi);
|
||||
DF_Entity *module = df_module_from_thread_candidates(thread, &modules);
|
||||
vaddr = df_vaddr_from_voff(module, n->v.voff_range.min);
|
||||
goto end_lookup;
|
||||
@@ -3411,26 +3417,10 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
|
||||
case DF_EntityKind_Module:
|
||||
{
|
||||
DF_Entity *bin_file = df_binary_file_from_module(entity);
|
||||
if(ui_clicked(df_icon_buttonf(DF_IconKind_Module, 0, "Inspect Binary File Memory")))
|
||||
{
|
||||
DF_CmdParams params = df_cmd_params_from_panel(ws, panel);
|
||||
params.entity = df_handle_from_entity(bin_file);
|
||||
df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Entity);
|
||||
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PendingEntity));
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
if(ui_clicked(df_icon_buttonf(DF_IconKind_Module, 0, "View Binary File Disassembly")))
|
||||
{
|
||||
DF_CmdParams params = df_cmd_params_from_panel(ws, panel);
|
||||
params.entity = df_handle_from_entity(bin_file);
|
||||
df_cmd_params_mark_slot(¶ms, DF_CmdParamSlot_Entity);
|
||||
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_PendingEntity));
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
}break;
|
||||
case DF_EntityKind_Process:
|
||||
{
|
||||
#if 0
|
||||
if(ui_clicked(df_icon_buttonf(DF_IconKind_FileOutline, 0, "Open Process Log")))
|
||||
{
|
||||
DF_Entity *log = df_log_from_entity(entity);
|
||||
@@ -3440,9 +3430,11 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Code));
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
#endif
|
||||
}break;
|
||||
case DF_EntityKind_Thread:
|
||||
{
|
||||
#if 0
|
||||
if(ui_clicked(df_icon_buttonf(DF_IconKind_FileOutline, 0, "Open Thread Log")))
|
||||
{
|
||||
DF_Entity *log = df_log_from_entity(entity);
|
||||
@@ -3452,6 +3444,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
df_push_cmd__root(¶ms, df_cmd_spec_from_core_cmd_kind(DF_CoreCmdKind_Code));
|
||||
ui_ctx_menu_close();
|
||||
}
|
||||
#endif
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -3928,9 +3921,9 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
{
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, unwind.frames.v[frame_idx].regs);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
|
||||
String8 symbol = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
|
||||
String8 symbol = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
|
||||
if(symbol.size != 0)
|
||||
{
|
||||
str8_list_pushf(scratch.arena, &lines, "0x%I64x: %S", rip_vaddr, symbol);
|
||||
@@ -4255,7 +4248,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, thread_rip_vaddr);
|
||||
U64 thread_rip_voff = df_voff_from_vaddr(module, thread_rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
|
||||
//- rjf: gather lister items
|
||||
DF_AutoCompListerItemChunkList item_list = {0};
|
||||
@@ -4263,7 +4256,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
//- rjf: gather locals
|
||||
if(ws->autocomp_lister_params.flags & DF_AutoCompListerFlag_Locals)
|
||||
{
|
||||
EVAL_String2NumMap *locals_map = df_query_cached_locals_map_from_binary_voff(binary, thread_rip_voff);
|
||||
EVAL_String2NumMap *locals_map = df_query_cached_locals_map_from_dbgi_voff(dbgi, thread_rip_voff);
|
||||
for(EVAL_String2NumMapNode *n = locals_map->first; n != 0; n = n->order_next)
|
||||
{
|
||||
DF_AutoCompListerItem item = {0};
|
||||
@@ -5716,7 +5709,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
UI_FontSize(df_font_size_from_slot(ws, DF_FontSlot_Main))
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
DF_CtrlCtx ctrl_ctx = ws->hover_eval_ctrl_ctx;
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
@@ -5983,7 +5976,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
|
||||
}
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
@@ -8311,7 +8304,7 @@ df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags
|
||||
}
|
||||
|
||||
internal DF_EvalVizWindowedRowList
|
||||
df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks)
|
||||
df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
@@ -8697,12 +8690,12 @@ df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DBGI_Scope *scop
|
||||
for(U64 idx = visible_idx_range.min; idx < visible_idx_range.max; idx += 1)
|
||||
{
|
||||
// rjf: unpack info about this row
|
||||
String8 name = dbgi_fuzzy_item_string_from_rdi_target_element_idx(parse_ctx->rdi, block->dbgi_target, block->backing_search_items.v[idx].idx);
|
||||
String8 name = push_str8f(arena, "Item %I64u", idx); // TODO(rjf): dbgi_fuzzy_item_string_from_rdi_target_element_idx(parse_ctx->rdi, block->dbgi_target, block->fzy_backing_items.v[idx].idx);
|
||||
|
||||
// rjf: get keys for this row
|
||||
DF_ExpandKey parent_key = block->parent_key;
|
||||
DF_ExpandKey key = block->key;
|
||||
key.child_num = block->backing_search_items.v[idx].idx;
|
||||
key.child_num = block->fzy_backing_items.v[idx].idx;
|
||||
|
||||
// rjf: get eval for this row
|
||||
DF_Eval eval = df_eval_from_string(arena, scope, ctrl_ctx, parse_ctx, macro_map, name);
|
||||
@@ -9942,9 +9935,9 @@ df_entity_tooltips(DF_Entity *entity)
|
||||
{
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, unwind.frames.v[idx].regs);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
|
||||
String8 symbol = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
|
||||
String8 symbol = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row
|
||||
{
|
||||
UI_Font(df_font_from_slot(DF_FontSlot_Code)) UI_PrefWidth(ui_em(18.f, 1.f)) UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_WeakText)) ui_labelf("0x%I64x", rip_vaddr);
|
||||
@@ -10138,8 +10131,8 @@ df_entity_desc_button(DF_Window *ws, DF_Entity *entity, FuzzyMatchRangeList *nam
|
||||
U64 rip_vaddr = regs_rip_from_arch_block(entity->arch, f->regs);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
|
||||
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
String8 procedure_name = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
String8 procedure_name = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
|
||||
if(procedure_name.size != 0)
|
||||
{
|
||||
FuzzyMatchRangeList fuzzy_matches = {0};
|
||||
@@ -10582,7 +10575,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
U64 thread_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, thread_rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
U64 thread_rip_voff = df_voff_from_vaddr(module, thread_rip_vaddr);
|
||||
|
||||
// rjf: thread info => color
|
||||
@@ -10649,7 +10642,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
n != 0;
|
||||
n = n->next)
|
||||
{
|
||||
if(n->v.binary == binary)
|
||||
if(n->v.dbgi == dbgi)
|
||||
{
|
||||
line_info = &n->v;
|
||||
break;
|
||||
@@ -10964,7 +10957,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
//
|
||||
UI_Focus(UI_FocusKind_Off)
|
||||
{
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
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;
|
||||
@@ -11029,7 +11022,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
}
|
||||
}
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
@@ -11257,11 +11250,11 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
if(params->line_src2dasm[line_slice_idx].first != 0 &&
|
||||
params->line_src2dasm[line_slice_idx].first->v.remap_line == mouse_pt.line)
|
||||
{
|
||||
df_set_hovered_line_info(params->line_src2dasm[line_slice_idx].first->v.binary, params->line_src2dasm[line_slice_idx].first->v.voff_range.min);
|
||||
df_set_hovered_line_info(params->line_src2dasm[line_slice_idx].first->v.dbgi, params->line_src2dasm[line_slice_idx].first->v.voff_range.min);
|
||||
}
|
||||
if(params->line_dasm2src[line_slice_idx].first != 0)
|
||||
{
|
||||
df_set_hovered_line_info(params->line_dasm2src[line_slice_idx].first->v.binary, params->line_dasm2src[line_slice_idx].first->v.voff_range.min);
|
||||
df_set_hovered_line_info(params->line_dasm2src[line_slice_idx].first->v.dbgi, params->line_dasm2src[line_slice_idx].first->v.voff_range.min);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11399,7 +11392,6 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
}
|
||||
if(dasm2src_info != 0)
|
||||
{
|
||||
DF_Entity *binary = dasm2src_info->binary;
|
||||
has_line_info = 1;
|
||||
line_info_line_num = dasm2src_info->pt.line;
|
||||
line_info_t = selected_thread_module->alive_t;
|
||||
@@ -11426,7 +11418,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
//
|
||||
UI_Parent(text_container_box) ProfScope("build line text") UI_Focus(UI_FocusKind_Off)
|
||||
{
|
||||
DF_Entity *hovered_line_binary = df_get_hovered_line_info_binary();
|
||||
DF_Entity *hovered_line_dbgi = df_get_hovered_line_info_dbgi();
|
||||
U64 hovered_line_voff = df_get_hovered_line_info_voff();
|
||||
ui_set_next_pref_height(ui_px(params->line_height_px*(dim_1s64(params->line_num_range)+1), 1.f));
|
||||
UI_WidthFill
|
||||
@@ -11501,12 +11493,12 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
if(token->kind == TXT_TokenKind_Identifier || token->kind == TXT_TokenKind_Keyword)
|
||||
{
|
||||
B32 mapped_special = 0;
|
||||
for(DF_EntityNode *n = params->relevant_binaries.first; n != 0; n = n->next)
|
||||
for(DF_EntityNode *n = params->relevant_dbgis.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_Entity *binary = n->entity;
|
||||
DF_Entity *dbgi = n->entity;
|
||||
if(!mapped_special && token->kind == TXT_TokenKind_Identifier)
|
||||
{
|
||||
U64 voff = df_voff_from_binary_symbol_name(binary, token_string);
|
||||
U64 voff = df_voff_from_dbgi_symbol_name(dbgi, token_string);
|
||||
if(voff != 0)
|
||||
{
|
||||
mapped_special = 1;
|
||||
@@ -11516,7 +11508,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
}
|
||||
if(!mapped_special && token->kind == TXT_TokenKind_Identifier)
|
||||
{
|
||||
U64 type_num = df_type_num_from_binary_name(binary, token_string);
|
||||
U64 type_num = df_type_num_from_dbgi_name(dbgi, token_string);
|
||||
if(type_num != 0)
|
||||
{
|
||||
mapped_special = 1;
|
||||
@@ -11708,7 +11700,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
for(DF_TextLineSrc2DasmInfoNode *n = src2dasm_list->first; n != 0; n = n->next)
|
||||
{
|
||||
if(n->v.remap_line == line_num &&
|
||||
n->v.binary == hovered_line_binary &&
|
||||
n->v.dbgi == hovered_line_dbgi &&
|
||||
n->v.voff_range.min <= hovered_line_voff && hovered_line_voff < n->v.voff_range.max)
|
||||
{
|
||||
matches = 1;
|
||||
@@ -11721,8 +11713,8 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
|
||||
// rjf: check dasm2src
|
||||
if(dasm2src_list->first != 0)
|
||||
{
|
||||
DF_Entity *binary = dasm2src_list->first->v.binary;
|
||||
if(binary == hovered_line_binary)
|
||||
DF_Entity *dbgi = dasm2src_list->first->v.dbgi;
|
||||
if(dbgi == hovered_line_dbgi)
|
||||
{
|
||||
for(DF_TextLineDasm2SrcInfoNode *n = dasm2src_list->first; n != 0; n = n->next)
|
||||
{
|
||||
@@ -13829,7 +13821,7 @@ df_gfx_end_frame(void)
|
||||
//- rjf: clear hover line info
|
||||
if(df_gfx_state->hover_line_set_this_frame == 0)
|
||||
{
|
||||
df_gfx_state->hover_line_binary = df_handle_zero();
|
||||
df_gfx_state->hover_line_dbgi = df_handle_zero();
|
||||
df_gfx_state->hover_line_voff = 0;
|
||||
}
|
||||
|
||||
|
||||
+7
-7
@@ -300,11 +300,11 @@ enum
|
||||
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name) df_gfx_view_rule_line_stringize__##name
|
||||
#define DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_DEF(name) internal DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_SIG(DF_GFX_VIEW_RULE_LINE_STRINGIZE_FUNCTION_NAME(name))
|
||||
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(DF_ExpandKey key, DF_Eval eval, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg)
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(name) void name(DF_ExpandKey key, DF_Eval eval, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg)
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name) df_gfx_view_rule_row_ui__##name
|
||||
#define DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_ROW_UI_FUNCTION_NAME(name))
|
||||
|
||||
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, DF_Eval eval, String8 string, DBGI_Scope *dbgi_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg, Vec2F32 dim)
|
||||
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(name) void name(struct DF_Window *ws, DF_ExpandKey key, DF_Eval eval, String8 string, DI_Scope *di_scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, struct DF_CfgNode *cfg, Vec2F32 dim)
|
||||
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_NAME(name) df_gfx_view_rule_block_ui__##name
|
||||
#define DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(name) DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_SIG(DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_NAME(name))
|
||||
|
||||
@@ -405,7 +405,7 @@ struct DF_CodeSliceParams
|
||||
DF_EntityList *line_pins;
|
||||
DF_TextLineDasm2SrcInfoList *line_dasm2src;
|
||||
DF_TextLineSrc2DasmInfoList *line_src2dasm;
|
||||
DF_EntityList relevant_binaries;
|
||||
DF_EntityList relevant_dbgis;
|
||||
|
||||
// rjf: visual parameters
|
||||
F_Tag font;
|
||||
@@ -714,7 +714,7 @@ struct DF_GfxState
|
||||
DF_DragDropState drag_drop_state;
|
||||
|
||||
// rjf: hover line info correllation state
|
||||
DF_Handle hover_line_binary;
|
||||
DF_Handle hover_line_dbgi;
|
||||
U64 hover_line_voff;
|
||||
B32 hover_line_set_this_frame;
|
||||
|
||||
@@ -871,8 +871,8 @@ internal B32 df_drag_drop(DF_DragDropPayload *out_payload);
|
||||
internal void df_drag_kill(void);
|
||||
internal void df_queue_drag_drop(void);
|
||||
|
||||
internal void df_set_hovered_line_info(DF_Entity *binary, U64 voff);
|
||||
internal DF_Entity *df_get_hovered_line_info_binary(void);
|
||||
internal void df_set_hovered_line_info(DF_Entity *dbgi, U64 voff);
|
||||
internal DF_Entity *df_get_hovered_line_info_dbgi(void);
|
||||
internal U64 df_get_hovered_line_info_voff(void);
|
||||
|
||||
////////////////////////////////
|
||||
@@ -930,7 +930,7 @@ internal void df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdLis
|
||||
|
||||
internal String8 df_eval_escaped_from_raw_string(Arena *arena, String8 raw);
|
||||
internal String8List df_single_line_eval_value_strings_from_eval(Arena *arena, DF_EvalVizStringFlags flags, TG_Graph *graph, RDI_Parsed *rdi, DF_CtrlCtx *ctrl_ctx, U32 default_radix, F_Tag font, F32 font_size, F32 max_size, S32 depth, DF_Eval eval, TG_Member *opt_member, DF_CfgTable *cfg_table);
|
||||
internal DF_EvalVizWindowedRowList df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks);
|
||||
internal DF_EvalVizWindowedRowList df_eval_viz_windowed_row_list_from_viz_block_list(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_EvalView *eval_view, U32 default_radix, F_Tag font, F32 font_size, Rng1S64 visible_range, DF_EvalVizBlockList *blocks);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Hover Eval
|
||||
|
||||
+17
-18
@@ -23,7 +23,7 @@ DF_CORE_VIEW_RULE_EVAL_RESOLUTION_FUNCTION_DEF(array)
|
||||
str8_list_push(scratch.arena, &array_size_expr_strs, child->string);
|
||||
}
|
||||
String8 array_size_expr = str8_list_join(scratch.arena, &array_size_expr_strs, 0);
|
||||
DF_Eval array_size_eval = df_eval_from_string(arena, dbgi_scope, ctrl_ctx, parse_ctx, macro_map, array_size_expr);
|
||||
DF_Eval array_size_eval = df_eval_from_string(arena, di_scope, ctrl_ctx, parse_ctx, macro_map, array_size_expr);
|
||||
DF_Eval array_size_eval_value = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, array_size_eval);
|
||||
eval_error_list_concat_in_place(&eval.errors, &array_size_eval.errors);
|
||||
array_size = array_size_eval_value.imm_u64;
|
||||
@@ -468,7 +468,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(rgba)
|
||||
//~ rjf: "text"
|
||||
|
||||
internal DF_TxtTopologyInfo
|
||||
df_vr_txt_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
df_vr_txt_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_TxtTopologyInfo result = zero_struct;
|
||||
@@ -526,7 +526,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(text)
|
||||
//
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx->thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
DF_TxtTopologyInfo top = df_vr_txt_topology_info_from_cfg(dbgi_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
DF_TxtTopologyInfo top = df_vr_txt_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr + (top.size_cap ? top.size_cap : 2048));
|
||||
@@ -609,7 +609,7 @@ DF_VIEW_UI_FUNCTION_DEF(text)
|
||||
//~ rjf: "disasm"
|
||||
|
||||
internal DF_DisasmTopologyInfo
|
||||
df_vr_disasm_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
df_vr_disasm_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_DisasmTopologyInfo result = zero_struct;
|
||||
@@ -668,7 +668,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
state->last_open_frame_idx = df_frame_index();
|
||||
{
|
||||
//- rjf: unpack params
|
||||
DF_DisasmTopologyInfo top = df_vr_disasm_topology_info_from_cfg(dbgi_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
DF_DisasmTopologyInfo top = df_vr_disasm_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
|
||||
//- rjf: resolve to address value & range
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
@@ -691,7 +691,6 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(disasm)
|
||||
dasm_params.style_flags = DASM_StyleFlag_Addresses;
|
||||
dasm_params.syntax = DASM_Syntax_Intel;
|
||||
dasm_params.base_vaddr = 0;
|
||||
dasm_params.exe_path = str8_zero();
|
||||
}
|
||||
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &data_hash);
|
||||
String8 dasm_text_data = {0};
|
||||
@@ -820,7 +819,7 @@ df_bitmap_view_state__canvas_from_screen_rect(DF_BitmapViewState *bvs, Rng2F32 r
|
||||
}
|
||||
|
||||
internal DF_BitmapTopologyInfo
|
||||
df_vr_bitmap_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
df_vr_bitmap_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_BitmapTopologyInfo info = {0};
|
||||
@@ -945,7 +944,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
|
||||
//
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx->type_graph, parse_ctx->rdi, ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
DF_BitmapTopologyInfo topology_info = df_vr_bitmap_topology_info_from_cfg(dbgi_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
DF_BitmapTopologyInfo topology_info = df_vr_bitmap_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
U64 expected_size = topology_info.width*topology_info.height*r_tex2d_format_bytes_per_pixel_table[topology_info.fmt];
|
||||
Rng1U64 vaddr_range = r1u64(base_vaddr, base_vaddr+expected_size);
|
||||
|
||||
@@ -1000,7 +999,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(bitmap)
|
||||
DF_VIEW_SETUP_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
DF_BitmapViewState *bvs = df_view_user_state(view, DF_BitmapViewState);
|
||||
DBGI_Scope *dbgi_scope = dbgi_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
DF_CfgNode *view_center_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("view_center"), StringMatchFlag_CaseInsensitive);
|
||||
DF_CfgNode *zoom_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("zoom"), StringMatchFlag_CaseInsensitive);
|
||||
DF_CfgNode *bitmap_cfg = df_cfg_node_child_from_string(cfg_root, str8_lit("bitmap"), StringMatchFlag_CaseInsensitive);
|
||||
@@ -1008,16 +1007,16 @@ DF_VIEW_SETUP_FUNCTION_DEF(bitmap)
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, process, thread_unwind_rip_vaddr);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, thread_unwind_rip_vaddr);
|
||||
bvs->view_center_pos.x = (F32)f64_from_str8(bitmap_cfg->first->string);
|
||||
bvs->view_center_pos.y = (F32)f64_from_str8(bitmap_cfg->first->next->string);
|
||||
bvs->zoom = (F32)f64_from_str8(zoom_cfg->first->string);
|
||||
bvs->top = df_vr_bitmap_topology_info_from_cfg(dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, bitmap_cfg);
|
||||
bvs->top = df_vr_bitmap_topology_info_from_cfg(di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, bitmap_cfg);
|
||||
if(bvs->zoom == 0)
|
||||
{
|
||||
bvs->zoom = 1.f;
|
||||
}
|
||||
dbgi_scope_close(dbgi_scope);
|
||||
di_scope_close(di_scope);
|
||||
}
|
||||
|
||||
DF_VIEW_STRING_FROM_STATE_FUNCTION_DEF(bitmap)
|
||||
@@ -1068,7 +1067,7 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
{
|
||||
DF_BitmapViewState *bvs = df_view_user_state(view, DF_BitmapViewState);
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *dbgi_scope = dbgi_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
TEX_Scope *tex_scope = tex_scope_open();
|
||||
|
||||
@@ -1079,13 +1078,13 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, process, thread_unwind_rip_vaddr);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, thread_unwind_rip_vaddr);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: evaluate expression
|
||||
//
|
||||
String8 expr = str8(view->query_buffer, view->query_string_size);
|
||||
DF_Eval eval = df_eval_from_string(scratch.arena, dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
|
||||
DF_Eval eval = df_eval_from_string(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
|
||||
DF_Eval value_eval = df_value_mode_eval_from_eval(parse_ctx.type_graph, parse_ctx.rdi, &ctrl_ctx, eval);
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
U64 expected_size = bvs->top.width*bvs->top.height*r_tex2d_format_bytes_per_pixel_table[bvs->top.fmt];
|
||||
@@ -1163,7 +1162,7 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
|
||||
hs_scope_close(hs_scope);
|
||||
tex_scope_close(tex_scope);
|
||||
dbgi_scope_close(dbgi_scope);
|
||||
di_scope_close(di_scope);
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
@@ -1171,7 +1170,7 @@ DF_VIEW_UI_FUNCTION_DEF(bitmap)
|
||||
//~ rjf: "geo"
|
||||
|
||||
internal DF_GeoTopologyInfo
|
||||
df_vr_geo_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
df_vr_geo_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg)
|
||||
{
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DF_GeoTopologyInfo result = {0};
|
||||
@@ -1292,7 +1291,7 @@ DF_GFX_VIEW_RULE_BLOCK_UI_FUNCTION_DEF(geo)
|
||||
U64 base_vaddr = value_eval.imm_u64 ? value_eval.imm_u64 : value_eval.offset;
|
||||
|
||||
//- rjf: extract extra geo topology info from view rule
|
||||
DF_GeoTopologyInfo top = df_vr_geo_topology_info_from_cfg(dbgi_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
DF_GeoTopologyInfo top = df_vr_geo_topology_info_from_cfg(di_scope, ctrl_ctx, parse_ctx, macro_map, cfg);
|
||||
Rng1U64 index_buffer_vaddr_range = r1u64(base_vaddr, base_vaddr+top.index_count*sizeof(U32));
|
||||
Rng1U64 vertex_buffer_vaddr_range = top.vertices_vaddr_range;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ struct DF_VR_TextState
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
internal DF_TxtTopologyInfo df_vr_txt_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
internal DF_TxtTopologyInfo df_vr_txt_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "disasm"
|
||||
@@ -61,7 +61,7 @@ struct DF_VR_DisasmState
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
internal DF_DisasmTopologyInfo df_vr_disasm_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
internal DF_DisasmTopologyInfo df_vr_disasm_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "bitmap"
|
||||
@@ -104,7 +104,7 @@ internal Vec2F32 df_bitmap_view_state__screen_from_canvas_pos(DF_BitmapViewState
|
||||
internal Rng2F32 df_bitmap_view_state__screen_from_canvas_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 cvs);
|
||||
internal Vec2F32 df_bitmap_view_state__canvas_from_screen_pos(DF_BitmapViewState *bvs, Rng2F32 rect, Vec2F32 scr);
|
||||
internal Rng2F32 df_bitmap_view_state__canvas_from_screen_rect(DF_BitmapViewState *bvs, Rng2F32 rect, Rng2F32 scr);
|
||||
internal DF_BitmapTopologyInfo df_vr_bitmap_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
internal DF_BitmapTopologyInfo df_vr_bitmap_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: "geo"
|
||||
@@ -139,6 +139,6 @@ struct DF_VR_GeoBoxDrawData
|
||||
F32 loaded_t;
|
||||
};
|
||||
|
||||
internal DF_GeoTopologyInfo df_vr_geo_topology_info_from_cfg(DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
internal DF_GeoTopologyInfo df_vr_geo_topology_info_from_cfg(DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_CfgNode *cfg);
|
||||
|
||||
#endif // DF_VIEW_RULES_H
|
||||
|
||||
+86
-87
@@ -543,7 +543,7 @@ df_watch_view_text_edit_state_from_pt(DF_WatchViewState *wv, DF_WatchViewPoint p
|
||||
//- rjf: windowed watch tree visualization (both single-line and multi-line)
|
||||
|
||||
internal DF_EvalVizBlockList
|
||||
df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews)
|
||||
df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
@@ -551,7 +551,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
|
||||
DF_EvalViewKey eval_view_key = df_eval_view_key_from_eval_watch_view(ews);
|
||||
DF_EvalView *eval_view = df_eval_view_from_key(eval_view_key);
|
||||
String8 filter = str8(view->query_buffer, view->query_string_size);
|
||||
DBGI_FuzzySearchTarget dbgi_target = DBGI_FuzzySearchTarget_UDTs;
|
||||
FZY_Target fzy_target = FZY_Target_UDTs;
|
||||
switch(ews->fill_kind)
|
||||
{
|
||||
////////////////////////////
|
||||
@@ -635,10 +635,10 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
|
||||
////////////////////////////
|
||||
//- rjf: debug info table fill -> build split debug info table blocks
|
||||
//
|
||||
case DF_WatchViewFillKind_Globals: dbgi_target = DBGI_FuzzySearchTarget_GlobalVariables; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_ThreadLocals: dbgi_target = DBGI_FuzzySearchTarget_ThreadVariables; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Types: dbgi_target = DBGI_FuzzySearchTarget_UDTs; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Procedures: dbgi_target = DBGI_FuzzySearchTarget_Procedures; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Globals: fzy_target = FZY_Target_GlobalVariables; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_ThreadLocals: fzy_target = FZY_Target_ThreadVariables; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Types: fzy_target = FZY_Target_UDTs; goto dbgi_table;
|
||||
case DF_WatchViewFillKind_Procedures: fzy_target = FZY_Target_Procedures; goto dbgi_table;
|
||||
dbgi_table:;
|
||||
{
|
||||
//- rjf: unpack context
|
||||
@@ -646,10 +646,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 thread_rip_unwind_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx->unwind_count);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, thread_rip_unwind_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
String8 exe_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, exe_path, os_now_microseconds()+100);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
|
||||
//- rjf: calculate top-level keys, expand root-level, grab root expansion node
|
||||
DF_ExpandKey parent_key = df_expand_key_make(5381, 0);
|
||||
@@ -660,7 +658,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
|
||||
//- rjf: query all filtered items from dbgi searching system
|
||||
U128 fuzzy_search_key = {(U64)view, df_hash_from_string(str8_struct(&view))};
|
||||
B32 items_stale = 0;
|
||||
DBGI_FuzzySearchItemArray items = dbgi_fuzzy_search_items_from_key_exe_query(scope, fuzzy_search_key, exe_path, filter, dbgi_target, os_now_microseconds()+100, &items_stale);
|
||||
// TODO(rjf)
|
||||
FZY_ItemArray items = {0}; // dbgi_fuzzy_search_items_from_key_exe_query(scope, fuzzy_search_key, exe_path, filter, dbgi_target, os_now_microseconds()+100, &items_stale);
|
||||
if(items_stale)
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
@@ -691,7 +690,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
|
||||
U64 idx = 0;
|
||||
for(DF_ExpandNode *child = root_node->first; child != 0; child = child->next)
|
||||
{
|
||||
U64 item_num = dbgi_fuzzy_item_num_from_array_element_idx__linear_search(&items, child->key.child_num);
|
||||
U64 item_num = fzy_item_num_from_array_element_idx__linear_search(&items, child->key.child_num);
|
||||
if(item_num != 0)
|
||||
{
|
||||
sub_expand_keys[idx] = child->key;
|
||||
@@ -731,8 +730,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
|
||||
DF_EvalVizBlock *last_vb = df_eval_viz_block_begin(arena, DF_EvalVizBlockKind_DebugInfoTable, parent_key, root_key, 0);
|
||||
{
|
||||
last_vb->visual_idx_range = last_vb->semantic_idx_range = r1u64(0, items.count);
|
||||
last_vb->dbgi_target = dbgi_target;
|
||||
last_vb->backing_search_items = items;
|
||||
last_vb->fzy_target = fzy_target;
|
||||
last_vb->fzy_backing_items = items;
|
||||
}
|
||||
for(U64 sub_expand_idx = 0; sub_expand_idx < sub_expand_keys_count; sub_expand_idx += 1)
|
||||
{
|
||||
@@ -740,7 +739,8 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF
|
||||
last_vb = df_eval_viz_block_split_and_continue(arena, &blocks, last_vb, sub_expand_item_idxs[sub_expand_idx]);
|
||||
|
||||
// rjf: grab name for the expanded row
|
||||
String8 name = dbgi_fuzzy_item_string_from_rdi_target_element_idx(&dbgi->rdi, dbgi_target, sub_expand_keys[sub_expand_idx].child_num);
|
||||
// TODO(rjf)
|
||||
String8 name = {0}; // dbgi_fuzzy_item_string_from_rdi_target_element_idx(&dbgi->rdi, dbgi_target, sub_expand_keys[sub_expand_idx].child_num);
|
||||
|
||||
// rjf: recurse for sub-expansion
|
||||
{
|
||||
@@ -817,7 +817,7 @@ internal void
|
||||
df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewState *ewv, B32 modifiable, U32 default_radix, Rng2F32 rect)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
|
||||
//////////////////////////////
|
||||
@@ -2035,7 +2035,7 @@ df_watch_view_build(DF_Window *ws, DF_Panel *panel, DF_View *view, DF_WatchViewS
|
||||
}
|
||||
|
||||
scratch_end(scratch);
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
ProfEnd();
|
||||
}
|
||||
|
||||
@@ -3228,15 +3228,15 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
U64 thread_unwind_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, thread_unwind_rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
String8 exe_path = df_full_path_from_entity(scratch.arena, binary);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
String8 query = str8(view->query_buffer, view->query_string_size);
|
||||
TG_Graph *graph = tg_graph_begin(bit_size_from_arch(df_architecture_from_entity(thread))/8, 256);
|
||||
|
||||
@@ -3250,10 +3250,9 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
|
||||
//- rjf: query -> raddbg, filtered items
|
||||
U128 fuzzy_search_key = {(U64)view, df_hash_from_string(str8_struct(&view))};
|
||||
DBGI_Parse *dbgi = dbgi_parse_from_exe_path(scope, exe_path, os_now_microseconds()+100);
|
||||
RDI_Parsed *rdi = &dbgi->rdi;
|
||||
B32 items_stale = 0;
|
||||
DBGI_FuzzySearchItemArray items = dbgi_fuzzy_search_items_from_key_exe_query(scope, fuzzy_search_key, exe_path, query, DBGI_FuzzySearchTarget_Procedures, os_now_microseconds()+100, &items_stale);
|
||||
// TODO(rjf)
|
||||
FZY_ItemArray items = {0}; // dbgi_fuzzy_search_items_from_key_exe_query(scope, fuzzy_search_key, exe_path, query, DBGI_FuzzySearchTarget_Procedures, os_now_microseconds()+100, &items_stale);
|
||||
if(items_stale)
|
||||
{
|
||||
df_gfx_request_frame();
|
||||
@@ -3304,7 +3303,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
idx += 1)
|
||||
UI_Focus((slv->cursor.y == idx+1) ? UI_FocusKind_On : UI_FocusKind_Off)
|
||||
{
|
||||
DBGI_FuzzySearchItem *item = &items.v[idx];
|
||||
FZY_Item *item = &items.v[idx];
|
||||
RDI_Procedure *procedure = rdi_element_from_idx(rdi, procedures, item->idx);
|
||||
U64 name_size = 0;
|
||||
U8 *name_base = rdi_string_from_idx(rdi, procedure->name_string_idx, &name_size);
|
||||
@@ -3339,8 +3338,8 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
}
|
||||
if(ui_hovering(sig)) UI_Tooltip
|
||||
{
|
||||
U64 binary_voff = df_voff_from_binary_symbol_name(binary, name);
|
||||
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_binary_voff(binary, binary_voff);
|
||||
U64 binary_voff = df_voff_from_dbgi_symbol_name(dbgi, name);
|
||||
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, binary_voff);
|
||||
String8 file_path = df_full_path_from_entity(scratch.arena, dasm2src_info.file);
|
||||
S64 line_num = dasm2src_info.pt.line;
|
||||
df_code_label(1.f, 0, df_rgba_from_theme_color(DF_ThemeColor_CodeFunction), name);
|
||||
@@ -3360,7 +3359,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
|
||||
}
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -4520,7 +4519,6 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
String8 query = str8(view->query_buffer, view->query_string_size);
|
||||
DF_CtrlCtx ctrl_ctx = df_ctrl_ctx_from_view(ws, view);
|
||||
|
||||
@@ -4735,8 +4733,8 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
|
||||
U64 rip_vaddr = df_query_cached_rip_from_thread(entity);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, rip_vaddr);
|
||||
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_binary_voff(binary, rip_voff);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, rip_voff);
|
||||
if(!df_entity_is_nil(line_info.file))
|
||||
{
|
||||
UI_PrefWidth(ui_children_sum(0)) df_entity_src_loc_button(ws, line_info.file, line_info.pt);
|
||||
@@ -4753,7 +4751,6 @@ DF_VIEW_UI_FUNCTION_DEF(Scheduler)
|
||||
sv->selected_column = cursor.x;
|
||||
sv->selected_entity = (1 <= cursor.y && cursor.y <= items.count) ? df_handle_from_entity(items.v[cursor.y-1].entity) : df_handle_zero();
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -5029,7 +5026,7 @@ DF_VIEW_CMD_FUNCTION_DEF(Modules)
|
||||
{
|
||||
String8 exe_path = module->name;
|
||||
String8 dbg_path = pick_string;
|
||||
dbgi_force_exe_path_dbg_path(exe_path, dbg_path);
|
||||
// TODO(rjf)
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}break;
|
||||
@@ -5041,7 +5038,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
String8 query = str8(view->query_buffer, view->query_string_size);
|
||||
|
||||
//- rjf: get state
|
||||
@@ -5208,16 +5205,17 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
|
||||
B32 brw_is_selected = (row_is_selected && cursor.x == 3);
|
||||
|
||||
// rjf: unpack module info
|
||||
DF_Entity *binary = df_binary_file_from_module(entity);
|
||||
DBGI_Parse *dbgi = df_dbgi_parse_from_binary_file(scope, binary);
|
||||
B32 dbgi_is_valid = (dbgi->dbg_props.modified != 0);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(entity);
|
||||
String8 dbgi_path = df_full_path_from_entity(scratch.arena, dbgi);
|
||||
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
|
||||
B32 dbgi_is_valid = (rdi != &di_rdi_parsed_nil);
|
||||
|
||||
// rjf: begin editing
|
||||
if(txt_is_selected && edit_begin)
|
||||
{
|
||||
mv->txt_editing = 1;
|
||||
mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi->dbg_path.size);
|
||||
MemoryCopy(mv->txt_buffer, dbgi->dbg_path.str, mv->txt_size);
|
||||
mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi_path.size);
|
||||
MemoryCopy(mv->txt_buffer, dbgi_path.str, mv->txt_size);
|
||||
mv->txt_cursor = txt_pt(1, 1+mv->txt_size);
|
||||
mv->txt_mark = txt_pt(1, 1);
|
||||
}
|
||||
@@ -5229,7 +5227,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
|
||||
UI_WidthFill
|
||||
{
|
||||
UI_TextColor(!dbgi_is_valid ? df_rgba_from_theme_color(DF_ThemeColor_FailureBackground) : ui_top_text_color())
|
||||
sig = df_line_editf(DF_LineEditFlag_NoBackground, 0, 0, &mv->txt_cursor, &mv->txt_mark, mv->txt_buffer, sizeof(mv->txt_buffer), &mv->txt_size, 0, dbgi->dbg_path, "###dbg_path_%p", entity);
|
||||
sig = df_line_editf(DF_LineEditFlag_NoBackground, 0, 0, &mv->txt_cursor, &mv->txt_mark, mv->txt_buffer, sizeof(mv->txt_buffer), &mv->txt_size, 0, dbgi_path, "###dbg_path_%p", entity);
|
||||
edit_commit = (edit_commit || ui_committed(sig));
|
||||
}
|
||||
|
||||
@@ -5247,8 +5245,8 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
|
||||
{
|
||||
ui_kill_action();
|
||||
mv->txt_editing = 1;
|
||||
mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi->dbg_path.size);
|
||||
MemoryCopy(mv->txt_buffer, dbgi->dbg_path.str, mv->txt_size);
|
||||
mv->txt_size = Min(sizeof(mv->txt_buffer), dbgi_path.size);
|
||||
MemoryCopy(mv->txt_buffer, dbgi_path.str, mv->txt_size);
|
||||
mv->txt_cursor = txt_pt(1, 1+mv->txt_size);
|
||||
mv->txt_mark = txt_pt(1, 1);
|
||||
}
|
||||
@@ -5287,7 +5285,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
|
||||
{
|
||||
String8 exe_path = commit_module->name;
|
||||
String8 dbg_path = str8(mv->txt_buffer, mv->txt_size);
|
||||
dbgi_force_exe_path_dbg_path(exe_path, dbg_path);
|
||||
// TODO(rjf)
|
||||
}
|
||||
if(edit_submit)
|
||||
{
|
||||
@@ -5305,7 +5303,7 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
|
||||
mv->selected_column = cursor.x;
|
||||
mv->selected_entity = (1 <= cursor.y && cursor.y <= items.count) ? df_handle_from_entity(items.v[cursor.y-1].entity) : df_handle_zero();
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -5539,8 +5537,8 @@ DF_VIEW_CMD_FUNCTION_DEF(Code)
|
||||
if(src2dasm_list->first != 0)
|
||||
{
|
||||
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
|
||||
DF_Entity *binary = src2dasm_list->first->v.binary;
|
||||
DF_EntityList possible_modules = df_modules_from_binary_file(scratch.arena, binary);
|
||||
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
|
||||
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
|
||||
DF_Entity *thread_dst_module = df_module_from_thread_candidates(thread, &possible_modules);
|
||||
U64 thread_dst_voff = voff_rng.min;
|
||||
if(!df_entity_is_nil(thread_dst_module) && thread_dst_voff != 0)
|
||||
@@ -5665,7 +5663,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
DBGI_Scope *dbgi_scope = dbgi_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
DF_CodeViewState *tv = df_view_user_state(view, DF_CodeViewState);
|
||||
|
||||
@@ -5692,7 +5690,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
U64 unwind_count = ctrl_ctx.unwind_count;
|
||||
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, unwind_count);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, process, rip_vaddr);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, process, rip_vaddr);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: unpack file/text entity info
|
||||
@@ -5842,8 +5840,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
U64 last_inst_on_unwound_rip_vaddr = rip_vaddr - !!unwind_count;
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, last_inst_on_unwound_rip_vaddr);
|
||||
U64 rip_voff = df_voff_from_vaddr(module, last_inst_on_unwound_rip_vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_binary_voff(binary, rip_voff);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, rip_voff);
|
||||
if(dasm2src_info.file == entity && visible_line_num_range.min <= dasm2src_info.pt.line && dasm2src_info.pt.line <= visible_line_num_range.max)
|
||||
{
|
||||
U64 slice_line_idx = dasm2src_info.pt.line-visible_line_num_range.min;
|
||||
@@ -5874,7 +5872,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
{
|
||||
MemoryCopy(code_slice_params.line_src2dasm, src2dasm.v, sizeof(DF_TextLineSrc2DasmInfoList)*src2dasm.count);
|
||||
}
|
||||
code_slice_params.relevant_binaries = src2dasm.binaries;
|
||||
code_slice_params.relevant_dbgis = src2dasm.dbgis;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6118,7 +6116,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
String8 expr = txt_string_from_info_data_txt_rng(&text_info, data, expr_rng);
|
||||
if(expr.size != 0)
|
||||
{
|
||||
DF_Eval eval = df_eval_from_string(scratch.arena, dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
|
||||
DF_Eval eval = df_eval_from_string(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
|
||||
if(eval.mode != EVAL_EvalMode_NULL)
|
||||
{
|
||||
df_set_hover_eval(ws, sig.mouse_expr_baseline_pos, ctrl_ctx, entity, sig.mouse_pt, 0, expr);
|
||||
@@ -6190,8 +6188,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
if(src2dasm_list->first != 0)
|
||||
{
|
||||
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
|
||||
DF_Entity *binary = src2dasm_list->first->v.binary;
|
||||
DF_EntityList possible_modules = df_modules_from_binary_file(scratch.arena, binary);
|
||||
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
|
||||
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
|
||||
DF_Entity *thread_dst_module = df_module_from_thread_candidates(dropped_entity, &possible_modules);
|
||||
U64 thread_dst_voff = voff_rng.min;
|
||||
if(!df_entity_is_nil(thread_dst_module) && thread_dst_voff != 0)
|
||||
@@ -6247,8 +6245,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
if(src2dasm_list->first != 0)
|
||||
{
|
||||
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
|
||||
DF_Entity *binary = src2dasm_list->first->v.binary;
|
||||
DF_EntityList possible_modules = df_modules_from_binary_file(scratch.arena, binary);
|
||||
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
|
||||
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
|
||||
DF_Entity *thread = df_entity_from_handle(ctrl_ctx.thread);
|
||||
DF_Entity *thread_dst_module = df_module_from_thread_candidates(thread, &possible_modules);
|
||||
DF_Entity *process = df_entity_ancestor_from_kind(thread, DF_EntityKind_Process);
|
||||
@@ -6406,20 +6404,19 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
//- rjf: determine up-to-dateness of source file
|
||||
//
|
||||
B32 file_is_out_of_date = 0;
|
||||
String8 out_of_date_binary_name = {0};
|
||||
for(DF_EntityNode *n = code_slice_params.relevant_binaries.first; n != 0; n = n->next)
|
||||
String8 out_of_date_dbgi_name = {0};
|
||||
for(DF_EntityNode *n = code_slice_params.relevant_dbgis.first; n != 0; n = n->next)
|
||||
{
|
||||
DF_Entity *binary = n->entity;
|
||||
if(!df_entity_is_nil(binary))
|
||||
DF_Entity *dbgi = n->entity;
|
||||
if(!df_entity_is_nil(dbgi))
|
||||
{
|
||||
String8 full_path = df_full_path_from_entity(scratch.arena, entity);
|
||||
TXTI_Handle handle = txti_handle_from_path(full_path);
|
||||
TXTI_BufferInfo info = txti_buffer_info_from_handle(scratch.arena, handle);
|
||||
DBGI_Parse *parse = df_dbgi_parse_from_binary_file(dbgi_scope, binary);
|
||||
if(parse->exe_props.modified < info.timestamp)
|
||||
if(dbgi->timestamp < info.timestamp)
|
||||
{
|
||||
file_is_out_of_date = 1;
|
||||
out_of_date_binary_name = binary->name;
|
||||
out_of_date_dbgi_name = dbgi->name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -6457,9 +6454,9 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
{
|
||||
UI_PrefWidth(ui_children_sum(1)) UI_Row UI_PrefWidth(ui_text_dim(1, 1))
|
||||
{
|
||||
ui_labelf("This file has changed since ", out_of_date_binary_name);
|
||||
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_Highlight0)) ui_label(out_of_date_binary_name);
|
||||
ui_labelf(" was built.");
|
||||
ui_labelf("This file has changed since ", out_of_date_dbgi_name);
|
||||
UI_TextColor(df_rgba_from_theme_color(DF_ThemeColor_Highlight0)) ui_label(out_of_date_dbgi_name);
|
||||
ui_labelf(" was produced.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6479,7 +6476,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
|
||||
}
|
||||
|
||||
txt_scope_close(txt_scope);
|
||||
dbgi_scope_close(dbgi_scope);
|
||||
di_scope_close(di_scope);
|
||||
hs_scope_close(hs_scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
@@ -6521,8 +6518,8 @@ DF_VIEW_CMD_FUNCTION_DEF(Disassembly)
|
||||
DF_Entity *process = df_entity_from_handle(dv->process);
|
||||
Architecture arch = df_architecture_from_entity(process);
|
||||
U64 dasm_base_vaddr = AlignDownPow2(dv->base_vaddr, KB(64));
|
||||
DF_Entity *dasm_module = df_module_from_process_vaddr(process, dasm_base_vaddr);
|
||||
DF_Entity *dasm_binary = df_binary_file_from_module(dasm_module);
|
||||
DF_Entity *dasm_module = df_module_from_process_vaddr(process, dasm_base_vaddr);
|
||||
DF_Entity *dasm_dbgi = df_dbgi_from_module(dasm_module);
|
||||
Rng1U64 dasm_vaddr_range = r1u64(dasm_base_vaddr, dasm_base_vaddr+KB(64));
|
||||
U128 dasm_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, dasm_vaddr_range, 0);
|
||||
U128 dasm_data_hash = {0};
|
||||
@@ -6533,7 +6530,8 @@ DF_VIEW_CMD_FUNCTION_DEF(Disassembly)
|
||||
dasm_params.style_flags = dv->style_flags;
|
||||
dasm_params.syntax = DASM_Syntax_Intel;
|
||||
dasm_params.base_vaddr = dasm_module->vaddr_rng.min;
|
||||
dasm_params.exe_path = df_full_path_from_entity(scratch.arena, dasm_binary);
|
||||
dasm_params.dbg_path = df_full_path_from_entity(scratch.arena, dasm_dbgi);
|
||||
dasm_params.dbg_timestamp = dasm_dbgi->timestamp;
|
||||
}
|
||||
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash);
|
||||
U128 dasm_text_hash = {0};
|
||||
@@ -6732,7 +6730,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
HS_Scope *hs_scope = hs_scope_open();
|
||||
DASM_Scope *dasm_scope = dasm_scope_open();
|
||||
TXT_Scope *txt_scope = txt_scope_open();
|
||||
DBGI_Scope *dbgi_scope = dbgi_scope_open();
|
||||
DI_Scope *di_scope = di_scope_open();
|
||||
DF_DisasmViewState *dv = df_view_user_state(view, DF_DisasmViewState);
|
||||
|
||||
//////////////////////////////
|
||||
@@ -6757,7 +6755,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
DF_Entity *selected_process = df_entity_ancestor_from_kind(selected_thread, DF_EntityKind_Process);
|
||||
U64 unwind_count = ctrl_ctx.unwind_count;
|
||||
U64 rip_vaddr = df_query_cached_rip_from_thread_unwind(selected_thread, unwind_count);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(dbgi_scope, selected_process, rip_vaddr);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(di_scope, selected_process, rip_vaddr);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: no disasm process open? -> snap to selected thread
|
||||
@@ -6776,7 +6774,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
Architecture arch = df_architecture_from_entity(process);
|
||||
U64 dasm_base_vaddr = AlignDownPow2(dv->base_vaddr, KB(64));
|
||||
DF_Entity *dasm_module = df_module_from_process_vaddr(process, dasm_base_vaddr);
|
||||
DF_Entity *dasm_binary = df_binary_file_from_module(dasm_module);
|
||||
DF_Entity *dasm_dbgi = df_dbgi_from_module(dasm_module);
|
||||
Rng1U64 dasm_vaddr_range = r1u64(dasm_base_vaddr, dasm_base_vaddr+KB(64));
|
||||
U128 dasm_key = ctrl_hash_store_key_from_process_vaddr_range(process->ctrl_machine_id, process->ctrl_handle, dasm_vaddr_range, 0);
|
||||
U128 dasm_data_hash = {0};
|
||||
@@ -6787,7 +6785,8 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
dasm_params.style_flags = dv->style_flags;
|
||||
dasm_params.syntax = DASM_Syntax_Intel;
|
||||
dasm_params.base_vaddr = dasm_module->vaddr_rng.min;
|
||||
dasm_params.exe_path = df_full_path_from_entity(scratch.arena, dasm_binary);
|
||||
dasm_params.dbg_path = df_full_path_from_entity(scratch.arena, dasm_dbgi);
|
||||
dasm_params.dbg_timestamp = dasm_dbgi->timestamp;
|
||||
}
|
||||
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash);
|
||||
U128 dasm_text_hash = {0};
|
||||
@@ -6800,7 +6799,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
//- rjf: unpack module info for this region
|
||||
//
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, dasm_vaddr_range.min);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: is loading -> equip view with loading information
|
||||
@@ -6889,7 +6888,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
{
|
||||
code_slice_params.margin_float_off_px = 0;
|
||||
}
|
||||
df_entity_list_push(scratch.arena, &code_slice_params.relevant_binaries, binary);
|
||||
df_entity_list_push(scratch.arena, &code_slice_params.relevant_dbgis, dbgi);
|
||||
|
||||
// rjf: fill text info
|
||||
{
|
||||
@@ -6971,7 +6970,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
// rjf: fill dasm -> src info
|
||||
{
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, dasm_vaddr_range.min);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_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_inst_array_code_off_from_idx(&dasm_info.insts, line_num-1);
|
||||
@@ -6980,7 +6979,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
DF_TextLineDasm2SrcInfoNode *dasm2src_n = push_array(scratch.arena, DF_TextLineDasm2SrcInfoNode, 1);
|
||||
SLLQueuePush(code_slice_params.line_dasm2src[slice_idx].first, code_slice_params.line_dasm2src[slice_idx].last, dasm2src_n);
|
||||
code_slice_params.line_dasm2src[slice_idx].count += 1;
|
||||
dasm2src_n->v = df_text_line_dasm2src_info_from_binary_voff(binary, voff);
|
||||
dasm2src_n->v = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, voff);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7050,7 +7049,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
String8 expr = str8_substr(code_slice_params.line_text[line_idx], r1u64(sig.mouse_expr_rng.min.column-1, sig.mouse_expr_rng.max.column-1));
|
||||
if(expr.size != 0)
|
||||
{
|
||||
DF_Eval eval = df_eval_from_string(scratch.arena, dbgi_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
|
||||
DF_Eval eval = df_eval_from_string(scratch.arena, di_scope, &ctrl_ctx, &parse_ctx, &eval_string2expr_map_nil, expr);
|
||||
if(eval.mode != EVAL_EvalMode_NULL)
|
||||
{
|
||||
U64 off = dasm_inst_array_code_off_from_idx(&dasm_info.insts, sig.mouse_expr_rng.min.line-1);
|
||||
@@ -7150,9 +7149,9 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
{
|
||||
U64 vaddr = dasm_vaddr_range.min+dasm_inst_array_code_off_from_idx(&dasm_info.insts, sig.goto_src_line_num-1);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
U64 voff = df_voff_from_vaddr(module, vaddr);
|
||||
DF_TextLineDasm2SrcInfo dasm2src = df_text_line_dasm2src_info_from_binary_voff(binary, voff);
|
||||
DF_TextLineDasm2SrcInfo dasm2src = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, voff);
|
||||
String8 file_path = df_full_path_from_entity(scratch.arena, dasm2src.file);
|
||||
DF_CmdParams params = df_cmd_params_from_view(ws, panel, view);
|
||||
params.text_point = dasm2src.pt;
|
||||
@@ -7326,7 +7325,7 @@ DF_VIEW_UI_FUNCTION_DEF(Disassembly)
|
||||
}
|
||||
}
|
||||
|
||||
dbgi_scope_close(dbgi_scope);
|
||||
di_scope_close(di_scope);
|
||||
txt_scope_close(txt_scope);
|
||||
dasm_scope_close(dasm_scope);
|
||||
hs_scope_close(hs_scope);
|
||||
@@ -7598,7 +7597,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
|
||||
{
|
||||
ProfBeginFunction();
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
DF_CodeViewState *tv = df_view_user_state(view, DF_CodeViewState);
|
||||
|
||||
//////////////////////////////
|
||||
@@ -8119,7 +8118,7 @@ DF_VIEW_UI_FUNCTION_DEF(Output)
|
||||
}
|
||||
}
|
||||
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
scratch_end(scratch);
|
||||
ProfEnd();
|
||||
}
|
||||
@@ -8492,9 +8491,9 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
{
|
||||
U64 f_rip = regs_rip_from_arch_block(thread->arch, f->regs);
|
||||
DF_Entity *module = df_module_from_process_vaddr(process, f_rip);
|
||||
DF_Entity *binary = df_binary_file_from_module(module);
|
||||
DF_Entity *dbgi = df_dbgi_from_module(module);
|
||||
U64 rip_voff = df_voff_from_vaddr(module, f_rip);
|
||||
String8 symbol_name = df_symbol_name_from_binary_voff(scratch.arena, binary, rip_voff);
|
||||
String8 symbol_name = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
|
||||
Annotation *annotation = push_array(scratch.arena, Annotation, 1);
|
||||
annotation->name_string = symbol_name.size != 0 ? symbol_name : str8_lit("[external code]");
|
||||
annotation->kind_string = str8_lit("Call Stack Frame");
|
||||
@@ -8544,7 +8543,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
df_rgba_from_theme_color(DF_ThemeColor_Thread6),
|
||||
df_rgba_from_theme_color(DF_ThemeColor_Thread7),
|
||||
};
|
||||
DBGI_Scope *scope = dbgi_scope_open();
|
||||
DI_Scope *scope = di_scope_open();
|
||||
U64 thread_rip_vaddr = df_query_cached_rip_from_thread_unwind(thread, ctrl_ctx.unwind_count);
|
||||
EVAL_ParseCtx parse_ctx = df_eval_parse_ctx_from_process_vaddr(scope, process, thread_rip_vaddr);
|
||||
RDI_Parsed *rdi = parse_ctx.rdi;
|
||||
@@ -8575,7 +8574,7 @@ DF_VIEW_UI_FUNCTION_DEF(Memory)
|
||||
}
|
||||
}
|
||||
}
|
||||
dbgi_scope_close(scope);
|
||||
di_scope_close(scope);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +495,7 @@ internal String8 df_string_from_eval_viz_row_column_kind(Arena *arena, DF_EvalVi
|
||||
internal DF_WatchViewTextEditState *df_watch_view_text_edit_state_from_pt(DF_WatchViewState *wv, DF_WatchViewPoint pt);
|
||||
|
||||
//- rjf: windowed watch tree visualization
|
||||
internal DF_EvalVizBlockList df_eval_viz_block_list_from_watch_view_state(Arena *arena, DBGI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews);
|
||||
internal DF_EvalVizBlockList df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, EVAL_String2ExprMap *macro_map, DF_View *view, DF_WatchViewState *ews);
|
||||
|
||||
//- rjf: eval/watch views main hooks
|
||||
internal void df_watch_view_init(DF_WatchViewState *ewv, DF_View *view, DF_WatchViewFillKind fill_kind);
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Helpers
|
||||
|
||||
internal U64
|
||||
fzy_hash_from_string(String8 string, StringMatchFlags match_flags)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal U64
|
||||
fzy_item_num_from_array_element_idx__linear_search(FZY_ItemArray *array, U64 element_idx)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Main Layer Initialization
|
||||
|
||||
internal void
|
||||
fzy_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scope Functions
|
||||
|
||||
internal FZY_Scope *
|
||||
fzy_scope_open(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal void
|
||||
fzy_scope_close(FZY_Scope *scope)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal void
|
||||
fzy_scope_touch_node__stripe_mutex_r_guarded(FZY_Scope *scope, FZY_Node *node)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cache Lookup Functions
|
||||
|
||||
internal FZY_ItemArray
|
||||
fzy_items_from_key_params_query(FZY_Scope *scope, U128 key, FZY_Params *params, String8 query, U64 endt_us, B32 *stale_out)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Searcher Threads
|
||||
|
||||
internal B32
|
||||
fzy_u2s_enqueue_req(U128 key, U64 endt_us)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal void
|
||||
fzy_u2s_dequeue_req(Arena *arena, FZY_Thread *thread, U128 *key_out)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal int
|
||||
fzy_qsort_compare_items(FZY_Item *a, FZY_Item *b)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
internal void
|
||||
fzy_search_thread__entry_point(void *p)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef FUZZY_SEARCH_H
|
||||
#define FUZZY_SEARCH_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Fuzzy Search Types
|
||||
|
||||
typedef enum FZY_Target
|
||||
{
|
||||
FZY_Target_Procedures,
|
||||
FZY_Target_GlobalVariables,
|
||||
FZY_Target_ThreadVariables,
|
||||
FZY_Target_UDTs,
|
||||
FZY_Target_COUNT
|
||||
}
|
||||
FZY_Target;
|
||||
|
||||
typedef struct FZY_Params FZY_Params;
|
||||
struct FZY_Params
|
||||
{
|
||||
FZY_Target target;
|
||||
};
|
||||
|
||||
typedef struct FZY_Item FZY_Item;
|
||||
struct FZY_Item
|
||||
{
|
||||
U64 idx;
|
||||
U64 missed_size;
|
||||
FuzzyMatchRangeList match_ranges;
|
||||
};
|
||||
|
||||
typedef struct FZY_ItemChunk FZY_ItemChunk;
|
||||
struct FZY_ItemChunk
|
||||
{
|
||||
FZY_ItemChunk *next;
|
||||
FZY_Item *v;
|
||||
U64 count;
|
||||
U64 cap;
|
||||
};
|
||||
|
||||
typedef struct FZY_ItemChunkList FZY_ItemChunkList;
|
||||
struct FZY_ItemChunkList
|
||||
{
|
||||
FZY_ItemChunk *first;
|
||||
FZY_ItemChunk *last;
|
||||
U64 chunk_count;
|
||||
U64 total_count;
|
||||
};
|
||||
|
||||
typedef struct FZY_ItemArray FZY_ItemArray;
|
||||
struct FZY_ItemArray
|
||||
{
|
||||
FZY_Item *v;
|
||||
U64 count;
|
||||
};
|
||||
|
||||
typedef struct FZY_Bucket FZY_Bucket;
|
||||
struct FZY_Bucket
|
||||
{
|
||||
Arena *arena;
|
||||
String8 query;
|
||||
FZY_Target target;
|
||||
};
|
||||
|
||||
typedef struct FZY_Node FZY_Node;
|
||||
struct FZY_Node
|
||||
{
|
||||
FZY_Node *next;
|
||||
U128 key;
|
||||
U64 scope_touch_count;
|
||||
U64 last_time_submitted_us;
|
||||
FZY_Bucket buckets[3];
|
||||
U64 gen;
|
||||
U64 submit_gen;
|
||||
FZY_ItemArray gen_items;
|
||||
};
|
||||
|
||||
typedef struct FZY_Slot FZY_Slot;
|
||||
struct FZY_Slot
|
||||
{
|
||||
FZY_Node *first;
|
||||
FZY_Node *last;
|
||||
};
|
||||
|
||||
typedef struct FZY_Stripe FZY_Stripe;
|
||||
struct FZY_Stripe
|
||||
{
|
||||
Arena *arena;
|
||||
OS_Handle rw_mutex;
|
||||
OS_Handle cv;
|
||||
};
|
||||
|
||||
typedef struct FZY_Thread FZY_Thread;
|
||||
struct FZY_Thread
|
||||
{
|
||||
OS_Handle thread;
|
||||
OS_Handle u2f_ring_mutex;
|
||||
OS_Handle u2f_ring_cv;
|
||||
U64 u2f_ring_size;
|
||||
U8 *u2f_ring_base;
|
||||
U64 u2f_ring_write_pos;
|
||||
U64 u2f_ring_read_pos;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scoped Access Types
|
||||
|
||||
typedef struct FZY_Touch FZY_Touch;
|
||||
struct FZY_Touch
|
||||
{
|
||||
FZY_Touch *next;
|
||||
FZY_Node *node;
|
||||
};
|
||||
|
||||
typedef struct FZY_Scope FZY_Scope;
|
||||
struct FZY_Scope
|
||||
{
|
||||
FZY_Scope *next;
|
||||
FZY_Touch *first_touch;
|
||||
FZY_Touch *last_touch;
|
||||
};
|
||||
|
||||
typedef struct FZY_TCTX FZY_TCTX;
|
||||
struct FZY_TCTX
|
||||
{
|
||||
Arena *arena;
|
||||
FZY_Scope *free_scope;
|
||||
FZY_Touch *free_touch;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Shared State Types
|
||||
|
||||
typedef struct FZY_Shared FZY_Shared;
|
||||
struct FZY_Shared
|
||||
{
|
||||
Arena *arena;
|
||||
|
||||
// rjf: search artifact cache table
|
||||
U64 slots_count;
|
||||
U64 stripes_count;
|
||||
FZY_Slot *slots;
|
||||
FZY_Stripe *stripes;
|
||||
|
||||
// rjf: threads
|
||||
U64 thread_count;
|
||||
FZY_Thread *threads;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Helpers
|
||||
|
||||
internal U64 fzy_hash_from_string(String8 string, StringMatchFlags match_flags);
|
||||
internal U64 fzy_item_num_from_array_element_idx__linear_search(FZY_ItemArray *array, U64 element_idx);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Main Layer Initialization
|
||||
|
||||
internal void fzy_init(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Scope Functions
|
||||
|
||||
internal FZY_Scope *fzy_scope_open(void);
|
||||
internal void fzy_scope_close(FZY_Scope *scope);
|
||||
internal void fzy_scope_touch_node__stripe_mutex_r_guarded(FZY_Scope *scope, FZY_Node *node);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cache Lookup Functions
|
||||
|
||||
internal FZY_ItemArray fzy_items_from_key_params_query(FZY_Scope *scope, U128 key, FZY_Params *params, String8 query, U64 endt_us, B32 *stale_out);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Searcher Threads
|
||||
|
||||
internal B32 fzy_u2s_enqueue_req(U128 key, U64 endt_us);
|
||||
internal void fzy_u2s_dequeue_req(Arena *arena, FZY_Thread *thread, U128 *key_out);
|
||||
|
||||
internal int fzy_qsort_compare_items(FZY_Item *a, FZY_Item *b);
|
||||
|
||||
internal void fzy_search_thread__entry_point(void *p);
|
||||
|
||||
#endif // FUZZY_SEARCH_H
|
||||
@@ -46,8 +46,9 @@
|
||||
#include "regs/regs.h"
|
||||
#include "regs/raddbgi/regs_raddbgi.h"
|
||||
#include "type_graph/type_graph.h"
|
||||
#include "dbgi/dbgi.h"
|
||||
//#include "dbgi/dbgi.h"
|
||||
#include "dbgi2/dbgi2.h"
|
||||
#include "fuzzy_search/fuzzy_search.h"
|
||||
#include "demon/demon_inc.h"
|
||||
#include "eval/eval_inc.h"
|
||||
#include "ctrl/ctrl_inc.h"
|
||||
@@ -85,8 +86,9 @@
|
||||
#include "regs/regs.c"
|
||||
#include "regs/raddbgi/regs_raddbgi.c"
|
||||
#include "type_graph/type_graph.c"
|
||||
#include "dbgi/dbgi.c"
|
||||
//#include "dbgi/dbgi.c"
|
||||
#include "dbgi2/dbgi2.c"
|
||||
#include "fuzzy_search/fuzzy_search.c"
|
||||
#include "demon/demon_inc.c"
|
||||
#include "eval/eval_inc.c"
|
||||
#include "ctrl/ctrl_inc.c"
|
||||
|
||||
Reference in New Issue
Block a user