From b6d8c3fd9eaf7b55960d80738365742a8fba9e29 Mon Sep 17 00:00:00 2001 From: Ryan Fleury Date: Wed, 7 Oct 2026 13:55:58 -0700 Subject: [PATCH] dwarf_parse: fix incorrect expectation of max_ops_per_inst in pre-dwarf-4; fix incorrect comp unit file --- src/dwarf/dwarf_parse.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dwarf/dwarf_parse.c b/src/dwarf/dwarf_parse.c index 6faabc27..bf58d85a 100644 --- a/src/dwarf/dwarf_parse.c +++ b/src/dwarf/dwarf_parse.c @@ -706,7 +706,7 @@ dw2_parse_ctx_equip_unit_root_tag(DW2_ParseCtx *ctx_out, DW2_Tag *tag, DW2_Offse ctx_out->unit_base_addr = low_pc_attrib->val.addr; ctx_out->language = lang_attrib->val.u128.u64[0]; ctx_out->unit_dir = comp_dir_attrib->val.string; - ctx_out->unit_file = comp_dir_attrib->val.string; + ctx_out->unit_file = name_attrib->val.string; // rjf: find offset tables Rng1U64Array rnglists_tables_ranges_array = {offset_tables->rnglists_tables_ranges, offset_tables->rnglists_tables_count}; @@ -960,7 +960,10 @@ dw2_read_line_table_header(Arena *arena, DW_Raw *raw, DW2_ParseCtx *ctx, String8 off += dw2_read_fmt_u64(data, off, format, &header_length); opl_header_length_off = off; off += str8_deserial_read_struct(data, off, &min_inst_length); - off += str8_deserial_read_struct(data, off, &max_ops_per_inst); + if(version >= DW_Version_4) + { + off += str8_deserial_read_struct(data, off, &max_ops_per_inst); + } off += str8_deserial_read_struct(data, off, &default_is_stmt); off += str8_deserial_read_struct(data, off, &line_base); off += str8_deserial_read_struct(data, off, &line_range);