Skip to content

Commit b33a257

Browse files
committed
switch eval viz stringification, and lister completions, over to working correctly with process-less (but not debug-info-less) evaluations
1 parent c8c25c0 commit b33a257

File tree

4 files changed

+42
-9
lines changed

4 files changed

+42
-9
lines changed

src/eval/eval_core.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,18 @@ e_dbg_info_from_module(E_Module *module)
760760
return result;
761761
}
762762

763+
internal E_DbgInfo *
764+
e_dbg_info_from_type_key(E_TypeKey type_key)
765+
{
766+
E_DbgInfo *result = &e_dbg_info_nil;
767+
if(type_key.kind == E_TypeKeyKind_Ext &&
768+
0 < type_key.u32[2] && type_key.u32[2] <= e_base_ctx->dbg_infos_count)
769+
{
770+
result = &e_base_ctx->dbg_infos[type_key.u32[2]-1];
771+
}
772+
return result;
773+
}
774+
763775
////////////////////////////////
764776
//~ rjf: Cache Accessing Functions
765777

src/eval/eval_core.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ struct E_TypeKey
174174
E_TypeKeyKind kind;
175175
U32 u32[3];
176176
// [0] -> E_TypeKind (Basic, Cons, Ext); Arch (Reg, RegAlias)
177-
// [1] -> Type Index In RDI (Ext); Code (Reg, RegAlias); Type Index In Constructed (Cons)
178-
// [2] -> RDI Index (Ext)
177+
// [1] -> Type Index In Debug Info (Ext); Code (Reg, RegAlias); Type Index In Constructed (Cons)
178+
// [2] -> Debug Info Number (Ext)
179179
};
180180

181181
typedef struct E_TypeKeyNode E_TypeKeyNode;
@@ -1222,6 +1222,7 @@ internal void e_select_ir_ctx(E_IRCtx *ctx);
12221222
//~ rjf: Context Accessors
12231223

12241224
internal E_DbgInfo *e_dbg_info_from_module(E_Module *module);
1225+
internal E_DbgInfo *e_dbg_info_from_type_key(E_TypeKey type_key);
12251226

12261227
////////////////////////////////
12271228
//~ rjf: Base Cache Accessing Functions

src/eval_visualization/eval_visualization_core.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1915,6 +1915,15 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
19151915
}
19161916
}
19171917
E_DbgInfo *dbg_info = e_dbg_info_from_module(module);
1918+
if(dbg_info == &e_dbg_info_nil)
1919+
{
1920+
dbg_info = e_dbg_info_from_type_key(type_key);
1921+
}
1922+
U32 dbg_info_num = 0;
1923+
if(dbg_info != &e_dbg_info_nil)
1924+
{
1925+
dbg_info_num = (U32)(dbg_info - e_base_ctx->dbg_infos) + 1;
1926+
}
19181927
RDI_Parsed *rdi = dbg_info->rdi;
19191928
U64 voff = vaddr - module->vaddr_range.min;
19201929
B32 good_symbol_match = 0;
@@ -1964,7 +1973,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
19641973
if(inline_site != 0)
19651974
{
19661975
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, inline_site->type_idx);
1967-
E_TypeKey type = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), inline_site->type_idx, module->dbg_info_num);
1976+
E_TypeKey type = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), inline_site->type_idx, dbg_info_num);
19681977
String8 name = {0};
19691978
name.str = rdi_string_from_idx(rdi, inline_site->name_string_idx, &name.size);
19701979
if(inline_site->type_idx != 0)
@@ -1994,7 +2003,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
19942003
U64 proc_idx = scope->proc_idx;
19952004
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, proc_idx);
19962005
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, procedure->type_idx);
1997-
E_TypeKey type = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), procedure->type_idx, module->dbg_info_num);
2006+
E_TypeKey type = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), procedure->type_idx, dbg_info_num);
19982007
String8 name = {0};
19992008
name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &name.size);
20002009
if(procedure->type_idx != 0)

src/raddbg/raddbg_core.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2224,11 +2224,22 @@ rd_view_ui(Rng2F32 rect)
22242224
{
22252225
default:
22262226
{
2227-
U64 vaddr = eval.value.u64;
2228-
CTRL_Entity *process = rd_ctrl_entity_from_eval_space(eval.space);
2229-
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
2230-
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
2231-
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
2227+
U64 voff = 0;
2228+
DI_Key dbgi_key = {0};
2229+
if(eval.space.kind == CTRL_EvalSpaceKind_Entity)
2230+
{
2231+
U64 vaddr = eval.value.u64;
2232+
CTRL_Entity *process = rd_ctrl_entity_from_eval_space(eval.space);
2233+
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, vaddr);
2234+
dbgi_key = ctrl_dbgi_key_from_module(module);
2235+
voff = ctrl_voff_from_vaddr(module, vaddr);
2236+
}
2237+
else
2238+
{
2239+
voff = eval.value.u64;
2240+
E_DbgInfo *dbg_info = e_dbg_info_from_type_key(eval.irtree.type_key);
2241+
dbgi_key = dbg_info->dbgi_key;
2242+
}
22322243
{
22332244
Access *access = access_open();
22342245
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);

0 commit comments

Comments
 (0)