eliminate path-tree-based keying of debug info on frontend; use dbgi-layer-defined debug info keys, which can be more robust to changes to the same debug info path across time (e.g. during hot reloads

This commit is contained in:
Ryan Fleury
2024-05-23 10:30:23 -07:00
parent 68a92e910a
commit f26b4c3b06
17 changed files with 390 additions and 385 deletions
+16 -9
View File
@@ -2855,9 +2855,11 @@ ctrl_thread__entry_point(void *p)
String8 path = msg->path;
CTRL_Entity *module = ctrl_entity_from_machine_id_handle(ctrl_state->ctrl_thread_entity_store, msg->machine_id, msg->entity);
CTRL_Entity *debug_info_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
di_close(debug_info_path->string, module->timestamp);
DI_Key old_dbgi_key = {debug_info_path->string, module->timestamp};
di_close(&old_dbgi_key);
ctrl_entity_equip_string(ctrl_state->ctrl_thread_entity_store, debug_info_path, path);
di_open(path, module->timestamp);
DI_Key new_dbgi_key = {debug_info_path->string, module->timestamp};
di_open(&new_dbgi_key);
CTRL_EventList evts = {0};
CTRL_Event *evt = ctrl_event_list_push(scratch.arena, &evts);
evt->kind = CTRL_EventKind_ModuleDebugInfoPathChange;
@@ -2896,7 +2898,8 @@ ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CTRL_MachineID m
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);
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);
DI_Key dbgi_key = {debug_info_path_entity->string, debug_info_path_entity->timestamp};
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
U64 base_vaddr = module_entity->vaddr_range.min;
for(CTRL_UserBreakpointNode *n = user_bps->first; n != 0; n = n->next)
{
@@ -3320,8 +3323,8 @@ ctrl_thread__module_close(CTRL_MachineID machine_id, DMN_Handle module, String8
CTRL_Entity *debug_info_path_ent = ctrl_entity_child_from_kind(module_ent, CTRL_EntityKind_DebugInfoPath);
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);
DI_Key dbgi_key = {debug_info_path_ent->string, debug_info_path_ent->timestamp};
di_close(&dbgi_key);
}
}
}
@@ -3420,7 +3423,8 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
U64 asan_shadow_base_vaddr = 0;
B32 asan_shadow_variable_exists_but_is_zero = 0;
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);
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
RDI_NameMap *unparsed_map = rdi_name_map_from_kind(rdi, RDI_NameMapKind_GlobalVariables);
if(rdi->global_variables != 0 && unparsed_map != 0)
{
@@ -3612,7 +3616,8 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
out_evt2->parent = event->process;
out_evt2->timestamp = timestamp;
out_evt2->string = initial_debug_info_path;
di_open(initial_debug_info_path, timestamp);
DI_Key initial_dbgi_key = {initial_debug_info_path, timestamp};
di_open(&initial_dbgi_key);
}break;
case DMN_EventKind_ExitProcess:
{
@@ -4219,7 +4224,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
}
U64 module_base_vaddr = module->vaddr_range.min;
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);
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 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);
@@ -4512,7 +4518,8 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
// rjf: evaluate hit stop conditions
if(conditions.node_count != 0)
{
RDI_Parsed *rdi = di_rdi_from_path_min_timestamp(di_scope, dbg_path->string, dbg_path->timestamp, max_U64);
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
for(String8Node *condition_n = conditions.first; condition_n != 0; condition_n = condition_n->next)
{
String8 string = condition_n->string;
+14 -14
View File
@@ -24,8 +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->dbg_path, b->dbg_path, 0) &&
a->dbg_timestamp == b->dbg_timestamp);
str8_match(a->dbgi_key.path, b->dbgi_key.path, 0) &&
a->dbgi_key.min_timestamp == b->dbgi_key.min_timestamp);
return result;
}
@@ -190,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.dbg_path = push_str8_copy(dasm_tctx->arena, touch->params.dbg_path);
touch->params.dbgi_key = di_key_copy(dasm_tctx->arena, &touch->params.dbgi_key);
SLLStackPush(scope->top_touch, touch);
}
@@ -251,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.dbg_path = push_str8_copy(stripe->arena, node->params.dbg_path);
node->params.dbgi_key = di_key_copy(stripe->arena, &node->params.dbgi_key);
node_is_new = 1;
}
}
@@ -295,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->dbg_path.size+sizeof(U64))
if(available_size >= sizeof(hash)+sizeof(U64)+sizeof(Architecture)+sizeof(DASM_StyleFlags)+sizeof(DASM_Syntax)+sizeof(U64)+sizeof(U64)+params->dbgi_key.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);
@@ -304,9 +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, &params->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, &params->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, &params->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, &params->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, &params->dbg_timestamp);
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, &params->dbgi_key.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->dbgi_key.path.str, params->dbgi_key.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, &params->dbgi_key.min_timestamp);
dasm_shared->u2p_ring_write_pos += 7;
dasm_shared->u2p_ring_write_pos -= dasm_shared->u2p_ring_write_pos%8;
break;
@@ -338,10 +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, &params_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, &params_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, &params_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, &params_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, &params_out->dbg_timestamp);
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, &params_out->dbgi_key.path.size);
params_out->dbgi_key.path.str = push_array(arena, U8, params_out->dbgi_key.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->dbgi_key.path.str, params_out->dbgi_key.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, &params_out->dbgi_key.min_timestamp);
dasm_shared->u2p_ring_read_pos += 7;
dasm_shared->u2p_ring_read_pos -= dasm_shared->u2p_ring_read_pos%8;
break;
@@ -390,9 +390,9 @@ dasm_parse_thread__entry_point(void *p)
//- rjf: get dbg info
RDI_Parsed *rdi = &di_rdi_parsed_nil;
if(got_task && params.dbg_path.size != 0)
if(got_task && params.dbgi_key.path.size != 0)
{
rdi = di_rdi_from_path_min_timestamp(di_scope, params.dbg_path, params.dbg_timestamp, max_U64);
rdi = di_rdi_from_key(di_scope, &params.dbgi_key, max_U64);
}
//- rjf: hash -> data
+1 -2
View File
@@ -36,8 +36,7 @@ struct DASM_Params
DASM_StyleFlags style_flags;
DASM_Syntax syntax;
U64 base_vaddr;
String8 dbg_path;
U64 dbg_timestamp;
DI_Key dbgi_key;
};
////////////////////////////////
+99 -48
View File
@@ -15,6 +15,58 @@ di_hash_from_string(String8 string, StringMatchFlags match_flags)
return result;
}
internal U64
di_hash_from_key(DI_Key *k)
{
U64 hash = di_hash_from_string(k->path, StringMatchFlag_CaseInsensitive);
return hash;
}
internal B32
di_key_match(DI_Key *a, DI_Key *b)
{
return (str8_match(a->path, b->path, StringMatchFlag_CaseInsensitive) && a->min_timestamp == b->min_timestamp);
}
internal DI_Key
di_key_copy(Arena *arena, DI_Key *src)
{
DI_Key dst = {0};
MemoryCopyStruct(&dst, src);
dst.path = push_str8_copy(arena, src->path);
return dst;
}
internal DI_Key
di_normalized_key_from_key(Arena *arena, DI_Key *src)
{
DI_Key dst = {path_normalized_from_string(arena, src->path), src->min_timestamp};
return dst;
}
internal void
di_key_list_push(Arena *arena, DI_KeyList *list, DI_Key *key)
{
DI_KeyNode *n = push_array(arena, DI_KeyNode, 1);
MemoryCopyStruct(&n->v, key);
SLLQueuePush(list->first, list->last, n);
list->count += 1;
}
internal DI_KeyArray
di_key_array_from_list(Arena *arena, DI_KeyList *list)
{
DI_KeyArray array = {0};
array.count = list->count;
array.v = push_array_no_zero(arena, DI_Key, array.count);
U64 idx = 0;
for(DI_KeyNode *n = list->first; n != 0; n = n->next, idx += 1)
{
MemoryCopyStruct(&array.v[idx], &n->v);
}
return array;
}
////////////////////////////////
//~ rjf: Main Layer Initialization
@@ -115,19 +167,19 @@ di_scope_touch_node__stripe_mutex_r_guarded(DI_Scope *scope, DI_Node *node)
//~ rjf: Per-Slot Functions
internal DI_Node *
di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(DI_Slot *slot, String8 path, U64 min_timestamp)
di_node_from_key_slot__stripe_mutex_r_guarded(DI_Slot *slot, DI_Key *key)
{
DI_Node *node = 0;
StringMatchFlags match_flags = path_match_flags_from_os(operating_system_from_context());
U64 most_recent_timestamp = max_U64;
for(DI_Node *n = slot->first; n != 0; n = n->next)
{
if(str8_match(n->path, path, match_flags) &&
min_timestamp <= n->min_timestamp &&
(n->min_timestamp - min_timestamp) <= most_recent_timestamp)
if(str8_match(n->key.path, key->path, match_flags) &&
key->min_timestamp <= n->key.min_timestamp &&
(n->key.min_timestamp - key->min_timestamp) <= most_recent_timestamp)
{
node = n;
most_recent_timestamp = (n->min_timestamp - min_timestamp);
most_recent_timestamp = (n->key.min_timestamp - key->min_timestamp);
}
}
return node;
@@ -231,30 +283,30 @@ di_string_release__stripe_mutex_w_guarded(DI_Stripe *stripe, String8 string)
//~ rjf: Key Opening/Closing
internal void
di_open(String8 path, U64 min_timestamp)
di_open(DI_Key *key)
{
Temp scratch = scratch_begin(0, 0);
if(path.size != 0)
if(key->path.size != 0)
{
String8 path_normalized = path_normalized_from_string(scratch.arena, path);
U64 hash = di_hash_from_string(path_normalized, StringMatchFlag_CaseInsensitive);
DI_Key key_normalized = di_normalized_key_from_key(scratch.arena, key);
U64 hash = di_hash_from_key(&key_normalized);
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];
DI_Stripe *stripe = &di_shared->stripes[stripe_idx];
log_infof("opening debug info: %S [0x%I64x]\n", path_normalized, min_timestamp);
log_infof("opening debug info: %S [0x%I64x]\n", key_normalized.path, key_normalized.min_timestamp);
OS_MutexScopeW(stripe->rw_mutex)
{
//- rjf: find existing node
DI_Node *node = di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(slot, path_normalized, min_timestamp);
DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key_normalized);
//- rjf: allocate node if none exists; insert into slot
if(node == 0)
{
U64 current_timestamp = os_properties_from_file_path(path).modified;
U64 current_timestamp = os_properties_from_file_path(key_normalized.path).modified;
if(current_timestamp == 0)
{
current_timestamp = min_timestamp;
current_timestamp = key_normalized.min_timestamp;
}
node = stripe->free_node;
if(node != 0)
@@ -267,9 +319,9 @@ di_open(String8 path, U64 min_timestamp)
}
MemoryZeroStruct(node);
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 = current_timestamp;
String8 path_stored = di_string_alloc__stripe_mutex_w_guarded(stripe, key_normalized.path);
node->key.path = path_stored;
node->key.min_timestamp = current_timestamp;
}
//- rjf: increment node reference count
@@ -278,7 +330,7 @@ di_open(String8 path, U64 min_timestamp)
node->ref_count += 1;
if(node->ref_count == 1)
{
di_u2p_enqueue_key(path_normalized, node->min_timestamp, 0);
di_u2p_enqueue_key(&key_normalized, max_U64);
}
}
}
@@ -287,23 +339,22 @@ di_open(String8 path, U64 min_timestamp)
}
internal void
di_close(String8 path, U64 min_timestamp)
di_close(DI_Key *key)
{
Temp scratch = scratch_begin(0, 0);
if(path.size != 0)
if(key->path.size != 0)
{
String8 path_normalized = path_normalized_from_string(scratch.arena, path);
StringMatchFlags match_flags = path_match_flags_from_os(operating_system_from_context());
U64 hash = di_hash_from_string(path_normalized, StringMatchFlag_CaseInsensitive);
DI_Key key_normalized = di_normalized_key_from_key(scratch.arena, key);
U64 hash = di_hash_from_key(&key_normalized);
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];
DI_Stripe *stripe = &di_shared->stripes[stripe_idx];
log_infof("closing debug info: %S [0x%I64x]\n", path_normalized, min_timestamp);
log_infof("closing debug info: %S [0x%I64x]\n", key_normalized.path, key_normalized.min_timestamp);
OS_MutexScopeW(stripe->rw_mutex)
{
//- rjf: find existing node
DI_Node *node = di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(slot, path_normalized, min_timestamp);
DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key_normalized);
//- rjf: node exists -> decrement reference count; release
if(node != 0)
@@ -322,7 +373,7 @@ di_close(String8 path, U64 min_timestamp)
//- rjf: release
if(node->ref_count == 0 && ins_atomic_u64_eval(&node->touch_count) == 0)
{
di_string_release__stripe_mutex_w_guarded(stripe, node->path);
di_string_release__stripe_mutex_w_guarded(stripe, node->key.path);
if(node->file_base != 0)
{
os_file_map_view_close(node->file_map, node->file_base);
@@ -354,15 +405,14 @@ di_close(String8 path, U64 min_timestamp)
//~ rjf: Cache Lookups
internal RDI_Parsed *
di_rdi_from_path_min_timestamp(DI_Scope *scope, String8 path, U64 min_timestamp, U64 endt_us)
di_rdi_from_key(DI_Scope *scope, DI_Key *key, U64 endt_us)
{
RDI_Parsed *result = &di_rdi_parsed_nil;
if(path.size != 0)
if(key->path.size != 0)
{
Temp scratch = scratch_begin(0, 0);
String8 path_normalized = path_normalized_from_string(scratch.arena, path);
StringMatchFlags match_flags = path_match_flags_from_os(operating_system_from_context());
U64 hash = di_hash_from_string(path_normalized, StringMatchFlag_CaseInsensitive);
DI_Key key_normalized = di_normalized_key_from_key(scratch.arena, key);
U64 hash = di_hash_from_key(&key_normalized);
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];
@@ -370,7 +420,7 @@ di_rdi_from_path_min_timestamp(DI_Scope *scope, String8 path, U64 min_timestamp,
OS_MutexScopeR(stripe->rw_mutex) for(;;)
{
//- rjf: find existing node
DI_Node *node = di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(slot, path_normalized, min_timestamp);
DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key_normalized);
//- rjf: no node? this path is not opened
if(node == 0)
@@ -390,7 +440,7 @@ di_rdi_from_path_min_timestamp(DI_Scope *scope, String8 path, U64 min_timestamp,
B32 sent = 0;
if(node != 0 && !node->parse_done && !node->is_working && ins_atomic_u64_eval(&node->last_time_requested_us)+1000000<os_now_microseconds())
{
sent = di_u2p_enqueue_key(path_normalized, min_timestamp, endt_us);
sent = di_u2p_enqueue_key(&key_normalized, endt_us);
if(sent)
{
ins_atomic_u64_eval_assign(&node->last_time_requested_us, os_now_microseconds());
@@ -417,18 +467,18 @@ di_rdi_from_path_min_timestamp(DI_Scope *scope, String8 path, U64 min_timestamp,
//~ rjf: Parse Threads
internal B32
di_u2p_enqueue_key(String8 path, U64 min_timestamp, U64 endt_us)
di_u2p_enqueue_key(DI_Key *key, U64 endt_us)
{
B32 sent = 0;
OS_MutexScope(di_shared->u2p_ring_mutex) for(;;)
{
U64 unconsumed_size = di_shared->u2p_ring_write_pos - di_shared->u2p_ring_read_pos;
U64 available_size = di_shared->u2p_ring_size - unconsumed_size;
if(available_size >= sizeof(path.size) + path.size + sizeof(min_timestamp))
if(available_size >= sizeof(key->path.size) + key->path.size + sizeof(key->min_timestamp))
{
di_shared->u2p_ring_write_pos += ring_write_struct(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_write_pos, &path.size);
di_shared->u2p_ring_write_pos += ring_write(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_write_pos, path.str, path.size);
di_shared->u2p_ring_write_pos += ring_write_struct(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_write_pos, &min_timestamp);
di_shared->u2p_ring_write_pos += ring_write_struct(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_write_pos, &key->path.size);
di_shared->u2p_ring_write_pos += ring_write(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_write_pos, key->path.str, key->path.size);
di_shared->u2p_ring_write_pos += ring_write_struct(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_write_pos, &key->min_timestamp);
di_shared->u2p_ring_write_pos += 7;
di_shared->u2p_ring_write_pos -= di_shared->u2p_ring_write_pos%8;
sent = 1;
@@ -448,17 +498,17 @@ 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)
di_u2p_dequeue_key(Arena *arena, DI_Key *out_key)
{
OS_MutexScope(di_shared->u2p_ring_mutex) for(;;)
{
U64 unconsumed_size = di_shared->u2p_ring_write_pos - di_shared->u2p_ring_read_pos;
if(unconsumed_size >= sizeof(out_path->size) + sizeof(out_min_timestamp[0]))
if(unconsumed_size >= sizeof(out_key->path.size) + sizeof(out_key->min_timestamp))
{
di_shared->u2p_ring_read_pos += ring_read_struct(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_read_pos, &out_path->size);
out_path->str = push_array(arena, U8, out_path->size);
di_shared->u2p_ring_read_pos += ring_read(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_read_pos, out_path->str, out_path->size);
di_shared->u2p_ring_read_pos += ring_read_struct(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_read_pos, out_min_timestamp);
di_shared->u2p_ring_read_pos += ring_read_struct(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_read_pos, &out_key->path.size);
out_key->path.str = push_array(arena, U8, out_key->path.size);
di_shared->u2p_ring_read_pos += ring_read(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_read_pos, out_key->path.str, out_key->path.size);
di_shared->u2p_ring_read_pos += ring_read_struct(di_shared->u2p_ring_base, di_shared->u2p_ring_size, di_shared->u2p_ring_read_pos, &out_key->min_timestamp);
di_shared->u2p_ring_read_pos += 7;
di_shared->u2p_ring_read_pos -= di_shared->u2p_ring_read_pos%8;
break;
@@ -530,9 +580,10 @@ di_parse_thread__entry_point(void *p)
////////////////////////////
//- rjf: grab next key
//
String8 og_path = {0};
U64 min_timestamp = 0;
di_u2p_dequeue_key(scratch.arena, &og_path, &min_timestamp);
DI_Key key = {0};
di_u2p_dequeue_key(scratch.arena, &key);
String8 og_path = key.path;
U64 min_timestamp = key.min_timestamp;
////////////////////////////
//- rjf: unpack key
@@ -549,7 +600,7 @@ 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, og_path, min_timestamp);
DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key);
if(node != 0)
{
got_task = !ins_atomic_u64_eval_cond_assign(&node->is_working, 1, 0);
@@ -852,7 +903,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, og_path, min_timestamp);
DI_Node *node = di_node_from_key_slot__stripe_mutex_r_guarded(slot, &key);
if(node != 0)
{
node->is_working = 0;
+45 -8
View File
@@ -4,6 +4,38 @@
#ifndef DI_H
#define DI_H
////////////////////////////////
//~ rjf: Cache Key Type
typedef struct DI_Key DI_Key;
struct DI_Key
{
String8 path;
U64 min_timestamp;
};
typedef struct DI_KeyNode DI_KeyNode;
struct DI_KeyNode
{
DI_KeyNode *next;
DI_Key v;
};
typedef struct DI_KeyList DI_KeyList;
struct DI_KeyList
{
DI_KeyNode *first;
DI_KeyNode *last;
U64 count;
};
typedef struct DI_KeyArray DI_KeyArray;
struct DI_KeyArray
{
DI_Key *v;
U64 count;
};
////////////////////////////////
//~ rjf: Event Types
@@ -63,8 +95,7 @@ struct DI_Node
U64 last_time_requested_us;
// rjf: key
String8 path;
U64 min_timestamp;
DI_Key key;
// rjf: file handles
OS_Handle file;
@@ -201,6 +232,12 @@ global RDI_Parsed di_rdi_parsed_nil =
//~ rjf: Basic Helpers
internal U64 di_hash_from_string(String8 string, StringMatchFlags match_flags);
internal U64 di_hash_from_key(DI_Key *k);
internal B32 di_key_match(DI_Key *a, DI_Key *b);
internal DI_Key di_key_copy(Arena *arena, DI_Key *src);
internal DI_Key di_normalized_key_from_key(Arena *arena, DI_Key *src);
internal void di_key_list_push(Arena *arena, DI_KeyList *list, DI_Key *key);
internal DI_KeyArray di_key_array_from_list(Arena *arena, DI_KeyList *list);
////////////////////////////////
//~ rjf: Main Layer Initialization
@@ -217,7 +254,7 @@ internal void di_scope_touch_node__stripe_mutex_r_guarded(DI_Scope *scope, DI_No
////////////////////////////////
//~ rjf: Per-Slot Functions
internal DI_Node *di_node_from_path_min_timestamp_slot__stripe_mutex_r_guarded(DI_Slot *slot, String8 path, U64 min_timestamp);
internal DI_Node *di_node_from_key_slot__stripe_mutex_r_guarded(DI_Slot *slot, DI_Key *key);
////////////////////////////////
//~ rjf: Per-Stripe Functions
@@ -229,19 +266,19 @@ internal void di_string_release__stripe_mutex_w_guarded(DI_Stripe *stripe, Strin
////////////////////////////////
//~ rjf: Key Opening/Closing
internal void di_open(String8 path, U64 min_timestamp);
internal void di_close(String8 path, U64 min_timestamp);
internal void di_open(DI_Key *key);
internal void di_close(DI_Key *key);
////////////////////////////////
//~ rjf: Cache Lookups
internal RDI_Parsed *di_rdi_from_path_min_timestamp(DI_Scope *scope, String8 path, U64 min_timestamp, U64 endt_us);
internal RDI_Parsed *di_rdi_from_key(DI_Scope *scope, DI_Key *key, U64 endt_us);
////////////////////////////////
//~ rjf: Parse Threads
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 B32 di_u2p_enqueue_key(DI_Key *key, U64 endt_us);
internal void di_u2p_dequeue_key(Arena *arena, DI_Key *out_key);
internal void di_p2u_push_event(DI_Event *event);
internal DI_EventList di_p2u_pop_events(Arena *arena, U64 endt_us);
+83 -95
View File
@@ -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 *debug = df_dbgi_from_module(module);
String8 procedure_name = df_symbol_name_from_dbgi_voff(scratch.arena, debug, rip_voff);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
String8 procedure_name = df_symbol_name_from_dbgi_key_voff(scratch.arena, &dbgi_key, rip_voff);
if(procedure_name.size != 0)
{
str8_list_push(scratch.arena, &strings, procedure_name);
@@ -2841,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 *debug = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_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);
@@ -2849,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_dbgi_voff(debug, ip_voff);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, ip_voff);
Rng1U64 line_voff_rng = line_info.voff_range;
if(line_voff_rng.max != 0)
{
@@ -2863,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_dbgi_voff(debug, opl_line_voff_rng);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, 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);
@@ -2966,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 *debug = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_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);
@@ -2974,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_dbgi_voff(debug, ip_voff);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, ip_voff);
Rng1U64 line_voff_rng = line_info.voff_range;
if(line_voff_rng.max != 0)
{
@@ -2988,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_dbgi_voff(debug, opl_line_voff_rng);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, 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);
@@ -3079,25 +3079,26 @@ df_trap_net_from_thread__step_into_line(Arena *arena, DF_Entity *thread)
////////////////////////////////
//~ rjf: Modules & Debug Info Mappings
//- rjf: module <=> debug info file
//- rjf: module <=> debug info keys
internal DF_Entity *
df_dbgi_from_module(DF_Entity *module)
internal DI_Key
df_dbgi_key_from_module(DF_Entity *module)
{
DF_Entity *debug = df_entity_from_handle(module->entity_handle);
return debug;
DF_Entity *debug_info_path = df_entity_child_from_kind(module, DF_EntityKind_DebugInfoPath);
DI_Key key = {debug_info_path->name, debug_info_path->timestamp};
return key;
}
internal DF_EntityList
df_modules_from_dbgi(Arena *arena, DF_Entity *debug)
df_modules_from_dbgi_key(Arena *arena, DI_Key *dbgi_key)
{
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_debug_info = df_dbgi_from_module(module);
if(module_debug_info == debug)
DI_Key module_dbgi_key = df_dbgi_key_from_module(module);
if(di_key_match(&module_dbgi_key, dbgi_key))
{
df_entity_list_push(arena, &list, module);
}
@@ -3153,28 +3154,16 @@ df_vaddr_range_from_voff_range(DF_Entity *module, Rng1U64 voff_rng)
////////////////////////////////
//~ rjf: Debug Info Lookups
//- rjf: debug file -> rdi
internal RDI_Parsed *
df_rdi_from_dbgi(DI_Scope *scope, DF_Entity *dbgi)
{
Temp scratch = scratch_begin(0, 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 rdi;
}
//- rjf: symbol lookups
internal String8
df_symbol_name_from_dbgi_voff(Arena *arena, DF_Entity *dbgi, U64 voff)
df_symbol_name_from_dbgi_key_voff(Arena *arena, DI_Key *dbgi_key, U64 voff)
{
String8 result = {0};
{
Temp scratch = scratch_begin(&arena, 1);
DI_Scope *scope = di_scope_open();
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
if(result.size == 0 && rdi->scope_vmap != 0)
{
U64 scope_idx = rdi_vmap_idx_from_voff(rdi->scope_vmap, rdi->scope_vmap_count, voff);
@@ -3205,9 +3194,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
U64 voff = df_voff_from_vaddr(module, vaddr);
result = df_symbol_name_from_dbgi_voff(arena, dbgi, voff);
result = df_symbol_name_from_dbgi_key_voff(arena, &dbgi_key, voff);
}
return result;
}
@@ -3224,7 +3213,7 @@ df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entit
}
Temp scratch = scratch_begin(&arena, 1);
DI_Scope *scope = di_scope_open();
DF_EntityList dbgis = df_push_active_dbgi_list(scratch.arena);
DI_KeyList dbgi_keys = df_push_active_dbgi_key_list(scratch.arena);
DF_EntityList overrides = df_possible_overrides_from_entity(scratch.arena, file);
for(DF_EntityNode *override_n = overrides.first;
override_n != 0;
@@ -3233,13 +3222,13 @@ 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 *dbgi_n = dbgis.first;
dbgi_n != 0;
dbgi_n = dbgi_n->next)
for(DI_KeyNode *dbgi_key_n = dbgi_keys.first;
dbgi_key_n != 0;
dbgi_key_n = dbgi_key_n->next)
{
// rjf: binary -> rdi
DF_Entity *dbgi = dbgi_n->entity;
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
DI_Key key = dbgi_key_n->v;
RDI_Parsed *rdi = di_rdi_from_key(scope, &key, 0);
// rjf: file_path_normalized * rdi -> src_id
B32 good_src_id = 0;
@@ -3294,7 +3283,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.dbgi = dbgi;
src2dasm_n->v.dbgi_key = key;
SLLQueuePush(src2dasm_list->first, src2dasm_list->last, src2dasm_n);
src2dasm_list->count += 1;
}
@@ -3302,10 +3291,10 @@ df_text_line_src2dasm_info_list_array_from_src_line_range(Arena *arena, DF_Entit
}
}
// rjf: good src id -> push to relevant binaries
// rjf: good src id -> push to relevant dbgi keys
if(good_src_id)
{
df_entity_list_push(arena, &src2dasm_array.dbgis, dbgi);
di_key_list_push(arena, &src2dasm_array.dbgi_keys, &key);
}
}
}
@@ -3317,13 +3306,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_dbgi_voff(DF_Entity *dbgi, U64 voff)
df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff)
{
Temp scratch = scratch_begin(0, 0);
DI_Scope *scope = di_scope_open();
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
DF_TextLineDasm2SrcInfo result = {0};
result.file = result.dbgi = &df_g_nil_entity;
result.file = &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);
@@ -3338,7 +3327,7 @@ df_text_line_dasm2src_info_from_dbgi_voff(DF_Entity *dbgi, 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.dbgi = dbgi;
MemoryCopyStruct(&result.dbgi_key, dbgi_key);
if(line->file_idx != 0 && file_normalized_full_path.size != 0)
{
result.file = df_entity_from_path(file_normalized_full_path, DF_EntityFromPathFlag_All);
@@ -3355,14 +3344,14 @@ df_text_line_dasm2src_info_from_dbgi_voff(DF_Entity *dbgi, U64 voff)
//- rjf: symbol -> voff lookups
internal U64
df_voff_from_dbgi_symbol_name(DF_Entity *dbgi, String8 symbol_name)
df_voff_from_dbgi_key_symbol_name(DI_Key *dbgi_key, String8 symbol_name)
{
ProfBeginFunction();
Temp scratch = scratch_begin(0, 0);
DI_Scope *scope = di_scope_open();
U64 result = 0;
{
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
RDI_NameMapKind name_map_kinds[] =
{
RDI_NameMapKind_GlobalVariables,
@@ -3436,13 +3425,13 @@ 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)
df_type_num_from_dbgi_key_name(DI_Key *dbgi_key, String8 name)
{
ProfBeginFunction();
DI_Scope *scope = di_scope_open();
U64 result = 0;
{
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
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);
@@ -3592,17 +3581,17 @@ df_architecture_from_entity(DF_Entity *entity)
}
internal EVAL_String2NumMap *
df_push_locals_map_from_dbgi_voff(Arena *arena, DI_Scope *scope, DF_Entity *dbgi, U64 voff)
df_push_locals_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff)
{
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
EVAL_String2NumMap *result = eval_push_locals_map_from_rdi_voff(arena, rdi, voff);
return result;
}
internal EVAL_String2NumMap *
df_push_member_map_from_dbgi_voff(Arena *arena, DI_Scope *scope, DF_Entity *dbgi, U64 voff)
df_push_member_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff)
{
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
EVAL_String2NumMap *result = eval_push_member_map_from_rdi_voff(arena, rdi, voff);
return result;
}
@@ -3879,13 +3868,13 @@ df_eval_parse_ctx_from_process_vaddr(DI_Scope *scope, DF_Entity *process, U64 va
//- rjf: extract info
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
U64 voff = df_voff_from_vaddr(module, vaddr);
DF_Entity *debug = df_dbgi_from_module(module);
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, debug);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
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_dbgi_voff(debug, voff);
EVAL_String2NumMap *member_map = df_query_cached_member_map_from_dbgi_voff(debug, voff);
EVAL_String2NumMap *locals_map = df_query_cached_locals_map_from_dbgi_key_voff(&dbgi_key, voff);
EVAL_String2NumMap *member_map = df_query_cached_member_map_from_dbgi_key_voff(&dbgi_key, voff);
//- rjf: build ctx
EVAL_ParseCtx ctx = zero_struct;
@@ -3908,7 +3897,7 @@ 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 dbgis = df_push_active_dbgi_list(scratch.arena);
DI_KeyList dbgi_keys = df_push_active_dbgi_key_list(scratch.arena);
DF_TextLineSrc2DasmInfoList src2dasm_list = {0};
//- rjf: search for line info in all binaries for this file:pt
@@ -3920,13 +3909,13 @@ df_eval_parse_ctx_from_src_loc(DI_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 *dbgi_n = dbgis.first;
dbgi_n != 0;
dbgi_n = dbgi_n->next)
for(DI_KeyNode *dbgi_key_n = dbgi_keys.first;
dbgi_key_n != 0;
dbgi_key_n = dbgi_key_n->next)
{
// rjf: debug file -> rdi
DF_Entity *dbgi = dbgi_n->entity;
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
// rjf: key -> rdi
DI_Key key = dbgi_key_n->v;
RDI_Parsed *rdi = di_rdi_from_key(scope, &key, 0);
// rjf: file_path_normalized * rdi -> src_id
B32 good_src_id = 0;
@@ -3972,7 +3961,7 @@ df_eval_parse_ctx_from_src_loc(DI_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.dbgi = dbgi;
src2dasm_n->v.dbgi_key = key;
SLLQueuePush(src2dasm_list.first, src2dasm_list.last, src2dasm_n);
src2dasm_list.count += 1;
}
@@ -3987,7 +3976,7 @@ df_eval_parse_ctx_from_src_loc(DI_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_dbgi(scratch.arena, src2dasm->dbgi);
DF_EntityList modules = df_modules_from_dbgi_key(scratch.arena, &src2dasm->dbgi_key);
if(modules.count != 0)
{
DF_Entity *module = modules.first->entity;
@@ -4133,9 +4122,9 @@ df_eval_from_string(Arena *arena, DI_Scope *scope, DF_CtrlCtx *ctrl_ctx, EVAL_Pa
{
U64 vaddr = result.imm_u64;
DF_Entity *module = df_module_from_process_vaddr(process, vaddr);
DF_Entity *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
U64 voff = df_voff_from_vaddr(module, vaddr);
String8 symbol_name = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, voff);
String8 symbol_name = df_symbol_name_from_dbgi_key_voff(scratch.arena, &dbgi_key, 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);
@@ -6112,16 +6101,18 @@ df_query_cached_entity_list_with_kind(DF_EntityKind kind)
return result;
}
internal DF_EntityList
df_push_active_dbgi_list(Arena *arena)
//- rjf: active entity based queries
internal DI_KeyList
df_push_active_dbgi_key_list(Arena *arena)
{
DF_EntityList dbgis = {0};
DI_KeyList 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 *dbgi = df_dbgi_from_module(module);
df_entity_list_push(arena, &dbgis, dbgi);
DI_Key key = df_dbgi_key_from_module(module);
di_key_list_push(arena, &dbgis, &key);
}
return dbgis;
}
@@ -6282,7 +6273,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_dbgi_voff(DF_Entity *dbgi, U64 voff)
df_query_cached_locals_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff)
{
ProfBeginFunction();
EVAL_String2NumMap *map = &eval_string2num_map_nil;
@@ -6298,14 +6289,13 @@ df_query_cached_locals_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff)
{
break;
}
DF_Handle handle = df_handle_from_entity(dbgi);
U64 hash = df_hash_from_string(str8_struct(&handle));
U64 hash = di_hash_from_key(dbgi_key);
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->dbgi, handle) && n->voff == voff)
if(di_key_match(&n->dbgi_key, dbgi_key) && n->voff == voff)
{
node = n;
break;
@@ -6314,11 +6304,11 @@ df_query_cached_locals_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff)
if(node == 0)
{
DI_Scope *scope = di_scope_open();
EVAL_String2NumMap *map = df_push_locals_map_from_dbgi_voff(cache->arena, scope, dbgi, voff);
EVAL_String2NumMap *map = df_push_locals_map_from_dbgi_key_voff(cache->arena, scope, dbgi_key, voff);
if(map->slots_count != 0)
{
node = push_array(cache->arena, DF_RunLocalsCacheNode, 1);
node->dbgi = handle;
node->dbgi_key = di_key_copy(cache->arena, dbgi_key);
node->voff = voff;
node->locals_map = map;
SLLQueuePush_N(slot->first, slot->last, node, hash_next);
@@ -6336,7 +6326,7 @@ 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)
df_query_cached_member_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff)
{
ProfBeginFunction();
EVAL_String2NumMap *map = &eval_string2num_map_nil;
@@ -6352,14 +6342,13 @@ df_query_cached_member_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff)
{
break;
}
DF_Handle handle = df_handle_from_entity(dbgi);
U64 hash = df_hash_from_string(str8_struct(&handle));
U64 hash = di_hash_from_key(dbgi_key);
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->dbgi, handle) && n->voff == voff)
if(di_key_match(&n->dbgi_key, dbgi_key) && n->voff == voff)
{
node = n;
break;
@@ -6368,11 +6357,11 @@ df_query_cached_member_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff)
if(node == 0)
{
DI_Scope *scope = di_scope_open();
EVAL_String2NumMap *map = df_push_member_map_from_dbgi_voff(cache->arena, scope, dbgi, voff);
EVAL_String2NumMap *map = df_push_member_map_from_dbgi_key_voff(cache->arena, scope, dbgi_key, voff);
if(map->slots_count != 0)
{
node = push_array(cache->arena, DF_RunLocalsCacheNode, 1);
node->dbgi = handle;
node->dbgi_key = di_key_copy(cache->arena, dbgi_key);
node->voff = voff;
node->locals_map = map;
SLLQueuePush_N(slot->first, slot->last, node, hash_next);
@@ -6699,9 +6688,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 *debug = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_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_dbgi_voff(debug, stop_thread_voff);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, 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)
{
@@ -6882,12 +6871,6 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
df_entity_equip_vaddr(module, event->rip_vaddr);
df_entity_equip_timestamp(module, event->timestamp);
// 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)
{
@@ -6938,8 +6921,13 @@ df_core_begin_frame(Arena *arena, DF_CmdList *cmds, F32 dt)
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));
DF_Entity *debug_info = df_entity_child_from_kind(module, DF_EntityKind_DebugInfoPath);
if(df_entity_is_nil(debug_info))
{
debug_info = df_entity_alloc(0, module, DF_EntityKind_DebugInfoPath);
}
df_entity_equip_name(0, debug_info, event->string);
df_entity_equip_timestamp(debug_info, event->timestamp);
}break;
//- rjf: debug strings
+18 -19
View File
@@ -521,7 +521,7 @@ struct DF_TextLineSrc2DasmInfo
{
Rng1U64 voff_range;
S64 remap_line;
DF_Entity *dbgi;
DI_Key dbgi_key;
};
typedef struct DF_TextLineSrc2DasmInfoNode DF_TextLineSrc2DasmInfoNode;
@@ -543,7 +543,7 @@ typedef struct DF_TextLineSrc2DasmInfoListArray DF_TextLineSrc2DasmInfoListArray
struct DF_TextLineSrc2DasmInfoListArray
{
DF_TextLineSrc2DasmInfoList *v;
DF_EntityList dbgis;
DI_KeyList dbgi_keys;
U64 count;
};
@@ -552,7 +552,7 @@ struct DF_TextLineSrc2DasmInfoListArray
typedef struct DF_TextLineDasm2SrcInfo DF_TextLineDasm2SrcInfo;
struct DF_TextLineDasm2SrcInfo
{
DF_Entity *dbgi;
DI_Key dbgi_key;
DF_Entity *file;
TxtPt pt;
Rng1U64 voff_range;
@@ -1004,7 +1004,7 @@ typedef struct DF_RunLocalsCacheNode DF_RunLocalsCacheNode;
struct DF_RunLocalsCacheNode
{
DF_RunLocalsCacheNode *hash_next;
DF_Handle dbgi;
DI_Key dbgi_key;
U64 voff;
EVAL_String2NumMap *locals_map;
};
@@ -1518,9 +1518,9 @@ internal CTRL_TrapList df_trap_net_from_thread__step_into_line(Arena *arena, DF_
////////////////////////////////
//~ rjf: Modules & Debug Info Mappings
//- 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: module <=> debug info keys
internal DI_Key df_dbgi_key_from_module(DF_Entity *module);
internal DF_EntityList df_modules_from_dbgi_key(Arena *arena, DI_Key *dbgi_key);
//- rjf: voff <=> vaddr
internal U64 df_base_vaddr_from_module(DF_Entity *module);
@@ -1532,22 +1532,19 @@ internal Rng1U64 df_vaddr_range_from_voff_range(DF_Entity *module, Rng1U64 voff_
////////////////////////////////
//~ rjf: Debug Info Lookups
//- 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_dbgi_voff(Arena *arena, DF_Entity *dbgi, U64 voff);
internal String8 df_symbol_name_from_dbgi_key_voff(Arena *arena, DI_Key *dbgi_key, 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_dbgi_voff(DF_Entity *dbgi, U64 voff);
internal DF_TextLineDasm2SrcInfo df_text_line_dasm2src_info_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff);
//- rjf: symbol -> voff lookups
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);
internal U64 df_voff_from_dbgi_key_symbol_name(DI_Key *dbgi_key, String8 symbol_name);
internal U64 df_type_num_from_dbgi_key_name(DI_Key *dbgi_key, String8 name);
////////////////////////////////
//~ rjf: Process/Thread/Module Info Lookups
@@ -1556,8 +1553,8 @@ 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_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 EVAL_String2NumMap *df_push_locals_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, U64 voff);
internal EVAL_String2NumMap *df_push_member_map_from_dbgi_key_voff(Arena *arena, DI_Scope *scope, DI_Key *dbgi_key, 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);
@@ -1679,7 +1676,9 @@ 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_dbgi_list(Arena *arena);
//- rjf: active entity based queries
internal DI_KeyList df_push_active_dbgi_key_list(Arena *arena);
internal DF_EntityList df_push_active_target_list(Arena *arena);
//- rjf: per-run caches
@@ -1687,8 +1686,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_dbgi_voff(DF_Entity *dbgi, U64 voff);
internal EVAL_String2NumMap *df_query_cached_member_map_from_dbgi_voff(DF_Entity *dbgi, U64 voff);
internal EVAL_String2NumMap *df_query_cached_locals_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff);
internal EVAL_String2NumMap *df_query_cached_member_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff);
//- rjf: top-level command dispatch
internal void df_push_cmd__root(DF_CmdParams *params, DF_CmdSpec *spec);
+1 -5
View File
@@ -26,14 +26,10 @@ DF_EntityKindTable:
//- rjf: filesystem modeling
{File file 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" FileOutline "File" }
{OverrideFileLink override_file_link 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 "Label" FileOutline "Override File Link" }
{PendingFileChange pending_file_change 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" FileOutline "Pending File Change" }
//- rjf: auto view rules
{AutoViewRule auto_view_rule 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 "Label" Binoculars "Auto View Rule" }
//- rjf: diagnostics log
{DiagLog diag_log 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" FileOutline "Diagnostics Log" }
//- rjf: text attachments
{FlashMarker flash_marker 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Null "Flash Marker" }
@@ -59,8 +55,8 @@ DF_EntityKindTable:
{Process process 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Threads "Process" }
{Thread thread 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Thread "Thread" }
{Module module 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Module "Module" }
{DebugInfoOverride debug_info_override 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 "Label" Null "Debug Info Override" }
{PendingThreadName pending_thread_name 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Threads "Pending Thread Name" }
{DebugInfoPath debug_info_path 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Module "Debug Info Path" }
//- rjf: parser task entities
{ConversionTask conversion_task 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 "Label" Null "Conversion Task" }
+8 -18
View File
@@ -30,16 +30,14 @@ Rng1U64 df_g_cmd_param_slot_range_table[22] =
{OffsetOf(DF_CmdParams, dir2), OffsetOf(DF_CmdParams, dir2) + sizeof(Dir2)},
};
DF_IconKind df_g_entity_kind_icon_kind_table[27] =
DF_IconKind df_g_entity_kind_icon_kind_table[25] =
{
DF_IconKind_Null,
DF_IconKind_Null,
DF_IconKind_Machine,
DF_IconKind_FileOutline,
DF_IconKind_FileOutline,
DF_IconKind_FileOutline,
DF_IconKind_Binoculars,
DF_IconKind_FileOutline,
DF_IconKind_Null,
DF_IconKind_Pin,
DF_IconKind_CircleFilled,
@@ -54,23 +52,21 @@ DF_IconKind_Null,
DF_IconKind_Threads,
DF_IconKind_Thread,
DF_IconKind_Module,
DF_IconKind_Null,
DF_IconKind_Threads,
DF_IconKind_Module,
DF_IconKind_Null,
DF_IconKind_Null,
DF_IconKind_Null,
};
String8 df_g_entity_kind_display_string_table[27] =
String8 df_g_entity_kind_display_string_table[25] =
{
str8_lit_comp("Nil"),
str8_lit_comp("Root"),
str8_lit_comp("Machine"),
str8_lit_comp("File"),
str8_lit_comp("Override File Link"),
str8_lit_comp("Pending File Change"),
str8_lit_comp("Auto View Rule"),
str8_lit_comp("Diagnostics Log"),
str8_lit_comp("Flash Marker"),
str8_lit_comp("Watch Pin"),
str8_lit_comp("Breakpoint"),
@@ -85,14 +81,14 @@ str8_lit_comp("Destination"),
str8_lit_comp("Process"),
str8_lit_comp("Thread"),
str8_lit_comp("Module"),
str8_lit_comp("Debug Info Override"),
str8_lit_comp("Pending Thread Name"),
str8_lit_comp("Debug Info Path"),
str8_lit_comp("Conversion Task"),
str8_lit_comp("Conversion Failure"),
str8_lit_comp("EndedProcess"),
};
String8 df_g_entity_kind_name_label_table[27] =
String8 df_g_entity_kind_name_label_table[25] =
{
str8_lit_comp("Label"),
str8_lit_comp("Label"),
@@ -101,8 +97,6 @@ str8_lit_comp("Label"),
str8_lit_comp("Label"),
str8_lit_comp("Label"),
str8_lit_comp("Label"),
str8_lit_comp("Label"),
str8_lit_comp("Label"),
str8_lit_comp("Expression"),
str8_lit_comp("Label"),
str8_lit_comp("Expression"),
@@ -123,17 +117,15 @@ str8_lit_comp("Label"),
str8_lit_comp("Label"),
};
DF_EntityKindFlags df_g_entity_kind_flags_table[27] =
DF_EntityKindFlags df_g_entity_kind_flags_table[25] =
{
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(1*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 1*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 1*DF_EntityKindFlag_LeafMutationProfileConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 1*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 1*DF_EntityKindFlag_NameIsCode | 1*DF_EntityKindFlag_UserDefinedLifetime),
@@ -147,14 +139,14 @@ DF_EntityKindFlags df_g_entity_kind_flags_table[27] =
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 1*DF_EntityKindFlag_LeafMutationSoftHalt | 1*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 1*DF_EntityKindFlag_TreeMutationSoftHalt | 1*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
(0*DF_EntityKindFlag_LeafMutationUserConfig | 0*DF_EntityKindFlag_LeafMutationProfileConfig | 0*DF_EntityKindFlag_LeafMutationSoftHalt | 0*DF_EntityKindFlag_LeafMutationDebugInfoMap | 0*DF_EntityKindFlag_TreeMutationUserConfig | 0*DF_EntityKindFlag_TreeMutationProfileConfig | 0*DF_EntityKindFlag_TreeMutationSoftHalt | 0*DF_EntityKindFlag_TreeMutationDebugInfoMap | 0*DF_EntityKindFlag_NameIsCode | 0*DF_EntityKindFlag_UserDefinedLifetime),
};
DF_EntityOpFlags df_g_entity_kind_op_flags_table[27] =
DF_EntityOpFlags df_g_entity_kind_op_flags_table[25] =
{
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
@@ -163,8 +155,6 @@ DF_EntityOpFlags df_g_entity_kind_op_flags_table[27] =
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
(1*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (1*DF_EntityOpFlag_Duplicate),
(1*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (1*DF_EntityOpFlag_Rename) | (1*DF_EntityOpFlag_Enable) | (1*DF_EntityOpFlag_Condition) | (1*DF_EntityOpFlag_Duplicate),
(0*DF_EntityOpFlag_Delete) | (0*DF_EntityOpFlag_Freeze) | (0*DF_EntityOpFlag_Edit) | (0*DF_EntityOpFlag_Rename) | (0*DF_EntityOpFlag_Enable) | (0*DF_EntityOpFlag_Condition) | (0*DF_EntityOpFlag_Duplicate),
+6 -8
View File
@@ -22,9 +22,7 @@ DF_EntityKind_Root,
DF_EntityKind_Machine,
DF_EntityKind_File,
DF_EntityKind_OverrideFileLink,
DF_EntityKind_PendingFileChange,
DF_EntityKind_AutoViewRule,
DF_EntityKind_DiagLog,
DF_EntityKind_FlashMarker,
DF_EntityKind_WatchPin,
DF_EntityKind_Breakpoint,
@@ -39,8 +37,8 @@ DF_EntityKind_Dest,
DF_EntityKind_Process,
DF_EntityKind_Thread,
DF_EntityKind_Module,
DF_EntityKind_DebugInfoOverride,
DF_EntityKind_PendingThreadName,
DF_EntityKind_DebugInfoPath,
DF_EntityKind_ConversionTask,
DF_EntityKind_ConversionFail,
DF_EntityKind_EndedProcess,
@@ -1531,11 +1529,11 @@ struct {B32 *value_ptr; String8 name;} DEV_toggle_table[] =
};
C_LINKAGE_BEGIN
extern Rng1U64 df_g_cmd_param_slot_range_table[22];
extern DF_IconKind df_g_entity_kind_icon_kind_table[27];
extern String8 df_g_entity_kind_display_string_table[27];
extern String8 df_g_entity_kind_name_label_table[27];
extern DF_EntityKindFlags df_g_entity_kind_flags_table[27];
extern DF_EntityOpFlags df_g_entity_kind_op_flags_table[27];
extern DF_IconKind df_g_entity_kind_icon_kind_table[25];
extern String8 df_g_entity_kind_display_string_table[25];
extern String8 df_g_entity_kind_name_label_table[25];
extern DF_EntityKindFlags df_g_entity_kind_flags_table[25];
extern DF_EntityOpFlags df_g_entity_kind_op_flags_table[25];
extern String8 df_g_cfg_src_string_table[4];
extern DF_CoreCmdKind df_g_cfg_src_load_cmd_kind_table[4];
extern DF_CoreCmdKind df_g_cfg_src_write_cmd_kind_table[4];
+42 -39
View File
@@ -583,17 +583,18 @@ df_queue_drag_drop(void)
}
internal void
df_set_hovered_line_info(DF_Entity *dbgi, U64 voff)
df_set_hovered_line_info(DI_Key *dbgi_key, U64 voff)
{
df_gfx_state->hover_line_dbgi = df_handle_from_entity(dbgi);
arena_clear(df_gfx_state->hover_line_arena);
df_gfx_state->hover_line_dbgi_key = di_key_copy(df_gfx_state->hover_line_arena, dbgi_key);
df_gfx_state->hover_line_voff = voff;
df_gfx_state->hover_line_set_this_frame = 1;
}
internal DF_Entity *
df_get_hovered_line_info_dbgi(void)
internal DI_Key
df_get_hovered_line_info_dbgi_key(void)
{
return df_entity_from_handle(df_gfx_state->hover_line_dbgi);
return df_gfx_state->hover_line_dbgi_key;
}
internal U64
@@ -2499,14 +2500,14 @@ 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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
RDI_Parsed *rdi = df_rdi_from_dbgi(scope, dbgi);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, rip_voff);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, rip_voff);
// rjf: snap to resolved line
B32 missing_rip = (rip_vaddr == 0);
B32 dbgi_missing = (dbgi->flags & DF_EntityFlag_IsMissing || df_entity_is_nil(dbgi));
B32 dbgi_missing = (dbgi_key.min_timestamp == 0 || dbgi_key.path.size == 0);
B32 dbgi_pending = !dbgi_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);
@@ -2562,17 +2563,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_dbgi = &df_g_nil_entity;
DI_Key voff_dbgi_key = {0};
if(name_resolved == 0)
{
DF_EntityList dbgis = df_push_active_dbgi_list(scratch.arena);
for(DF_EntityNode *n = dbgis.first; n != 0; n = n->next)
DI_KeyList keys = df_push_active_dbgi_key_list(scratch.arena);
for(DI_KeyNode *n = keys.first; n != 0; n = n->next)
{
U64 binary_voff = df_voff_from_dbgi_symbol_name(n->entity, name);
U64 binary_voff = df_voff_from_dbgi_key_symbol_name(&n->v, name);
if(binary_voff != 0)
{
voff = binary_voff;
voff_dbgi = n->entity;
voff_dbgi_key = n->v;
name_resolved = 1;
break;
}
@@ -2681,16 +2682,16 @@ 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_dbgi_voff(voff_dbgi, voff);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&voff_dbgi_key, 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_dbgi))
if(voff_dbgi_key.path.size != 0)
{
DF_EntityList modules = df_modules_from_dbgi(scratch.arena, voff_dbgi);
DF_EntityList modules = df_modules_from_dbgi_key(scratch.arena, &voff_dbgi_key);
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))
@@ -2918,7 +2919,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_dbgi(scratch.arena, n->v.dbgi);
DF_EntityList modules = df_modules_from_dbgi_key(scratch.arena, &n->v.dbgi_key);
DF_Entity *module = df_module_from_thread_candidates(thread, &modules);
vaddr = df_vaddr_from_voff(module, n->v.voff_range.min);
goto end_lookup;
@@ -3493,6 +3494,7 @@ df_window_update_and_render(Arena *arena, DF_Window *ws, DF_CmdList *cmds)
avg_ui_hash_chain_length = chain_length_sum / chain_count;
}
ui_labelf("Target Hz: %.2f", 1.f/df_dt());
ui_labelf("Unwind Cache Gen: %I64u", df_state->unwind_cache_gen);
ui_labelf("Ctrl Run Index: %I64u", ctrl_run_gen());
ui_labelf("Ctrl Mem Gen Index: %I64u", ctrl_mem_gen());
ui_labelf("Window %p", window);
@@ -3922,9 +3924,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
String8 symbol = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
String8 symbol = df_symbol_name_from_dbgi_key_voff(scratch.arena, &dbgi_key, rip_voff);
if(symbol.size != 0)
{
str8_list_pushf(scratch.arena, &lines, "0x%I64x: %S", rip_vaddr, symbol);
@@ -4249,7 +4251,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
//- rjf: gather lister items
DF_AutoCompListerItemChunkList item_list = {0};
@@ -4257,7 +4259,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_dbgi_voff(dbgi, thread_rip_voff);
EVAL_String2NumMap *locals_map = df_query_cached_locals_map_from_dbgi_key_voff(&dbgi_key, thread_rip_voff);
for(EVAL_String2NumMapNode *n = locals_map->first; n != 0; n = n->order_next)
{
DF_AutoCompListerItem item = {0};
@@ -9936,9 +9938,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
U64 rip_voff = df_voff_from_vaddr(module, rip_vaddr);
String8 symbol = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
String8 symbol = df_symbol_name_from_dbgi_key_voff(scratch.arena, &dbgi_key, 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);
@@ -10132,8 +10134,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 *dbgi = df_dbgi_from_module(module);
String8 procedure_name = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
String8 procedure_name = df_symbol_name_from_dbgi_key_voff(scratch.arena, &dbgi_key, rip_voff);
if(procedure_name.size != 0)
{
FuzzyMatchRangeList fuzzy_matches = {0};
@@ -10576,7 +10578,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
U64 thread_rip_voff = df_voff_from_vaddr(module, thread_rip_vaddr);
// rjf: thread info => color
@@ -10643,7 +10645,7 @@ df_code_slice(DF_Window *ws, DF_CtrlCtx *ctrl_ctx, EVAL_ParseCtx *parse_ctx, DF_
n != 0;
n = n->next)
{
if(n->v.dbgi == dbgi)
if(di_key_match(&n->v.dbgi_key, &dbgi_key))
{
line_info = &n->v;
break;
@@ -11251,11 +11253,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.dbgi, 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_key, 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.dbgi, 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_key, params->line_dasm2src[line_slice_idx].first->v.voff_range.min);
}
}
@@ -11419,7 +11421,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_dbgi = df_get_hovered_line_info_dbgi();
DI_Key hovered_line_dbgi_key = df_get_hovered_line_info_dbgi_key();
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
@@ -11494,12 +11496,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_dbgis.first; n != 0; n = n->next)
for(DI_KeyNode *n = params->relevant_dbgi_keys.first; n != 0; n = n->next)
{
DF_Entity *dbgi = n->entity;
DI_Key dbgi_key = n->v;
if(!mapped_special && token->kind == TXT_TokenKind_Identifier)
{
U64 voff = df_voff_from_dbgi_symbol_name(dbgi, token_string);
U64 voff = df_voff_from_dbgi_key_symbol_name(&dbgi_key, token_string);
if(voff != 0)
{
mapped_special = 1;
@@ -11509,7 +11511,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_dbgi_name(dbgi, token_string);
U64 type_num = df_type_num_from_dbgi_key_name(&dbgi_key, token_string);
if(type_num != 0)
{
mapped_special = 1;
@@ -11701,7 +11703,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.dbgi == hovered_line_dbgi &&
di_key_match(&n->v.dbgi_key, &hovered_line_dbgi_key) &&
n->v.voff_range.min <= hovered_line_voff && hovered_line_voff < n->v.voff_range.max)
{
matches = 1;
@@ -11714,8 +11716,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 *dbgi = dasm2src_list->first->v.dbgi;
if(dbgi == hovered_line_dbgi)
DI_Key dbgi_key = dasm2src_list->first->v.dbgi_key;
if(di_key_match(&dbgi_key, &dasm2src_list->first->v.dbgi_key))
{
for(DF_TextLineDasm2SrcInfoNode *n = dasm2src_list->first; n != 0; n = n->next)
{
@@ -12813,6 +12815,7 @@ df_gfx_init(OS_WindowRepaintFunctionType *window_repaint_entry_point, DF_StateDe
df_gfx_state->repaint_hook = window_repaint_entry_point;
df_gfx_state->cfg_main_font_path_arena = arena_alloc();
df_gfx_state->cfg_code_font_path_arena = arena_alloc();
df_gfx_state->hover_line_arena = arena_alloc();
df_clear_bindings();
// rjf: register gfx layer views
@@ -13822,7 +13825,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_dbgi = df_handle_zero();
MemoryZeroStruct(&df_gfx_state->hover_line_dbgi_key);
df_gfx_state->hover_line_voff = 0;
}
+5 -4
View File
@@ -405,7 +405,7 @@ struct DF_CodeSliceParams
DF_EntityList *line_pins;
DF_TextLineDasm2SrcInfoList *line_dasm2src;
DF_TextLineSrc2DasmInfoList *line_src2dasm;
DF_EntityList relevant_dbgis;
DI_KeyList relevant_dbgi_keys;
// rjf: visual parameters
F_Tag font;
@@ -714,7 +714,8 @@ struct DF_GfxState
DF_DragDropState drag_drop_state;
// rjf: hover line info correllation state
DF_Handle hover_line_dbgi;
Arena *hover_line_arena;
DI_Key hover_line_dbgi_key;
U64 hover_line_voff;
B32 hover_line_set_this_frame;
@@ -871,8 +872,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 *dbgi, U64 voff);
internal DF_Entity *df_get_hovered_line_info_dbgi(void);
internal void df_set_hovered_line_info(DI_Key *dbgi_key, U64 voff);
internal DI_Key df_get_hovered_line_info_dbgi_key(void);
internal U64 df_get_hovered_line_info_voff(void);
////////////////////////////////
+42 -56
View File
@@ -646,7 +646,7 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
//- rjf: calculate top-level keys, expand root-level, grab root expansion node
DF_ExpandKey parent_key = df_expand_key_make(5381, 0);
@@ -657,11 +657,10 @@ df_eval_viz_block_list_from_watch_view_state(Arena *arena, DI_Scope *di_scope, F
//- 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;
FZY_DbgiKey key = {df_full_path_from_entity(scratch.arena, dbgi), dbgi->timestamp};
FZY_Params params = {fzy_target};
{
params.dbgi_keys.count = 1;
params.dbgi_keys.v = &key;
params.dbgi_keys.v = &dbgi_key;
}
FZY_ItemArray items = fzy_items_from_key_params_query(fzy_scope, fuzzy_search_key, &params, filter, os_now_microseconds()+100, &items_stale);
if(items_stale)
@@ -3237,30 +3236,19 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
FZY_Scope *fzy_scope = fzy_scope_open();
F32 row_height_px = floor_f32(ui_top_font_size()*2.5f);
String8 query = str8(view->query_buffer, view->query_string_size);
DF_EntityList dbgis_list = df_push_active_dbgi_list(scratch.arena);
DF_EntityArray dbgis = df_entity_array_from_list(scratch.arena, &dbgis_list);
DI_KeyList dbgi_keys_list = df_push_active_dbgi_key_list(scratch.arena);
DI_KeyArray dbgi_keys = di_key_array_from_list(scratch.arena, &dbgi_keys_list);
FZY_Params params = {FZY_Target_Procedures, dbgi_keys};
U64 endt_us = os_now_microseconds()+200;
//- rjf: produce fuzzy search parameters
FZY_Params params = {FZY_Target_Procedures};
{
params.dbgi_keys.count = dbgis.count;
params.dbgi_keys.v = push_array(scratch.arena, FZY_DbgiKey, params.dbgi_keys.count);
for(U64 idx = 0; idx < params.dbgi_keys.count; idx += 1)
{
params.dbgi_keys.v[idx].path = df_full_path_from_entity(scratch.arena, dbgis.v[idx]);
params.dbgi_keys.v[idx].timestamp = dbgis.v[idx]->timestamp;
}
}
//- rjf: grab rdis, make type graphs for each
U64 rdis_count = dbgis.count;
U64 rdis_count = dbgi_keys.count;
RDI_Parsed **rdis = push_array(scratch.arena, RDI_Parsed *, rdis_count);
TG_Graph **graphs = push_array(scratch.arena, TG_Graph *, rdis_count);
{
for(U64 idx = 0; idx < rdis_count; idx += 1)
{
rdis[idx] = di_rdi_from_path_min_timestamp(di_scope, params.dbgi_keys.v[idx].path, params.dbgi_keys.v[idx].timestamp, endt_us);
rdis[idx] = di_rdi_from_key(di_scope, &dbgi_keys.v[idx], endt_us);
graphs[idx] = tg_graph_begin(rdi_addr_size_from_arch(rdis[idx]->top_level_info->architecture), 256);
}
}
@@ -3341,7 +3329,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
FZY_Item *item = &items.v[idx];
//- rjf: determine dbgi/rdi to which this item belongs
DF_Entity *dbgi = &df_g_nil_entity;
DI_Key dbgi_key = {0};
RDI_Parsed *rdi = &di_rdi_parsed_nil;
TG_Graph *graph = 0;
U64 base_idx = 0;
@@ -3350,7 +3338,7 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
{
if(base_idx <= item->idx && item->idx < base_idx + rdis[rdi_idx]->procedures_count)
{
dbgi = dbgis.v[rdi_idx];
dbgi_key = dbgi_keys.v[rdi_idx];
rdi = rdis[rdi_idx];
graph = graphs[rdi_idx];
break;
@@ -3398,8 +3386,8 @@ DF_VIEW_UI_FUNCTION_DEF(SymbolLister)
}
if(ui_hovering(sig)) UI_Tooltip
{
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);
U64 binary_voff = df_voff_from_dbgi_key_symbol_name(&dbgi_key, name);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, 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);
@@ -4794,8 +4782,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 *dbgi = df_dbgi_from_module(module);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, rip_voff);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
DF_TextLineDasm2SrcInfo line_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, 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);
@@ -5266,9 +5254,9 @@ DF_VIEW_UI_FUNCTION_DEF(Modules)
B32 brw_is_selected = (row_is_selected && cursor.x == 3);
// rjf: unpack module info
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);
DI_Key dbgi_key = df_dbgi_key_from_module(entity);
String8 dbgi_path = dbgi_key.path;
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
B32 dbgi_is_valid = (rdi != &di_rdi_parsed_nil);
// rjf: begin editing
@@ -5598,8 +5586,8 @@ DF_VIEW_CMD_FUNCTION_DEF(Code)
if(src2dasm_list->first != 0)
{
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
DI_Key dbgi_key = src2dasm_list->first->v.dbgi_key;
DF_EntityList possible_modules = df_modules_from_dbgi_key(scratch.arena, &dbgi_key);
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)
@@ -5901,8 +5889,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 *dbgi = df_dbgi_from_module(module);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, rip_voff);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
DF_TextLineDasm2SrcInfo dasm2src_info = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, 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;
@@ -5933,7 +5921,7 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
{
MemoryCopy(code_slice_params.line_src2dasm, src2dasm.v, sizeof(DF_TextLineSrc2DasmInfoList)*src2dasm.count);
}
code_slice_params.relevant_dbgis = src2dasm.dbgis;
code_slice_params.relevant_dbgi_keys = src2dasm.dbgi_keys;
}
}
@@ -6249,8 +6237,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
if(src2dasm_list->first != 0)
{
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
DI_Key dbgi_key = src2dasm_list->first->v.dbgi_key;
DF_EntityList possible_modules = df_modules_from_dbgi_key(scratch.arena, &dbgi_key);
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)
@@ -6306,8 +6294,8 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
if(src2dasm_list->first != 0)
{
Rng1U64 voff_rng = src2dasm_list->first->v.voff_range;
DF_Entity *dbgi = src2dasm_list->first->v.dbgi;
DF_EntityList possible_modules = df_modules_from_dbgi(scratch.arena, dbgi);
DI_Key dbgi_key = src2dasm_list->first->v.dbgi_key;
DF_EntityList possible_modules = df_modules_from_dbgi_key(scratch.arena, &dbgi_key);
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);
@@ -6466,18 +6454,18 @@ DF_VIEW_UI_FUNCTION_DEF(Code)
//
B32 file_is_out_of_date = 0;
String8 out_of_date_dbgi_name = {0};
for(DF_EntityNode *n = code_slice_params.relevant_dbgis.first; n != 0; n = n->next)
for(DI_KeyNode *n = code_slice_params.relevant_dbgi_keys.first; n != 0; n = n->next)
{
DF_Entity *dbgi = n->entity;
if(!df_entity_is_nil(dbgi))
DI_Key key = n->v;
if(key.path.size != 0)
{
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);
if(dbgi->timestamp < info.timestamp)
if(key.min_timestamp < info.timestamp)
{
file_is_out_of_date = 1;
out_of_date_dbgi_name = dbgi->name;
out_of_date_dbgi_name = str8_skip_last_slash(key.path);
break;
}
}
@@ -6580,7 +6568,7 @@ DF_VIEW_CMD_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_dbgi = df_dbgi_from_module(dasm_module);
DI_Key dasm_dbgi_key = df_dbgi_key_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};
@@ -6591,8 +6579,7 @@ 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.dbg_path = df_full_path_from_entity(scratch.arena, dasm_dbgi);
dasm_params.dbg_timestamp = dasm_dbgi->timestamp;
dasm_params.dbgi_key = dasm_dbgi_key;
}
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash);
U128 dasm_text_hash = {0};
@@ -6835,7 +6822,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_dbgi = df_dbgi_from_module(dasm_module);
DI_Key dasm_dbgi_key = df_dbgi_key_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};
@@ -6846,8 +6833,7 @@ 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.dbg_path = df_full_path_from_entity(scratch.arena, dasm_dbgi);
dasm_params.dbg_timestamp = dasm_dbgi->timestamp;
dasm_params.dbgi_key = dasm_dbgi_key;
}
DASM_Info dasm_info = dasm_info_from_key_params(dasm_scope, dasm_key, &dasm_params, &dasm_data_hash);
U128 dasm_text_hash = {0};
@@ -6860,7 +6846,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
//////////////////////////////
//- rjf: is loading -> equip view with loading information
@@ -6949,7 +6935,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_dbgis, dbgi);
di_key_list_push(scratch.arena, &code_slice_params.relevant_dbgi_keys, &dbgi_key);
// rjf: fill text info
{
@@ -7031,7 +7017,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
for(S64 line_num = visible_line_num_range.min; line_num < visible_line_num_range.max; line_num += 1)
{
U64 vaddr = dasm_vaddr_range.min + dasm_inst_array_code_off_from_idx(&dasm_info.insts, line_num-1);
@@ -7040,7 +7026,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_dbgi_voff(dbgi, voff);
dasm2src_n->v = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, voff);
}
}
}
@@ -7210,9 +7196,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
U64 voff = df_voff_from_vaddr(module, vaddr);
DF_TextLineDasm2SrcInfo dasm2src = df_text_line_dasm2src_info_from_dbgi_voff(dbgi, voff);
DF_TextLineDasm2SrcInfo dasm2src = df_text_line_dasm2src_info_from_dbgi_key_voff(&dbgi_key, 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;
@@ -8552,9 +8538,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 *dbgi = df_dbgi_from_module(module);
DI_Key dbgi_key = df_dbgi_key_from_module(module);
U64 rip_voff = df_voff_from_vaddr(module, f_rip);
String8 symbol_name = df_symbol_name_from_dbgi_voff(scratch.arena, dbgi, rip_voff);
String8 symbol_name = df_symbol_name_from_dbgi_key_voff(scratch.arena, &dbgi_key, 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");
+4 -26
View File
@@ -22,7 +22,7 @@ fzy_hash_from_params(FZY_Params *params)
hash = fzy_hash_from_string(hash, str8_struct(&params->target));
for(U64 idx = 0; idx < params->dbgi_keys.count; idx += 1)
{
hash = fzy_hash_from_string(hash, str8_struct(&params->dbgi_keys.v[idx].timestamp));
hash = fzy_hash_from_string(hash, str8_struct(&params->dbgi_keys.v[idx].min_timestamp));
hash = fzy_hash_from_string(hash, params->dbgi_keys.v[idx].path);
}
return hash;
@@ -84,35 +84,13 @@ fzy_item_string_from_rdi_target_element_idx(RDI_Parsed *rdi, FZY_Target target,
return result;
}
internal void
fzy_dbgi_key_list_push(Arena *arena, FZY_DbgiKeyList *list, FZY_DbgiKey key)
{
FZY_DbgiKeyNode *n = push_array(arena, FZY_DbgiKeyNode, 1);
n->v = key;
SLLQueuePush(list->first, list->last, n);
list->count += 1;
}
internal FZY_DbgiKeyArray
fzy_dbgi_key_array_from_list(Arena *arena, FZY_DbgiKeyList *list)
{
FZY_DbgiKeyArray array = {0};
array.v = push_array(arena, FZY_DbgiKey, list->count);
U64 idx = 0;
for(FZY_DbgiKeyNode *n = list->first; n != 0; n = n->next, idx += 1)
{
array.v[idx] = n->v;
}
return array;
}
internal FZY_Params
fzy_params_copy(Arena *arena, FZY_Params *src)
{
FZY_Params dst = zero_struct;
MemoryCopyStruct(&dst, src);
dst.dbgi_keys.v = push_array(arena, FZY_DbgiKey, dst.dbgi_keys.count);
MemoryCopy(dst.dbgi_keys.v, src->dbgi_keys.v, sizeof(FZY_DbgiKey)*src->dbgi_keys.count);
dst.dbgi_keys.v = push_array(arena, DI_Key, dst.dbgi_keys.count);
MemoryCopy(dst.dbgi_keys.v, src->dbgi_keys.v, sizeof(DI_Key)*src->dbgi_keys.count);
for(U64 idx = 0; idx < dst.dbgi_keys.count; idx += 1)
{
dst.dbgi_keys.v[idx].path = push_str8_copy(arena, dst.dbgi_keys.v[idx].path);
@@ -422,7 +400,7 @@ fzy_search_thread__entry_point(void *p)
{
for(U64 idx = 0; idx < rdis_count; idx += 1)
{
rdis[idx] = di_rdi_from_path_min_timestamp(di_scope, params.dbgi_keys.v[idx].path, params.dbgi_keys.v[idx].timestamp, max_U64);
rdis[idx] = di_rdi_from_key(di_scope, &params.dbgi_keys.v[idx], max_U64);
}
}
+1 -32
View File
@@ -53,40 +53,11 @@ typedef enum FZY_Target
}
FZY_Target;
typedef struct FZY_DbgiKey FZY_DbgiKey;
struct FZY_DbgiKey
{
String8 path;
U64 timestamp;
};
typedef struct FZY_DbgiKeyNode FZY_DbgiKeyNode;
struct FZY_DbgiKeyNode
{
FZY_DbgiKeyNode *next;
FZY_DbgiKey v;
};
typedef struct FZY_DbgiKeyList FZY_DbgiKeyList;
struct FZY_DbgiKeyList
{
FZY_DbgiKeyNode *first;
FZY_DbgiKeyNode *last;
U64 count;
};
typedef struct FZY_DbgiKeyArray FZY_DbgiKeyArray;
struct FZY_DbgiKeyArray
{
FZY_DbgiKey *v;
U64 count;
};
typedef struct FZY_Params FZY_Params;
struct FZY_Params
{
FZY_Target target;
FZY_DbgiKeyArray dbgi_keys;
DI_KeyArray dbgi_keys;
};
////////////////////////////////
@@ -199,8 +170,6 @@ internal U64 fzy_hash_from_string(U64 seed, String8 string);
internal U64 fzy_hash_from_params(FZY_Params *params);
internal U64 fzy_item_num_from_array_element_idx__linear_search(FZY_ItemArray *array, U64 element_idx);
internal String8 fzy_item_string_from_rdi_target_element_idx(RDI_Parsed *rdi, FZY_Target target, U64 element_idx);
internal void fzy_dbgi_key_list_push(Arena *arena, FZY_DbgiKeyList *list, FZY_DbgiKey key);
internal FZY_DbgiKeyArray fzy_dbgi_key_array_from_list(Arena *arena, FZY_DbgiKeyList *list);
internal FZY_Params fzy_params_copy(Arena *arena, FZY_Params *src);
////////////////////////////////
+3
View File
@@ -1,10 +1,13 @@
__declspec(dllexport) int
loop_iteration(int it)
{
return 111;
#if 0
int sum = 0;
for(int i = 0; i < 1000; i += 1)
{
sum += it*i;
}
return sum;
#endif
}
+2 -2
View File
@@ -32,7 +32,6 @@
#include "hash_store/hash_store.h"
#include "file_stream/file_stream.h"
#include "text_cache/text_cache.h"
#include "dasm_cache/dasm_cache.h"
#include "path/path.h"
#include "txti/txti.h"
#include "coff/coff.h"
@@ -47,6 +46,7 @@
#include "regs/raddbgi/regs_raddbgi.h"
#include "type_graph/type_graph.h"
#include "dbgi/dbgi.h"
#include "dasm_cache/dasm_cache.h"
#include "fuzzy_search/fuzzy_search.h"
#include "demon/demon_inc.h"
#include "eval/eval_inc.h"
@@ -71,7 +71,6 @@
#include "hash_store/hash_store.c"
#include "file_stream/file_stream.c"
#include "text_cache/text_cache.c"
#include "dasm_cache/dasm_cache.c"
#include "path/path.c"
#include "txti/txti.c"
#include "coff/coff.c"
@@ -86,6 +85,7 @@
#include "regs/raddbgi/regs_raddbgi.c"
#include "type_graph/type_graph.c"
#include "dbgi/dbgi.c"
#include "dasm_cache/dasm_cache.c"
#include "fuzzy_search/fuzzy_search.c"
#include "demon/demon_inc.c"
#include "eval/eval_inc.c"