rdi_from_dwarf: preserve unit dir in generated source file paths. do not assume relativity to binary, often incorrect

This commit is contained in:
Ryan Fleury committed 2026-09-24 11:24:42 -06:00
1 parent df1de0541a
commit 31d10c3b4f
1 file changed
+5 -1
+5 -1
View File
@@ -432,6 +432,7 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
//- rjf: build path -> src file map
for EachIndex(unit_idx, unit_count)
{
DW2_ParseCtx *ctx = &unit_parse_ctxs[unit_idx];
DW2_LineTableHeader *hdr = &unit_line_table_headers[unit_idx];
for EachIndex(file_idx, hdr->files.count)
{
@@ -439,7 +440,10 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
if(f->file_name.size != 0)
{
DW2_LineTableFile *dir = &hdr->dirs.v[f->dir_idx];
String8 full_file_path = str8f(scratch2.arena, "%S%s%S", dir->file_name, dir->file_name.size != 0 ? "/" : "", f->file_name);
String8 full_file_path = str8f(scratch2.arena, "%S%s%S%s%S",
ctx->unit_dir, ctx->unit_dir.size != 0 ? "/" : "",
dir->file_name, dir->file_name.size != 0 ? "/" : "",
f->file_name);
U64 hash = u64_hash_from_str8(full_file_path);
U64 slot_idx = hash%slots_count;
SrcFileNode *node = 0;