mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 09:18:09 +00:00
get debugger onto new location info & symbol format
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ commands =
|
||||
//- rjf: [raddbg]
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg meta telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg debug telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
//- rjf: [raddbg wsl]
|
||||
// .f1 = { .win = "wsl ./build.sh raddbg", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
|
||||
|
||||
@@ -4329,9 +4329,9 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
|
||||
U32 *ids = rdi_matches_from_map_node(rdi, node, &id_count);
|
||||
if(id_count > 0)
|
||||
{
|
||||
RDI_GlobalVariable *global_var = rdi_element_from_name_idx(rdi, GlobalVariables, ids[0]);
|
||||
U64 global_var_voff = global_var->voff;
|
||||
U64 global_var_vaddr = global_var->voff + module->vaddr_range.min;
|
||||
RDI_Symbol *global_var = rdi_element_from_name_idx(rdi, GlobalVariableSymbols, ids[0]);
|
||||
U64 global_var_voff = rdi_voff_from_location(global_var->location);
|
||||
U64 global_var_vaddr = global_var_voff + module->vaddr_range.min;
|
||||
Arch arch = process->arch;
|
||||
U64 addr_size = bit_size_from_arch(arch)/8;
|
||||
dmn_process_read(ev->process, r1u64(global_var_vaddr, global_var_vaddr+addr_size), &asan_shadow_base_vaddr);
|
||||
@@ -5709,7 +5709,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
@@ -5743,7 +5743,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
@@ -5773,7 +5773,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
@@ -5801,7 +5801,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
@@ -5835,7 +5835,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
@@ -5880,7 +5880,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
|
||||
procedure_id = ids[0];
|
||||
}
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_id);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, procedure_id);
|
||||
U64 voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
if(voff != 0)
|
||||
{
|
||||
|
||||
+8
-14
@@ -1157,17 +1157,11 @@ di_search_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *
|
||||
switch(section_kind)
|
||||
{
|
||||
default:{}break;
|
||||
case RDI_SectionKind_Procedures:
|
||||
case RDI_SectionKind_ProcedureSymbols:
|
||||
case RDI_SectionKind_GlobalVariableSymbols:
|
||||
case RDI_SectionKind_ThreadVariableSymbols:
|
||||
{
|
||||
element_name_idx_off = OffsetOf(RDI_Procedure, name_string_idx);
|
||||
}break;
|
||||
case RDI_SectionKind_GlobalVariables:
|
||||
{
|
||||
element_name_idx_off = OffsetOf(RDI_GlobalVariable, name_string_idx);
|
||||
}break;
|
||||
case RDI_SectionKind_ThreadVariables:
|
||||
{
|
||||
element_name_idx_off = OffsetOf(RDI_ThreadVariable, name_string_idx);
|
||||
element_name_idx_off = OffsetOf(RDI_Symbol, name_string_idx);
|
||||
}break;
|
||||
case RDI_SectionKind_UDTs:
|
||||
{
|
||||
@@ -1568,10 +1562,10 @@ di_match_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *g
|
||||
};
|
||||
read_only local_persist RDI_SectionKind name_map_section_kinds[] =
|
||||
{
|
||||
RDI_SectionKind_GlobalVariables,
|
||||
RDI_SectionKind_ThreadVariables,
|
||||
RDI_SectionKind_Constants,
|
||||
RDI_SectionKind_Procedures,
|
||||
RDI_SectionKind_GlobalVariableSymbols,
|
||||
RDI_SectionKind_ThreadVariableSymbols,
|
||||
RDI_SectionKind_ConstantSymbols,
|
||||
RDI_SectionKind_ProcedureSymbols,
|
||||
RDI_SectionKind_TypeNodes,
|
||||
};
|
||||
Rng1U64 range = lane_range(dbgi_keys.count);
|
||||
|
||||
+1
-1
@@ -419,7 +419,7 @@ dasm_artifact_create(String8 key, B32 *cancel_signal, B32 *retry_out, U64 *gen_o
|
||||
{
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, scope_idx);
|
||||
RDI_U32 procedure_idx = scope->proc_idx;
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_idx);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, procedure_idx);
|
||||
String8 procedure_name = {0};
|
||||
procedure_name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &procedure_name.size);
|
||||
if(procedure_name.size != 0)
|
||||
|
||||
+94
-3
@@ -590,7 +590,7 @@ e_push_locals_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff)
|
||||
U32 local_opl_idx = scope->local_first + scope->local_count;
|
||||
for(U32 local_idx = scope->local_first; local_idx < local_opl_idx; local_idx += 1)
|
||||
{
|
||||
RDI_Local *local_var = rdi_element_from_name_idx(rdi, Locals, local_idx);
|
||||
RDI_Symbol *local_var = rdi_element_from_name_idx(rdi, LocalVariableSymbols, local_idx);
|
||||
U64 local_name_size = 0;
|
||||
U8 *local_name_str = rdi_string_from_idx(rdi, local_var->name_string_idx, &local_name_size);
|
||||
String8 name = push_str8_copy(arena, str8(local_name_str, local_name_size));
|
||||
@@ -612,10 +612,10 @@ e_push_member_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff)
|
||||
|
||||
//- rjf: tightest scope -> procedure
|
||||
U32 proc_idx = tightest_scope->proc_idx;
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, proc_idx);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, proc_idx);
|
||||
|
||||
//- rjf: procedure -> udt
|
||||
U32 udt_idx = procedure->container_idx;
|
||||
U32 udt_idx = procedure->container_flags & RDI_ContainerFlag_KindMask == RDI_ContainerKind_Type ? procedure->container_idx : 0;
|
||||
RDI_UDT *udt = rdi_element_from_name_idx(rdi, UDTs, udt_idx);
|
||||
|
||||
//- rjf: build blank map
|
||||
@@ -644,6 +644,97 @@ e_push_member_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff)
|
||||
return map;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Location Info -> Eval Op List
|
||||
|
||||
internal E_OpList
|
||||
e_oplist_from_location(Arena *arena, RDI_Parsed *rdi, RDI_Location loc)
|
||||
{
|
||||
E_OpList result = {0};
|
||||
B32 need_extra_memread = 0;
|
||||
switch((RDI_LocationKindEnum)rdi_kind_from_location(loc))
|
||||
{
|
||||
case RDI_LocationKind_NULL:
|
||||
case RDI_LocationKind_Set:{}break;
|
||||
|
||||
//- rjf: bytecode
|
||||
case RDI_LocationKind_AddrBytecodeStream:
|
||||
case RDI_LocationKind_ValBytecodeStream:
|
||||
{
|
||||
U64 all_bytecode_size = 0;
|
||||
U8 *all_bytecode = rdi_table_from_name(rdi, LocationsBytecodeData, &all_bytecode_size);
|
||||
U64 bytecode_first_idx = rdi_bytecode_data_off_from_location(loc);
|
||||
bytecode_first_idx = Min(bytecode_first_idx, all_bytecode_size);
|
||||
U64 bytecode_opl_idx = bytecode_first_idx;
|
||||
for(U64 off = bytecode_first_idx, next_off = all_bytecode_size; off < all_bytecode_size; off = next_off)
|
||||
{
|
||||
next_off = all_bytecode_size;
|
||||
U8 opcode = all_bytecode[off];
|
||||
if(opcode == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
U16 ctrlbits = rdi_eval_op_ctrlbits_table[opcode];
|
||||
U32 p_size = RDI_DECODEN_FROM_CTRLBITS(ctrlbits);
|
||||
bytecode_opl_idx += (1 + p_size);
|
||||
next_off = (off + 1 + p_size);
|
||||
}
|
||||
String8 bytecode = str8(all_bytecode + bytecode_first_idx, (bytecode_opl_idx - bytecode_first_idx));
|
||||
e_oplist_push_bytecode(arena, &result, bytecode);
|
||||
}break;
|
||||
|
||||
//- rjf: reg + off
|
||||
case RDI_LocationKind_AddrRegPlusU16: goto reg_plus_off;
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16: need_extra_memread = 1; goto reg_plus_off;
|
||||
reg_plus_off:;
|
||||
{
|
||||
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
|
||||
Arch arch = arch_from_rdi_arch(tli->arch);
|
||||
U64 arch_addr_bytesize = byte_size_from_arch(arch);
|
||||
RDI_RegCode regcode = rdi_regcode_from_location(loc);
|
||||
U64 reg_off = rdi_regoff_from_location(loc);
|
||||
e_oplist_push_op(arena, &result, RDI_EvalOp_RegRead, e_value_u64(RDI_EncodeRegReadParam(regcode, arch_addr_bytesize, 0)));
|
||||
e_oplist_push_uconst(arena, &result, reg_off);
|
||||
e_oplist_push_op(arena, &result, RDI_EvalOp_Add, e_value_u64(0));
|
||||
if(need_extra_memread)
|
||||
{
|
||||
e_oplist_push_op(arena, &result, RDI_EvalOp_MemRead, e_value_u64(arch_addr_bytesize));
|
||||
}
|
||||
}break;
|
||||
|
||||
//- rjf: reg
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
|
||||
Arch arch = arch_from_rdi_arch(tli->arch);
|
||||
RDI_RegCode rdi_regcode = rdi_regcode_from_location(loc);
|
||||
REGS_RegCode regs_reg_code = regs_reg_code_from_arch_rdi_code(arch, rdi_regcode);
|
||||
REGS_Rng reg_rng = regs_reg_code_rng_table_from_arch(arch)[regs_reg_code];
|
||||
U64 byte_size = (U64)reg_rng.byte_size;
|
||||
U64 byte_pos = 0;
|
||||
e_oplist_push_op(arena, &result, RDI_EvalOp_RegRead, e_value_u64(RDI_EncodeRegReadParam(rdi_regcode, byte_size, byte_pos)));
|
||||
}break;
|
||||
|
||||
//- rjf: space offsets
|
||||
case RDI_LocationKind_ModuleOff:
|
||||
{
|
||||
U64 voff = rdi_voff_from_location(loc);
|
||||
e_oplist_push_op(arena, &result, RDI_EvalOp_ModuleOff, e_value_u64(voff));
|
||||
}break;
|
||||
case RDI_LocationKind_TLSOff:
|
||||
{
|
||||
U64 toff = rdi_toff_from_location(loc);
|
||||
e_oplist_push_op(arena, &result, RDI_EvalOp_TLSOff, e_value_u64(toff));
|
||||
}break;
|
||||
case RDI_LocationKind_ConstantDataOff:
|
||||
{
|
||||
U64 constant_data_off = rdi_constant_data_off_from_location(loc);
|
||||
e_oplist_push_uconst(arena, &result, constant_data_off);
|
||||
}break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cache Creation & Selection
|
||||
|
||||
|
||||
@@ -1075,7 +1075,7 @@ struct E_Cache
|
||||
E_CacheParentNode *free_parent_node;
|
||||
|
||||
//- rjf: unpacked context
|
||||
RDI_Procedure *thread_ip_procedure;
|
||||
RDI_Symbol *thread_ip_procedure;
|
||||
|
||||
//- rjf: [types] JIT-constructed types tables
|
||||
U64 cons_id_gen;
|
||||
@@ -1208,6 +1208,11 @@ internal void e_auto_hook_map_insert_new_(Arena *arena, E_AutoHookMap *map, E_Au
|
||||
internal E_String2NumMap *e_push_locals_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff);
|
||||
internal E_String2NumMap *e_push_member_map_from_rdi_voff(Arena *arena, RDI_Parsed *rdi, U64 voff);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Location Info -> Eval Op List
|
||||
|
||||
internal E_OpList e_oplist_from_location(Arena *arena, RDI_Parsed *rdi, RDI_Location loc);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cache Creation & Selection
|
||||
|
||||
|
||||
+11
-32
@@ -12,43 +12,22 @@ e_select_interpret_ctx(E_InterpretCtx *ctx, RDI_Parsed *primary_rdi, U64 ip_voff
|
||||
// compute and apply frame base
|
||||
if(primary_rdi != 0)
|
||||
{
|
||||
E_Interpretation frame_base = { .code = ~0 };
|
||||
|
||||
RDI_Procedure *proc = rdi_procedure_from_voff(primary_rdi, ip_voff);
|
||||
for(U64 loc_block_idx = proc->frame_base_location_first; loc_block_idx < proc->frame_base_location_opl; loc_block_idx += 1)
|
||||
Temp scratch = scratch_begin(0, 0);
|
||||
RDI_Symbol *proc = rdi_procedure_from_voff(primary_rdi, ip_voff);
|
||||
RDI_Location location = rdi_location_from_location_voff(primary_rdi, proc->location, ip_voff);
|
||||
E_OpList oplist = e_oplist_from_location(scratch.arena, primary_rdi, location);
|
||||
String8 bytecode = e_bytecode_from_oplist(scratch.arena, &oplist);
|
||||
E_Interpretation frame_base_interpretation = e_interpret(bytecode);
|
||||
U64 frame_base = frame_base_interpretation.value.u64;
|
||||
if(frame_base_interpretation.code == E_InterpretationCode_Good)
|
||||
{
|
||||
RDI_LocationBlock *block = rdi_element_from_name_idx(primary_rdi, LocationBlocks, loc_block_idx);
|
||||
if (block->scope_off_first <= ip_voff && ip_voff < block->scope_off_opl) {
|
||||
U64 all_location_data_size = 0;
|
||||
U8 *all_location_data = rdi_table_from_name(primary_rdi, LocationData, &all_location_data_size);
|
||||
if(block->location_data_off + sizeof(RDI_LocationKind) <= all_location_data_size)
|
||||
{
|
||||
RDI_LocationKind loc_kind = *(RDI_LocationKind *)(all_location_data + block->location_data_off);
|
||||
if(loc_kind == RDI_LocationKind_ValBytecodeStream || loc_kind == RDI_LocationKind_AddrBytecodeStream)
|
||||
{
|
||||
U8 *bytecode_ptr = all_location_data + block->location_data_off;
|
||||
U8 *bytecode_opl = all_location_data + all_location_data_size;
|
||||
U64 bytecode_size = rdi_size_from_bytecode_stream(bytecode_ptr, bytecode_opl);
|
||||
String8 bytecode = str8(bytecode_ptr + sizeof(RDI_LocationKind), bytecode_size);
|
||||
frame_base = e_interpret(bytecode);
|
||||
}
|
||||
else if(loc_kind != RDI_LocationKind_NULL)
|
||||
{
|
||||
NotImplemented;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(frame_base.code == E_InterpretationCode_Good)
|
||||
{
|
||||
*ctx->frame_base = frame_base.value.u64;
|
||||
*ctx->frame_base = frame_base;
|
||||
}
|
||||
else
|
||||
{
|
||||
ctx->frame_base = 0;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -960,7 +939,7 @@ e_interpret(String8 bytecode)
|
||||
// TODO: add support for pushing multiple values onto the stack
|
||||
NotImplemented;
|
||||
}break;
|
||||
|
||||
|
||||
case RDI_EvalOp_PushCfa:
|
||||
{
|
||||
nval.u64 = e_interpret_ctx->cfa;
|
||||
|
||||
+59
-79
@@ -971,18 +971,18 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
E_DbgInfo *dbg_info = e_dbg_info_from_module(module);
|
||||
U64 voff = interpretation.value.u64 - module->vaddr_range.min;
|
||||
U64 new_vaddr = 0;
|
||||
RDI_Procedure *p = rdi_procedure_from_voff(dbg_info->rdi, voff);
|
||||
RDI_GlobalVariable *g = rdi_global_variable_from_voff(dbg_info->rdi, voff);
|
||||
RDI_Symbol *p = rdi_procedure_from_voff(dbg_info->rdi, voff);
|
||||
RDI_Symbol *g = rdi_global_variable_from_voff(dbg_info->rdi, voff);
|
||||
U32 type_idx = 0;
|
||||
if(p->name_string_idx != 0)
|
||||
{
|
||||
type_idx = p->type_idx;
|
||||
new_vaddr = module->vaddr_range.min + rdi_first_voff_from_procedure(dbg_info->rdi, p);
|
||||
}
|
||||
else if(g->name_string_idx != 0)
|
||||
else if(g->name_string_idx != 0 && rdi_kind_from_location(g->location) == RDI_LocationKind_ModuleOff)
|
||||
{
|
||||
type_idx = g->type_idx;
|
||||
new_vaddr = module->vaddr_range.min + g->voff;
|
||||
new_vaddr = module->vaddr_range.min + rdi_voff_from_location(g->location);
|
||||
}
|
||||
if(type_idx != 0)
|
||||
{
|
||||
@@ -1692,8 +1692,8 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
B32 string_mapped = 0;
|
||||
B32 string_is_implicit_member_name = 0;
|
||||
E_TypeKey mapped_type_key = zero_struct;
|
||||
E_Module *mapped_location_block_module = &e_module_nil;
|
||||
RDI_LocationBlock *mapped_location_block = 0;
|
||||
E_Module *mapped_location_module = &e_module_nil;
|
||||
RDI_Location mapped_location = 0;
|
||||
E_Mode mapped_bytecode_mode = E_Mode_Offset;
|
||||
E_Space mapped_bytecode_space = zero_struct;
|
||||
String8 mapped_bytecode = {0};
|
||||
@@ -1788,7 +1788,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
E_Module *module = e_base_ctx->primary_module;
|
||||
E_DbgInfo *dbg_info = e_dbg_info_from_module(module);
|
||||
RDI_Parsed *rdi = dbg_info->rdi;
|
||||
RDI_Procedure *procedure = e_cache->thread_ip_procedure;
|
||||
RDI_Symbol *procedure = e_cache->thread_ip_procedure;
|
||||
RDI_UDT *udt = rdi_container_udt_from_procedure(rdi, procedure);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, udt->self_type_idx);
|
||||
E_TypeKey container_type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), udt->self_type_idx, module->dbg_info_num);
|
||||
@@ -1810,7 +1810,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
U64 local_num = e_num_from_string(e_ir_ctx->locals_map, string__redirected);
|
||||
if(local_num != 0)
|
||||
{
|
||||
RDI_Local *local = rdi_element_from_name_idx(rdi, Locals, local_num-1);
|
||||
RDI_Symbol *local = rdi_element_from_name_idx(rdi, LocalVariableSymbols, local_num-1);
|
||||
|
||||
// rjf: extract local's type key
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, local->type_idx);
|
||||
@@ -1819,16 +1819,12 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
// rjf: extract local's location block
|
||||
B32 got_location_block = 0;
|
||||
U64 ip_voff = e_base_ctx->thread_ip_voff;
|
||||
for(U32 loc_block_idx = local->location_first;
|
||||
loc_block_idx < local->location_opl;
|
||||
loc_block_idx += 1)
|
||||
{
|
||||
RDI_LocationBlock *block = rdi_element_from_name_idx(rdi, LocationBlocks, loc_block_idx);
|
||||
if(block->scope_off_first <= ip_voff && ip_voff < block->scope_off_opl)
|
||||
mapped_location = rdi_location_from_location_voff(rdi, local->location, ip_voff);
|
||||
if(mapped_location != 0)
|
||||
{
|
||||
mapped_location_block_module = module;
|
||||
mapped_location_block = block;
|
||||
got_location_block = 1;
|
||||
mapped_location_module = module;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1896,7 +1892,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
E_Module *module = e_base_ctx->primary_module;
|
||||
E_DbgInfo *dbg_info = e_dbg_info_from_module(module);
|
||||
RDI_Parsed *rdi = dbg_info->rdi;
|
||||
RDI_Procedure *procedure = e_cache->thread_ip_procedure;
|
||||
RDI_Symbol *procedure = e_cache->thread_ip_procedure;
|
||||
U64 name_size = 0;
|
||||
U8 *name_ptr = rdi_string_from_idx(rdi, procedure->name_string_idx, &name_size);
|
||||
String8 containing_procedure_name = str8(name_ptr, name_size);
|
||||
@@ -1962,72 +1958,30 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
switch(match.section_kind)
|
||||
{
|
||||
default:{}break;
|
||||
case RDI_SectionKind_GlobalVariables:
|
||||
case RDI_SectionKind_GlobalVariableSymbols:
|
||||
case RDI_SectionKind_ThreadVariableSymbols:
|
||||
case RDI_SectionKind_ConstantSymbols:
|
||||
{
|
||||
RDI_GlobalVariable *global_var = rdi_element_from_name_idx(rdi, GlobalVariables, match.idx);
|
||||
U32 type_idx = global_var->type_idx;
|
||||
RDI_Symbol *symbol = (RDI_Symbol *)rdi_section_raw_element_from_kind_idx(rdi, match.section_kind, match.idx);
|
||||
U64 ip_voff = e_base_ctx->thread_ip_voff;
|
||||
RDI_Location location = rdi_location_from_location_voff(rdi, symbol->location, ip_voff);
|
||||
U32 type_idx = symbol->type_idx;
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, type_idx);
|
||||
E_OpList oplist = {0};
|
||||
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU64, e_value_u64(module->vaddr_range.min + global_var->voff));
|
||||
string_mapped = 1;
|
||||
mapped_type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, dbg_info_num);
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
mapped_location = location;
|
||||
mapped_location_module = module;
|
||||
mapped_bytecode_mode = E_Mode_Offset;
|
||||
mapped_bytecode_space = module->space;
|
||||
}break;
|
||||
case RDI_SectionKind_ThreadVariables:
|
||||
case RDI_SectionKind_ProcedureSymbols:
|
||||
{
|
||||
RDI_ThreadVariable *thread_var = rdi_element_from_name_idx(rdi, ThreadVariables, match.idx);
|
||||
U32 type_idx = thread_var->type_idx;
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, type_idx);
|
||||
E_OpList oplist = {0};
|
||||
e_oplist_push_op(arena, &oplist, RDI_EvalOp_TLSOff, e_value_u64(thread_var->tls_off));
|
||||
string_mapped = 1;
|
||||
mapped_type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, dbg_info_num);
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
mapped_bytecode_mode = E_Mode_Offset;
|
||||
mapped_bytecode_space = module->space;
|
||||
}break;
|
||||
case RDI_SectionKind_Constants:
|
||||
{
|
||||
RDI_Constant *constant = rdi_element_from_name_idx(rdi, Constants, match.idx);
|
||||
U32 type_idx = constant->type_idx;
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, type_idx);
|
||||
RDI_U32 constant_value_off = *rdi_element_from_name_idx(rdi, ConstantValueTable, constant->constant_value_idx);
|
||||
RDI_U32 constant_value_size = *rdi_element_from_name_idx(rdi, ConstantValueTable, constant->constant_value_idx+1) - constant_value_off;
|
||||
if(constant_value_size <= 8)
|
||||
{
|
||||
RDI_U64 constant_value_data_size = 0;
|
||||
RDI_U8 *constant_value_data = rdi_table_from_name(rdi, ConstantValueData, &constant_value_data_size);
|
||||
if(0 <= constant_value_off && constant_value_off + constant_value_size <= constant_value_data_size)
|
||||
{
|
||||
RDI_U64 value = 0;
|
||||
MemoryCopy(&value, constant_value_data+constant_value_off, constant_value_size);
|
||||
E_OpList oplist = {0};
|
||||
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU64, e_value_u64(value));
|
||||
string_mapped = 1;
|
||||
mapped_type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, dbg_info_num);
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
mapped_bytecode_mode = E_Mode_Value;
|
||||
mapped_bytecode_space = module->space;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}break;
|
||||
case RDI_SectionKind_Procedures:
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, match.idx);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, procedure->root_scope_idx);
|
||||
U64 voff = *rdi_element_from_name_idx(rdi, ScopeVOffData, scope->voff_range_first);
|
||||
U32 type_idx = procedure->type_idx;
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, type_idx);
|
||||
E_OpList oplist = {0};
|
||||
e_oplist_push_op(arena, &oplist, RDI_EvalOp_ConstU64, e_value_u64(module->vaddr_range.min + voff));
|
||||
string_mapped = 1;
|
||||
mapped_type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), type_idx, dbg_info_num);
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
RDI_Symbol *procedure = (RDI_Symbol *)rdi_section_raw_element_from_kind_idx(rdi, match.section_kind, match.idx);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, procedure->type_idx);
|
||||
U64 procedure_base_voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
mapped_type_key = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), procedure->type_idx, dbg_info_num);
|
||||
mapped_location = rdi_location_voff(procedure_base_voff);
|
||||
mapped_location_module = module;
|
||||
mapped_bytecode_mode = E_Mode_Value;
|
||||
mapped_bytecode_space = module->space;
|
||||
}break;
|
||||
case RDI_SectionKind_TypeNodes:
|
||||
{
|
||||
@@ -2114,14 +2068,39 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
}break;
|
||||
}
|
||||
|
||||
//- rjf: mapped to location block -> extract or produce bytecode for this mapping
|
||||
if(!generated && mapped_location_block != 0)
|
||||
//- rjf: mapped to location -> extract or produce bytecode for this mapping
|
||||
if(!generated && mapped_location != 0 && mapped_bytecode.size == 0)
|
||||
{
|
||||
E_Module *module = mapped_location_block_module;
|
||||
E_Module *module = mapped_location_module;
|
||||
E_DbgInfo *dbg_info = e_dbg_info_from_module(module);
|
||||
E_Space space = module->space;
|
||||
Arch arch = module->arch;
|
||||
RDI_Parsed *rdi = dbg_info->rdi;
|
||||
RDI_Location location = mapped_location;
|
||||
E_OpList oplist = e_oplist_from_location(scratch.arena, rdi, location);
|
||||
// TODO(rjf): @locpass `space` needs to be set to the constant data space if needed
|
||||
mapped_bytecode = e_bytecode_from_oplist(arena, &oplist);
|
||||
mapped_bytecode_space = space;
|
||||
if(mapped_bytecode_mode == E_Mode_Null)
|
||||
{
|
||||
switch(rdi_kind_from_location(mapped_location))
|
||||
{
|
||||
default:{}break;
|
||||
case RDI_LocationKind_ValBytecodeStream:
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
mapped_bytecode_mode = E_Mode_Value;
|
||||
}break;
|
||||
case RDI_LocationKind_AddrBytecodeStream:
|
||||
case RDI_LocationKind_AddrRegPlusU16:
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16:
|
||||
{
|
||||
mapped_bytecode_mode = E_Mode_Offset;
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 //~TODO(rjf): OLD vvvvvvvvvvvv
|
||||
RDI_LocationBlock *block = mapped_location_block;
|
||||
U64 all_location_data_size = 0;
|
||||
U8 *all_location_data = rdi_table_from_name(rdi, LocationData, &all_location_data_size);
|
||||
@@ -2204,6 +2183,7 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
}break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
//- rjf: generate IR trees for bytecode
|
||||
@@ -2499,8 +2479,8 @@ e_push_irtree_and_type_from_expr(Arena *arena, E_IRTreeAndType *root_parent, E_I
|
||||
{
|
||||
U64 vtable_voff = vtable_vaddr - module_base;
|
||||
U64 global_idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_GlobalVMap, vtable_voff);
|
||||
RDI_GlobalVariable *global_var = rdi_element_from_name_idx(rdi, GlobalVariables, global_idx);
|
||||
if(global_var->link_flags & RDI_LinkFlag_TypeScoped)
|
||||
RDI_Symbol *global_var = rdi_element_from_name_idx(rdi, GlobalVariableSymbols, global_idx);
|
||||
if(global_var->container_flags & RDI_ContainerFlag_KindMask == RDI_ContainerKind_Type)
|
||||
{
|
||||
RDI_UDT *udt = rdi_element_from_name_idx(rdi, UDTs, global_var->container_idx);
|
||||
RDI_TypeNode *type = rdi_element_from_name_idx(rdi, TypeNodes, udt->self_type_idx);
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ struct E_IRState
|
||||
E_IRCtx *ctx;
|
||||
|
||||
// rjf: unpacked ctx
|
||||
RDI_Procedure *thread_ip_procedure;
|
||||
RDI_Symbol *thread_ip_procedure;
|
||||
|
||||
// rjf: overridden irtree
|
||||
E_IRTreeAndType *overridden_irtree;
|
||||
|
||||
@@ -2026,7 +2026,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, scope_idx);
|
||||
U64 proc_idx = scope->proc_idx;
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, proc_idx);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, proc_idx);
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, procedure->type_idx);
|
||||
E_TypeKey type = e_type_key_ext(e_type_kind_from_rdi(type_node->kind), procedure->type_idx, dbg_info_num);
|
||||
String8 name = {0};
|
||||
@@ -2065,7 +2065,7 @@ ev_string_iter_next(Arena *arena, EV_StringIter *it, String8 *out_string)
|
||||
RDI_Scope *scope = rdi_scope_from_voff(rdi, voff);
|
||||
|
||||
// rjf: scope -> procedure / string
|
||||
RDI_Procedure *procedure = rdi_procedure_from_scope(rdi, scope);
|
||||
RDI_Symbol *procedure = rdi_procedure_from_scope(rdi, scope);
|
||||
String8 procedure_name = {0};
|
||||
procedure_name.str = rdi_name_from_procedure(rdi, procedure, &procedure_name.size);
|
||||
|
||||
|
||||
+1
-10
@@ -10,7 +10,7 @@
|
||||
#ifndef RDI_C
|
||||
#define RDI_C
|
||||
|
||||
RDI_U16 rdi_section_element_size_table[53] =
|
||||
RDI_U16 rdi_section_element_size_table[44] =
|
||||
{
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_TopLevelInfo),
|
||||
@@ -35,17 +35,10 @@ sizeof(RDI_TypeNode),
|
||||
sizeof(RDI_UDT),
|
||||
sizeof(RDI_Member),
|
||||
sizeof(RDI_EnumMember),
|
||||
sizeof(RDI_GlobalVariable),
|
||||
sizeof(RDI_ThreadVariable),
|
||||
sizeof(RDI_Constant),
|
||||
sizeof(RDI_Procedure),
|
||||
sizeof(RDI_Local),
|
||||
sizeof(RDI_Scope),
|
||||
sizeof(RDI_U64),
|
||||
sizeof(RDI_VMapEntry),
|
||||
sizeof(RDI_InlineSite),
|
||||
sizeof(RDI_LocationBlock),
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_Symbol),
|
||||
sizeof(RDI_VMapEntry),
|
||||
sizeof(RDI_Symbol),
|
||||
@@ -55,8 +48,6 @@ sizeof(RDI_Symbol),
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_LocationSetElement),
|
||||
sizeof(RDI_U8),
|
||||
sizeof(RDI_U32),
|
||||
sizeof(RDI_MD5),
|
||||
sizeof(RDI_SHA1),
|
||||
sizeof(RDI_SHA256),
|
||||
|
||||
+24
-238
@@ -67,7 +67,7 @@ union RDI_GUID {RDI_U8 u8[16]; RDI_U64 u64[2];};
|
||||
|
||||
// "raddbg\0\0"
|
||||
#define RDI_MAGIC_CONSTANT 0x0000676264646172
|
||||
#define RDI_ENCODING_VERSION 21
|
||||
#define RDI_ENCODING_VERSION 22
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
//~ Format Types & Functions
|
||||
@@ -98,36 +98,27 @@ RDI_SectionKind_TypeNodes = 0x0013,
|
||||
RDI_SectionKind_UDTs = 0x0014,
|
||||
RDI_SectionKind_Members = 0x0015,
|
||||
RDI_SectionKind_EnumMembers = 0x0016,
|
||||
RDI_SectionKind_GlobalVariables = 0x0017,
|
||||
RDI_SectionKind_ThreadVariables = 0x0018,
|
||||
RDI_SectionKind_Constants = 0x0019,
|
||||
RDI_SectionKind_Procedures = 0x001A,
|
||||
RDI_SectionKind_Locals = 0x001B,
|
||||
RDI_SectionKind_Scopes = 0x001C,
|
||||
RDI_SectionKind_ScopeVOffData = 0x001D,
|
||||
RDI_SectionKind_ScopeVMap = 0x001E,
|
||||
RDI_SectionKind_InlineSites = 0x001F,
|
||||
RDI_SectionKind_LocationBlocks = 0x0020,
|
||||
RDI_SectionKind_LocationData = 0x0021,
|
||||
RDI_SectionKind_GlobalVariableSymbols = 0x0022,
|
||||
RDI_SectionKind_GlobalVMap = 0x0023,
|
||||
RDI_SectionKind_ThreadVariableSymbols = 0x0024,
|
||||
RDI_SectionKind_ConstantSymbols = 0x0025,
|
||||
RDI_SectionKind_ProcedureSymbols = 0x0026,
|
||||
RDI_SectionKind_LocalVariableSymbols = 0x0027,
|
||||
RDI_SectionKind_LocationsBytecodeData = 0x0028,
|
||||
RDI_SectionKind_LocationsConstantData = 0x0029,
|
||||
RDI_SectionKind_LocationsSetElements = 0x002A,
|
||||
RDI_SectionKind_ConstantValueData = 0x002B,
|
||||
RDI_SectionKind_ConstantValueTable = 0x002C,
|
||||
RDI_SectionKind_MD5Checksums = 0x002D,
|
||||
RDI_SectionKind_SHA1Checksums = 0x002E,
|
||||
RDI_SectionKind_SHA256Checksums = 0x002F,
|
||||
RDI_SectionKind_Timestamps = 0x0030,
|
||||
RDI_SectionKind_NameMaps = 0x0031,
|
||||
RDI_SectionKind_NameMapBuckets = 0x0032,
|
||||
RDI_SectionKind_NameMapNodes = 0x0033,
|
||||
RDI_SectionKind_COUNT = 0x0034,
|
||||
RDI_SectionKind_Scopes = 0x0017,
|
||||
RDI_SectionKind_ScopeVOffData = 0x0018,
|
||||
RDI_SectionKind_ScopeVMap = 0x0019,
|
||||
RDI_SectionKind_InlineSites = 0x001A,
|
||||
RDI_SectionKind_GlobalVariableSymbols = 0x001B,
|
||||
RDI_SectionKind_GlobalVMap = 0x001C,
|
||||
RDI_SectionKind_ThreadVariableSymbols = 0x001D,
|
||||
RDI_SectionKind_ConstantSymbols = 0x001E,
|
||||
RDI_SectionKind_ProcedureSymbols = 0x001F,
|
||||
RDI_SectionKind_LocalVariableSymbols = 0x0020,
|
||||
RDI_SectionKind_LocationsBytecodeData = 0x0021,
|
||||
RDI_SectionKind_LocationsConstantData = 0x0022,
|
||||
RDI_SectionKind_LocationsSetElements = 0x0023,
|
||||
RDI_SectionKind_MD5Checksums = 0x0024,
|
||||
RDI_SectionKind_SHA1Checksums = 0x0025,
|
||||
RDI_SectionKind_SHA256Checksums = 0x0026,
|
||||
RDI_SectionKind_Timestamps = 0x0027,
|
||||
RDI_SectionKind_NameMaps = 0x0028,
|
||||
RDI_SectionKind_NameMapBuckets = 0x0029,
|
||||
RDI_SectionKind_NameMapNodes = 0x002A,
|
||||
RDI_SectionKind_COUNT = 0x002B,
|
||||
} RDI_SectionKindEnum;
|
||||
|
||||
typedef RDI_U32 RDI_SectionEncoding;
|
||||
@@ -400,22 +391,6 @@ RDI_ContainerFlag_External = 1u<<7,
|
||||
RDI_ContainerFlag_KindMask = 0x7f,
|
||||
} RDI_ContainerFlagsEnum;
|
||||
|
||||
typedef RDI_U32 RDI_LinkFlags;
|
||||
typedef enum RDI_LinkFlagsEnum
|
||||
{
|
||||
RDI_LinkFlag_External = 1<<0,
|
||||
RDI_LinkFlag_TypeScoped = 1<<1,
|
||||
RDI_LinkFlag_ProcScoped = 1<<2,
|
||||
} RDI_LinkFlagsEnum;
|
||||
|
||||
typedef RDI_U32 RDI_LocalKind;
|
||||
typedef enum RDI_LocalKindEnum
|
||||
{
|
||||
RDI_LocalKind_NULL = 0x0,
|
||||
RDI_LocalKind_Parameter = 0x1,
|
||||
RDI_LocalKind_Variable = 0x2,
|
||||
} RDI_LocalKindEnum;
|
||||
|
||||
typedef RDI_U8 RDI_SymbolFlags;
|
||||
typedef enum RDI_SymbolFlagsEnum
|
||||
{
|
||||
@@ -564,17 +539,10 @@ X(TypeNodes, type_nodes, RDI_TypeNode)\
|
||||
X(UDTs, udts, RDI_UDT)\
|
||||
X(Members, members, RDI_Member)\
|
||||
X(EnumMembers, enum_members, RDI_EnumMember)\
|
||||
X(GlobalVariables, global_variables, RDI_GlobalVariable)\
|
||||
X(ThreadVariables, thread_variables, RDI_ThreadVariable)\
|
||||
X(Constants, constants, RDI_Constant)\
|
||||
X(Procedures, procedures, RDI_Procedure)\
|
||||
X(Locals, locals, RDI_Local)\
|
||||
X(Scopes, scopes, RDI_Scope)\
|
||||
X(ScopeVOffData, scope_voff_data, RDI_U64)\
|
||||
X(ScopeVMap, scope_vmap, RDI_VMapEntry)\
|
||||
X(InlineSites, inline_sites, RDI_InlineSite)\
|
||||
X(LocationBlocks, location_blocks, RDI_LocationBlock)\
|
||||
X(LocationData, location_data, RDI_U8)\
|
||||
X(GlobalVariableSymbols, global_variable_symbols, RDI_Symbol)\
|
||||
X(GlobalVMap, global_vmap, RDI_VMapEntry)\
|
||||
X(ThreadVariableSymbols, thread_variable_symbols, RDI_Symbol)\
|
||||
@@ -584,8 +552,6 @@ X(LocalVariableSymbols, local_variable_symbols, RDI_Symbol)\
|
||||
X(LocationsBytecodeData, locations_bytecode_data, RDI_U8)\
|
||||
X(LocationsConstantData, locations_constant_data, RDI_U8)\
|
||||
X(LocationsSetElements, locations_set_elements, RDI_LocationSetElement)\
|
||||
X(ConstantValueData, constant_value_data, RDI_U8)\
|
||||
X(ConstantValueTable, constant_value_table, RDI_U32)\
|
||||
X(MD5Checksums, md5_checksums, RDI_MD5)\
|
||||
X(SHA1Checksums, sha1_checksums, RDI_SHA1)\
|
||||
X(SHA256Checksums, sha256_checksums, RDI_SHA256)\
|
||||
@@ -913,14 +879,7 @@ X(RDI_U32, pad)\
|
||||
X(RDI_U64, val)\
|
||||
|
||||
#define RDI_LinkFlags_XList \
|
||||
X(External)\
|
||||
X(TypeScoped)\
|
||||
X(ProcScoped)\
|
||||
|
||||
#define RDI_LocalKind_XList \
|
||||
X(NULL)\
|
||||
X(Parameter)\
|
||||
X(Variable)\
|
||||
X($(a.name != COUNT -> a.name))\
|
||||
|
||||
#define RDI_LocationKind_XList \
|
||||
X(NULL)\
|
||||
@@ -950,30 +909,6 @@ X(RDI_U32, type_idx)\
|
||||
X(RDI_U32, root_scope_idx)\
|
||||
X(RDI_U32, link_name_string_idx)\
|
||||
|
||||
#define RDI_GlobalVariable_XList \
|
||||
X(RDI_U32, name_string_idx)\
|
||||
X(RDI_LinkFlags, link_flags)\
|
||||
X(RDI_U64, voff)\
|
||||
X(RDI_U32, type_idx)\
|
||||
X(RDI_U32, container_idx)\
|
||||
|
||||
#define RDI_ThreadVariable_XList \
|
||||
X(type, name_string_idx)\
|
||||
X(type, link_flags)\
|
||||
X(type, tls_off)\
|
||||
X(type, type_idx)\
|
||||
X(type, container_idx)\
|
||||
|
||||
#define RDI_Procedure_XList \
|
||||
X(RDI_U32, name_string_idx)\
|
||||
X(RDI_U32, link_name_string_idx)\
|
||||
X(RDI_LinkFlags, link_flags)\
|
||||
X(RDI_U32, type_idx)\
|
||||
X(RDI_U32, root_scope_idx)\
|
||||
X(RDI_U32, container_idx)\
|
||||
X(RDI_U32, frame_base_location_first)\
|
||||
X(RDI_U32, frame_base_location_opl)\
|
||||
|
||||
#define RDI_Scope_XList \
|
||||
X(RDI_U32, proc_idx)\
|
||||
X(RDI_U32, parent_scope_idx)\
|
||||
@@ -991,40 +926,6 @@ X(RDI_U32, type_idx)\
|
||||
X(RDI_U32, owner_type_idx)\
|
||||
X(RDI_U32, line_table_idx)\
|
||||
|
||||
#define RDI_Local_XList \
|
||||
X(RDI_LocalKind, kind)\
|
||||
X(RDI_U32, name_string_idx)\
|
||||
X(RDI_U32, type_idx)\
|
||||
X(RDI_U32, pad)\
|
||||
X(RDI_U32, location_first)\
|
||||
X(RDI_U32, location_opl)\
|
||||
|
||||
#define RDI_LocationBlock_XList \
|
||||
X(RDI_U32, scope_off_first)\
|
||||
X(RDI_U32, scope_off_opl)\
|
||||
X(RDI_U32, location_data_off)\
|
||||
|
||||
#define RDI_LocationBytecodeStream_XList \
|
||||
X(RDI_LocationKind, kind)\
|
||||
|
||||
#define RDI_LocationRegPlusU16_XList \
|
||||
X(RDI_LocationKind, kind)\
|
||||
X(RDI_RegCode, reg_code)\
|
||||
X(RDI_U16, offset)\
|
||||
|
||||
#define RDI_LocationReg_XList \
|
||||
X(RDI_LocationKind, kind)\
|
||||
X(RDI_RegCode, reg_code)\
|
||||
|
||||
#define RDI_RegAndOffsetU16_XList \
|
||||
X(RDI_RegCode, reg_code)\
|
||||
X(RDI_U16, offset)\
|
||||
|
||||
#define RDI_LocationSetElement_XList \
|
||||
X(RDI_U64, voff_first)\
|
||||
X(RDI_U64, voff_opl)\
|
||||
X(RDI_Location, location)\
|
||||
|
||||
#define RDI_EvalOp_XList \
|
||||
X(Stop)\
|
||||
X(Noop)\
|
||||
@@ -1141,16 +1042,9 @@ typedef struct RDI_U32_TypeNodes { RDI_U32 v; } RDI_U32_TypeNo
|
||||
typedef struct RDI_U32_UDTs { RDI_U32 v; } RDI_U32_UDTs;
|
||||
typedef struct RDI_U32_Members { RDI_U32 v; } RDI_U32_Members;
|
||||
typedef struct RDI_U32_EnumMembers { RDI_U32 v; } RDI_U32_EnumMembers;
|
||||
typedef struct RDI_U32_GlobalVariables { RDI_U32 v; } RDI_U32_GlobalVariables;
|
||||
typedef struct RDI_U32_ThreadVariables { RDI_U32 v; } RDI_U32_ThreadVariables;
|
||||
typedef struct RDI_U32_Constants { RDI_U32 v; } RDI_U32_Constants;
|
||||
typedef struct RDI_U32_Procedures { RDI_U32 v; } RDI_U32_Procedures;
|
||||
typedef struct RDI_U32_Locals { RDI_U32 v; } RDI_U32_Locals;
|
||||
typedef struct RDI_U32_Scopes { RDI_U32 v; } RDI_U32_Scopes;
|
||||
typedef struct RDI_U32_ScopeVOffData { RDI_U32 v; } RDI_U32_ScopeVOffData;
|
||||
typedef struct RDI_U32_InlineSites { RDI_U32 v; } RDI_U32_InlineSites;
|
||||
typedef struct RDI_U32_LocationBlocks { RDI_U32 v; } RDI_U32_LocationBlocks;
|
||||
typedef struct RDI_U32_LocationData { RDI_U32 v; } RDI_U32_LocationData;
|
||||
typedef struct RDI_U32_GlobalVariableSymbols { RDI_U32 v; } RDI_U32_GlobalVariableSymbols;
|
||||
typedef struct RDI_U32_ThreadVariableSymbols { RDI_U32 v; } RDI_U32_ThreadVariableSymbols;
|
||||
typedef struct RDI_U32_ConstantSymbols { RDI_U32 v; } RDI_U32_ConstantSymbols;
|
||||
@@ -1159,8 +1053,6 @@ typedef struct RDI_U32_LocalVariableSymbols { RDI_U32 v; } RDI_U32_LocalV
|
||||
typedef struct RDI_U32_LocationsBytecodeData { RDI_U32 v; } RDI_U32_LocationsBytecodeData;
|
||||
typedef struct RDI_U32_LocationsConstantData { RDI_U32 v; } RDI_U32_LocationsConstantData;
|
||||
typedef struct RDI_U32_LocationsSetElements { RDI_U32 v; } RDI_U32_LocationsSetElements;
|
||||
typedef struct RDI_U32_ConstantValueData { RDI_U32 v; } RDI_U32_ConstantValueData;
|
||||
typedef struct RDI_U32_ConstantValueTable { RDI_U32 v; } RDI_U32_ConstantValueTable;
|
||||
typedef struct RDI_U32_MD5Checksums { RDI_U32 v; } RDI_U32_MD5Checksums;
|
||||
typedef struct RDI_U32_SHA1Checksums { RDI_U32 v; } RDI_U32_SHA1Checksums;
|
||||
typedef struct RDI_U32_SHA256Checksums { RDI_U32 v; } RDI_U32_SHA256Checksums;
|
||||
@@ -1190,16 +1082,9 @@ typedef RDI_U32_Table RDI_U32_TypeNodes;
|
||||
typedef RDI_U32_Table RDI_U32_UDTs;
|
||||
typedef RDI_U32_Table RDI_U32_Members;
|
||||
typedef RDI_U32_Table RDI_U32_EnumMembers;
|
||||
typedef RDI_U32_Table RDI_U32_GlobalVariables;
|
||||
typedef RDI_U32_Table RDI_U32_ThreadVariables;
|
||||
typedef RDI_U32_Table RDI_U32_Constants;
|
||||
typedef RDI_U32_Table RDI_U32_Procedures;
|
||||
typedef RDI_U32_Table RDI_U32_Locals;
|
||||
typedef RDI_U32_Table RDI_U32_Scopes;
|
||||
typedef RDI_U32_Table RDI_U32_ScopeVOffData;
|
||||
typedef RDI_U32_Table RDI_U32_InlineSites;
|
||||
typedef RDI_U32_Table RDI_U32_LocationBlocks;
|
||||
typedef RDI_U32_Table RDI_U32_LocationData;
|
||||
typedef RDI_U32_Table RDI_U32_GlobalVariableSymbols;
|
||||
typedef RDI_U32_Table RDI_U32_ThreadVariableSymbols;
|
||||
typedef RDI_U32_Table RDI_U32_ConstantSymbols;
|
||||
@@ -1208,8 +1093,6 @@ typedef RDI_U32_Table RDI_U32_LocalVariableSymbols;
|
||||
typedef RDI_U32_Table RDI_U32_LocationsBytecodeData;
|
||||
typedef RDI_U32_Table RDI_U32_LocationsConstantData;
|
||||
typedef RDI_U32_Table RDI_U32_LocationsSetElements;
|
||||
typedef RDI_U32_Table RDI_U32_ConstantValueData;
|
||||
typedef RDI_U32_Table RDI_U32_ConstantValueTable;
|
||||
typedef RDI_U32_Table RDI_U32_MD5Checksums;
|
||||
typedef RDI_U32_Table RDI_U32_SHA1Checksums;
|
||||
typedef RDI_U32_Table RDI_U32_SHA256Checksums;
|
||||
@@ -1481,47 +1364,6 @@ RDI_U32 root_scope_idx;
|
||||
RDI_U32 link_name_string_idx;
|
||||
};
|
||||
|
||||
typedef struct RDI_GlobalVariable RDI_GlobalVariable;
|
||||
struct RDI_GlobalVariable
|
||||
{
|
||||
RDI_U32 name_string_idx;
|
||||
RDI_LinkFlags link_flags;
|
||||
RDI_U64 voff;
|
||||
RDI_U32 type_idx;
|
||||
RDI_U32 container_idx;
|
||||
};
|
||||
|
||||
typedef struct RDI_ThreadVariable RDI_ThreadVariable;
|
||||
struct RDI_ThreadVariable
|
||||
{
|
||||
RDI_U32 name_string_idx;
|
||||
RDI_LinkFlags link_flags;
|
||||
RDI_U32 tls_off;
|
||||
RDI_U32 type_idx;
|
||||
RDI_U32 container_idx;
|
||||
};
|
||||
|
||||
typedef struct RDI_Constant RDI_Constant;
|
||||
struct RDI_Constant
|
||||
{
|
||||
RDI_U32 name_string_idx;
|
||||
RDI_U32 type_idx;
|
||||
RDI_U32 constant_value_idx;
|
||||
};
|
||||
|
||||
typedef struct RDI_Procedure RDI_Procedure;
|
||||
struct RDI_Procedure
|
||||
{
|
||||
RDI_U32 name_string_idx;
|
||||
RDI_U32 link_name_string_idx;
|
||||
RDI_LinkFlags link_flags;
|
||||
RDI_U32 type_idx;
|
||||
RDI_U32 root_scope_idx;
|
||||
RDI_U32 container_idx;
|
||||
RDI_U32 frame_base_location_first;
|
||||
RDI_U32 frame_base_location_opl;
|
||||
};
|
||||
|
||||
typedef struct RDI_Scope RDI_Scope;
|
||||
struct RDI_Scope
|
||||
{
|
||||
@@ -1545,53 +1387,6 @@ RDI_U32 owner_type_idx;
|
||||
RDI_U32 line_table_idx;
|
||||
};
|
||||
|
||||
typedef struct RDI_Local RDI_Local;
|
||||
struct RDI_Local
|
||||
{
|
||||
RDI_LocalKind kind;
|
||||
RDI_U32 name_string_idx;
|
||||
RDI_U32 type_idx;
|
||||
RDI_U32 pad;
|
||||
RDI_U32 location_first;
|
||||
RDI_U32 location_opl;
|
||||
};
|
||||
|
||||
typedef struct RDI_LocationBlock RDI_LocationBlock;
|
||||
struct RDI_LocationBlock
|
||||
{
|
||||
RDI_U32 scope_off_first;
|
||||
RDI_U32 scope_off_opl;
|
||||
RDI_U32 location_data_off;
|
||||
};
|
||||
|
||||
typedef struct RDI_LocationBytecodeStream RDI_LocationBytecodeStream;
|
||||
struct RDI_LocationBytecodeStream
|
||||
{
|
||||
RDI_LocationKind kind;
|
||||
};
|
||||
|
||||
typedef struct RDI_LocationRegPlusU16 RDI_LocationRegPlusU16;
|
||||
struct RDI_LocationRegPlusU16
|
||||
{
|
||||
RDI_LocationKind kind;
|
||||
RDI_RegCode reg_code;
|
||||
RDI_U16 offset;
|
||||
};
|
||||
|
||||
typedef struct RDI_LocationReg RDI_LocationReg;
|
||||
struct RDI_LocationReg
|
||||
{
|
||||
RDI_LocationKind kind;
|
||||
RDI_RegCode reg_code;
|
||||
};
|
||||
|
||||
typedef struct RDI_RegAndOffsetU16 RDI_RegAndOffsetU16;
|
||||
struct RDI_RegAndOffsetU16
|
||||
{
|
||||
RDI_RegCode reg_code;
|
||||
RDI_U16 offset;
|
||||
};
|
||||
|
||||
typedef struct RDI_LocationSetElement RDI_LocationSetElement;
|
||||
struct RDI_LocationSetElement
|
||||
{
|
||||
@@ -1646,17 +1441,10 @@ typedef RDI_TypeNode RDI_SectionElementType_TypeNodes;
|
||||
typedef RDI_UDT RDI_SectionElementType_UDTs;
|
||||
typedef RDI_Member RDI_SectionElementType_Members;
|
||||
typedef RDI_EnumMember RDI_SectionElementType_EnumMembers;
|
||||
typedef RDI_GlobalVariable RDI_SectionElementType_GlobalVariables;
|
||||
typedef RDI_ThreadVariable RDI_SectionElementType_ThreadVariables;
|
||||
typedef RDI_Constant RDI_SectionElementType_Constants;
|
||||
typedef RDI_Procedure RDI_SectionElementType_Procedures;
|
||||
typedef RDI_Local RDI_SectionElementType_Locals;
|
||||
typedef RDI_Scope RDI_SectionElementType_Scopes;
|
||||
typedef RDI_U64 RDI_SectionElementType_ScopeVOffData;
|
||||
typedef RDI_VMapEntry RDI_SectionElementType_ScopeVMap;
|
||||
typedef RDI_InlineSite RDI_SectionElementType_InlineSites;
|
||||
typedef RDI_LocationBlock RDI_SectionElementType_LocationBlocks;
|
||||
typedef RDI_U8 RDI_SectionElementType_LocationData;
|
||||
typedef RDI_Symbol RDI_SectionElementType_GlobalVariableSymbols;
|
||||
typedef RDI_VMapEntry RDI_SectionElementType_GlobalVMap;
|
||||
typedef RDI_Symbol RDI_SectionElementType_ThreadVariableSymbols;
|
||||
@@ -1666,8 +1454,6 @@ typedef RDI_Symbol RDI_SectionElementType_LocalVariableSym
|
||||
typedef RDI_U8 RDI_SectionElementType_LocationsBytecodeData;
|
||||
typedef RDI_U8 RDI_SectionElementType_LocationsConstantData;
|
||||
typedef RDI_LocationSetElement RDI_SectionElementType_LocationsSetElements;
|
||||
typedef RDI_U8 RDI_SectionElementType_ConstantValueData;
|
||||
typedef RDI_U32 RDI_SectionElementType_ConstantValueTable;
|
||||
typedef RDI_MD5 RDI_SectionElementType_MD5Checksums;
|
||||
typedef RDI_SHA1 RDI_SectionElementType_SHA1Checksums;
|
||||
typedef RDI_SHA256 RDI_SectionElementType_SHA256Checksums;
|
||||
@@ -1684,7 +1470,7 @@ RDI_PROC RDI_EvalConversionKind rdi_eval_conversion_kind_from_typegroups(RDI_Eva
|
||||
RDI_PROC RDI_S32 rdi_eval_op_typegroup_are_compatible(RDI_EvalOp op, RDI_EvalTypeGroup group);
|
||||
RDI_PROC RDI_U8 *rdi_explanation_string_from_eval_conversion_kind(RDI_EvalConversionKind kind, RDI_U64 *size_out);
|
||||
|
||||
extern RDI_U16 rdi_section_element_size_table[53];
|
||||
extern RDI_U16 rdi_section_element_size_table[44];
|
||||
extern RDI_U16 rdi_eval_op_ctrlbits_table[54];
|
||||
|
||||
#endif // RDI_H
|
||||
|
||||
+56
-21
@@ -728,7 +728,7 @@ rdi_matches_from_map_node(RDI_Parsed *p, RDI_NameMapNode *node, RDI_U32 *n_out)
|
||||
|
||||
//- procedures
|
||||
|
||||
RDI_PROC RDI_Procedure *
|
||||
RDI_PROC RDI_Symbol *
|
||||
rdi_procedure_from_name(RDI_Parsed *rdi, RDI_U8 *name, RDI_U64 name_size)
|
||||
{
|
||||
RDI_NameMap *map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_Procedures);
|
||||
@@ -742,35 +742,35 @@ rdi_procedure_from_name(RDI_Parsed *rdi, RDI_U8 *name, RDI_U64 name_size)
|
||||
{
|
||||
procedure_idx = ids[0];
|
||||
}
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, procedure_idx);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, procedure_idx);
|
||||
return procedure;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_Procedure *
|
||||
RDI_PROC RDI_Symbol *
|
||||
rdi_procedure_from_name_cstr(RDI_Parsed *rdi, char *cstr)
|
||||
{
|
||||
RDI_Procedure *result = rdi_procedure_from_name(rdi, (RDI_U8 *)cstr, rdi_cstring_length(cstr));
|
||||
RDI_Symbol *result = rdi_procedure_from_name(rdi, (RDI_U8 *)cstr, rdi_cstring_length(cstr));
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U8 *
|
||||
rdi_name_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure, RDI_U64 *len_out)
|
||||
rdi_name_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure, RDI_U64 *len_out)
|
||||
{
|
||||
return rdi_string_from_idx(rdi, procedure->name_string_idx, len_out);
|
||||
}
|
||||
|
||||
RDI_PROC RDI_Scope *
|
||||
rdi_root_scope_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure)
|
||||
rdi_root_scope_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure)
|
||||
{
|
||||
RDI_Scope *scope = rdi_element_from_name_idx(rdi, Scopes, procedure->root_scope_idx);
|
||||
return scope;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_UDT *
|
||||
rdi_container_udt_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure)
|
||||
rdi_container_udt_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure)
|
||||
{
|
||||
RDI_U64 idx = 0;
|
||||
if(procedure->link_flags & RDI_LinkFlag_TypeScoped)
|
||||
if(procedure->container_flags & RDI_ContainerFlag_KindMask == RDI_ContainerKind_Type)
|
||||
{
|
||||
idx = procedure->container_idx;
|
||||
}
|
||||
@@ -778,20 +778,20 @@ rdi_container_udt_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure)
|
||||
return udt;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_Procedure *
|
||||
rdi_container_procedure_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure)
|
||||
RDI_PROC RDI_Scope *
|
||||
rdi_container_scope_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure)
|
||||
{
|
||||
RDI_U64 idx = 0;
|
||||
if(procedure->link_flags & RDI_LinkFlag_ProcScoped)
|
||||
if(procedure->container_flags & RDI_ContainerFlag_KindMask == RDI_ContainerKind_Scope)
|
||||
{
|
||||
idx = procedure->container_idx;
|
||||
}
|
||||
RDI_Procedure *container_procedure = rdi_element_from_name_idx(rdi, Procedures, idx);
|
||||
return container_procedure;
|
||||
RDI_Scope *container_scope = rdi_element_from_name_idx(rdi, Scopes, idx);
|
||||
return container_scope;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdi_first_voff_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure)
|
||||
rdi_first_voff_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure)
|
||||
{
|
||||
RDI_Scope *scope = rdi_root_scope_from_procedure(rdi, procedure);
|
||||
RDI_U64 result = rdi_first_voff_from_scope(rdi, scope);
|
||||
@@ -799,18 +799,18 @@ rdi_first_voff_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure)
|
||||
}
|
||||
|
||||
RDI_PROC RDI_U64
|
||||
rdi_opl_voff_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure)
|
||||
rdi_opl_voff_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure)
|
||||
{
|
||||
RDI_Scope *scope = rdi_root_scope_from_procedure(rdi, procedure);
|
||||
RDI_U64 result = rdi_opl_voff_from_scope(rdi, scope);
|
||||
return result;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_Procedure *
|
||||
RDI_PROC RDI_Symbol *
|
||||
rdi_procedure_from_voff(RDI_Parsed *rdi, RDI_U64 voff)
|
||||
{
|
||||
RDI_Scope *scope = rdi_scope_from_voff(rdi, voff);
|
||||
RDI_Procedure *procedure = rdi_procedure_from_scope(rdi, scope);
|
||||
RDI_Symbol *procedure = rdi_procedure_from_scope(rdi, scope);
|
||||
return procedure;
|
||||
}
|
||||
|
||||
@@ -851,10 +851,10 @@ rdi_parent_from_scope(RDI_Parsed *rdi, RDI_Scope *scope)
|
||||
return parent;
|
||||
}
|
||||
|
||||
RDI_PROC RDI_Procedure *
|
||||
RDI_PROC RDI_Symbol *
|
||||
rdi_procedure_from_scope(RDI_Parsed *rdi, RDI_Scope *scope)
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, scope->proc_idx);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, scope->proc_idx);
|
||||
return procedure;
|
||||
}
|
||||
|
||||
@@ -867,14 +867,49 @@ rdi_inline_site_from_scope(RDI_Parsed *rdi, RDI_Scope *scope)
|
||||
|
||||
//- global variables
|
||||
|
||||
RDI_PROC RDI_GlobalVariable *
|
||||
RDI_PROC RDI_Symbol *
|
||||
rdi_global_variable_from_voff(RDI_Parsed *rdi, RDI_U64 voff)
|
||||
{
|
||||
RDI_U32 idx = rdi_vmap_idx_from_section_kind_voff(rdi, RDI_SectionKind_GlobalVMap, voff);
|
||||
RDI_GlobalVariable *gvar = rdi_element_from_name_idx(rdi, GlobalVariables, idx);
|
||||
RDI_Symbol *gvar = rdi_element_from_name_idx(rdi, GlobalVariableSymbols, idx);
|
||||
return gvar;
|
||||
}
|
||||
|
||||
//- location picking
|
||||
|
||||
RDI_PROC RDI_Location
|
||||
rdi_location_from_location_voff(RDI_Parsed *rdi, RDI_Location location, RDI_U64 voff)
|
||||
{
|
||||
RDI_Location result = 0;
|
||||
if(rdi_kind_from_location(location) != RDI_LocationKind_Set)
|
||||
{
|
||||
result = location;
|
||||
}
|
||||
else
|
||||
{
|
||||
RDI_U64 set_first_idx = rdi_set_first_index_from_location(location);
|
||||
RDI_U64 set_count = rdi_set_count_from_location(location);
|
||||
RDI_U64 set_opl_idx = set_first_idx + set_count;
|
||||
RDI_U64 all_elems_count = 0;
|
||||
RDI_LocationSetElement *all_elems = rdi_table_from_name(rdi, LocationsSetElements, &all_elems_count);
|
||||
if(set_opl_idx > all_elems_count)
|
||||
{
|
||||
set_opl_idx = all_elems_count;
|
||||
}
|
||||
RDI_LocationSetElement *set_first = all_elems + set_first_idx;
|
||||
RDI_LocationSetElement *set_opl = all_elems + set_opl_idx;
|
||||
for(RDI_LocationSetElement *e = set_first; e < set_opl; e += 1)
|
||||
{
|
||||
if(e->voff_first <= voff && voff <= e->voff_opl)
|
||||
{
|
||||
result = e->location;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//- units
|
||||
|
||||
RDI_PROC RDI_Unit *
|
||||
|
||||
+16
-16
@@ -122,13 +122,10 @@ static union
|
||||
RDI_UDT udt;
|
||||
RDI_Member member;
|
||||
RDI_EnumMember enum_member;
|
||||
RDI_GlobalVariable global_variable;
|
||||
RDI_ThreadVariable thread_variable;
|
||||
RDI_Procedure procedure;
|
||||
RDI_Symbol symbol;
|
||||
RDI_Scope scope;
|
||||
RDI_U64 voff;
|
||||
RDI_LocationBlock location_block;
|
||||
RDI_Local local;
|
||||
RDI_LocationSetElement location_set_element;
|
||||
}
|
||||
rdi_nil_element_union = {0};
|
||||
static RDI_Parsed rdi_parsed_nil = {0};
|
||||
@@ -179,26 +176,29 @@ RDI_PROC RDI_U32 *rdi_matches_from_map_node(RDI_Parsed *p, RDI_NameMapNode *node
|
||||
//~ High-Level Composite Lookup Functions
|
||||
|
||||
//- procedures
|
||||
RDI_PROC RDI_Procedure *rdi_procedure_from_name(RDI_Parsed *rdi, RDI_U8 *name, RDI_U64 name_size);
|
||||
RDI_PROC RDI_Procedure *rdi_procedure_from_name_cstr(RDI_Parsed *rdi, char *cstr);
|
||||
RDI_PROC RDI_U8 *rdi_name_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure, RDI_U64 *len_out);
|
||||
RDI_PROC RDI_Scope *rdi_root_scope_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure);
|
||||
RDI_PROC RDI_UDT *rdi_container_udt_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure);
|
||||
RDI_PROC RDI_Procedure *rdi_container_procedure_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure);
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure);
|
||||
RDI_PROC RDI_U64 rdi_opl_voff_from_procedure(RDI_Parsed *rdi, RDI_Procedure *procedure);
|
||||
RDI_PROC RDI_Procedure *rdi_procedure_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
RDI_PROC RDI_Symbol *rdi_procedure_from_name(RDI_Parsed *rdi, RDI_U8 *name, RDI_U64 name_size);
|
||||
RDI_PROC RDI_Symbol *rdi_procedure_from_name_cstr(RDI_Parsed *rdi, char *cstr);
|
||||
RDI_PROC RDI_U8 *rdi_name_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure, RDI_U64 *len_out);
|
||||
RDI_PROC RDI_Scope *rdi_root_scope_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure);
|
||||
RDI_PROC RDI_UDT *rdi_container_udt_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure);
|
||||
RDI_PROC RDI_Scope *rdi_container_scope_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure);
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure);
|
||||
RDI_PROC RDI_U64 rdi_opl_voff_from_procedure(RDI_Parsed *rdi, RDI_Symbol *procedure);
|
||||
RDI_PROC RDI_Symbol *rdi_procedure_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
|
||||
//- scopes
|
||||
RDI_PROC RDI_U64 rdi_first_voff_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
RDI_PROC RDI_U64 rdi_opl_voff_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
RDI_PROC RDI_Scope *rdi_scope_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
RDI_PROC RDI_Scope *rdi_parent_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
RDI_PROC RDI_Procedure *rdi_procedure_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
RDI_PROC RDI_Symbol *rdi_procedure_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
RDI_PROC RDI_InlineSite *rdi_inline_site_from_scope(RDI_Parsed *rdi, RDI_Scope *scope);
|
||||
|
||||
//- global variables
|
||||
RDI_PROC RDI_GlobalVariable *rdi_global_variable_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
RDI_PROC RDI_Symbol *rdi_global_variable_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
|
||||
//- location picking
|
||||
RDI_PROC RDI_Location rdi_location_from_location_voff(RDI_Parsed *rdi, RDI_Location location, RDI_U64 voff);
|
||||
|
||||
//- units
|
||||
RDI_PROC RDI_Unit *rdi_unit_from_voff(RDI_Parsed *rdi, RDI_U64 voff);
|
||||
|
||||
@@ -1115,35 +1115,6 @@ rdim_scope_push_voff_range(RDIM_Arena *arena, RDIM_ScopeChunkList *list, RDIM_Sc
|
||||
list->scope_voff_count += 2;
|
||||
}
|
||||
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDI_PROC RDIM_Local *
|
||||
rdim_scope_push_local(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *scope)
|
||||
{
|
||||
RDIM_Local *local = rdim_push_array(arena, RDIM_Local, 1);
|
||||
RDIM_SLLQueuePush(scope->first_local, scope->last_local, local);
|
||||
scope->local_count += 1;
|
||||
scopes->local_count += 1;
|
||||
return local;
|
||||
}
|
||||
|
||||
RDI_PROC RDIM_LocationCase *
|
||||
rdim_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_LocationCaseList *list, RDIM_Location *location, RDIM_Rng1U64 voff_range)
|
||||
{
|
||||
RDIM_LocationCase *n = rdim_push_array(arena, RDIM_LocationCase, 1);
|
||||
RDIM_SLLQueuePush(list->first, list->last, n);
|
||||
list->count += 1;
|
||||
n->location = *location;
|
||||
n->voff_range = voff_range;
|
||||
return n;
|
||||
}
|
||||
|
||||
RDI_PROC RDIM_LocationCase *
|
||||
rdim_local_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location *location, RDIM_Rng1U64 voff_range)
|
||||
{
|
||||
return rdim_push_location_case(arena, scopes, &local->location_cases, location, voff_range);
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Bake Parameter Joining
|
||||
|
||||
@@ -2092,58 +2063,6 @@ rdim_serialized_section_make_unpacked(void *data, RDI_U64 size)
|
||||
return s;
|
||||
}
|
||||
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDI_PROC RDIM_SerializedSectionBundle
|
||||
rdim_serialized_section_bundle_from_bake_results(RDIM_BakeResults *results)
|
||||
{
|
||||
RDIM_SerializedSectionBundle bundle;
|
||||
rdim_memzero_struct(&bundle);
|
||||
bundle.sections[RDI_SectionKind_TopLevelInfo] = rdim_serialized_section_make_unpacked_struct(results->top_level_info.top_level_info);
|
||||
bundle.sections[RDI_SectionKind_StringData] = rdim_serialized_section_make_unpacked_array(results->strings.string_data, results->strings.string_data_size);
|
||||
bundle.sections[RDI_SectionKind_StringTable] = rdim_serialized_section_make_unpacked_array(results->strings.string_offs, results->strings.string_offs_count);
|
||||
bundle.sections[RDI_SectionKind_IndexRuns] = rdim_serialized_section_make_unpacked_array(results->idx_runs.idx_runs, results->idx_runs.idx_count);
|
||||
bundle.sections[RDI_SectionKind_BinarySections] = rdim_serialized_section_make_unpacked_array(results->binary_sections.binary_sections, results->binary_sections.binary_sections_count);
|
||||
bundle.sections[RDI_SectionKind_FilePathNodes] = rdim_serialized_section_make_unpacked_array(results->file_paths.nodes, results->file_paths.nodes_count);
|
||||
bundle.sections[RDI_SectionKind_SourceFiles] = rdim_serialized_section_make_unpacked_array(results->src_files.source_files, results->src_files.source_files_count);
|
||||
bundle.sections[RDI_SectionKind_LineTables] = rdim_serialized_section_make_unpacked_array(results->line_tables.line_tables, results->line_tables.line_tables_count);
|
||||
bundle.sections[RDI_SectionKind_LineInfoVOffs] = rdim_serialized_section_make_unpacked_array(results->line_tables.line_table_voffs, results->line_tables.line_table_voffs_count);
|
||||
bundle.sections[RDI_SectionKind_LineInfoLines] = rdim_serialized_section_make_unpacked_array(results->line_tables.line_table_lines, results->line_tables.line_table_lines_count);
|
||||
bundle.sections[RDI_SectionKind_LineInfoColumns] = rdim_serialized_section_make_unpacked_array(results->line_tables.line_table_columns, results->line_tables.line_table_columns_count);
|
||||
bundle.sections[RDI_SectionKind_SourceLineMaps] = rdim_serialized_section_make_unpacked_array(results->src_files.source_line_maps, results->src_files.source_line_maps_count);
|
||||
bundle.sections[RDI_SectionKind_SourceLineMapNumbers] = rdim_serialized_section_make_unpacked_array(results->src_files.source_line_map_nums, results->src_files.source_line_map_nums_count);
|
||||
bundle.sections[RDI_SectionKind_SourceLineMapRanges] = rdim_serialized_section_make_unpacked_array(results->src_files.source_line_map_rngs, results->src_files.source_line_map_rngs_count);
|
||||
bundle.sections[RDI_SectionKind_SourceLineMapVOffs] = rdim_serialized_section_make_unpacked_array(results->src_files.source_line_map_voffs, results->src_files.source_line_map_voffs_count);
|
||||
bundle.sections[RDI_SectionKind_Units] = rdim_serialized_section_make_unpacked_array(results->units.units, results->units.units_count);
|
||||
bundle.sections[RDI_SectionKind_UnitVMap] = rdim_serialized_section_make_unpacked_array(results->unit_vmap.vmap.vmap, results->unit_vmap.vmap.count);
|
||||
bundle.sections[RDI_SectionKind_Namespaces] = rdim_serialized_section_make_unpacked_array(results->namespaces.namespaces, results->namespaces.namespaces_count);
|
||||
bundle.sections[RDI_SectionKind_TypeNodes] = rdim_serialized_section_make_unpacked_array(results->type_nodes.type_nodes, results->type_nodes.type_nodes_count);
|
||||
bundle.sections[RDI_SectionKind_UDTs] = rdim_serialized_section_make_unpacked_array(results->udts.udts, results->udts.udts_count);
|
||||
bundle.sections[RDI_SectionKind_Members] = rdim_serialized_section_make_unpacked_array(results->udts.members, results->udts.members_count);
|
||||
bundle.sections[RDI_SectionKind_EnumMembers] = rdim_serialized_section_make_unpacked_array(results->udts.enum_members, results->udts.enum_members_count);
|
||||
bundle.sections[RDI_SectionKind_GlobalVariables] = rdim_serialized_section_make_unpacked_array(results->global_variables.global_variables, results->global_variables.global_variables_count);
|
||||
bundle.sections[RDI_SectionKind_GlobalVMap] = rdim_serialized_section_make_unpacked_array(results->global_vmap.vmap.vmap, results->global_vmap.vmap.count);
|
||||
bundle.sections[RDI_SectionKind_ThreadVariables] = rdim_serialized_section_make_unpacked_array(results->thread_variables.thread_variables, results->thread_variables.thread_variables_count);
|
||||
bundle.sections[RDI_SectionKind_Constants] = rdim_serialized_section_make_unpacked_array(results->constants.constants, results->constants.constants_count);
|
||||
bundle.sections[RDI_SectionKind_Procedures] = rdim_serialized_section_make_unpacked_array(results->procedures.procedures, results->procedures.procedures_count);
|
||||
bundle.sections[RDI_SectionKind_Scopes] = rdim_serialized_section_make_unpacked_array(results->scopes.scopes, results->scopes.scopes_count);
|
||||
bundle.sections[RDI_SectionKind_ScopeVOffData] = rdim_serialized_section_make_unpacked_array(results->scopes.scope_voffs, results->scopes.scope_voffs_count);
|
||||
bundle.sections[RDI_SectionKind_ScopeVMap] = rdim_serialized_section_make_unpacked_array(results->scope_vmap.vmap.vmap, results->scope_vmap.vmap.count);
|
||||
bundle.sections[RDI_SectionKind_InlineSites] = rdim_serialized_section_make_unpacked_array(results->inline_sites.inline_sites, results->inline_sites.inline_sites_count);
|
||||
bundle.sections[RDI_SectionKind_Locals] = rdim_serialized_section_make_unpacked_array(results->scopes.locals, results->scopes.locals_count);
|
||||
bundle.sections[RDI_SectionKind_LocationBlocks] = rdim_serialized_section_make_unpacked_array(results->location_blocks.location_blocks, results->location_blocks.location_blocks_count);
|
||||
bundle.sections[RDI_SectionKind_LocationData] = rdim_serialized_section_make_unpacked_array(results->locations.location_data, results->locations.location_data_size);
|
||||
bundle.sections[RDI_SectionKind_ConstantValueData] = rdim_serialized_section_make_unpacked_array(results->constants.constant_value_data, results->constants.constant_value_data_size);
|
||||
bundle.sections[RDI_SectionKind_ConstantValueTable] = rdim_serialized_section_make_unpacked_array(results->constants.constant_values, results->constants.constant_values_count);
|
||||
bundle.sections[RDI_SectionKind_MD5Checksums] = rdim_serialized_section_make_unpacked_array(results->checksums.md5s, results->checksums.md5s_count);
|
||||
bundle.sections[RDI_SectionKind_SHA1Checksums] = rdim_serialized_section_make_unpacked_array(results->checksums.sha1s, results->checksums.sha1s_count);
|
||||
bundle.sections[RDI_SectionKind_SHA256Checksums] = rdim_serialized_section_make_unpacked_array(results->checksums.sha256s, results->checksums.sha256s_count);
|
||||
bundle.sections[RDI_SectionKind_NameMaps] = rdim_serialized_section_make_unpacked_array(results->top_level_name_maps.name_maps, results->top_level_name_maps.name_maps_count);
|
||||
bundle.sections[RDI_SectionKind_NameMapBuckets] = rdim_serialized_section_make_unpacked_array(results->name_maps.buckets, results->name_maps.buckets_count);
|
||||
bundle.sections[RDI_SectionKind_NameMapNodes] = rdim_serialized_section_make_unpacked_array(results->name_maps.nodes, results->name_maps.nodes_count);
|
||||
return bundle;
|
||||
}
|
||||
#endif
|
||||
|
||||
RDI_PROC RDIM_String8List
|
||||
rdim_file_blobs_from_section_bundle(RDIM_Arena *arena, RDIM_SerializedSectionBundle *bundle)
|
||||
{
|
||||
|
||||
@@ -912,16 +912,6 @@ struct RDIM_InlineSiteChunkList
|
||||
////////////////////////////////
|
||||
//~ rjf: Scope Info Types
|
||||
|
||||
typedef struct RDIM_Local RDIM_Local;
|
||||
struct RDIM_Local
|
||||
{
|
||||
RDIM_Local *next;
|
||||
RDI_LocalKind kind;
|
||||
RDIM_String8 name;
|
||||
RDIM_Type *type;
|
||||
RDIM_LocationCaseList location_cases;
|
||||
};
|
||||
|
||||
typedef struct RDIM_Scope RDIM_Scope;
|
||||
struct RDIM_Scope
|
||||
{
|
||||
@@ -932,11 +922,6 @@ struct RDIM_Scope
|
||||
RDIM_Scope *last_child;
|
||||
RDIM_Scope *next_sibling;
|
||||
RDIM_Rng1U64List voff_ranges;
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDIM_Local *first_local;
|
||||
RDIM_Local *last_local;
|
||||
RDI_U32 local_count;
|
||||
#endif
|
||||
RDIM_InlineSite *inline_site;
|
||||
RDIM_SymbolChunkList locals;
|
||||
};
|
||||
@@ -1283,52 +1268,6 @@ struct RDIM_LineRec
|
||||
|
||||
//- rjf: baking results
|
||||
|
||||
typedef struct RDIM_LocationBakeResult RDIM_LocationBakeResult;
|
||||
struct RDIM_LocationBakeResult
|
||||
{
|
||||
RDI_U8 *location_data;
|
||||
RDI_U64 location_data_size;
|
||||
};
|
||||
|
||||
typedef struct RDIM_LocationBlockBakeResult RDIM_LocationBlockBakeResult;
|
||||
struct RDIM_LocationBlockBakeResult
|
||||
{
|
||||
RDI_LocationBlock *location_blocks;
|
||||
RDI_U64 location_blocks_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_GlobalVariableBakeResult RDIM_GlobalVariableBakeResult;
|
||||
struct RDIM_GlobalVariableBakeResult
|
||||
{
|
||||
RDI_GlobalVariable *global_variables;
|
||||
RDI_U64 global_variables_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_ThreadVariableBakeResult RDIM_ThreadVariableBakeResult;
|
||||
struct RDIM_ThreadVariableBakeResult
|
||||
{
|
||||
RDI_ThreadVariable *thread_variables;
|
||||
RDI_U64 thread_variables_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_ConstantsBakeResult RDIM_ConstantsBakeResult;
|
||||
struct RDIM_ConstantsBakeResult
|
||||
{
|
||||
RDI_Constant *constants;
|
||||
RDI_U64 constants_count;
|
||||
RDI_U32 *constant_values;
|
||||
RDI_U64 constant_values_count;
|
||||
RDI_U8 *constant_value_data;
|
||||
RDI_U64 constant_value_data_size;
|
||||
};
|
||||
|
||||
typedef struct RDIM_ProcedureBakeResult RDIM_ProcedureBakeResult;
|
||||
struct RDIM_ProcedureBakeResult
|
||||
{
|
||||
RDI_Procedure *procedures;
|
||||
RDI_U64 procedures_count;
|
||||
};
|
||||
|
||||
typedef struct RDIM_SerializedSection RDIM_SerializedSection;
|
||||
struct RDIM_SerializedSection
|
||||
{
|
||||
@@ -1501,11 +1440,6 @@ RDI_PROC RDIM_Scope *rdim_scope_chunk_list_push(RDIM_Arena *arena, RDIM_ScopeChu
|
||||
RDI_PROC RDI_U64 rdim_idx_from_scope(RDIM_Scope *scope);
|
||||
RDI_PROC void rdim_scope_chunk_list_concat_in_place(RDIM_ScopeChunkList *dst, RDIM_ScopeChunkList *to_push);
|
||||
RDI_PROC void rdim_scope_push_voff_range(RDIM_Arena *arena, RDIM_ScopeChunkList *list, RDIM_Scope *scope, RDIM_Rng1U64 range);
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDI_PROC RDIM_Local *rdim_scope_push_local(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Scope *scope);
|
||||
RDI_PROC RDIM_LocationCase *rdim_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_LocationCaseList *list, RDIM_Location *location, RDIM_Rng1U64 voff_range);
|
||||
RDI_PROC RDIM_LocationCase *rdim_local_push_location_case(RDIM_Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location *location, RDIM_Rng1U64 voff_range);
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: [Building] Bake Parameter Joining
|
||||
@@ -1578,9 +1512,6 @@ RDI_PROC void rdim_bake_section_list_concat_in_place(RDIM_BakeSectionList *dst,
|
||||
RDI_PROC RDIM_SerializedSection rdim_serialized_section_make_unpacked(void *data, RDI_U64 size);
|
||||
#define rdim_serialized_section_make_unpacked_struct(ptr) rdim_serialized_section_make_unpacked((ptr), sizeof(*(ptr)))
|
||||
#define rdim_serialized_section_make_unpacked_array(ptr, count) rdim_serialized_section_make_unpacked((ptr), sizeof(*(ptr))*(count))
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDI_PROC RDIM_SerializedSectionBundle rdim_serialized_section_bundle_from_bake_results(RDIM_BakeResults *results);
|
||||
#endif
|
||||
RDI_PROC RDIM_String8List rdim_file_blobs_from_section_bundle(RDIM_Arena *arena, RDIM_SerializedSectionBundle *bundle);
|
||||
|
||||
#endif // RDI_MAKE_H
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
** stepping, breakpoints, evaluation, cross-module calls.
|
||||
*/
|
||||
|
||||
#define EvalTest(expr, match)
|
||||
|
||||
#if _WIN32 && _DEBUG
|
||||
#pragma comment(linker, "/nodefaultlib:libcmt")
|
||||
#pragma comment(lib, "libcmtd")
|
||||
@@ -416,14 +418,14 @@ raddbg_type_view(MyByte *, no_string($));
|
||||
static void
|
||||
type_coverage_eval_tests(void)
|
||||
{
|
||||
Basics basics = {-1, 1, -2, 2, -4, 4, -8, 8, 1.5f, 1.50000000000001};
|
||||
Basics basics = {-1, 1, -2, 2, -4, 4, -8, 8, 1.5f, 1.50000000000001}; EvalTest(basics.a, -1);
|
||||
Basics_Stdint basics_stdint = {-1, 1, -2, 2, -4, 4, -8, 8, 1.5f, 1.50000000000001};
|
||||
|
||||
uint32_t a = (1<<31);
|
||||
int32_t b = (1<<31);
|
||||
|
||||
uint32_t abcd = 0xaabbccdd;
|
||||
int64_t abcd64 = (int64_t)abcd;
|
||||
uint32_t abcd = 0xaabbccdd; EvalTest(abcd, 0xaabbccdd);
|
||||
int64_t abcd64 = (int64_t)abcd; EvalTest(abcd64, 0xaabbccdd); EvalTest(abcd64, abcd);
|
||||
|
||||
char string[] = "Hello World!";
|
||||
char longer_text[] =
|
||||
@@ -484,6 +486,9 @@ type_coverage_eval_tests(void)
|
||||
memory_,
|
||||
6
|
||||
};
|
||||
EvalTest(dynamic[0].i, 100); EvalTest(dynamic[0].f, 1.f);
|
||||
EvalTest(dynamic[1].i, 101); EvalTest(dynamic[1].f, 2.f);
|
||||
EvalTest(dynamic[2].i, 102); EvalTest(dynamic[2].f, 4.f);
|
||||
|
||||
TemplatedDynamicArray<Pair> templated_dynamic = {dynamic.pairs, dynamic.count};
|
||||
TemplatedDynamicArray<Pair> templated_dynamics[] =
|
||||
|
||||
+2
-2
@@ -1029,13 +1029,13 @@ rb_thread_entry_point(void *p)
|
||||
ProfScope("dump FUNC records")
|
||||
{
|
||||
U64 count = 0;
|
||||
RDI_Procedure *v = rdi_table_from_name(rdi, Procedures, &count);
|
||||
RDI_Symbol *v = rdi_table_from_name(rdi, ProcedureSymbols, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
// NOTE(rjf): breakpad does not support multiple voff ranges per procedure.
|
||||
String8List *out = &p2b_shared->lane_func_dumps[lane_idx()];
|
||||
RDI_Procedure *proc = &v[idx];
|
||||
RDI_Symbol *proc = &v[idx];
|
||||
RDI_Scope *root_scope = rdi_element_from_name_idx(rdi, Scopes, proc->root_scope_idx);
|
||||
if(root_scope->voff_range_opl > root_scope->voff_range_first)
|
||||
{
|
||||
|
||||
@@ -2284,12 +2284,12 @@ rd_view_ui(Rng2F32 rect)
|
||||
String8 name = {0};
|
||||
if(name.size == 0)
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
RDI_Symbol *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
name.str = rdi_name_from_procedure(rdi, procedure, &name.size);
|
||||
}
|
||||
if(name.size == 0)
|
||||
{
|
||||
RDI_GlobalVariable *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
RDI_Symbol *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
name.str = rdi_string_from_idx(rdi, gvar->name_string_idx, &name.size);
|
||||
}
|
||||
if(name.size != 0)
|
||||
@@ -2370,12 +2370,12 @@ rd_view_ui(Rng2F32 rect)
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 1, 0);
|
||||
if(name.size == 0)
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
RDI_Symbol *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
name.str = rdi_name_from_procedure(rdi, procedure, &name.size);
|
||||
}
|
||||
if(name.size == 0)
|
||||
{
|
||||
RDI_GlobalVariable *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
RDI_Symbol *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
name.str = rdi_string_from_idx(rdi, gvar->name_string_idx, &name.size);
|
||||
}
|
||||
access_close(access);
|
||||
@@ -9508,9 +9508,9 @@ rd_code_color_slot_from_txt_token_kind_lookup_string(TXT_TokenKind kind, String8
|
||||
switch(section_kind)
|
||||
{
|
||||
default:{mapped = 0;}break;
|
||||
case RDI_SectionKind_Procedures:
|
||||
case RDI_SectionKind_GlobalVariables:
|
||||
case RDI_SectionKind_ThreadVariables:
|
||||
case RDI_SectionKind_ProcedureSymbols:
|
||||
case RDI_SectionKind_GlobalVariableSymbols:
|
||||
case RDI_SectionKind_ThreadVariableSymbols:
|
||||
{
|
||||
color = RD_CodeColorSlot_CodeSymbol;
|
||||
}break;
|
||||
@@ -14060,13 +14060,13 @@ rd_frame(void)
|
||||
{
|
||||
match = di_match_from_string(name, 0, di_key_zero(), rd_state->frame_eval_memread_endt_us);
|
||||
}
|
||||
if(match.section_kind == RDI_SectionKind_Procedures)
|
||||
if(match.section_kind == RDI_SectionKind_ProcedureSymbols)
|
||||
{
|
||||
Access *access = access_open();
|
||||
{
|
||||
name_resolved = 1;
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, match.key, 0, 0);
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, match.idx);
|
||||
RDI_Symbol *procedure = rdi_element_from_name_idx(rdi, ProcedureSymbols, match.idx);
|
||||
voff = rdi_first_voff_from_procedure(rdi, procedure);
|
||||
voff_dbgi_key = match.key;
|
||||
}
|
||||
|
||||
+10
-28
@@ -1751,10 +1751,10 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(debug_info_table)
|
||||
E_TypeKey lhs_type_key = eval.irtree.type_key;
|
||||
E_Type *lhs_type = e_type_from_key(lhs_type_key);
|
||||
if(0){}
|
||||
else if(str8_match(lhs_type->name, str8_lit("procedures"), 0)) {section = RDI_SectionKind_Procedures;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("globals"), 0)) {section = RDI_SectionKind_GlobalVariables;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("thread_locals"), 0)) {section = RDI_SectionKind_ThreadVariables;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("constants"), 0)) {section = RDI_SectionKind_Constants;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("procedures"), 0)) {section = RDI_SectionKind_ProcedureSymbols;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("globals"), 0)) {section = RDI_SectionKind_GlobalVariableSymbols;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("thread_locals"), 0)) {section = RDI_SectionKind_ThreadVariableSymbols;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("constants"), 0)) {section = RDI_SectionKind_ConstantSymbols;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("types"), 0)) {section = RDI_SectionKind_UDTs;}
|
||||
else if(str8_match(lhs_type->name, str8_lit("source_files"), 0)) {section = RDI_SectionKind_SourceFiles;}
|
||||
}
|
||||
@@ -1806,32 +1806,14 @@ E_TYPE_EXPAND_RANGE_FUNCTION_DEF(debug_info_table)
|
||||
switch(accel->section)
|
||||
{
|
||||
default:{}break;
|
||||
case RDI_SectionKind_Procedures:
|
||||
case RDI_SectionKind_ProcedureSymbols:
|
||||
case RDI_SectionKind_GlobalVariableSymbols:
|
||||
case RDI_SectionKind_ThreadVariableSymbols:
|
||||
case RDI_SectionKind_ConstantSymbols:
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_element_from_name_idx(rdi, Procedures, element_idx);
|
||||
RDI_Symbol *symbol = (RDI_Symbol *)rdi_section_raw_element_from_kind_idx(rdi, accel->section, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_GlobalVariables:
|
||||
{
|
||||
RDI_GlobalVariable *gvar = rdi_element_from_name_idx(rdi, GlobalVariables, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(rdi, gvar->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_ThreadVariables:
|
||||
{
|
||||
RDI_ThreadVariable *tvar = rdi_element_from_name_idx(rdi, ThreadVariables, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(rdi, tvar->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_Constants:
|
||||
{
|
||||
RDI_Constant *cnst = rdi_element_from_name_idx(rdi, Constants, element_idx);
|
||||
String8 symbol_name = {0};
|
||||
symbol_name.str = rdi_string_from_idx(rdi, cnst->name_string_idx, &symbol_name.size);
|
||||
symbol_name.str = rdi_string_from_idx(rdi, symbol->name_string_idx, &symbol_name.size);
|
||||
item_string = symbol_name;
|
||||
}break;
|
||||
case RDI_SectionKind_UDTs:
|
||||
|
||||
@@ -3313,7 +3313,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
U64 f_rip_voff = ctrl_voff_from_vaddr(module, f_rip_vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, f_rip_voff);
|
||||
RDI_Symbol *procedure = rdi_procedure_from_voff(rdi, f_rip_voff);
|
||||
String8 procedure_name = {0};
|
||||
procedure_name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &procedure_name.size);
|
||||
access_close(access);
|
||||
@@ -3358,7 +3358,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
|
||||
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
RDI_Symbol *procedure = rdi_procedure_from_voff(rdi, voff);
|
||||
RDI_Scope *root_scope = rdi_element_from_name_idx(rdi, Scopes, procedure->root_scope_idx);
|
||||
if(procedure->root_scope_idx != 0)
|
||||
{
|
||||
@@ -3416,11 +3416,12 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
|
||||
E_DbgInfo *dbg_info = e_dbg_info_from_module(module);
|
||||
DI_Key dbgi_key = dbg_info->dbgi_key;
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
RDI_GlobalVariable *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
if(gvar->voff != 0)
|
||||
RDI_Symbol *gvar = rdi_global_variable_from_voff(rdi, voff);
|
||||
U64 gvar_voff = rdi_voff_from_location(gvar->location);
|
||||
if(gvar_voff != 0)
|
||||
{
|
||||
RDI_TypeNode *type_node = rdi_element_from_name_idx(rdi, TypeNodes, gvar->type_idx);
|
||||
Rng1U64 voff_range = r1u64(gvar->voff, gvar->voff + type_node->byte_size);
|
||||
Rng1U64 voff_range = r1u64(gvar_voff, gvar_voff + type_node->byte_size);
|
||||
Rng1U64 vaddr_range = r1u64(voff_range.min + module->vaddr_range.min, voff_range.max + module->vaddr_range.min);
|
||||
next_vaddr = vaddr_range.max;
|
||||
next_vaddr = Max(next_vaddr, vaddr+1);
|
||||
|
||||
@@ -567,7 +567,7 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
|
||||
RDI_Parsed *rdi = di_rdi_from_key(access, dbgi_key, 0, 0);
|
||||
if(rdi != &rdi_parsed_nil)
|
||||
{
|
||||
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, rip_voff);
|
||||
RDI_Symbol *procedure = rdi_procedure_from_voff(rdi, rip_voff);
|
||||
name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &name.size);
|
||||
name = push_str8_copy(arena, name);
|
||||
}
|
||||
|
||||
+24
-260
@@ -77,7 +77,7 @@
|
||||
"";
|
||||
"// \"raddbg\\0\\0\"";
|
||||
"#define RDI_MAGIC_CONSTANT 0x0000676264646172";
|
||||
"#define RDI_ENCODING_VERSION 21";
|
||||
"#define RDI_ENCODING_VERSION 22";
|
||||
"";
|
||||
"////////////////////////////////////////////////////////////////";
|
||||
"//~ Format Types & Functions";
|
||||
@@ -179,52 +179,36 @@ RDI_SectionTable:
|
||||
{Members members RDI_Member 0x0015 U32 ""}
|
||||
{EnumMembers enum_members RDI_EnumMember 0x0016 U32 ""}
|
||||
|
||||
//- TODO(rjf): vvv old story for symbols
|
||||
{GlobalVariables global_variables RDI_GlobalVariable 0x0017 U32 ""}
|
||||
{ThreadVariables thread_variables RDI_ThreadVariable 0x0018 U32 ""}
|
||||
{Constants constants RDI_Constant 0x0019 U32 ""}
|
||||
{Procedures procedures RDI_Procedure 0x001A U32 ""}
|
||||
{Locals locals RDI_Local 0x001B U32 ""}
|
||||
|
||||
|
||||
//- rjf: scope info
|
||||
{Scopes scopes RDI_Scope 0x001C U32 ""}
|
||||
{ScopeVOffData scope_voff_data RDI_U64 0x001D U32 ""}
|
||||
{ScopeVMap scope_vmap RDI_VMapEntry 0x001E - ""}
|
||||
{InlineSites inline_sites RDI_InlineSite 0x001F U32 ""}
|
||||
{Scopes scopes RDI_Scope 0x0017 U32 ""}
|
||||
{ScopeVOffData scope_voff_data RDI_U64 0x0018 U32 ""}
|
||||
{ScopeVMap scope_vmap RDI_VMapEntry 0x0019 - ""}
|
||||
{InlineSites inline_sites RDI_InlineSite 0x001A U32 ""}
|
||||
|
||||
//- TODO(rjf): vvv old story for locations
|
||||
{LocationBlocks location_blocks RDI_LocationBlock 0x0020 U32 ""}
|
||||
{LocationData location_data RDI_U8 0x0021 U32 ""}
|
||||
//- rjf: symbols
|
||||
{GlobalVariableSymbols global_variable_symbols RDI_Symbol 0x001B U32 ""}
|
||||
{GlobalVMap global_vmap RDI_VMapEntry 0x001C - ""}
|
||||
{ThreadVariableSymbols thread_variable_symbols RDI_Symbol 0x001D U32 ""}
|
||||
{ConstantSymbols constant_symbols RDI_Symbol 0x001E U32 ""}
|
||||
{ProcedureSymbols procedure_symbols RDI_Symbol 0x001F U32 ""}
|
||||
{LocalVariableSymbols local_variable_symbols RDI_Symbol 0x0020 U32 ""}
|
||||
|
||||
//- NOTE(rjf): vvv new story for symbols
|
||||
{GlobalVariableSymbols global_variable_symbols RDI_Symbol 0x0022 U32 ""}
|
||||
{GlobalVMap global_vmap RDI_VMapEntry 0x0023 - ""}
|
||||
{ThreadVariableSymbols thread_variable_symbols RDI_Symbol 0x0024 U32 ""}
|
||||
{ConstantSymbols constant_symbols RDI_Symbol 0x0025 U32 ""}
|
||||
{ProcedureSymbols procedure_symbols RDI_Symbol 0x0026 U32 ""}
|
||||
{LocalVariableSymbols local_variable_symbols RDI_Symbol 0x0027 U32 ""}
|
||||
|
||||
//- NOTE(rjf): vvv new story for locations
|
||||
{LocationsBytecodeData locations_bytecode_data RDI_U8 0x0028 U32 ""}
|
||||
{LocationsConstantData locations_constant_data RDI_U8 0x0029 U32 ""}
|
||||
{LocationsSetElements locations_set_elements RDI_LocationSetElement 0x002A U32 ""}
|
||||
|
||||
//- TODO(rjf): vvv old story for locations (constants)
|
||||
{ConstantValueData constant_value_data RDI_U8 0x002B U32 ""}
|
||||
{ConstantValueTable constant_value_table RDI_U32 0x002C U32 ""}
|
||||
//- rjf: locations
|
||||
{LocationsBytecodeData locations_bytecode_data RDI_U8 0x0021 U32 ""}
|
||||
{LocationsConstantData locations_constant_data RDI_U8 0x0022 U32 ""}
|
||||
{LocationsSetElements locations_set_elements RDI_LocationSetElement 0x0023 U32 ""}
|
||||
|
||||
//- rjf: checksums / timestamps
|
||||
{MD5Checksums md5_checksums RDI_MD5 0x002D U32 ""}
|
||||
{SHA1Checksums sha1_checksums RDI_SHA1 0x002E U32 ""}
|
||||
{SHA256Checksums sha256_checksums RDI_SHA256 0x002F U32 ""}
|
||||
{Timestamps timestamps RDI_U64 0x0030 U32 ""}
|
||||
{MD5Checksums md5_checksums RDI_MD5 0x0024 U32 ""}
|
||||
{SHA1Checksums sha1_checksums RDI_SHA1 0x0025 U32 ""}
|
||||
{SHA256Checksums sha256_checksums RDI_SHA256 0x0026 U32 ""}
|
||||
{Timestamps timestamps RDI_U64 0x0027 U32 ""}
|
||||
|
||||
//- rjf: name maps
|
||||
{NameMaps name_maps RDI_NameMap 0x0031 U32 ""}
|
||||
{NameMapBuckets name_map_buckets RDI_NameMapBucket 0x0032 U32 ""}
|
||||
{NameMapNodes name_map_nodes RDI_NameMapNode 0x0033 U32 ""}
|
||||
{COUNT count RDI_U8 0x0034 - ""}
|
||||
{NameMaps name_maps RDI_NameMap 0x0028 U32 ""}
|
||||
{NameMapBuckets name_map_buckets RDI_NameMapBucket 0x0029 U32 ""}
|
||||
{NameMapNodes name_map_nodes RDI_NameMapNode 0x002A U32 ""}
|
||||
{COUNT count RDI_U8 0x002B - ""}
|
||||
}
|
||||
|
||||
@table(name value)
|
||||
@@ -1016,22 +1000,6 @@ RDI_ContainerFlagTable:
|
||||
{KindMask `0x7f`}
|
||||
}
|
||||
|
||||
@table(name value)
|
||||
RDI_LinkFlagTable:
|
||||
{
|
||||
{External `1<<0`}
|
||||
{TypeScoped `1<<1`}
|
||||
{ProcScoped `1<<2`}
|
||||
}
|
||||
|
||||
@table(name value)
|
||||
RDI_LocalKindTable:
|
||||
{
|
||||
{NULL 0x0}
|
||||
{Parameter 0x1}
|
||||
{Variable 0x2}
|
||||
}
|
||||
|
||||
@table(name value)
|
||||
RDI_LocationKindTable:
|
||||
{
|
||||
@@ -1075,47 +1043,6 @@ RDI_SymbolMemberTable:
|
||||
{link_name_string_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_GlobalVariableMemberTable:
|
||||
{
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{link_flags RDI_LinkFlags ""}
|
||||
{voff RDI_U64 ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{container_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_ThreadVariableMemberTable:
|
||||
{
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{link_flags RDI_LinkFlags ""}
|
||||
{tls_off RDI_U32 ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{container_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_ConstantMemberTable:
|
||||
{
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{constant_value_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_ProcedureMemberTable:
|
||||
{
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{link_name_string_idx RDI_U32 ""}
|
||||
{link_flags RDI_LinkFlags ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{root_scope_idx RDI_U32 ""}
|
||||
{container_idx RDI_U32 ""}
|
||||
{frame_base_location_first RDI_U32 ""}
|
||||
{frame_base_location_opl RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_ScopeMemberTable:
|
||||
{
|
||||
@@ -1139,54 +1066,6 @@ RDI_InlineSiteMemberTable:
|
||||
{line_table_idx RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocalMemberTable:
|
||||
{
|
||||
{kind RDI_LocalKind ""}
|
||||
{name_string_idx RDI_U32 ""}
|
||||
{type_idx RDI_U32 ""}
|
||||
{pad RDI_U32 ""}
|
||||
{location_first RDI_U32 ""}
|
||||
{location_opl RDI_U32 ""}
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationBlockMemberTable:
|
||||
{
|
||||
{scope_off_first RDI_U32 }
|
||||
{scope_off_opl RDI_U32 }
|
||||
{location_data_off RDI_U32 }
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationBytecodeStreamMemberTable:
|
||||
{
|
||||
{kind RDI_LocationKind ""}
|
||||
// [... 0] null terminated byte sequence RDI_EvalBytecodeStream
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationRegPlusU16MemberTable:
|
||||
{
|
||||
{kind RDI_LocationKind }
|
||||
{reg_code RDI_RegCode }
|
||||
{offset RDI_U16 }
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationRegMemberTable:
|
||||
{
|
||||
{kind RDI_LocationKind }
|
||||
{reg_code RDI_RegCode }
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_RegAndOffsetU16MemberTable:
|
||||
{
|
||||
{reg_code RDI_RegCode }
|
||||
{offset RDI_U16 }
|
||||
}
|
||||
|
||||
@table(name type desc)
|
||||
RDI_LocationSetElementMemberTable:
|
||||
{
|
||||
@@ -1207,16 +1086,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_ContainerFlagTable a) `$(a.name .. =>20) = $(a.value)`,
|
||||
}
|
||||
|
||||
@enum(RDI_U32) RDI_LinkFlags:
|
||||
{
|
||||
@expand(RDI_LinkFlagTable a) `$(a.name .. =>20) = $(a.value)`
|
||||
}
|
||||
|
||||
@enum(RDI_U32) RDI_LocalKind:
|
||||
{
|
||||
@expand(RDI_LocalKindTable a) `$(a.name .. =>20) = $(a.value)`
|
||||
}
|
||||
|
||||
@enum(RDI_U8) RDI_SymbolFlags:
|
||||
{
|
||||
@expand(RDI_SymbolFlagTable a) `$(a.name .. =>20) = $(a.value)`
|
||||
@@ -1265,11 +1134,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_LinkFlagTable a) `$(a.name != COUNT -> a.name)`;
|
||||
}
|
||||
|
||||
@xlist RDI_LocalKind_XList:
|
||||
{
|
||||
@expand(RDI_LocalKindTable a) `$(a.name != COUNT -> a.name)`;
|
||||
}
|
||||
|
||||
@xlist RDI_LocationKind_XList:
|
||||
{
|
||||
@expand(RDI_LocationKindTable a) `$(a.name != COUNT -> a.name)`;
|
||||
@@ -1285,21 +1149,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_SymbolMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_GlobalVariable_XList:
|
||||
{
|
||||
@expand(RDI_GlobalVariableMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_ThreadVariable_XList:
|
||||
{
|
||||
@expand(RDI_ThreadVariableMemberTable a) `$(type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_Procedure_XList:
|
||||
{
|
||||
@expand(RDI_ProcedureMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_Scope_XList:
|
||||
{
|
||||
@expand(RDI_ScopeMemberTable a) `$(a.type), $(a.name)`
|
||||
@@ -1310,41 +1159,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_InlineSiteMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_Local_XList:
|
||||
{
|
||||
@expand(RDI_LocalMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationBlock_XList:
|
||||
{
|
||||
@expand(RDI_LocationBlockMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationBytecodeStream_XList:
|
||||
{
|
||||
@expand(RDI_LocationBytecodeStreamMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationRegPlusU16_XList:
|
||||
{
|
||||
@expand(RDI_LocationRegPlusU16MemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationReg_XList:
|
||||
{
|
||||
@expand(RDI_LocationRegMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_RegAndOffsetU16_XList:
|
||||
{
|
||||
@expand(RDI_RegAndOffsetU16MemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
@xlist RDI_LocationSetElement_XList:
|
||||
{
|
||||
@expand(RDI_LocationSetElementMemberTable a) `$(a.type), $(a.name)`
|
||||
}
|
||||
|
||||
//- rjf: structs
|
||||
|
||||
@struct RDI_Namespace:
|
||||
@@ -1357,26 +1171,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_SymbolMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_GlobalVariable:
|
||||
{
|
||||
@expand(RDI_GlobalVariableMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_ThreadVariable:
|
||||
{
|
||||
@expand(RDI_ThreadVariableMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_Constant:
|
||||
{
|
||||
@expand(RDI_ConstantMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_Procedure:
|
||||
{
|
||||
@expand(RDI_ProcedureMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_Scope:
|
||||
{
|
||||
@expand(RDI_ScopeMemberTable a) `$(a.type) $(a.name)`
|
||||
@@ -1387,36 +1181,6 @@ RDI_LocationSetElementMemberTable:
|
||||
@expand(RDI_InlineSiteMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_Local:
|
||||
{
|
||||
@expand(RDI_LocalMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationBlock:
|
||||
{
|
||||
@expand(RDI_LocationBlockMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationBytecodeStream:
|
||||
{
|
||||
@expand(RDI_LocationBytecodeStreamMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationRegPlusU16:
|
||||
{
|
||||
@expand(RDI_LocationRegPlusU16MemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationReg:
|
||||
{
|
||||
@expand(RDI_LocationRegMemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_RegAndOffsetU16:
|
||||
{
|
||||
@expand(RDI_RegAndOffsetU16MemberTable a) `$(a.type) $(a.name)`
|
||||
}
|
||||
|
||||
@struct RDI_LocationSetElement:
|
||||
{
|
||||
@expand(RDI_LocationSetElementMemberTable a) `$(a.type) $(a.name)`
|
||||
|
||||
+1
-231
@@ -93,20 +93,6 @@ rdi_string_from_language(Arena *arena, RDI_Language v)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_local_kind(Arena *arena, RDI_LocalKind v)
|
||||
{
|
||||
String8 result = {0};
|
||||
switch(v)
|
||||
{
|
||||
default:{result = push_str8f(arena, "<invalid RDI_LocalKind %u>", v);}break;
|
||||
#define X(name) case RDI_LocalKind_##name:{result = str8_lit(#name);}break;
|
||||
RDI_LocalKind_XList
|
||||
#undef X
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#if 0
|
||||
internal String8
|
||||
rdi_string_from_type_kind(Arena *arena, RDI_TypeKind v)
|
||||
@@ -251,21 +237,6 @@ rdi_string_from_udt_flags(Arena *arena, RDI_UDTFlags flags)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_link_flags(Arena *arena, RDI_LinkFlags flags)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
String8List list = {0};
|
||||
#define X(name) if (flags & RDI_LinkFlag_##name) { flags &= ~RDI_LinkFlag_##name; str8_list_push(scratch.arena, &list, str8_lit(#name)); }
|
||||
RDI_LinkFlags_XList;
|
||||
#undef X
|
||||
StringJoin join = {.sep = str8_lit("|")};
|
||||
String8 result = str8_list_join(arena, &list, &join);
|
||||
if(result.size == 0) { result = str8_lit("None"); }
|
||||
scratch_end(scratch);
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8
|
||||
rdi_string_from_bytecode(Arena *arena, RDI_Arch arch, String8 bc)
|
||||
{
|
||||
@@ -427,103 +398,6 @@ rdi_string_from_bytecode(Arena *arena, RDI_Arch arch, String8 bc)
|
||||
return result;
|
||||
}
|
||||
|
||||
internal String8List
|
||||
rdi_strings_from_locations(Arena *arena, RDI_Parsed *rdi, RDI_Arch arch, Rng1U64 location_block_range)
|
||||
{
|
||||
String8List strings = {0};
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
U64 location_block_count = 0;
|
||||
U64 location_data_size = 0;
|
||||
RDI_LocationBlock *location_block_array = rdi_table_from_name(rdi, LocationBlocks, &location_block_count);
|
||||
RDI_U8 *location_data = rdi_table_from_name(rdi, LocationData, &location_data_size);
|
||||
Rng1U64 location_block_range_clamped = r1u64(ClampTop(location_block_range.min, location_block_count),
|
||||
ClampTop(location_block_range.max, location_block_count));
|
||||
for(U64 block_idx = location_block_range_clamped.min;
|
||||
block_idx < location_block_range_clamped.max;
|
||||
block_idx +=1)
|
||||
{
|
||||
String8 qualifier = {0};
|
||||
String8 location_info = {0};
|
||||
RDI_LocationBlock *block_ptr = &location_block_array[block_idx];
|
||||
if(block_ptr->scope_off_first == 0 && block_ptr->scope_off_opl == max_U32)
|
||||
{
|
||||
qualifier = str8_lit("*always*");
|
||||
}
|
||||
else
|
||||
{
|
||||
qualifier = push_str8f(scratch.arena, "[%#08x, %#08x): ", block_ptr->scope_off_first, block_ptr->scope_off_opl);
|
||||
}
|
||||
if(block_ptr->location_data_off >= location_data_size)
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "<bad-location-data-offset %x>", block_ptr->location_data_off);
|
||||
}
|
||||
else
|
||||
{
|
||||
U8 *loc_data_opl = location_data + location_data_size;
|
||||
U8 *loc_base_ptr = location_data + block_ptr->location_data_off;
|
||||
RDI_LocationKind kind = *(RDI_LocationKind *)loc_base_ptr;
|
||||
switch(kind)
|
||||
{
|
||||
default:
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "\?\?\? (%u)", kind);
|
||||
}break;
|
||||
case RDI_LocationKind_AddrBytecodeStream:
|
||||
{
|
||||
String8 bc = str8_range(loc_base_ptr + 1, loc_data_opl);
|
||||
String8 bc_str = rdi_string_from_bytecode(scratch.arena, arch, bc);
|
||||
location_info = push_str8f(scratch.arena, "AddrBytecodeStream(%S)", bc_str);
|
||||
}break;
|
||||
case RDI_LocationKind_ValBytecodeStream:
|
||||
{
|
||||
String8 bc = str8_range(loc_base_ptr + 1, loc_data_opl);
|
||||
String8 bc_str = rdi_string_from_bytecode(scratch.arena, arch, bc);
|
||||
location_info = push_str8f(scratch.arena, "ValBytecodeStream(%S)", bc_str);
|
||||
}break;
|
||||
case RDI_LocationKind_AddrRegPlusU16:
|
||||
{
|
||||
if(loc_base_ptr + sizeof(RDI_LocationRegPlusU16) > loc_data_opl)
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "AddrRegPlusU16(\?\?\?)");
|
||||
}
|
||||
else
|
||||
{
|
||||
RDI_LocationRegPlusU16 *loc = (RDI_LocationRegPlusU16*)loc_base_ptr;
|
||||
location_info = push_str8f(scratch.arena, "AddrRegPlusU16(reg: %S, off: %u)", rdi_string_from_reg_code(scratch.arena, arch, loc->reg_code), loc->offset);
|
||||
}
|
||||
}break;
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16:
|
||||
{
|
||||
if(loc_base_ptr + sizeof(RDI_LocationRegPlusU16) > loc_data_opl)
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "AddrAddrRegPlusU16(\?\?\?)");
|
||||
}
|
||||
else
|
||||
{
|
||||
RDI_LocationRegPlusU16 *loc = (RDI_LocationRegPlusU16 *)loc_base_ptr;
|
||||
location_info = push_str8f(scratch.arena, "AddrAddrRegisterPlusU16(reg: %S, off: %u)", rdi_string_from_reg_code(scratch.arena, arch, loc->reg_code), loc->offset);
|
||||
}
|
||||
}break;
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
if(loc_base_ptr + sizeof(RDI_LocationReg) > loc_data_opl)
|
||||
{
|
||||
location_info = push_str8f(scratch.arena, "ValReg(\?\?\?)");
|
||||
}
|
||||
else
|
||||
{
|
||||
RDI_LocationReg *loc = (RDI_LocationReg*)loc_base_ptr;
|
||||
location_info = push_str8f(scratch.arena, "ValReg(reg: %S)", rdi_string_from_reg_code(scratch.arena, arch, loc->reg_code));
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
str8_list_pushf(arena, &strings, "%S: %S", qualifier, location_info);
|
||||
}
|
||||
scratch_end(scratch);
|
||||
return strings;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Dumping
|
||||
|
||||
@@ -997,30 +871,6 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump global variables
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
DumpSubset(GlobalVariables)
|
||||
{
|
||||
U64 count = 0;
|
||||
RDI_GlobalVariable *v = rdi_table_from_name(rdi, GlobalVariables, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_GlobalVariable *gvar = &v[idx];
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
dumpf("\n '%S': // global_variable[%I64u]\n {\n", str8_from_rdi_string_idx(rdi, gvar->name_string_idx), idx);
|
||||
dumpf(" link_flags: `%S`\n", rdi_string_from_link_flags(scratch.arena, gvar->link_flags));
|
||||
dumpf(" voff: %#08x\n", gvar->voff);
|
||||
dumpf(" type_idx: %u\n", gvar->type_idx);
|
||||
dumpf(" container_idx: %u\n", gvar->container_idx);
|
||||
dumpf(" }\n");
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump global variables vmap
|
||||
//
|
||||
@@ -1036,86 +886,6 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump thread variables
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
DumpSubset(ThreadVariables)
|
||||
{
|
||||
U64 count = 0;
|
||||
RDI_ThreadVariable *v = rdi_table_from_name(rdi, ThreadVariables, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_ThreadVariable *tvar = &v[idx];
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
dumpf("\n '%S': // thread_variable[%I64u]\n {\n", str8_from_rdi_string_idx(rdi, tvar->name_string_idx), idx);
|
||||
dumpf(" link_flags: `%S`\n", rdi_string_from_link_flags(scratch.arena, tvar->link_flags));
|
||||
dumpf(" tls_off: %#08x\n", tvar->tls_off);
|
||||
dumpf(" type_idx: %u\n", tvar->type_idx);
|
||||
dumpf(" container_idx: %u\n", tvar->container_idx);
|
||||
dumpf(" }\n");
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump constants
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
DumpSubset(Constants)
|
||||
{
|
||||
U64 count = 0;
|
||||
RDI_Constant *v = rdi_table_from_name(rdi, Constants, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_Constant *cnst = &v[idx];
|
||||
dumpf("\n '%S': // constant[%I64u]\n {\n", str8_from_rdi_string_idx(rdi, cnst->name_string_idx), idx);
|
||||
dumpf(" type_idx: %u\n", cnst->type_idx);
|
||||
dumpf(" }\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump procedures
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
DumpSubset(Procedures)
|
||||
{
|
||||
RDI_TopLevelInfo *tli = rdi_element_from_name_idx(rdi, TopLevelInfo, 0);
|
||||
U64 count = 0;
|
||||
RDI_Procedure *v = rdi_table_from_name(rdi, Procedures, &count);
|
||||
Rng1U64 range = lane_range(count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
RDI_Procedure *proc = &v[idx];
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
dumpf("\n '%S': // procedure[%I64u]\n {\n", str8_from_rdi_string_idx(rdi, proc->name_string_idx), idx);
|
||||
dumpf(" link_name: '%S'\n", str8_from_rdi_string_idx(rdi, proc->link_name_string_idx));
|
||||
dumpf(" link_flags: `%S`\n", rdi_string_from_link_flags(scratch.arena, proc->link_flags));
|
||||
dumpf(" type_idx: %u\n", proc->type_idx);
|
||||
dumpf(" root_scope_idx: %u\n", proc->root_scope_idx);
|
||||
dumpf(" container_idx: %u\n", proc->container_idx);
|
||||
if(proc->frame_base_location_first != 0)
|
||||
{
|
||||
String8List frame_base_location_strings = rdi_strings_from_locations(scratch.arena, rdi, tli->arch, r1u64(proc->frame_base_location_first, proc->frame_base_location_opl));
|
||||
dumpf(" frame_base: // (first: %u, opl: %u)\n", proc->frame_base_location_first, proc->frame_base_location_opl);
|
||||
dumpf(" {\n");
|
||||
for(String8Node *n = frame_base_location_strings.first; n != 0; n = n->next)
|
||||
{
|
||||
dumpf(" %S\n", n->string);
|
||||
}
|
||||
dumpf(" }\n");
|
||||
}
|
||||
dumpf(" }\n");
|
||||
scratch_end(scratch);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////
|
||||
//- rjf: dump symbols
|
||||
//
|
||||
@@ -1514,7 +1284,7 @@ lane_sync(); if(flags & (1ull<<(kind))) ProfScope(rdi_name_title_from_dump_subse
|
||||
|
||||
#if SUBPROGRAM_CONVERSION_TEST
|
||||
internal String8
|
||||
rdi_string_from_type(Arena *arena, RDI_Parsed *rdi, RDI_Procedure *proc, RDI_TypeNode *type)
|
||||
rdi_string_from_type(Arena *arena, RDI_Parsed *rdi, RDI_Symbol *proc, RDI_TypeNode *type)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
|
||||
|
||||
+1
-4
@@ -82,7 +82,6 @@ internal String8 str8_from_rdi_path_node_idx(Arena *arean, RDI_Parsed *rdi, Path
|
||||
internal String8 rdi_string_from_data_section_kind(Arena *arena, RDI_SectionKind v);
|
||||
internal String8 rdi_string_from_arch (Arena *arena, RDI_Arch v);
|
||||
internal String8 rdi_string_from_language (Arena *arena, RDI_Language v);
|
||||
internal String8 rdi_string_from_local_kind (Arena *arena, RDI_LocalKind v);
|
||||
#if 0 // TODO(rjf): conflicts with RDI...
|
||||
internal String8 rdi_string_from_type_kind (Arena *arena, RDI_TypeKind v);
|
||||
#endif
|
||||
@@ -92,9 +91,7 @@ internal String8 rdi_string_from_name_map_kind(RDI_NameMapKind kind);
|
||||
internal String8 rdi_string_from_binary_section_flags(Arena *arena, RDI_BinarySectionFlags flags);
|
||||
internal String8 rdi_string_from_type_modifier_flags (Arena *arena, RDI_TypeModifierFlags flags);
|
||||
internal String8 rdi_string_from_udt_flags (Arena *arena, RDI_UDTFlags flags);
|
||||
internal String8 rdi_string_from_link_flags (Arena *arena, RDI_LinkFlags flags);
|
||||
internal String8 rdi_string_from_bytecode(Arena *arena, RDI_Arch arch, String8 bc);
|
||||
internal String8List rdi_strings_from_locations(Arena *arena, RDI_Parsed *rdi, RDI_Arch arch, Rng1U64 location_block_range);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: RDI Dumping
|
||||
@@ -104,6 +101,6 @@ internal String8List rdi_dump_list_from_parsed(Arena *arena, RDI_Parsed *rdi, RD
|
||||
////////////////////////////////
|
||||
//~ Type Formatter
|
||||
|
||||
internal String8 rdi_string_from_type(Arena *arena, RDI_Parsed *rdi, RDI_Procedure *proc, RDI_TypeNode *type);
|
||||
internal String8 rdi_string_from_type(Arena *arena, RDI_Parsed *rdi, RDI_Symbol *proc, RDI_TypeNode *type);
|
||||
|
||||
#endif // RDI_FORMAT_LOCAL_H
|
||||
|
||||
@@ -3112,13 +3112,6 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
||||
bake_params.udts = g_d2r_shared.udts;
|
||||
bake_params.src_files = g_d2r_shared.src_files;
|
||||
bake_params.line_tables = g_d2r_shared.line_tables;
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
bake_params.global_variables = g_d2r_shared.gvars;
|
||||
bake_params.thread_variables = g_d2r_shared.tvars;
|
||||
bake_params.procedures = g_d2r_shared.procs;
|
||||
bake_params.scopes = g_d2r_shared.scopes;
|
||||
bake_params.inline_sites = g_d2r_shared.inline_sites;
|
||||
#endif
|
||||
|
||||
scratch_end(scratch);
|
||||
return bake_params;
|
||||
|
||||
@@ -337,41 +337,6 @@ p2r_location_from_addr_reg_off(Arena *arena, RDI_Arch arch, RDI_RegCode reg_code
|
||||
return result;
|
||||
}
|
||||
|
||||
internal void
|
||||
p2r_local_push_location_cases_over_lvar_addr_range(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location *loc, CV_LvarAddrRange *range, COFF_SectionHeader *section, CV_LvarAddrGap *gaps, U64 gap_count)
|
||||
{
|
||||
//- rjf: extract range info
|
||||
U64 voff_first = 0;
|
||||
U64 voff_opl = 0;
|
||||
if(section != 0)
|
||||
{
|
||||
voff_first = section->voff + range->off;
|
||||
voff_opl = voff_first + range->len;
|
||||
}
|
||||
|
||||
//- rjf: emit location for ranges not coverd by gaps
|
||||
CV_LvarAddrGap *gap_ptr = gaps;
|
||||
U64 voff_cursor = voff_first;
|
||||
for(U64 i = 0; i < gap_count; i += 1, gap_ptr += 1)
|
||||
{
|
||||
U64 voff_gap_first = voff_first + gap_ptr->off;
|
||||
U64 voff_gap_opl = voff_gap_first + gap_ptr->len;
|
||||
if(voff_cursor < voff_gap_first)
|
||||
{
|
||||
RDIM_Rng1U64 voff_range = {voff_cursor, voff_gap_first};
|
||||
rdim_local_push_location_case(arena, scopes, local, loc, voff_range);
|
||||
}
|
||||
voff_cursor = voff_gap_opl;
|
||||
}
|
||||
|
||||
//- rjf: emit remaining range
|
||||
if(voff_cursor < voff_opl)
|
||||
{
|
||||
RDIM_Rng1U64 voff_range = {voff_cursor, voff_opl};
|
||||
rdim_local_push_location_case(arena, scopes, local, loc, voff_range);
|
||||
}
|
||||
}
|
||||
|
||||
internal void
|
||||
p2r_location_case_list_push_over_lvar_addr_range(Arena *arena, RDIM_LocationCaseList *loc_cases, RDIM_Location loc, CV_LvarAddrRange *range, COFF_SectionHeader *section, CV_LvarAddrGap *gaps, U64 gap_count)
|
||||
{
|
||||
@@ -3664,7 +3629,6 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params)
|
||||
|
||||
// rjf: determine if this is a parameter
|
||||
B32 is_param = (regrel_idx < curr_proc_symbol->type->count);
|
||||
RDI_LocalKind local_kind = is_param ? RDI_LocalKind_Parameter : RDI_LocalKind_Variable;
|
||||
|
||||
// rjf: determine if we need an extra indirection to the value
|
||||
B32 extra_indirection_to_value = 0;
|
||||
@@ -3674,7 +3638,7 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params)
|
||||
{
|
||||
case RDI_Arch_X64:
|
||||
{
|
||||
extra_indirection_to_value = (local_kind == RDI_LocalKind_Parameter && (type->byte_size > 8 || !IsPow2OrZero(type->byte_size)));
|
||||
extra_indirection_to_value = (is_param && (type->byte_size > 8 || !IsPow2OrZero(type->byte_size)));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
@@ -3729,29 +3693,6 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params)
|
||||
rdim_location_case_list_push(arena, &local->location_cases, loc, voff_range);
|
||||
}
|
||||
}
|
||||
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
// rjf: build local
|
||||
RDIM_Scope *scope = top_scope_node->scope;
|
||||
RDIM_Local *local = rdim_scope_push_local(arena, sym_scopes, scope);
|
||||
local->kind = local_kind;
|
||||
local->name = name;
|
||||
local->type = type;
|
||||
|
||||
// rjf: add location info to local
|
||||
{
|
||||
// rjf: get raddbg register code
|
||||
RDI_RegCode reg_code = p2r_rdi_reg_code_from_cv_reg_code(arch, cv_reg);
|
||||
// TODO(rjf): real byte_size & byte_pos from cv_reg goes here
|
||||
U32 byte_size = 8;
|
||||
U32 byte_pos = 0;
|
||||
|
||||
// rjf: build location
|
||||
RDIM_Location loc = p2r_location_from_addr_reg_off(arena, arch, reg_code, byte_size, byte_pos, (S64)(S32)var_off, extra_indirection_to_value);
|
||||
RDIM_Rng1U64 voff_range = {0, max_U64};
|
||||
rdim_local_push_location_case(arena, sym_scopes, local, &loc, voff_range);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
regrel_idx += 1;
|
||||
@@ -3831,13 +3772,6 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params)
|
||||
// rjf: is not a global modification -> emit a local variable
|
||||
if(!is_global_modification)
|
||||
{
|
||||
// rjf: determine local kind
|
||||
RDI_LocalKind local_kind = RDI_LocalKind_Variable;
|
||||
if(slocal->flags & CV_LocalFlag_Param)
|
||||
{
|
||||
local_kind = RDI_LocalKind_Parameter;
|
||||
}
|
||||
|
||||
// rjf: build local
|
||||
RDIM_Scope *scope = top_scope_node->scope;
|
||||
RDIM_Symbol *local = rdim_symbol_chunk_list_push(arena, &scope->locals, 8);
|
||||
@@ -3847,15 +3781,6 @@ p2r_convert(Arena *arena, P2R_ConvertParams *params)
|
||||
local->type = type;
|
||||
}
|
||||
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
// rjf: build local
|
||||
RDIM_Scope *scope = top_scope_node->scope;
|
||||
RDIM_Local *local = rdim_scope_push_local(arena, sym_scopes, scope);
|
||||
local->kind = local_kind;
|
||||
local->name = name;
|
||||
local->type = type;
|
||||
#endif
|
||||
|
||||
// rjf: save defrange target, for subsequent defrange symbols
|
||||
defrange_target = local;
|
||||
}
|
||||
|
||||
@@ -112,7 +112,6 @@ internal RDI_ChecksumKind p2r_rdi_from_cv_c13_checksum_kind(CV_C13ChecksumKind k
|
||||
|
||||
internal RDI_RegCode p2r_reg_code_from_arch_encoded_fp_reg(RDI_Arch arch, CV_EncodedFramePtrReg encoded_reg);
|
||||
internal RDIM_Location p2r_location_from_addr_reg_off(Arena *arena, RDI_Arch arch, RDI_RegCode reg_code, U32 reg_byte_size, U32 reg_byte_pos, S64 offset, B32 extra_indirection);
|
||||
internal void p2r_local_push_location_cases_over_lvar_addr_range(Arena *arena, RDIM_ScopeChunkList *scopes, RDIM_Local *local, RDIM_Location *loc, CV_LvarAddrRange *range, COFF_SectionHeader *section, CV_LvarAddrGap *gaps, U64 gap_count);
|
||||
internal void p2r_location_case_list_push_over_lvar_addr_range(Arena *arena, RDIM_LocationCaseList *loc_cases, RDIM_Location loc, CV_LvarAddrRange *range, COFF_SectionHeader *section, CV_LvarAddrGap *gaps, U64 gap_count);
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -2753,216 +2753,6 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
}
|
||||
lane_sync();
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage compute lane location block layout
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
typedef struct LocLayout LocLayout;
|
||||
struct LocLayout
|
||||
{
|
||||
RDI_U64 *location_case_chunk_lane_counts; // [lane_count * (scope_chunk_count + procedure_chunk_count)
|
||||
RDI_U64 *location_case_chunk_lane_offs; // [lane_count * (scope_chunk_count + procedure_chunk_count)
|
||||
RDI_U64 total_location_case_count;
|
||||
};
|
||||
LocLayout *loc_layout = 0;
|
||||
U64 total_location_case_chunk_count = (all_scopes->chunk_count + params->procedures.chunk_count);
|
||||
ProfScope("compute lane location block layout")
|
||||
{
|
||||
// rjf: set up
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
loc_layout = push_array(scratch.arena, LocLayout, 1);
|
||||
loc_layout->location_case_chunk_lane_counts = push_array(arena, RDI_U64, lane_count() * total_location_case_chunk_count);
|
||||
loc_layout->location_case_chunk_lane_offs = push_array(arena, RDI_U64, lane_count() * total_location_case_chunk_count);
|
||||
}
|
||||
lane_sync_u64(&loc_layout, 0);
|
||||
|
||||
// rjf: per-chunk-lane count of location cases
|
||||
{
|
||||
// rjf: count location cases in scopes
|
||||
U64 chunk_idx = 0;
|
||||
for EachNode(n, RDIM_ScopeChunkNode, all_scopes->first)
|
||||
{
|
||||
U64 slot_idx = lane_idx() * total_location_case_chunk_count + chunk_idx;
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
for EachNode(local, RDIM_Local, n->v[idx].first_local)
|
||||
{
|
||||
loc_layout->location_case_chunk_lane_counts[slot_idx] += local->location_cases.count;
|
||||
}
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
|
||||
// rjf: count location cases in procedures
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->procedures.first)
|
||||
{
|
||||
U64 slot_idx = lane_idx() * total_location_case_chunk_count + chunk_idx;
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
loc_layout->location_case_chunk_lane_counts[slot_idx] += n->v[idx].location_cases.count;
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
}
|
||||
lane_sync();
|
||||
|
||||
// rjf: lay out location case offsets
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
U64 chunk_idx = 0;
|
||||
U64 location_case_layout_off = 1;
|
||||
for EachNode(n, RDIM_ScopeChunkNode, all_scopes->first)
|
||||
{
|
||||
for EachIndex(l_idx, lane_count())
|
||||
{
|
||||
U64 slot_idx = l_idx * total_location_case_chunk_count + chunk_idx;
|
||||
loc_layout->location_case_chunk_lane_offs[slot_idx] = location_case_layout_off;
|
||||
location_case_layout_off += loc_layout->location_case_chunk_lane_counts[slot_idx];
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->procedures.first)
|
||||
{
|
||||
for EachIndex(l_idx, lane_count())
|
||||
{
|
||||
U64 slot_idx = l_idx * total_location_case_chunk_count + chunk_idx;
|
||||
loc_layout->location_case_chunk_lane_offs[slot_idx] = location_case_layout_off;
|
||||
location_case_layout_off += loc_layout->location_case_chunk_lane_counts[slot_idx];
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
loc_layout->total_location_case_count = location_case_layout_off;
|
||||
}
|
||||
}
|
||||
lane_sync();
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage bake location blocks
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDIM_LocationBlockBakeResult *baked_location_blocks = 0;
|
||||
ProfScope("bake location blocks")
|
||||
{
|
||||
// rjf: set up
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
baked_location_blocks = push_array(scratch.arena, RDIM_LocationBlockBakeResult, 1);
|
||||
baked_location_blocks->location_blocks_count = loc_layout->total_location_case_count;
|
||||
baked_location_blocks->location_blocks = push_array(arena, RDI_LocationBlock, baked_location_blocks->location_blocks_count);
|
||||
}
|
||||
lane_sync_u64(&baked_location_blocks, 0);
|
||||
|
||||
// rjf: wide fill from scopes
|
||||
U64 chunk_idx = 0;
|
||||
ProfScope("wide fill from scopes")
|
||||
{
|
||||
for EachNode(n, RDIM_ScopeChunkNode, all_scopes->first)
|
||||
{
|
||||
U64 layout_slot_idx = lane_idx() * total_location_case_chunk_count + chunk_idx;
|
||||
U64 layout_off = loc_layout->location_case_chunk_lane_offs[layout_slot_idx];
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
for EachNode(local, RDIM_Local, n->v[idx].first_local)
|
||||
{
|
||||
for EachNode(src, RDIM_LocationCase, local->location_cases.first)
|
||||
{
|
||||
RDI_LocationBlock *dst = &baked_location_blocks->location_blocks[layout_off];
|
||||
dst->scope_off_first = (RDI_U32)src->voff_range.min; // TODO(rjf): @u64_to_u32
|
||||
dst->scope_off_opl = (RDI_U32)src->voff_range.max; // TODO(rjf): @u64_to_u32
|
||||
dst->location_data_off = (RDI_U32)rdim_off_from_location(src->location); // TODO(rjf): @u64_to_u32
|
||||
layout_off += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
}
|
||||
|
||||
// rjf: wide fill from procedures
|
||||
ProfScope("wide fill from procedures")
|
||||
{
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->procedures.first)
|
||||
{
|
||||
U64 layout_slot_idx = lane_idx() * total_location_case_chunk_count + chunk_idx;
|
||||
U64 layout_off = loc_layout->location_case_chunk_lane_offs[layout_slot_idx];
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
for EachNode(src, RDIM_LocationCase, n->v[idx].location_cases.first)
|
||||
{
|
||||
RDI_LocationBlock *dst = &baked_location_blocks->location_blocks[layout_off];
|
||||
dst->scope_off_first = (RDI_U32)src->voff_range.min; // TODO(rjf): @u64_to_u32
|
||||
dst->scope_off_opl = (RDI_U32)src->voff_range.max; // TODO(rjf): @u64_to_u32
|
||||
dst->location_data_off = (RDI_U32)rdim_off_from_location(src->location); // TODO(rjf): @u64_to_u32
|
||||
layout_off += 1;
|
||||
}
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage bake locations (OLD)
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDIM_LocationBakeResult *baked_locations = 0;
|
||||
ProfScope("bake locations")
|
||||
{
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
baked_locations = push_array(scratch.arena, RDIM_LocationBakeResult, 1);
|
||||
baked_locations->location_data_size = params->locations.total_encoded_size+1;
|
||||
baked_locations->location_data = push_array(arena, RDI_U8, baked_locations->location_data_size);
|
||||
}
|
||||
lane_sync_u64(&baked_locations, 0);
|
||||
for EachNode(n, RDIM_LocationChunkNode, params->locations.first)
|
||||
{
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(n_idx, range)
|
||||
{
|
||||
RDIM_Location *loc = &n->v[n_idx];
|
||||
RDI_U8 *dst = &baked_locations->location_data[n->base_encoding_off + loc->relative_encoding_off + 1];
|
||||
switch((RDI_LocationKindEnum)loc->info.kind)
|
||||
{
|
||||
case RDI_LocationKind_NULL:{}break;
|
||||
case RDI_LocationKind_AddrBytecodeStream:
|
||||
case RDI_LocationKind_ValBytecodeStream:
|
||||
{
|
||||
MemoryCopy(dst+0, &loc->info.kind, sizeof(loc->info.kind));
|
||||
RDI_U64 write_off = sizeof(loc->info.kind);
|
||||
for EachNode(op_node, RDIM_EvalBytecodeOp, loc->info.bytecode.first_op)
|
||||
{
|
||||
MemoryCopy(dst + write_off, &op_node->op, 1);
|
||||
write_off += 1;
|
||||
MemoryCopy(dst + write_off, &op_node->p, op_node->p_size);
|
||||
write_off += op_node->p_size;
|
||||
}
|
||||
dst[write_off] = 0;
|
||||
}break;
|
||||
case RDI_LocationKind_AddrRegPlusU16:
|
||||
case RDI_LocationKind_AddrAddrRegPlusU16:
|
||||
{
|
||||
RDI_LocationRegPlusU16 baked = {loc->info.kind, loc->info.reg_code, loc->info.offset};
|
||||
MemoryCopy(dst, &baked, sizeof(baked));
|
||||
}break;
|
||||
case RDI_LocationKind_ValReg:
|
||||
{
|
||||
RDI_LocationReg baked = {loc->info.kind, loc->info.reg_code};
|
||||
MemoryCopy(dst, &baked, sizeof(baked));
|
||||
}break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage compute layout for scope sub-lists (locals / voffs)
|
||||
//
|
||||
@@ -3150,178 +2940,6 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
}
|
||||
lane_sync_u64(&all_locals, 0);
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage bake procedures
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDIM_ProcedureBakeResult *baked_procedures = 0;
|
||||
ProfScope("bake procedures")
|
||||
{
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
baked_procedures = push_array(scratch.arena, RDIM_ProcedureBakeResult, 1);
|
||||
baked_procedures->procedures_count = params->procedures.total_count+1;
|
||||
baked_procedures->procedures = push_array(arena, RDI_Procedure, baked_procedures->procedures_count);
|
||||
}
|
||||
lane_sync_u64(&baked_procedures, 0);
|
||||
{
|
||||
U64 chunk_idx = 0;
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->procedures.first)
|
||||
{
|
||||
U64 location_block_layout_slot_idx = lane_idx()*total_location_case_chunk_count + all_scopes->chunk_count + chunk_idx;
|
||||
U64 location_block_off = loc_layout->location_case_chunk_lane_offs[location_block_layout_slot_idx];
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(n_idx, range)
|
||||
{
|
||||
RDIM_Symbol *src = &n->v[n_idx];
|
||||
RDI_Procedure *dst = &baked_procedures->procedures[n->base_idx + n_idx + 1];
|
||||
dst->name_string_idx = rdim_bake_idx_from_string(bake_strings, src->name);
|
||||
dst->link_name_string_idx = rdim_bake_idx_from_string(bake_strings, src->link_name);
|
||||
if(src->is_extern)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_External;
|
||||
}
|
||||
if(src->container_type != 0)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_TypeScoped;
|
||||
dst->container_idx = src->container_type ? (RDI_U32)rdim_idx_from_udt(src->container_type->udt) : 0; // TODO(rjf): @u64_to_u32
|
||||
}
|
||||
else if(src->container_scope != 0)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_ProcScoped;
|
||||
dst->container_idx = (RDI_U32)rdim_idx_from_symbol(src->container_scope->symbol); // TODO(rjf): @u64_to_u32
|
||||
}
|
||||
dst->type_idx = (RDI_U32)rdim_idx_from_type(src->type); // TODO(rjf): @u64_to_u32
|
||||
dst->root_scope_idx = (RDI_U32)rdim_idx_from_scope(src->root_scope); // TODO(rjf): @u64_to_u32
|
||||
if(src->location_cases.count != 0)
|
||||
{
|
||||
dst->frame_base_location_first = location_block_off;
|
||||
dst->frame_base_location_opl = location_block_off + src->location_cases.count;
|
||||
location_block_off += src->location_cases.count;
|
||||
}
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage compute layout for constant data
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
typedef struct ConstantLayout ConstantLayout;
|
||||
struct ConstantLayout
|
||||
{
|
||||
RDI_U64 *constant_data_chunk_lane_counts; // [lane_count * constant_chunk_count]
|
||||
RDI_U64 *constant_data_chunk_lane_offs; // [lane_count * constant_chunk_count]
|
||||
};
|
||||
ConstantLayout *constant_layout = 0;
|
||||
ProfScope("compute layout for constant data")
|
||||
{
|
||||
// rjf: set up
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
constant_layout = push_array(scratch.arena, ConstantLayout, 1);
|
||||
constant_layout->constant_data_chunk_lane_counts = push_array(arena, U64, lane_count() * params->constants.chunk_count);
|
||||
constant_layout->constant_data_chunk_lane_offs = push_array(arena, U64, lane_count() * params->constants.chunk_count);
|
||||
}
|
||||
lane_sync_u64(&constant_layout, 0);
|
||||
|
||||
// rjf: count
|
||||
{
|
||||
U64 chunk_idx = 0;
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->constants.first)
|
||||
{
|
||||
U64 slot_idx = lane_idx()*params->constants.chunk_count + chunk_idx;
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(idx, range)
|
||||
{
|
||||
constant_layout->constant_data_chunk_lane_counts[slot_idx] += n->v[idx].value_data.size;
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
}
|
||||
lane_sync();
|
||||
|
||||
// rjf: layout
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
U64 chunk_idx = 0;
|
||||
U64 layout_off = 0;
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->constants.first)
|
||||
{
|
||||
for EachIndex(l_idx, lane_count())
|
||||
{
|
||||
U64 slot_idx = l_idx*params->constants.chunk_count + chunk_idx;
|
||||
constant_layout->constant_data_chunk_lane_offs[slot_idx] = layout_off;
|
||||
layout_off += constant_layout->constant_data_chunk_lane_counts[slot_idx];
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
lane_sync();
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage bake constants
|
||||
//
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
RDIM_ConstantsBakeResult *baked_constants = 0;
|
||||
ProfScope("bake constants")
|
||||
{
|
||||
// rjf: set up
|
||||
if(lane_idx() == 0)
|
||||
{
|
||||
baked_constants = push_array(scratch.arena, RDIM_ConstantsBakeResult, 1);
|
||||
}
|
||||
lane_sync_u64(&baked_constants, 0);
|
||||
if(lane_idx() == lane_from_task_idx(0))
|
||||
{
|
||||
baked_constants->constant_values_count = params->constants.total_count+1;
|
||||
baked_constants->constant_values = push_array(arena, RDI_U32, baked_constants->constant_values_count);
|
||||
}
|
||||
if(lane_idx() == lane_from_task_idx(1))
|
||||
{
|
||||
baked_constants->constant_value_data_size = params->constants.total_value_data_size;
|
||||
baked_constants->constant_value_data = push_array(arena, RDI_U8, baked_constants->constant_value_data_size);
|
||||
}
|
||||
if(lane_idx() == lane_from_task_idx(2))
|
||||
{
|
||||
baked_constants->constants_count = params->constants.total_count+1;
|
||||
baked_constants->constants = push_array(arena, RDI_Constant, baked_constants->constants_count);
|
||||
}
|
||||
lane_sync();
|
||||
|
||||
// rjf: wide bake
|
||||
{
|
||||
U64 chunk_idx = 0;
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->constants.first)
|
||||
{
|
||||
U64 slot_idx = lane_idx()*params->constants.chunk_count + chunk_idx;
|
||||
U64 value_data_off = constant_layout->constant_data_chunk_lane_offs[slot_idx];
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(n_idx, range)
|
||||
{
|
||||
RDIM_Symbol *src = &n->v[n_idx];
|
||||
RDI_Constant *dst = &baked_constants->constants[1 + n->base_idx + n_idx];
|
||||
RDI_U32 *dst_value_off = &baked_constants->constant_values[1 + n->base_idx + n_idx];
|
||||
RDI_U8 *dst_value_data = baked_constants->constant_value_data + value_data_off;
|
||||
dst->name_string_idx = rdim_bake_idx_from_string(bake_strings, src->name);
|
||||
dst->type_idx = (RDI_U32)rdim_idx_from_type(src->type); // TODO(rjf): @u64_to_u32
|
||||
dst->constant_value_idx = 1 + n->base_idx + n_idx;
|
||||
dst_value_off[0] = (RDI_U32)value_data_off; // TODO(rjf): @u64_to_u32
|
||||
rdim_memcpy(dst_value_data, src->value_data.str, src->value_data.size);
|
||||
value_data_off += src->value_data.size;
|
||||
}
|
||||
chunk_idx += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
lane_sync();
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
//- rjf: @rdim_bake_stage bake units, types, inline sites
|
||||
//
|
||||
@@ -3463,72 +3081,6 @@ rdim_bake(Arena *arena, RDIM_BakeParams *params)
|
||||
}
|
||||
}
|
||||
|
||||
//- rjf: bake global variables
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
ProfScope("bake global variables")
|
||||
{
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->global_variables.first)
|
||||
{
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(n_idx, range)
|
||||
{
|
||||
RDIM_Symbol *src = &n->v[n_idx];
|
||||
RDI_GlobalVariable *dst = &baked_global_variables->global_variables[n->base_idx + n_idx + 1];
|
||||
dst->name_string_idx = rdim_bake_idx_from_string(bake_strings, src->name);
|
||||
dst->voff = src->offset;
|
||||
dst->type_idx = (RDI_U32)rdim_idx_from_type(src->type); // TODO(rjf): @u64_to_u32
|
||||
if(src->is_extern)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_External;
|
||||
}
|
||||
if(src->container_type != 0)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_TypeScoped;
|
||||
dst->container_idx = src->container_type ? (RDI_U32)rdim_idx_from_udt(src->container_type->udt) : 0; // TODO(rjf): @u64_to_u32
|
||||
}
|
||||
else if(src->container_scope != 0)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_ProcScoped;
|
||||
dst->container_idx = (RDI_U32)rdim_idx_from_symbol(src->container_scope->symbol); // TODO(rjf): @u64_to_u32
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//- rjf: bake thread variables
|
||||
#if 0 // TODO(rjf): @locpass
|
||||
ProfScope("bake thread variables")
|
||||
{
|
||||
for EachNode(n, RDIM_SymbolChunkNode, params->thread_variables.first)
|
||||
{
|
||||
Rng1U64 range = lane_range(n->count);
|
||||
for EachInRange(n_idx, range)
|
||||
{
|
||||
RDIM_Symbol *src = &n->v[n_idx];
|
||||
RDI_ThreadVariable *dst = &baked_thread_variables->thread_variables[n->base_idx + n_idx + 1];
|
||||
dst->name_string_idx = rdim_bake_idx_from_string(bake_strings, src->name);
|
||||
dst->tls_off = (RDI_U32)src->offset; // TODO(rjf): @u64_to_u32
|
||||
dst->type_idx = (RDI_U32)rdim_idx_from_type(src->type);
|
||||
if(src->is_extern)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_External;
|
||||
}
|
||||
if(src->container_type != 0)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_TypeScoped;
|
||||
dst->container_idx = src->container_type ? (RDI_U32)rdim_idx_from_udt(src->container_type->udt) : 0; // TODO(rjf): @u64_to_u32
|
||||
}
|
||||
else if(src->container_scope != 0)
|
||||
{
|
||||
dst->link_flags |= RDI_LinkFlag_ProcScoped;
|
||||
dst->container_idx = (RDI_U32)rdim_idx_from_symbol(src->container_scope->symbol); // TODO(rjf): @u64_to_u32
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//- rjf: bake inline sites
|
||||
ProfScope("bake inline sites")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user