diff --git a/src/codeview/codeview.c b/src/codeview/codeview.c index c993d31f..d63679c2 100644 --- a/src/codeview/codeview.c +++ b/src/codeview/codeview.c @@ -490,12 +490,8 @@ cv_c13_parsed_from_data(Arena *arena, String8 c13_data, String8 strtbl, COFF_Sec CV_C13SubSecLinesHeader *hdr = (CV_C13SubSecLinesHeader*)(first + read_off); read_off += sizeof(*hdr); - // extract top level info + // rjf: extract section index U32 sec_idx = hdr->sec; - B32 has_cols = !!(hdr->flags & CV_C13SubSecLinesFlag_HasColumns); - U64 secrel_off = hdr->sec_off; - U64 secrel_opl = secrel_off + hdr->len; - U64 sec_base_off = sections.v[sec_idx - 1].voff; // rjf: bad section index -> skip if(sec_idx < 1 || sections.count < sec_idx) @@ -503,6 +499,12 @@ cv_c13_parsed_from_data(Arena *arena, String8 c13_data, String8 strtbl, COFF_Sec continue; } + // extract top level info + B32 has_cols = !!(hdr->flags & CV_C13SubSecLinesFlag_HasColumns); + U64 secrel_off = hdr->sec_off; + U64 secrel_opl = secrel_off + hdr->len; + U64 sec_base_off = sections.v[sec_idx - 1].voff; + // read files for(;read_off+sizeof(CV_C13File) <= read_off_opl;) { @@ -519,7 +521,7 @@ cv_c13_parsed_from_data(Arena *arena, String8 c13_data, String8 strtbl, COFF_Sec CV_C13Checksum *checksum = (CV_C13Checksum*)(c13_data.str + file_chksms->off + file_off); U32 name_off = checksum->name_off; file_name = str8_cstring_capped((char*)(strtbl.str + name_off), - (char*)(strtbl.str + strtbl.size)); + (char*)(strtbl.str + strtbl.size)); } // array layouts @@ -596,7 +598,7 @@ cv_c13_parsed_from_data(Arena *arena, String8 c13_data, String8 strtbl, COFF_Sec CV_C13Checksum *checksum = (CV_C13Checksum*)(c13_data.str + file_chksms->off + hdr->file_off); U32 name_off = checksum->name_off; file_name = str8_cstring_capped((char*)(strtbl.str + name_off), - (char*)(strtbl.str + strtbl.size)); + (char*)(strtbl.str + strtbl.size)); } // rjf: parse extra files @@ -617,7 +619,7 @@ cv_c13_parsed_from_data(Arena *arena, String8 c13_data, String8 strtbl, COFF_Sec SLLQueuePush(node->inlinee_lines_first, node->inlinee_lines_last, n); n->v.inlinee = hdr->inlinee; n->v.file_name = file_name; - n->v.file_off = hdr->file_off; + n->v.file_off = hdr->file_off; n->v.first_source_ln = hdr->first_source_ln; n->v.extra_file_count = extra_file_count; n->v.extra_files = extra_files; diff --git a/src/ctrl/ctrl_core.c b/src/ctrl/ctrl_core.c index bca979ad..9b85aeb9 100644 --- a/src/ctrl/ctrl_core.c +++ b/src/ctrl/ctrl_core.c @@ -4133,15 +4133,7 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, CTRL_Entity *loaded_module = ctrl_entity_from_handle(ctrl_state->ctrl_thread_entity_store, loaded_module_handle); //- rjf: determine if this is the first process launched in this session - B32 is_first_process = 1; - for(CTRL_Entity *child = process->parent->first; child != &ctrl_entity_nil; child = child->next) - { - if(child->kind == CTRL_EntityKind_Process && child != process) - { - is_first_process = 0; - break; - } - } + B32 is_first_process = (ctrl_state->process_counter == 1); //- rjf: if this is the first process this session, clear the debug directory state if(is_first_process) @@ -4212,7 +4204,10 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, String8List dir_node_path_parts = {0}; for(CTRL_DbgDirNode *n = dir_node; n != 0; n = n->parent) { - str8_list_push_front(temp.arena, &dir_node_path_parts, n->name); + if(n->name.size != 0) + { + str8_list_push_front(temp.arena, &dir_node_path_parts, n->name); + } } String8 dir_node_path = str8_list_join(temp.arena, &dir_node_path_parts, &(StringJoin){.sep = str8_lit("/")}); @@ -4231,6 +4226,8 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, U64 task_count = 0; for(Task *t = first_task; t != 0; t = t->next) { + ProfBegin("search task %.*s", str8_varg(t->path)); + // rjf: increment search counter t->node->search_count += 1; @@ -4240,10 +4237,11 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, // sub-search if needed. DI_KeyList preemptively_loaded_keys = {0}; OS_FileIter *it = os_file_iter_begin(temp.arena, t->path, 0); - for(OS_FileInfo info = {0}; os_file_iter_next(temp.arena, it, &info);) + U64 idx = 0; + for(OS_FileInfo info = {0}; idx < 64 && os_file_iter_next(temp.arena, it, &info); idx += 1) { // rjf: folder -> do sub-search if not duplicative - if(info.props.flags & FilePropertyFlag_IsFolder && task_count < 16384) + if(info.props.flags & FilePropertyFlag_IsFolder && task_count < 16384 && !str8_match(str8_prefix(info.name, 1), str8_lit("."), 0)) { CTRL_DbgDirNode *existing_dir_child = 0; for(CTRL_DbgDirNode *child = t->node->first; child != 0; child = child->next) @@ -4273,7 +4271,8 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, } // rjf: debug info file -> kick off open - else if(!(info.props.flags & FilePropertyFlag_IsFolder) && + else if(preemptively_loaded_keys.count < 4096 && + !(info.props.flags & FilePropertyFlag_IsFolder) && str8_match(str8_skip_last_dot(info.name), debug_info_ext, StringMatchFlag_CaseInsensitive) && !str8_match(loaded_di_name, info.name, StringMatchFlag_CaseInsensitive)) { @@ -4293,9 +4292,12 @@ ctrl_thread__next_dmn_event(Arena *arena, DMN_CtrlCtx *ctrl_ctx, CTRL_Msg *msg, di_scope_close(di_scope); di_close(&n->v); } + + ProfEnd(); } temp_end(temp); + } } }