mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-11-17 03:30:13 -08:00
rdi_from_dwarf: correctly use unit_dir only when line table directories are relative; correctly use unit compilation unit name as first file in pre-dwarf-5
This commit is contained in:
1 parent
31d10c3b4f
commit
9fdcc88cab
2 files changed
+11
-2
No files matched your search
@@ -676,6 +676,7 @@ internal void
|
||||
dw2_parse_ctx_equip_unit_root_tag(DW2_ParseCtx *ctx_out, DW2_Tag *tag, DW2_OffsetTableSet *offset_tables)
|
||||
{
|
||||
// rjf: unpack attributes
|
||||
DW2_Attrib *name_attrib = &dw2_attrib_nil;
|
||||
DW2_Attrib *low_pc_attrib = &dw2_attrib_nil;
|
||||
DW2_Attrib *lang_attrib = &dw2_attrib_nil;
|
||||
DW2_Attrib *rnglists_base_off_attrib = &dw2_attrib_nil;
|
||||
@@ -689,6 +690,7 @@ dw2_parse_ctx_equip_unit_root_tag(DW2_ParseCtx *ctx_out, DW2_Tag *tag, DW2_Offse
|
||||
{
|
||||
default:{}break;
|
||||
#define Case(name, name_upper) case DW_AttribKind_##name_upper:{name##_attrib = &n->v;}break
|
||||
Case(name, Name);
|
||||
Case(low_pc, LowPc);
|
||||
Case(lang, Language);
|
||||
Case(rnglists_base_off, RngListsBase);
|
||||
@@ -704,6 +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;
|
||||
|
||||
// rjf: find offset tables
|
||||
Rng1U64Array rnglists_tables_ranges_array = {offset_tables->rnglists_tables_ranges, offset_tables->rnglists_tables_count};
|
||||
@@ -1115,7 +1118,7 @@ dw2_read_line_table_header(Arena *arena, DW_Raw *raw, DW2_ParseCtx *ctx, String8
|
||||
DW2_LineTableFile *entry_out = &table.v[idx];
|
||||
for(U64 entry_format_idx = 0; entry_format_idx < entry_formats_count; entry_format_idx += 1)
|
||||
{
|
||||
DW_LNCT lnct = (DW_LNCT)entry_formats[entry_format_idx*2 + 0];
|
||||
DW_LNCT lnct = (DW_LNCT)entry_formats[entry_format_idx*2 + 0];
|
||||
DW_FormKind form_kind = (DW_FormKind)entry_formats[entry_format_idx*2 + 1];
|
||||
DW2_FormVal form_val = {0};
|
||||
off += dw2_read_form_val(raw, ctx, data, off, form_kind, 0, &form_val);
|
||||
|
||||
@@ -440,10 +440,16 @@ d2r_convert(Arena *arena, D2R_ConvertParams *params)
|
||||
if(f->file_name.size != 0)
|
||||
{
|
||||
DW2_LineTableFile *dir = &hdr->dirs.v[f->dir_idx];
|
||||
String8 root_dir = {0};
|
||||
if(path_style_from_str8(dir->file_name) == PathStyle_Relative)
|
||||
{
|
||||
root_dir = ctx->unit_dir;
|
||||
}
|
||||
String8 full_file_path = str8f(scratch2.arena, "%S%s%S%s%S",
|
||||
ctx->unit_dir, ctx->unit_dir.size != 0 ? "/" : "",
|
||||
root_dir, root_dir.size != 0 ? "/" : "",
|
||||
dir->file_name, dir->file_name.size != 0 ? "/" : "",
|
||||
f->file_name);
|
||||
full_file_path = path_normalized_from_string(scratch2.arena, full_file_path);
|
||||
U64 hash = u64_hash_from_str8(full_file_path);
|
||||
U64 slot_idx = hash%slots_count;
|
||||
SrcFileNode *node = 0;
|
||||
|
||||
Reference in new issue
Block a user