adjust step trap net build in case of memory read failure - ensure we get correct memory read, otherwise we can generate bad trap nets during heavy load. allow high vs. low priority in async rdi loading; use low-priority in pre-emptive case

This commit is contained in:
Ryan Fleury
2025-06-18 08:36:41 -07:00
parent 5de7c06d3b
commit 401f117653
12 changed files with 95 additions and 218 deletions
+2 -2
View File
@@ -46,7 +46,7 @@ load_paths =
commands =
{
//- rjf: [raddbg]
// .f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
.f1 = { .win = "raddbg_stable --ipc kill_all && build raddbg telemetry", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [textperf]
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta telemetry textperf && raddbg_stable --ipc bring_to_front && raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
@@ -55,7 +55,7 @@ commands =
// .f1 = { .win = "raddbg_stable --ipc kill_all && build no_meta tester", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: [radbin]
.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 radbin", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
//- rjf: running target
.f3 = { .win = "raddbg_stable --ipc run", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, },
+12 -10
View File
@@ -3293,7 +3293,7 @@ ctrl_call_stack_from_unwind(Arena *arena, CTRL_Entity *process, CTRL_Unwind *bas
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
U64 rip_voff = ctrl_voff_from_vaddr(module, rip_vaddr);
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, 0);
RDI_Scope *scope = rdi_scope_from_voff(rdi, rip_voff);
// rjf: build inline frames (minus parent & inline depth)
@@ -3816,7 +3816,7 @@ ctrl_thread__append_resolved_module_user_bp_traps(Arena *arena, CTRL_EvalScope *
CTRL_Entity *module_entity = ctrl_entity_from_handle(entity_ctx, module);
CTRL_Entity *debug_info_path_entity = ctrl_entity_child_from_kind(module_entity, CTRL_EntityKind_DebugInfoPath);
DI_Key dbgi_key = {debug_info_path_entity->string, debug_info_path_entity->timestamp};
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, max_U64);
U64 base_vaddr = module_entity->vaddr_range.min;
for(CTRL_UserBreakpointNode *n = user_bps->first; n != 0; n = n->next)
{
@@ -4390,7 +4390,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
B32 asan_shadow_variable_exists_but_is_zero = 0;
CTRL_Entity *dbg_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, max_U64);
RDI_NameMap *unparsed_map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_GlobalVariables);
{
RDI_ParsedNameMap map = {0};
@@ -4728,8 +4728,6 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
(entity_ctx->entity_kind_counts[CTRL_EntityKind_Module] > 256 ||
entity_ctx->entity_kind_counts[CTRL_EntityKind_Module] == 1))
{
U64 endt_us = os_now_microseconds() + 1000000;
//- rjf: unpack event
CTRL_Handle process_handle = ctrl_handle_make(CTRL_MachineID_Local, event->process);
CTRL_Handle loaded_module_handle = ctrl_handle_make(CTRL_MachineID_Local, event->module);
@@ -4881,13 +4879,17 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg,
}
}
//- rjf: for each pre-emptively loaded key, wait for the initial
// load task to be done
//- rjf: for each pre-emptively loaded key, try to grab RDI - kicking off parse
for(DI_KeyNode *n = preemptively_loaded_keys.first; n != 0; n = n->next)
{
DI_Scope *di_scope = di_scope_open();
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &n->v, endt_us);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &n->v, 0, 0);
di_scope_close(di_scope);
}
//- rjf: close all pre-emptively loaded keys
for(DI_KeyNode *n = preemptively_loaded_keys.first; n != 0; n = n->next)
{
di_close(&n->v);
}
}
@@ -5019,7 +5021,7 @@ ctrl_thread__eval_scope_begin(Arena *arena, CTRL_Entity *thread)
CTRL_Entity *dbg_path = ctrl_entity_child_from_kind(mod, CTRL_EntityKind_DebugInfoPath);
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
eval_modules[eval_module_idx].arch = arch;
eval_modules[eval_module_idx].rdi = di_rdi_from_key(scope->di_scope, &dbgi_key, max_U64);
eval_modules[eval_module_idx].rdi = di_rdi_from_key(scope->di_scope, &dbgi_key, 1, max_U64);
eval_modules[eval_module_idx].vaddr_range = mod->vaddr_range;
eval_modules[eval_module_idx].space = e_space_make(CTRL_EvalSpaceKind_Entity);
eval_modules[eval_module_idx].space.u64_0 = (U64)process;
@@ -5829,7 +5831,7 @@ ctrl_thread__run(DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg)
U64 module_base_vaddr = module->vaddr_range.min;
CTRL_Entity *dbg_path = ctrl_entity_child_from_kind(module, CTRL_EntityKind_DebugInfoPath);
DI_Key dbgi_key = {dbg_path->string, dbg_path->timestamp};
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, max_U64);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, max_U64);
RDI_NameMap *unparsed_map = rdi_element_from_name_idx(rdi, NameMaps, RDI_NameMapKind_Procedures);
RDI_ParsedNameMap map = {0};
rdi_parsed_from_name_map(rdi, unparsed_map, &map);
+1 -1
View File
@@ -533,7 +533,7 @@ ASYNC_WORK_DEF(dasm_parse_work)
RDI_Parsed *rdi = &rdi_parsed_nil;
if(params.dbgi_key.path.size != 0)
{
rdi = di_rdi_from_key(di_scope, &params.dbgi_key, max_U64);
rdi = di_rdi_from_key(di_scope, &params.dbgi_key, 1, max_U64);
}
//- rjf: hash -> data
+8 -8
View File
@@ -475,7 +475,7 @@ d_trap_net_from_thread__step_over_line(Arena *arena, CTRL_Entity *thread)
}
// rjf: push trap for natural linear flow
if(good_line_info)
if(good_line_info && good_machine_code)
{
CTRL_Trap trap = {CTRL_TrapFlag_EndStepping, line_vaddr_rng.max};
ctrl_trap_list_push(arena, &result, &trap);
@@ -631,7 +631,7 @@ d_trap_net_from_thread__step_into_line(Arena *arena, CTRL_Entity *thread)
}
// rjf: push trap for natural linear flow
if(good_line_info)
if(good_line_info && good_machine_code)
{
CTRL_Trap trap = {CTRL_TrapFlag_EndStepping, line_vaddr_rng.max};
ctrl_trap_list_push(arena, &result, &trap);
@@ -654,7 +654,7 @@ d_voff_from_dbgi_key_symbol_name(DI_Key *dbgi_key, String8 symbol_name)
DI_Scope *scope = di_scope_open();
U64 result = 0;
{
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 1, 0);
RDI_NameMapKind name_map_kinds[] =
{
RDI_NameMapKind_GlobalVariables,
@@ -734,7 +734,7 @@ d_lines_from_dbgi_key_voff(Arena *arena, DI_Key *dbgi_key, U64 voff)
{
Temp scratch = scratch_begin(&arena, 1);
DI_Scope *scope = di_scope_open();
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 1, 0);
D_LineList result = {0};
{
//- rjf: gather line tables
@@ -843,7 +843,7 @@ d_lines_array_from_dbgi_key_file_path_line_range(Arena *arena, DI_Key dbgi_key,
String8 file_path_normalized = lower_from_str8(scratch.arena, path_normalized_from_string(scratch.arena, file_path));
// rjf: binary -> rdi
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
// rjf: file_path_normalized * rdi -> src_id
B32 good_src_id = 0;
@@ -941,7 +941,7 @@ d_lines_array_from_file_path_line_range(Arena *arena, String8 file_path, Rng1S64
{
// rjf: binary -> rdi
DI_Key key = dbgi_key_n->v;
RDI_Parsed *rdi = di_rdi_from_key(scope, &key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, &key, 1, 0);
// rjf: file_path_normalized * rdi -> src_id
B32 good_src_id = 0;
@@ -1302,7 +1302,7 @@ d_query_cached_locals_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff)
if(node == 0)
{
DI_Scope *scope = di_scope_open();
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 1, 0);
E_String2NumMap *map = e_push_locals_map_from_rdi_voff(cache->arena, rdi, voff);
if(map->slots_count != 0)
{
@@ -1356,7 +1356,7 @@ d_query_cached_member_map_from_dbgi_key_voff(DI_Key *dbgi_key, U64 voff)
if(node == 0)
{
DI_Scope *scope = di_scope_open();
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, dbgi_key, 1, 0);
E_String2NumMap *map = e_push_member_map_from_rdi_voff(cache->arena, rdi, voff);
if(map->slots_count != 0)
{
+4 -4
View File
@@ -582,7 +582,7 @@ di_close(DI_Key *key)
//~ rjf: Debug Info Cache Lookups
internal RDI_Parsed *
di_rdi_from_key(DI_Scope *scope, DI_Key *key, U64 endt_us)
di_rdi_from_key(DI_Scope *scope, DI_Key *key, B32 high_priority, U64 endt_us)
{
ProfBeginFunction();
RDI_Parsed *result = &rdi_parsed_nil;
@@ -631,7 +631,7 @@ di_rdi_from_key(DI_Scope *scope, DI_Key *key, U64 endt_us)
ins_atomic_u64_eval_assign(&node->is_working, 1);
DeferLoop(os_rw_mutex_drop_r(stripe->rw_mutex), os_rw_mutex_take_r(stripe->rw_mutex))
{
async_push_work(di_parse_work);
async_push_work(di_parse_work, .priority = high_priority ? ASYNC_Priority_High : ASYNC_Priority_Low);
}
}
}
@@ -1392,7 +1392,7 @@ di_search_thread__entry_point(void *p)
RDI_Parsed **rdis = push_array(scratch.arena, RDI_Parsed *, rdis_count);
for EachIndex(idx, rdis_count)
{
rdis[idx] = di_rdi_from_key(di_scope, &params.dbgi_keys.v[idx], max_U64);
rdis[idx] = di_rdi_from_key(di_scope, &params.dbgi_keys.v[idx], 1, max_U64);
}
//- rjf: kick off search tasks
@@ -1798,7 +1798,7 @@ ASYNC_WORK_DEF(di_match_work)
{
DI_Scope *di_scope = di_scope_open();
DI_Key key = params_keys.v[dbgi_idx];
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &key, os_now_microseconds()+1000);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &key, 1, os_now_microseconds()+1000);
for EachElement(name_map_kind_idx, name_map_kinds)
{
RDI_NameMap *name_map = rdi_element_from_name_idx(rdi, NameMaps, name_map_kinds[name_map_kind_idx]);
+1 -1
View File
@@ -435,7 +435,7 @@ internal void di_close(DI_Key *key);
////////////////////////////////
//~ rjf: Debug Info Cache Lookups
internal RDI_Parsed *di_rdi_from_key(DI_Scope *scope, DI_Key *key, U64 endt_us);
internal RDI_Parsed *di_rdi_from_key(DI_Scope *scope, DI_Key *key, B32 high_priority, U64 endt_us);
////////////////////////////////
//~ rjf: Search Cache Lookups
+5 -5
View File
@@ -3279,7 +3279,7 @@ rd_view_ui(Rng2F32 rect)
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
{
DI_Scope *scope = di_scope_open();
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
String8 name = {0};
if(name.size == 0)
{
@@ -3366,7 +3366,7 @@ rd_view_ui(Rng2F32 rect)
U64 voff = ctrl_voff_from_vaddr(module, vaddr);
{
DI_Scope *scope = di_scope_open();
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
if(name.size == 0)
{
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff);
@@ -6417,7 +6417,7 @@ rd_window_frame(void)
{
DI_Scope *di_scope = di_scope_open();
DI_Key dbgi_key = ctrl_dbgi_key_from_module(ctrl_entity);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, 0);
if(rdi->raw_data_size != 0)
{
ui_labelf("Symbols successfully loaded from %S", dbgi_key.path);
@@ -11691,7 +11691,7 @@ rd_frame(void)
CTRL_Entity *m = all_modules.v[eval_module_idx];
DI_Key dbgi_key = ctrl_dbgi_key_from_module(m);
eval_modules[eval_module_idx].arch = m->arch;
eval_modules[eval_module_idx].rdi = di_rdi_from_key(rd_state->frame_di_scope, &dbgi_key, 0);
eval_modules[eval_module_idx].rdi = di_rdi_from_key(rd_state->frame_di_scope, &dbgi_key, 1, 0);
eval_modules[eval_module_idx].vaddr_range = m->vaddr_range;
eval_modules[eval_module_idx].space = rd_eval_space_from_ctrl_entity(ctrl_entity_ancestor_from_kind(m, CTRL_EntityKind_Process), RD_EvalSpaceKind_CtrlEntity);
if(module == m)
@@ -14403,7 +14403,7 @@ rd_frame(void)
CTRL_Entity *process = ctrl_entity_ancestor_from_kind(thread, CTRL_EntityKind_Process);
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
U64 rip_voff = ctrl_voff_from_vaddr(module, rip_vaddr);
D_LineList lines = d_lines_from_dbgi_key_voff(scratch.arena, &dbgi_key, rip_voff);
D_Line line = {0};
+1 -1
View File
@@ -1570,7 +1570,7 @@ E_TYPE_EXPAND_INFO_FUNCTION_DEF(debug_info_table)
RDI_Parsed **rdis = push_array(arena, RDI_Parsed *, rdis_count);
for(U64 idx = 0; idx < rdis_count; idx += 1)
{
rdis[idx] = di_rdi_from_key(rd_state->frame_di_scope, &dbgi_keys.v[idx], endt_us);
rdis[idx] = di_rdi_from_key(rd_state->frame_di_scope, &dbgi_keys.v[idx], 1, endt_us);
}
//- rjf: query all filtered items from dbgi searching system
+3 -3
View File
@@ -2956,7 +2956,7 @@ RD_VIEW_UI_FUNCTION_DEF(memory)
CTRL_Entity *module = ctrl_module_from_process_vaddr(selected_process, f_rip_vaddr);
U64 f_rip_voff = ctrl_voff_from_vaddr(module, f_rip_vaddr);
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, f_rip_voff);
String8 procedure_name = {0};
procedure_name.str = rdi_string_from_idx(rdi, procedure->name_string_idx, &procedure_name.size);
@@ -3071,7 +3071,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(scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, voff);
RDI_Scope *root_scope = rdi_element_from_name_idx(rdi, Scopes, procedure->root_scope_idx);
if(procedure->root_scope_idx != 0)
@@ -3128,7 +3128,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(scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(scope, &dbgi_key, 1, 0);
RDI_GlobalVariable *gvar = rdi_global_variable_from_voff(rdi, voff);
if(gvar->voff != 0)
{
+2 -2
View File
@@ -555,7 +555,7 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
CTRL_Entity *module = ctrl_module_from_process_vaddr(process, rip_vaddr);
U64 rip_voff = ctrl_voff_from_vaddr(module, rip_vaddr);
DI_Key dbgi_key = ctrl_dbgi_key_from_module(module);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, 0);
if(rdi != &rdi_parsed_nil)
{
RDI_Procedure *procedure = rdi_procedure_from_voff(rdi, rip_voff);
@@ -585,7 +585,7 @@ rd_title_fstrs_from_ctrl_entity(Arena *arena, CTRL_Entity *entity, B32 include_e
{
DI_Scope *di_scope = di_scope_open();
DI_Key dbgi_key = ctrl_dbgi_key_from_module(entity);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 0);
RDI_Parsed *rdi = di_rdi_from_key(di_scope, &dbgi_key, 1, 0);
if(rdi->raw_data_size == 0)
{
dr_fstrs_push_new(arena, &result, &params, str8_lit(" "));
+56 -174
View File
@@ -38,124 +38,6 @@ p2r_hash_from_voff(U64 voff)
return hash;
}
////////////////////////////////
//~ rjf: Command Line -> Conversion Inputs
#if 0
internal P2R_ConvertParams *
p2r_user2convert_from_cmdln(Arena *arena, CmdLine *cmdline)
{
P2R_ConvertParams *result = push_array(arena, P2R_ConvertParams, 1);
//- rjf: get input pdb
{
String8 input_name = cmd_line_string(cmdline, str8_lit("pdb"));
if(input_name.size == 0)
{
str8_list_push(arena, &result->errors, str8_lit("Missing required parameter: '--pdb:<pdb_file>'"));
}
if(input_name.size > 0)
{
String8 input_data = os_data_from_file_path(arena, input_name);
if(input_data.size == 0)
{
str8_list_pushf(arena, &result->errors, "Could not load input PDB file from '%S'", input_name);
}
if(input_data.size != 0)
{
result->input_pdb_name = input_name;
result->input_pdb_data = input_data;
}
}
}
//- rjf: get input exe
{
String8 input_name = cmd_line_string(cmdline, str8_lit("exe"));
if(input_name.size > 0)
{
String8 input_data = os_data_from_file_path(arena, input_name);
if(input_data.size == 0)
{
str8_list_pushf(arena, &result->errors, "Could not load input EXE file from '%S'", input_name);
}
if(input_data.size != 0)
{
result->input_exe_name = input_name;
result->input_exe_data = input_data;
}
}
}
//- rjf: get output name
{
result->output_name = cmd_line_string(cmdline, str8_lit("out"));
if(result->output_name.size == 0)
{
str8_list_pushf(arena, &result->errors, "Missing required parameter: '--out:<output_path>'");
}
}
//- rjf: define string -> section flag bits
#define FlagNameMapXList \
Case("sections", BinarySections)\
Case("units", Units)\
Case("procedures", Procedures)\
Case("globals", GlobalVariables)\
Case("threadvars", ThreadVariables)\
Case("scopes", Scopes)\
Case("locals", Locals)\
Case("types", Types)\
Case("udts", UDTs)\
Case("lines", LineInfo)\
Case("globals_name_map", GlobalVariableNameMap)\
Case("threadvars_name_map", ThreadVariableNameMap)\
Case("procedure_name_map", ProcedureNameMap)\
Case("type_name_map", TypeNameMap)\
Case("link_name_map", LinkNameProcedureNameMap)\
Case("source_path_name_map",NormalSourcePathNameMap)\
//- rjf: get section flags
{
result->flags = P2R_ConvertFlag_All;
String8List only_names = cmd_line_strings(cmdline, str8_lit("only"));
String8List omit_names = cmd_line_strings(cmdline, str8_lit("only"));
if(only_names.node_count != 0)
{
result->flags = 0;
for(String8Node *n = only_names.first; n != 0; n = n->next)
{
String8 string = n->string;
#define Case(str, flag) if(str8_match(string, str8_lit(str), StringMatchFlag_CaseInsensitive)) {result->flags |= P2R_ConvertFlag_##flag;}
FlagNameMapXList;
#undef Case
}
}
if(omit_names.node_count != 0)
{
for(String8Node *n = omit_names.first; n != 0; n = n->next)
{
String8 string = n->string;
#define Case(str, flag) if(str8_match(string, str8_lit(str), StringMatchFlag_CaseInsensitive)) {result->flags &= ~P2R_ConvertFlag_##flag;}
FlagNameMapXList;
#undef Case
}
}
}
//- rjf: get other flags
{
if(cmd_line_has_flag(cmdline, str8_lit("deterministic")))
{
result->flags |= P2R_ConvertFlag_Deterministic;
}
}
#undef FlagNameMapXList
return result;
}
#endif
////////////////////////////////
//~ rjf: COFF <-> RDI Canonical Conversions
@@ -577,29 +459,29 @@ ASYNC_WORK_DEF(p2r_comp_unit_contributions_parse_work)
ProfScope("parse comp unit contributions") out = pdb_comp_unit_contribution_array_from_data(arena, in->data, in->coff_sections);
ProfEnd();
return out;
}
ASYNC_WORK_DEF(p2r_comp_unit_contributions_bucket_work)
{
ProfBeginFunction();
Arena *arena = async_root_thread_arena(p2r_async_root);
P2R_CompUnitContributionsBucketIn *in = (P2R_CompUnitContributionsBucketIn *)input;
P2R_CompUnitContributionsBucketOut *out = push_array(arena, P2R_CompUnitContributionsBucketOut, 1);
{
out->unit_ranges = push_array(arena, RDIM_Rng1U64ChunkList, in->comp_unit_count);
for(U64 idx = 0; idx < in->contributions.count; idx += 1)
{
PDB_CompUnitContribution *contribution = &in->contributions.contributions[idx];
if(contribution->mod < in->comp_unit_count)
{
RDIM_Rng1U64 r = {contribution->voff_first, contribution->voff_opl};
rdim_rng1u64_chunk_list_push(arena, &out->unit_ranges[contribution->mod], 256, r);
}
}
}
ProfEnd();
return out;
}
}
ASYNC_WORK_DEF(p2r_comp_unit_contributions_bucket_work)
{
ProfBeginFunction();
Arena *arena = async_root_thread_arena(p2r_async_root);
P2R_CompUnitContributionsBucketIn *in = (P2R_CompUnitContributionsBucketIn *)input;
P2R_CompUnitContributionsBucketOut *out = push_array(arena, P2R_CompUnitContributionsBucketOut, 1);
{
out->unit_ranges = push_array(arena, RDIM_Rng1U64ChunkList, in->comp_unit_count);
for(U64 idx = 0; idx < in->contributions.count; idx += 1)
{
PDB_CompUnitContribution *contribution = &in->contributions.contributions[idx];
if(contribution->mod < in->comp_unit_count)
{
RDIM_Rng1U64 r = {contribution->voff_first, contribution->voff_opl};
rdim_rng1u64_chunk_list_push(arena, &out->unit_ranges[contribution->mod], 256, r);
}
}
}
ProfEnd();
return out;
}
////////////////////////////////
//~ rjf: Unit Source File Gathering Tasks
@@ -959,8 +841,8 @@ ASYNC_WORK_DEF(p2r_unit_convert_work)
dst_unit->object_file = obj_name;
dst_unit->archive_file = pdb_unit->group_name;
dst_unit->language = p2r_rdi_language_from_cv_language(pdb_unit_sym->info.language);
dst_unit->line_table = line_table;
dst_unit->voff_ranges = in->comp_unit_ranges;
dst_unit->line_table = line_table;
dst_unit->voff_ranges = in->comp_unit_ranges;
}
////////////////////////////
@@ -3228,11 +3110,11 @@ ASYNC_WORK_DEF(p2r_symbol_stream_convert_work)
U8 *name_ptr = val_ptr + val.encoded_size;
String8 name = str8_cstring_capped(name_ptr, sym_data_opl);
String8 val_data = str8_struct(&val64);
U64 container_name_opl = 0;
if(type != 0)
{
container_name_opl = p2r_end_of_cplusplus_container_name(type->name);
}
U64 container_name_opl = 0;
if(type != 0)
{
container_name_opl = p2r_end_of_cplusplus_container_name(type->name);
}
String8 name_qualified = name;
if(container_name_opl != 0)
{
@@ -3279,8 +3161,8 @@ internal RDIM_BakeParams
p2r_convert(Arena *arena, ASYNC_Root *async_root, P2R_ConvertParams *in)
{
Temp scratch = scratch_begin(&arena, 1);
p2r_async_root = async_root;
p2r_async_root = async_root;
//////////////////////////////////////////////////////////////
//- rjf: parse MSF structure
//
@@ -3451,40 +3333,40 @@ p2r_convert(Arena *arena, ASYNC_Root *async_root, P2R_ConvertParams *in)
//////////////////////////////////////////////////////////////
//- rjf: do compilation unit parse
//
//
PDB_CompUnitArray *comp_units = 0;
U64 comp_unit_count = 0;
{
U64 comp_unit_count = 0;
{
P2R_CompUnitParseIn comp_unit_parse_in = {dbi ? pdb_data_from_dbi_range(dbi, PDB_DbiRange_ModuleInfo) : str8_zero()};
ASYNC_Task *comp_unit_parse_task = !dbi ? 0 : async_task_launch(scratch.arena, p2r_comp_unit_parse_work, .input = &comp_unit_parse_in);
comp_units = async_task_join_struct(comp_unit_parse_task, PDB_CompUnitArray);
comp_unit_count = comp_units ? comp_units->count : 0;
}
ASYNC_Task *comp_unit_parse_task = !dbi ? 0 : async_task_launch(scratch.arena, p2r_comp_unit_parse_work, .input = &comp_unit_parse_in);
comp_units = async_task_join_struct(comp_unit_parse_task, PDB_CompUnitArray);
comp_unit_count = comp_units ? comp_units->count : 0;
}
//////////////////////////////////////////////////////////////
//- rjf: do compilation unit contributions parse
//
//
PDB_CompUnitContributionArray *comp_unit_contributions = 0;
U64 comp_unit_contribution_count = 0;
{
U64 comp_unit_contribution_count = 0;
{
P2R_CompUnitContributionsParseIn comp_unit_contributions_parse_in = {dbi ? pdb_data_from_dbi_range(dbi, PDB_DbiRange_SecCon) : str8_zero(), coff_sections};
ASYNC_Task *comp_unit_contributions_parse_task = !dbi ? 0 : async_task_launch(scratch.arena, p2r_comp_unit_contributions_parse_work, .input = &comp_unit_contributions_parse_in);
ASYNC_Task *comp_unit_contributions_parse_task = !dbi ? 0 : async_task_launch(scratch.arena, p2r_comp_unit_contributions_parse_work, .input = &comp_unit_contributions_parse_in);
comp_unit_contributions = async_task_join_struct(comp_unit_contributions_parse_task, PDB_CompUnitContributionArray);
comp_unit_contribution_count = comp_unit_contributions ? comp_unit_contributions->count : 0;
}
comp_unit_contribution_count = comp_unit_contributions ? comp_unit_contributions->count : 0;
}
//////////////////////////////////////////////////////////////
//- rjf: do compilation unit contributions bucket
//
RDIM_Rng1U64ChunkList *unit_ranges = 0;
if(comp_unit_contributions)
{
//
RDIM_Rng1U64ChunkList *unit_ranges = 0;
if(comp_unit_contributions)
{
P2R_CompUnitContributionsBucketIn in = {comp_unit_count, *comp_unit_contributions};
ASYNC_Task *task = async_task_launch(scratch.arena, p2r_comp_unit_contributions_bucket_work, .input = &in);
P2R_CompUnitContributionsBucketOut *out = async_task_join_struct(task, P2R_CompUnitContributionsBucketOut);
unit_ranges = out->unit_ranges;
}
ASYNC_Task *task = async_task_launch(scratch.arena, p2r_comp_unit_contributions_bucket_work, .input = &in);
P2R_CompUnitContributionsBucketOut *out = async_task_join_struct(task, P2R_CompUnitContributionsBucketOut);
unit_ranges = out->unit_ranges;
}
//////////////////////////////////////////////////////////////
//- rjf: parse syms & line info for each compilation unit
//
-7
View File
@@ -283,13 +283,6 @@ global ASYNC_Root *p2r_async_root = 0;
internal U64 p2r_end_of_cplusplus_container_name(String8 str);
internal U64 p2r_hash_from_voff(U64 voff);
////////////////////////////////
//~ rjf: Command Line -> Conversion Inputs
#if 0
internal P2R_ConvertParams *p2r_user2convert_from_cmdln(Arena *arena, CmdLine *cmdline);
#endif
////////////////////////////////
//~ rjf: COFF => RDI Canonical Conversions