mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
radbin: only dump eh frame data if found
This commit is contained in:
+28
-4
@@ -355,6 +355,9 @@ rb_thread_entry_point(void *p)
|
|||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//- rjf: COFF OBJ => check if contains DWARF
|
||||||
|
//
|
||||||
if(file_format == RB_FileFormat_COFF_OBJ || file_format == RB_FileFormat_COFF_BigOBJ)
|
if(file_format == RB_FileFormat_COFF_OBJ || file_format == RB_FileFormat_COFF_BigOBJ)
|
||||||
{
|
{
|
||||||
Temp scratch = scratch_begin(&arena, 1);
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
@@ -386,6 +389,28 @@ rb_thread_entry_point(void *p)
|
|||||||
scratch_end(scratch);
|
scratch_end(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//////////////////////////
|
||||||
|
//- rjf: ELF => check if contains EH frame info
|
||||||
|
//
|
||||||
|
if(file_format == RB_FileFormat_ELF32 ||
|
||||||
|
file_format == RB_FileFormat_ELF64)
|
||||||
|
{
|
||||||
|
Temp scratch = scratch_begin(&arena, 1);
|
||||||
|
ELF_Bin elf_bin = elf_bin_from_data(scratch.arena, file_data);
|
||||||
|
for EachIndex(sect_idx, elf_bin.hdr.e_shnum)
|
||||||
|
{
|
||||||
|
ELF_Shdr64 *shdr = &elf_bin.shdrs.v[sect_idx];
|
||||||
|
String8 name = elf_name_from_shdr64(file_data, &elf_bin, shdr);
|
||||||
|
if(str8_match(name, str8_lit(".eh_frame_hdr"), 0))
|
||||||
|
{
|
||||||
|
log_infof("EH frame data detected in %S (%S)\n", n->string, rb_file_format_display_name_table[file_format]);
|
||||||
|
file_format_flags |= RB_FileFormatFlag_HasEhFrame;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scratch_end(scratch);
|
||||||
|
}
|
||||||
|
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
//- rjf: push to list
|
//- rjf: push to list
|
||||||
//
|
//
|
||||||
@@ -1427,7 +1452,6 @@ 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);
|
||||||
|
|
||||||
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];
|
||||||
@@ -1436,7 +1460,6 @@ rb_thread_entry_point(void *p)
|
|||||||
{
|
{
|
||||||
eh_frame_hdr = str8_substr(f->data, r1u64(shdr->sh_offset, shdr->sh_offset + shdr->sh_size));
|
eh_frame_hdr = str8_substr(f->data, r1u64(shdr->sh_offset, shdr->sh_offset + shdr->sh_size));
|
||||||
eh_frame_hdr_vaddr = shdr->sh_addr;
|
eh_frame_hdr_vaddr = shdr->sh_addr;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if(str8_match(name, str8_lit(".eh_frame"), 0))
|
else if(str8_match(name, str8_lit(".eh_frame"), 0))
|
||||||
{
|
{
|
||||||
@@ -1537,7 +1560,7 @@ rb_thread_entry_point(void *p)
|
|||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
|
|
||||||
//- rjf: dump file extension info
|
//- rjf: dump DWARF file extension info
|
||||||
if(f->format_flags & RB_FileFormatFlag_HasDWARF)
|
if(f->format_flags & RB_FileFormatFlag_HasDWARF)
|
||||||
{
|
{
|
||||||
if(lane_idx() == 0)
|
if(lane_idx() == 0)
|
||||||
@@ -1549,7 +1572,8 @@ rb_thread_entry_point(void *p)
|
|||||||
lane_sync();
|
lane_sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(eh_dump_subset_flags)
|
//- rjf: dump EH frame file extension info
|
||||||
|
if(f->format_flags & RB_FileFormatFlag_HasEhFrame)
|
||||||
{
|
{
|
||||||
if(lane_idx() == 0)
|
if(lane_idx() == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ typedef U32 RB_FileFormatFlags;
|
|||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
RB_FileFormatFlag_HasDWARF = (1<<0),
|
RB_FileFormatFlag_HasDWARF = (1<<0),
|
||||||
|
RB_FileFormatFlag_HasEhFrame = (1<<1),
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct RB_File RB_File;
|
typedef struct RB_File RB_File;
|
||||||
|
|||||||
Reference in New Issue
Block a user