fix eh_frame dumping

This commit is contained in:
Nikita Smith
2025-11-07 14:39:45 -08:00
committed by Ryan Fleury
parent f0bd30c89b
commit 942c354bd9
+16 -15
View File
@@ -1108,21 +1108,7 @@ rb_thread_entry_point(void *p)
{ {
elf = elf_bin_from_data(arena, f->data); elf = elf_bin_from_data(arena, f->data);
arch = arch_from_elf_machine(elf.hdr.e_machine); arch = arch_from_elf_machine(elf.hdr.e_machine);
}
if(f->format_flags & RB_FileFormatFlag_HasDWARF)
{
if(f->format == RB_FileFormat_PE)
{
String8 raw_sections = str8_substr(f->data, pe.section_table_range);
U64 section_count = raw_sections.size / sizeof(COFF_SectionHeader);
COFF_SectionHeader *section_table = (COFF_SectionHeader *)raw_sections.str;
String8 string_table = str8_substr(f->data, pe.string_table_range);
dw = dw_input_from_coff_section_table(arena, f->data, string_table, section_count, section_table);
}
else if(f->format == RB_FileFormat_ELF32 ||
f->format == RB_FileFormat_ELF64)
{
dw = dw_input_from_elf_bin(arena, f->data, &elf);
for EachIndex(sect_idx, elf.hdr.e_shnum) for EachIndex(sect_idx, elf.hdr.e_shnum)
{ {
ELF_Shdr64 *shdr = &elf.shdrs.v[sect_idx]; ELF_Shdr64 *shdr = &elf.shdrs.v[sect_idx];
@@ -1140,6 +1126,21 @@ rb_thread_entry_point(void *p)
} }
} }
} }
if(f->format_flags & RB_FileFormatFlag_HasDWARF)
{
if(f->format == RB_FileFormat_PE)
{
String8 raw_sections = str8_substr(f->data, pe.section_table_range);
U64 section_count = raw_sections.size / sizeof(COFF_SectionHeader);
COFF_SectionHeader *section_table = (COFF_SectionHeader *)raw_sections.str;
String8 string_table = str8_substr(f->data, pe.string_table_range);
dw = dw_input_from_coff_section_table(arena, f->data, string_table, section_count, section_table);
}
else if(f->format == RB_FileFormat_ELF32 ||
f->format == RB_FileFormat_ELF64)
{
dw = dw_input_from_elf_bin(arena, f->data, &elf);
}
} }
} }