mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-14 17:28:07 +00:00
minor fixes and improvements for DWARF dumper
This commit is contained in:
+1
-1
@@ -158,7 +158,7 @@ typedef enum DW_InlKindEnum
|
||||
X(FixedAdvancePc, 0x09) \
|
||||
X(SetPrologueEnd, 0x0A) \
|
||||
X(SetEpilogueBegin, 0x0B) \
|
||||
X(SetIsa, 0x0C) \
|
||||
X(SetIsa, 0x0C)
|
||||
|
||||
typedef U8 DW_StdOpcode;
|
||||
typedef enum DW_StdOpcodeEnum
|
||||
|
||||
+11
-11
@@ -983,11 +983,9 @@ DW_PRINTER(dw_print_line)
|
||||
{
|
||||
dw_printf("// %-4s %-30s\n", "No.", "Name");
|
||||
dw_printf("// ---- ------------------------------\n");
|
||||
String8 cu_comp_dir = dw_string_from_tag_attrib_kind(input, cu, cu->tag, DW_AttribKind_CompDir);
|
||||
dw_printf("{ %-4I64u %-30S }\n", 0, cu_comp_dir);
|
||||
for EachIndex(dir_idx, vm->header.dir_table.count)
|
||||
{
|
||||
dw_printf("{ %-4I64u %-30S }\n", dir_idx+1, vm->header.dir_table.v[dir_idx]);
|
||||
dw_printf("{ %-4I64u %-30S }\n", dir_idx, vm->header.dir_table.v[dir_idx]);
|
||||
}
|
||||
}
|
||||
dw_unindent();
|
||||
@@ -998,7 +996,7 @@ DW_PRINTER(dw_print_line)
|
||||
dw_printf("{\n");
|
||||
dw_indent();
|
||||
{
|
||||
dw_printf("// %-4s %-8s %-8s %-33s %-8s %-20s\n", "No.", "Dir No.", "Time", "MD5", "Size", "Name");
|
||||
dw_printf("// %-4s %-8s %-8s %-33s %-8s %-20s\n", "No.", "Dir No.", "Time", "MD5", "Size", "Path");
|
||||
dw_printf("// ---- -------- -------- --------------------------------- -------- --------------------\n");
|
||||
for EachIndex(file_idx, vm->header.file_table.count)
|
||||
{
|
||||
@@ -1006,11 +1004,11 @@ DW_PRINTER(dw_print_line)
|
||||
dw_printf("{ %-4I64u %-8I64u %-8I64u %016I64x-%016I64x %-8I64u %-20S }\n",
|
||||
file_idx,
|
||||
file->dir_idx,
|
||||
file->modify_time,
|
||||
file->md5_digest.u64[1],
|
||||
file->md5_digest.u64[0],
|
||||
file->file_size,
|
||||
file->file_name);
|
||||
file->time_stamp,
|
||||
file->md5.u64[1],
|
||||
file->md5.u64[0],
|
||||
file->size,
|
||||
file->path);
|
||||
}
|
||||
}
|
||||
dw_unindent();
|
||||
@@ -1038,8 +1036,10 @@ DW_PRINTER(dw_print_line)
|
||||
str8_list_pushf(opcode_temp.arena, &opcode_fmt, "%08I64x:", global_opcode_off);
|
||||
|
||||
// push opcode id
|
||||
if (vm->opcode != 0) {
|
||||
String8 opcode_str = dw_string_from_std_opcode(opcode_temp.arena, vm->opcode);
|
||||
str8_list_push(arena, &opcode_fmt, opcode_str);
|
||||
str8_list_pushf(arena, &opcode_fmt, "%-11S:", opcode_str);
|
||||
}
|
||||
|
||||
// print operands
|
||||
switch(vm->opcode)
|
||||
@@ -1103,7 +1103,7 @@ DW_PRINTER(dw_print_line)
|
||||
}break;
|
||||
case DW_StdOpcode_ExtendedOpcode:
|
||||
{
|
||||
str8_list_push(opcode_temp.arena, &opcode_fmt, dw_string_from_ext_opcode(opcode_temp.arena, vm->ext_opcode));
|
||||
str8_list_pushf(opcode_temp.arena, &opcode_fmt, "%S*", dw_string_from_ext_opcode(opcode_temp.arena, vm->ext_opcode));
|
||||
//str8_list_pushf(opcode_temp.arena, &opcode_fmt, "length: %u", length);
|
||||
switch(vm->ext_opcode)
|
||||
{
|
||||
|
||||
+25
-2
@@ -342,6 +342,21 @@ rb_thread_entry_point(void *p)
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
if(file_format == RB_FileFormat_COFF_OBJ || file_format == RB_FileFormat_COFF_BigOBJ)
|
||||
{
|
||||
Temp scratch = scratch_begin(&arena, 1);
|
||||
COFF_FileHeaderInfo coff_obj = coff_file_header_info_from_data(file_data);
|
||||
String8 string_table = str8_substr(file_data, coff_obj.string_table_range);
|
||||
U64 section_count = coff_obj.section_count_no_null;
|
||||
COFF_SectionHeader *section_table = (COFF_SectionHeader *)str8_substr(file_data, coff_obj.section_table_range).str;
|
||||
if(dw_is_dwarf_present_coff_section_table(string_table, section_count, section_table))
|
||||
{
|
||||
log_infof("DWARF data detected in %S (%S)\n", n->string, rb_file_format_display_name_table[file_format]);
|
||||
file_format_flags |= RB_FileFormatFlag_HasDWARF;
|
||||
}
|
||||
scratch_end(scratch);
|
||||
}
|
||||
|
||||
//////////////////////////
|
||||
//- rjf: ELF => check if contains DWARF
|
||||
//
|
||||
@@ -1104,6 +1119,7 @@ rb_thread_entry_point(void *p)
|
||||
Arch arch = Arch_Null;
|
||||
PE_BinInfo pe = {0};
|
||||
ELF_Bin elf = {0};
|
||||
COFF_FileHeaderInfo coff_obj = {0};
|
||||
DW_Input dw = {0};
|
||||
U64 eh_frame_hdr_vaddr = 0;
|
||||
U64 eh_frame_vaddr = 0;
|
||||
@@ -1115,8 +1131,15 @@ rb_thread_entry_point(void *p)
|
||||
pe = pe_bin_info_from_data(arena, f->data);
|
||||
arch = pe.arch;
|
||||
}
|
||||
if(f->format == RB_FileFormat_ELF32 ||
|
||||
f->format == RB_FileFormat_ELF64)
|
||||
else if(f->format == RB_FileFormat_COFF_OBJ || f->format == RB_FileFormat_COFF_BigOBJ)
|
||||
{
|
||||
coff_obj = coff_file_header_info_from_data(f->data);
|
||||
String8 string_table = str8_substr(f->data, coff_obj.string_table_range);
|
||||
U64 section_count = coff_obj.section_count_no_null;
|
||||
COFF_SectionHeader *section_table = (COFF_SectionHeader *)str8_substr(f->data, coff_obj.section_table_range).str;
|
||||
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)
|
||||
{
|
||||
elf = elf_bin_from_data(arena, f->data);
|
||||
arch = arch_from_elf_machine(elf.hdr.e_machine);
|
||||
|
||||
Reference in New Issue
Block a user