From 13fb24f2536a678112ae187bb3cc913e31c1da12 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Fri, 1 May 2026 08:42:48 -0700 Subject: [PATCH] fix incorrect function parameter type parsing (was causing quadratic parses of .debug_info, oops) --- project.4coder | 2 +- src/rdi_from_dwarf/rdi_from_dwarf.c | 7 +++---- src/rdi_from_dwarf/rdi_from_dwarf_2.c | 9 +++++---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/project.4coder b/project.4coder index 50d985d6..d342f4b0 100644 --- a/project.4coder +++ b/project.4coder @@ -49,7 +49,7 @@ commands = // .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 = "build radbin && pushd build && del raddbg.elf.rdi && del raddbg.elf.dump && radbin --rdi ./raddbg --out:raddbg.elf.rdi && radbin --dump raddbg.elf.rdi --out:raddbg.elf.dump", .linux = "", .out = "*compilation*", .footer_panel = true, .save_dirty_files = true, .cursor_at_end = false, }, + .f1 = { .win = "build radbin telemetry release", .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, }, diff --git a/src/rdi_from_dwarf/rdi_from_dwarf.c b/src/rdi_from_dwarf/rdi_from_dwarf.c index f171c50b..445281a6 100644 --- a/src/rdi_from_dwarf/rdi_from_dwarf.c +++ b/src/rdi_from_dwarf/rdi_from_dwarf.c @@ -2792,8 +2792,8 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params) //////////////////////////////// - ProfBeginV("Convert Line Tables [Count: %llu]", cu_ranges.count); RDIM_LineTable **cu_line_tables_rdi = push_array(scratch.arena, RDIM_LineTable *, cu_ranges.count); + ProfScope("Convert Line Tables [Count: %llu]", cu_ranges.count) { Temp temp = temp_begin(scratch.arena); @@ -2812,7 +2812,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params) for EachIndex(cu_idx, cu_ranges.count) { total_file_count += line_vms[cu_idx]->header.file_table.count; } // TODO: sync - ProfBeginV("Dedup source files [Count: %llu]", total_file_count); + ProfBegin("Dedup source files [Count: %llu]", total_file_count); LFHT_NodeChunkList *src_file_lfht_nodes = push_array(temp.arena, LFHT_NodeChunkList, lane_count()); LFHT_Node *src_file_lfht = 0; @@ -2846,7 +2846,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params) ProfEnd(); // TODO: sync - ProfBeginV("Sort unique source files [Count: %llu]", unique_file_count); + ProfBegin("Sort unique source files [Count: %llu]", unique_file_count); d2r_sort_ptrs(lookups, unique_file_count, d2r_src_file_lfht_key_value_is_before); ProfEnd(); @@ -3000,7 +3000,6 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params) temp_end(temp); } - ProfEnd(); //////////////////////////////// diff --git a/src/rdi_from_dwarf/rdi_from_dwarf_2.c b/src/rdi_from_dwarf/rdi_from_dwarf_2.c index a8e4c1df..39eff3ab 100644 --- a/src/rdi_from_dwarf/rdi_from_dwarf_2.c +++ b/src/rdi_from_dwarf/rdi_from_dwarf_2.c @@ -1785,7 +1785,7 @@ d2r2_convert(Arena *arena, D2R2_ConvertParams *params) read_off += dw2_read_tag(scratch2.arena, unit_parse_ctx, raw->sec[DW_Section_Info].data, read_off, &child_tag); // rjf: formal parameters -> gather direct types - if(child_tag.kind == DW_TagKind_FormalParameter) + if(depth == 1 && child_tag.kind == DW_TagKind_FormalParameter) { DW2_Attrib *direct_type_attrib = dw2_attrib_from_kind(&child_tag, DW_AttribKind_Type); U64 direct_type_info_off = dw2_reference_info_off_from_form_val(unit_parse_ctx, &direct_type_attrib->val); @@ -1806,11 +1806,11 @@ d2r2_convert(Arena *arena, D2R2_ConvertParams *params) } // rjf: tree navigations - if(tag.has_children) + if(child_tag.has_children) { depth += 1; } - if(tag.kind == DW_TagKind_Null) + if(child_tag.kind == DW_TagKind_Null) { depth -= 1; } @@ -1894,6 +1894,7 @@ d2r2_convert(Arena *arena, D2R2_ConvertParams *params) // RDIM_TypeChunkList *all_types = 0; RDIM_Type **type_from_idx_map = 0; + ProfScope("build all types") { if(lane_idx() == 0) { @@ -2085,7 +2086,7 @@ d2r2_convert(Arena *arena, D2R2_ConvertParams *params) off += dw2_read_tag(scratch2.arena, unit_parse_ctx, raw->sec[DW_Section_Info].data, off, &child_tag); // rjf: gather parameters - if(child_tag.kind == DW_TagKind_FormalParameter) + if(depth == 1 && child_tag.kind == DW_TagKind_FormalParameter) { DW2_Attrib *type_attrib = dw2_attrib_from_kind(&child_tag, DW_AttribKind_Type); ParamNode *n = push_array(scratch2.arena, ParamNode, 1);