pass over raddump

- made inline sites section more compact
- consistent indentation for PE/COFF printers
This commit is contained in:
Nikita Smith
2025-03-31 22:49:17 -07:00
parent 03a87fd4ee
commit 1c1a8b84ec
3 changed files with 359 additions and 347 deletions
+105 -95
View File
@@ -1474,12 +1474,25 @@ rdi_print_scope(Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi,
} }
internal void internal void
rdi_print_inline_site(Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_InlineSite *inline_site) rdi_print_inline_site(Arena *arena,
String8List *out,
String8 indent,
RDI_Parsed *rdi,
U64 idx,
RDI_InlineSite *inline_site)
{ {
rd_printf("name ='%S'", str8_from_rdi_string_idx(rdi, inline_site->name_string_idx)); Temp scratch = scratch_begin(&arena, 1);
rd_printf("type_idx =%u", inline_site->type_idx); String8 inline_site_idx = push_str8f(scratch.arena, "inline_site[%u]", idx);
rd_printf("owner_type_idx=%u", inline_site->owner_type_idx); String8 type_idx = push_str8f(scratch.arena, "type_idx = %u,", inline_site->type_idx);
rd_printf("line_table_idx=%u", inline_site->line_table_idx); String8 owner_type_idx = push_str8f(scratch.arena, "owner_type_idx = %u,", inline_site->owner_type_idx);
String8 line_table_idx = push_str8f(scratch.arena, "line_table_idx = %u,", inline_site->line_table_idx);
rd_printf("%-20S = { %-25S %-25S %-25S name = '%-20S' }",
inline_site_idx,
type_idx,
owner_type_idx,
line_table_idx,
str8_from_rdi_string_idx(rdi, inline_site->name_string_idx));
scratch_end(scratch);
} }
internal void internal void
@@ -1712,10 +1725,7 @@ rdi_print(Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RD_Op
rd_printf("# INLINE SITES"); rd_printf("# INLINE SITES");
rd_indent(); rd_indent();
for (U64 i = 0; i < inline_site_count; ++i) { for (U64 i = 0; i < inline_site_count; ++i) {
rd_printf("inline_site[%llu]:", i); rdi_print_inline_site(arena, out, indent, rdi, i, &inline_site_array[i]);
rd_indent();
rdi_print_inline_site(arena, out, indent, rdi, &inline_site_array[i]);
rd_unindent();
} }
rd_unindent(); rd_unindent();
rd_newline(); rd_newline();
@@ -4076,9 +4086,9 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cursor += str8_deserial_read_cstr(raw_symbol, cursor, &name); cursor += str8_deserial_read_cstr(raw_symbol, cursor, &name);
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Parent: %x", sym.parent); rd_printf("Parent : %#x", sym.parent);
rd_printf("End: %x", sym.end); rd_printf("End : %#x", sym.end);
rd_printf("Next: %x", sym.next); rd_printf("Next : %#x", sym.next);
rd_printf("Address: %S", cv_string_sec_off(scratch.arena, sym.sec, sym.off)); rd_printf("Address: %S", cv_string_sec_off(scratch.arena, sym.sec, sym.off));
rd_printf("Length : %u", sym.len); rd_printf("Length : %u", sym.len);
rd_printf("Ordinal: %S", cv_string_from_thunk_ordinal(sym.ord)); rd_printf("Ordinal: %S", cv_string_from_thunk_ordinal(sym.ord));
@@ -4106,7 +4116,7 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
rd_indent(); rd_indent();
for (U32 i = 0; i < sym.count; ++i) { for (U32 i = 0; i < sym.count; ++i) {
U32 invoks = i < invocation_count ? invocations[i] : 0; U32 invoks = i < invocation_count ? invocations[i] : 0;
rd_printf("%08x (%u)", funcs[i], invoks); rd_printf("%#08x (%u)", funcs[i], invoks);
} }
rd_unindent(); rd_unindent();
} break; } break;
@@ -4178,12 +4188,12 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym); cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym);
cursor += str8_deserial_read_cstr(raw_symbol, cursor, &name); cursor += str8_deserial_read_cstr(raw_symbol, cursor, &name);
rd_printf("Parent: %x", sym.parent); rd_printf("Parent : %#x", sym.parent);
rd_printf("End: %x", sym.end); rd_printf("End : %#x", sym.end);
rd_printf("Address: %S", cv_string_sec_off(scratch.arena, sym.sec, sym.off)); rd_printf("Address: %S", cv_string_sec_off(scratch.arena, sym.sec, sym.off));
rd_printf("Length : %u", sym.len); rd_printf("Length : %u", sym.len);
if (name.size) {
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
if (name.size) {
} }
} break; } break;
case CV_SymKind_LABEL32_ST: case CV_SymKind_LABEL32_ST:
@@ -4207,12 +4217,12 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
U32 float_pkg = CV_CompileFlags_Extract_FloatPkg(sym.flags); U32 float_pkg = CV_CompileFlags_Extract_FloatPkg(sym.flags);
U32 ambient_data = CV_CompileFlags_Extract_AmbientData(sym.flags); U32 ambient_data = CV_CompileFlags_Extract_AmbientData(sym.flags);
U32 mode = CV_CompileFlags_Extract_Mode(sym.flags); U32 mode = CV_CompileFlags_Extract_Mode(sym.flags);
rd_printf("Arch: %S", cv_string_from_arch(sym.machine)); rd_printf("Arch : %#x (%S)", sym.machine, cv_string_from_arch(sym.machine));
rd_printf("Language: %S", cv_string_from_language(language)); rd_printf("Language : %#x (%S)", language, cv_string_from_language(language));
rd_printf("FloatPrec: %x", float_prec); rd_printf("FloatPrec : %#x", float_prec);
rd_printf("FloatPkg: %x", float_pkg); rd_printf("FloatPkg : %#x", float_pkg);
rd_printf("Ambient Data: %x", ambient_data); rd_printf("Ambient Data : %#x", ambient_data);
rd_printf("Mode: %x", mode); rd_printf("Mode : %#x", mode);
rd_printf("Version String: %S", version_string); rd_printf("Version String: %S", version_string);
} break; } break;
case CV_SymKind_COMPILE2_ST: case CV_SymKind_COMPILE2_ST:
@@ -4224,9 +4234,9 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cursor += str8_deserial_read_cstr(raw_symbol, cursor, &version_string); cursor += str8_deserial_read_cstr(raw_symbol, cursor, &version_string);
U32 language = CV_Compile2Flags_Extract_Language(sym.flags); U32 language = CV_Compile2Flags_Extract_Language(sym.flags);
rd_printf("Machine: %S", cv_string_from_arch(sym.machine)); rd_printf("Machine : %#x (%S)", sym.machine, cv_string_from_arch(sym.machine));
rd_printf("Flags: %x", sym.flags); rd_printf("Flags : %#x", sym.flags);
rd_printf("Language: %S", cv_string_from_language(language)); rd_printf("Language : %#x (%S)", language, cv_string_from_language(language));
rd_printf("Frontend Version: %u.%u", sym.ver_fe_major, sym.ver_fe_minor); rd_printf("Frontend Version: %u.%u", sym.ver_fe_major, sym.ver_fe_minor);
rd_printf("Frontend Build : %u", sym.ver_fe_build); rd_printf("Frontend Build : %u", sym.ver_fe_build);
rd_printf("Backend Version : %u.%u", sym.ver_major, sym.ver_minor); rd_printf("Backend Version : %u.%u", sym.ver_major, sym.ver_minor);
@@ -4240,9 +4250,9 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cursor += str8_deserial_read_cstr(raw_symbol, cursor, &version_string); cursor += str8_deserial_read_cstr(raw_symbol, cursor, &version_string);
U32 language = CV_Compile3Flags_Extract_Language(sym.flags); U32 language = CV_Compile3Flags_Extract_Language(sym.flags);
rd_printf("Machine: %S", cv_string_from_arch(sym.machine)); rd_printf("Machine : %#x (%S)", sym.machine, cv_string_from_arch(sym.machine));
rd_printf("Flags: %x", sym.flags); rd_printf("Flags : %#x", sym.flags);
rd_printf("Language: %S", cv_string_from_language(language)); rd_printf("Language : %#x (%S)", language, cv_string_from_language(language));
rd_printf("Frontend Version: %u.%u", sym.ver_fe_major, sym.ver_fe_minor); rd_printf("Frontend Version: %u.%u", sym.ver_fe_major, sym.ver_fe_minor);
rd_printf("Frontend Build : %u", sym.ver_fe_build); rd_printf("Frontend Build : %u", sym.ver_fe_build);
rd_printf("Fontend QFE : %u", sym.ver_feqfe); rd_printf("Fontend QFE : %u", sym.ver_feqfe);
@@ -4269,7 +4279,7 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
rd_printf("Address : %S", cv_string_sec_off(scratch.arena, sym.sec, sym.off)); rd_printf("Address : %S", cv_string_sec_off(scratch.arena, sym.sec, sym.off));
rd_printf("Length : %u", sym.len); rd_printf("Length : %u", sym.len);
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, sym.itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, sym.itype));
rd_printf("Flags: %S", cv_string_from_proc_flags(scratch.arena, sym.flags)); rd_printf("Flags : %#x (%S)", sym.flags, cv_string_from_proc_flags(scratch.arena, sym.flags));
rd_printf("Debug Start: %#x", sym.dbg_start); rd_printf("Debug Start: %#x", sym.dbg_start);
rd_printf("Debug End : %#x", sym.dbg_end); rd_printf("Debug End : %#x", sym.dbg_end);
} break; } break;
@@ -4306,9 +4316,9 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
String8 flags = cv_string_from_frame_proc_flags(scratch.arena, sym.flags); String8 flags = cv_string_from_frame_proc_flags(scratch.arena, sym.flags);
U32 local_ptr = CV_FrameprocFlags_Extract_LocalBasePointer(sym.flags); U32 local_ptr = CV_FrameprocFlags_Extract_LocalBasePointer(sym.flags);
U32 param_ptr = CV_FrameprocFlags_Extract_ParamBasePointer(sym.flags); U32 param_ptr = CV_FrameprocFlags_Extract_ParamBasePointer(sym.flags);
rd_printf("Frame Size: %x", sym.frame_size); rd_printf("Frame Size : %#x", sym.frame_size);
rd_printf("Pad Size: %x", sym.pad_size); rd_printf("Pad Size : %#x", sym.pad_size);
rd_printf("Pad Offset: %x", sym.pad_off); rd_printf("Pad Offset : %#x", sym.pad_off);
rd_printf("Save Registers Area: %u", sym.save_reg_size); rd_printf("Save Registers Area: %u", sym.save_reg_size);
rd_printf("Exception Handler : %S", cv_string_sec_off(arena, sym.eh_sec, sym.eh_off)); rd_printf("Exception Handler : %S", cv_string_sec_off(arena, sym.eh_sec, sym.eh_off));
rd_printf("Flags : %S", flags); rd_printf("Flags : %S", flags);
@@ -4361,8 +4371,8 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym); cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym);
cursor += raw_gaps.size; cursor += raw_gaps.size;
rd_printf("Register: %S", cv_string_from_reg_id(scratch.arena, arch, sym.reg)); rd_printf("Register : %#x (%S)", sym.reg, cv_string_from_reg_id(scratch.arena, arch, sym.reg));
rd_printf("Attributes: %S", cv_string_from_range_attribs(scratch.arena, sym.attribs)); rd_printf("Attributes : %#x (%S)", sym.attribs, cv_string_from_range_attribs(scratch.arena, sym.attribs));
rd_printf("Parent Offset: %#x", sym.field_offset); rd_printf("Parent Offset: %#x", sym.field_offset);
cv_print_lvar_addr_range(arena, out, indent, sym.range); cv_print_lvar_addr_range(arena, out, indent, sym.range);
cv_print_lvar_addr_gap(arena, out, indent, raw_gaps); cv_print_lvar_addr_gap(arena, out, indent, raw_gaps);
@@ -4378,7 +4388,7 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym); cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym);
cursor += raw_gaps.size; cursor += raw_gaps.size;
rd_printf("Flags: %S", cv_string_from_defrange_register_rel_flags(scratch.arena, sym.flags)); rd_printf("Flags : %#x (%S)", sym.flags, cv_string_from_defrange_register_rel_flags(scratch.arena, sym.flags));
rd_printf("Address: %S", cv_string_from_reg_off(scratch.arena, arch, sym.reg, sym.reg_off)); rd_printf("Address: %S", cv_string_from_reg_off(scratch.arena, arch, sym.reg, sym.reg_off));
cv_print_lvar_addr_gap(arena, out, indent, raw_gaps); cv_print_lvar_addr_gap(arena, out, indent, raw_gaps);
} break; } break;
@@ -4433,7 +4443,7 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym); cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym);
rd_printf("Address: %S", cv_string_sec_off(arena, sym.reg, sym.off)); rd_printf("Address: %S", cv_string_sec_off(arena, sym.reg, sym.off));
rd_printf("Kind: %S", cv_string_from_frame_cookie_kind(sym.kind)); rd_printf("Kind : %#x (%S)", sym.kind, cv_string_from_frame_cookie_kind(sym.kind));
rd_printf("Flags : %#x", sym.flags); // TODO: llvm and cvinfo.h don't define these flags... rd_printf("Flags : %#x", sym.flags); // TODO: llvm and cvinfo.h don't define these flags...
} break; } break;
case CV_SymKind_HEAPALLOCSITE: { case CV_SymKind_HEAPALLOCSITE: {
@@ -4484,8 +4494,8 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
CV_SymReturn sym = {0}; CV_SymReturn sym = {0};
cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym); cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym);
rd_printf("Flags: %S", cv_string_from_generic_flags(scratch.arena, sym.flags)); rd_printf("Flags : %#x (%S)", sym.flags, cv_string_from_generic_flags(scratch.arena, sym.flags));
rd_printf("Style: %S", cv_string_from_generic_style(sym.style)); rd_printf("Style : %#x (%S)", sym.style, cv_string_from_generic_style(sym.style));
if (sym.style == CV_GenericStyle_REG) { if (sym.style == CV_GenericStyle_REG) {
U8 count = 0; U8 count = 0;
cursor += str8_deserial_read_struct(raw_symbol, cursor, &count); cursor += str8_deserial_read_struct(raw_symbol, cursor, &count);
@@ -4506,7 +4516,7 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cv_print_symbol(arena, out, indent, arch, min_itype, type, raw_subsym); cv_print_symbol(arena, out, indent, arch, min_itype, type, raw_subsym);
} break; } break;
case CV_SymKind_SLINK32: { case CV_SymKind_SLINK32: {
Assert(!"ret"); Assert(!"TODO: test");
CV_SymSLink32 sym = {0}; CV_SymSLink32 sym = {0};
cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym); cursor += str8_deserial_read_struct(raw_symbol, cursor, &sym);
@@ -4601,7 +4611,7 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
rd_printf("Parent : %#x", sym.parent); rd_printf("Parent : %#x", sym.parent);
rd_printf("End : %#x", sym.end); rd_printf("End : %#x", sym.end);
rd_printf("Length : %u", sym.len); rd_printf("Length : %u", sym.len);
rd_printf("Flags: %S", cv_string_from_sepcode(scratch.arena, sym.flags)); rd_printf("Flags : %#x (%S)", sym.flags, cv_string_from_sepcode(scratch.arena, sym.flags));
rd_printf("Address : %S", cv_string_sec_off(scratch.arena, sym.sec, sym.sec_off)); rd_printf("Address : %S", cv_string_sec_off(scratch.arena, sym.sec, sym.sec_off));
rd_printf("Parent Address: %S", cv_string_sec_off(scratch.arena, sym.sec_parent, sym.sec_parent_off)); rd_printf("Parent Address: %S", cv_string_sec_off(scratch.arena, sym.sec_parent, sym.sec_parent_off));
} break; } break;
@@ -4627,8 +4637,8 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
rd_printf("Type : %S", cv_string_from_trampoline_kind(sym.kind)); rd_printf("Type : %S", cv_string_from_trampoline_kind(sym.kind));
rd_printf("Thunk Size: %u", sym.thunk_size); rd_printf("Thunk Size: %u", sym.thunk_size);
rd_printf("Thunk: %.*s", cv_string_sec_off(scratch.arena, sym.thunk_sec, sym.thunk_sec_off)); rd_printf("Thunk : %S", cv_string_sec_off(scratch.arena, sym.thunk_sec, sym.thunk_sec_off));
rd_printf("Target: %.*s", cv_string_sec_off(scratch.arena, sym.target_sec, sym.target_sec_off)); rd_printf("Target : %S", cv_string_sec_off(scratch.arena, sym.target_sec, sym.target_sec_off));
} break; } break;
case CV_SymKind_POGODATA: { case CV_SymKind_POGODATA: {
Assert(!"TODO: test"); Assert(!"TODO: test");
@@ -4716,7 +4726,7 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Size : %u", sym.size); rd_printf("Size : %u", sym.size);
rd_printf("Characteristics: %S", coff_string_from_section_flags(scratch.arena, sym.characteristics)); rd_printf("Characteristics: %#x (%S)", sym.characteristics, coff_string_from_section_flags(scratch.arena, sym.characteristics));
rd_printf("Address : %S", cv_string_sec_off(scratch.arena, sym.sec, sym.off)); rd_printf("Address : %S", cv_string_sec_off(scratch.arena, sym.sec, sym.off));
} break; } break;
case CV_SymKind_EXPORT: { case CV_SymKind_EXPORT: {
@@ -4878,7 +4888,7 @@ cv_print_symbol(Arena *arena, String8List *out, String8 indent, CV_Arch arch, CV
cursor += str8_deserial_read_cstr(raw_symbol, cursor, &name); cursor += str8_deserial_read_cstr(raw_symbol, cursor, &name);
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Flags: %x", sym.flags); rd_printf("Flags: %#x", sym.flags);
rd_printf("Type : %S", cv_string_from_itype(arena, min_itype, sym.itype)); rd_printf("Type : %S", cv_string_from_itype(arena, min_itype, sym.itype));
} break; } break;
case CV_SymKind_ARMSWITCHTABLE: { case CV_SymKind_ARMSWITCHTABLE: {
@@ -5037,10 +5047,10 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Fields : %S", cv_string_from_itype(scratch.arena, min_itype, lf.field_itype)); rd_printf("Fields : %S", cv_string_from_itype(scratch.arena, min_itype, lf.field_itype));
rd_printf("Properties: %S", cv_string_from_type_props(scratch.arena, lf.props)); rd_printf("Properties : %#x (%S)", lf.props, cv_string_from_type_props(scratch.arena, lf.props));
rd_printf("Derived : %S", cv_string_from_itype(scratch.arena, min_itype, lf.derived_itype)); rd_printf("Derived : %S", cv_string_from_itype(scratch.arena, min_itype, lf.derived_itype));
rd_printf("VShape : %S", cv_string_from_itype(scratch.arena, min_itype, lf.vshape_itype)); rd_printf("VShape : %S", cv_string_from_itype(scratch.arena, min_itype, lf.vshape_itype));
rd_printf("Unknown: %x", lf.unknown); rd_printf("Unknown : %#x", lf.unknown);
if (lf.props & CV_TypeProp_HasUniqueName) { if (lf.props & CV_TypeProp_HasUniqueName) {
String8 unique_name = str8_zero(); String8 unique_name = str8_zero();
cursor += str8_deserial_read_cstr(raw_leaf, cursor, &unique_name); cursor += str8_deserial_read_cstr(raw_leaf, cursor, &unique_name);
@@ -5107,7 +5117,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
if (has_vbase) { if (has_vbase) {
cursor += str8_deserial_read_struct(raw_leaf, cursor, &vbase); cursor += str8_deserial_read_struct(raw_leaf, cursor, &vbase);
} }
rd_printf("Attribs: %S", cv_string_from_field_attribs(scratch.arena, ml.attribs)); rd_printf("Attribs : %#x (%S)", ml.attribs, cv_string_from_field_attribs(scratch.arena, ml.attribs));
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, ml.itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, ml.itype));
if (has_vbase) { if (has_vbase) {
rd_printf("Virtual Base: %x", vbase); rd_printf("Virtual Base: %x", vbase);
@@ -5127,7 +5137,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
String8 name = {0}; String8 name = {0};
cursor += str8_deserial_read_cstr(raw_leaf, cursor, &name); cursor += str8_deserial_read_cstr(raw_leaf, cursor, &name);
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Field Attribs: %S", cv_string_from_field_attribs(scratch.arena, lf.attribs)); rd_printf("Field Attribs: %#x (%S)", lf.attribs, cv_string_from_field_attribs(scratch.arena, lf.attribs));
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype));
if (has_vbase) { if (has_vbase) {
rd_printf("Virtual Base: %#x", vbase); rd_printf("Virtual Base: %#x", vbase);
@@ -5153,7 +5163,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
cursor += cv_read_numeric(raw_leaf, cursor, &vbptr_off); cursor += cv_read_numeric(raw_leaf, cursor, &vbptr_off);
cursor += cv_read_numeric(raw_leaf, cursor, &vbtable_off); cursor += cv_read_numeric(raw_leaf, cursor, &vbtable_off);
rd_printf("Attribs: %S", cv_string_from_field_attribs(scratch.arena, lf.attribs)); rd_printf("Attribs : %#x (%S)", lf.attribs, cv_string_from_field_attribs(scratch.arena, lf.attribs));
rd_printf("Direct Base Type: %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype)); rd_printf("Direct Base Type: %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype));
rd_printf("Virtual Base Ptr: %S", cv_string_from_itype(scratch.arena, min_itype, lf.vbptr_itype)); rd_printf("Virtual Base Ptr: %S", cv_string_from_itype(scratch.arena, min_itype, lf.vbptr_itype));
rd_printf("vbpoff : %S", cv_string_from_numeric(scratch.arena, vbptr_off)); rd_printf("vbpoff : %S", cv_string_from_numeric(scratch.arena, vbptr_off));
@@ -5165,7 +5175,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
cursor += str8_deserial_read_struct(raw_leaf, cursor, &lf); cursor += str8_deserial_read_struct(raw_leaf, cursor, &lf);
cursor += cv_read_numeric(raw_leaf, cursor, &offset); cursor += cv_read_numeric(raw_leaf, cursor, &offset);
rd_printf("Attribs: %S", cv_string_from_field_attribs(scratch.arena, lf.attribs)); rd_printf("Attribs: %#x (%S)", lf.attribs, cv_string_from_field_attribs(scratch.arena, lf.attribs));
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype));
rd_printf("Offset : %S", cv_string_from_numeric(scratch.arena, offset)); rd_printf("Offset : %S", cv_string_from_numeric(scratch.arena, offset));
} break; } break;
@@ -5192,7 +5202,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
cursor += str8_deserial_read_cstr(raw_leaf, cursor, &name); cursor += str8_deserial_read_cstr(raw_leaf, cursor, &name);
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Attribs: %S", cv_string_from_field_attribs(scratch.arena, lf.attribs)); rd_printf("Attribs: %#x (%S)", lf.attribs, cv_string_from_field_attribs(scratch.arena, lf.attribs));
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype));
} break; } break;
case CV_LeafKind_MFUNCTION: { case CV_LeafKind_MFUNCTION: {
@@ -5202,8 +5212,8 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
rd_printf("Return Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.ret_itype)); rd_printf("Return Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.ret_itype));
rd_printf("Class Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.class_itype)); rd_printf("Class Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.class_itype));
rd_printf("This Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.this_itype)); rd_printf("This Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.this_itype));
rd_printf("Call Kind: %S", cv_string_from_call_kind(lf.call_kind)); rd_printf("Call Kind : %#x (%S)", lf.call_kind, cv_string_from_call_kind(lf.call_kind));
rd_printf("Function Attribs: %S", cv_string_from_function_attribs(scratch.arena, lf.attribs)); rd_printf("Function Attribs: %#x (%S)", lf.attribs, cv_string_from_function_attribs(scratch.arena, lf.attribs));
rd_printf("Argument Count : %u", lf.arg_count); rd_printf("Argument Count : %u", lf.arg_count);
rd_printf("Argument Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.arg_itype)); rd_printf("Argument Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.arg_itype));
} break; } break;
@@ -5231,7 +5241,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Field Count: %u", lf.count); rd_printf("Field Count: %u", lf.count);
rd_printf("Properties: %S", cv_string_from_type_props(scratch.arena, lf.props)); rd_printf("Properties : %#x (%S)", lf.props, cv_string_from_type_props(scratch.arena, lf.props));
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.base_itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.base_itype));
rd_printf("Field : %S", cv_string_from_itype(scratch.arena, min_itype, lf.field_itype)); rd_printf("Field : %S", cv_string_from_itype(scratch.arena, min_itype, lf.field_itype));
if (lf.props & CV_TypeProp_HasUniqueName) { if (lf.props & CV_TypeProp_HasUniqueName) {
@@ -5327,7 +5337,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Field Count: %u", lf.count); rd_printf("Field Count: %u", lf.count);
rd_printf("Properties: %S", cv_string_from_type_props(scratch.arena, lf.props)); rd_printf("Properties : %#x (%S)", lf.props, cv_string_from_type_props(scratch.arena, lf.props));
rd_printf("Field : %S", cv_string_from_itype(scratch.arena, min_itype, lf.field_itype)); rd_printf("Field : %S", cv_string_from_itype(scratch.arena, min_itype, lf.field_itype));
rd_printf("Size : %S", cv_string_from_numeric(scratch.arena, num)); rd_printf("Size : %S", cv_string_from_numeric(scratch.arena, num));
if (lf.props & CV_TypeProp_HasUniqueName) { if (lf.props & CV_TypeProp_HasUniqueName) {
@@ -5349,7 +5359,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Field Count : %u", lf.count); rd_printf("Field Count : %u", lf.count);
rd_printf("Properties: %S", cv_string_from_type_props(scratch.arena, lf.props)); rd_printf("Properties : %#x (%S)", lf.props, cv_string_from_type_props(scratch.arena, lf.props));
rd_printf("Field List Type: %S", cv_string_from_itype(scratch.arena, min_itype, lf.field_itype)); rd_printf("Field List Type: %S", cv_string_from_itype(scratch.arena, min_itype, lf.field_itype));
rd_printf("Derived Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.derived_itype)); rd_printf("Derived Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.derived_itype));
rd_printf("VShape : %S", cv_string_from_itype(scratch.arena, min_itype, lf.vshape_itype)); rd_printf("VShape : %S", cv_string_from_itype(scratch.arena, min_itype, lf.vshape_itype));
@@ -5382,8 +5392,8 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
String8 func_attribs = cv_string_from_function_attribs(scratch.arena, lf.attribs); String8 func_attribs = cv_string_from_function_attribs(scratch.arena, lf.attribs);
rd_printf("Return type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.ret_itype)); rd_printf("Return type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.ret_itype));
rd_printf("Call Convention: %S", call_kind); rd_printf("Call Convention : %#x (%S)", lf.call_kind, call_kind);
rd_printf("Function Attribs: %S", func_attribs); rd_printf("Function Attribs : %#x (%S)", lf.attribs, func_attribs);
rd_printf("Argumnet Count : %u", lf.arg_count); rd_printf("Argumnet Count : %u", lf.arg_count);
rd_printf("Argument List Type: %S", cv_string_from_itype(scratch.arena, min_itype, lf.arg_itype)); rd_printf("Argument List Type: %S", cv_string_from_itype(scratch.arena, min_itype, lf.arg_itype));
} break; } break;
@@ -5394,7 +5404,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
cursor += str8_deserial_read_cstr(raw_leaf, cursor, &name); cursor += str8_deserial_read_cstr(raw_leaf, cursor, &name);
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Scope Type: %S", cv_string_from_itype(scratch.arena, min_itype, lf.scope_string_id)); rd_printf("Scope Type: %#x (%S)", lf.scope_string_id, cv_string_from_itype(scratch.arena, min_itype, lf.scope_string_id));
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype));
} break; } break;
case CV_LeafKind_MODIFIER: { case CV_LeafKind_MODIFIER: {
@@ -5402,7 +5412,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
cursor += str8_deserial_read_struct(raw_leaf, cursor, &lf); cursor += str8_deserial_read_struct(raw_leaf, cursor, &lf);
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype));
rd_printf("Flags: %S", cv_string_from_modifier_flags(scratch.arena, lf.flags)); rd_printf("Flags: %#x (%S)", lf.flags, cv_string_from_modifier_flags(scratch.arena, lf.flags));
} break; } break;
case CV_LeafKind_ARRAY_ST: case CV_LeafKind_ARRAY_ST:
case CV_LeafKind_ARRAY: { case CV_LeafKind_ARRAY: {
@@ -5438,7 +5448,7 @@ cv_print_leaf(Arena *arena, String8List *out, String8 indent, CV_TypeIndex min_i
cursor += str8_deserial_read_cstr(raw_leaf, cursor, &name); cursor += str8_deserial_read_cstr(raw_leaf, cursor, &name);
rd_printf("Name : %S", name); rd_printf("Name : %S", name);
rd_printf("Attribs: %S", cv_string_from_field_attribs(scratch.arena, lf.attribs)); rd_printf("Attribs: %#x (%S)", lf.attribs, cv_string_from_field_attribs(scratch.arena, lf.attribs));
rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype)); rd_printf("Type : %S", cv_string_from_itype(scratch.arena, min_itype, lf.itype));
rd_printf("Offset : %S", cv_string_from_numeric(scratch.arena, num)); rd_printf("Offset : %S", cv_string_from_numeric(scratch.arena, num));
} break; } break;
@@ -5937,7 +5947,7 @@ coff_print_archive_member_header(Arena *arena, String8List *out, String8 indent,
String8 time_stamp = coff_string_from_time_stamp(scratch.arena, header.time_stamp); String8 time_stamp = coff_string_from_time_stamp(scratch.arena, header.time_stamp);
rd_printf("Name : %S" , header.name ); rd_printf("Name : %S" , header.name );
rd_printf("Time Stamp: %S" , time_stamp ); rd_printf("Time Stamp: (%#x) %S" , header.time_stamp, time_stamp );
rd_printf("User ID : %u" , header.user_id ); rd_printf("User ID : %u" , header.user_id );
rd_printf("Group ID : %u" , header.group_id); rd_printf("Group ID : %u" , header.group_id);
rd_printf("Mode : %S" , header.mode ); rd_printf("Mode : %S" , header.mode );
@@ -6388,8 +6398,8 @@ coff_print_big_obj_header(Arena *arena, String8List *out, String8 indent, COFF_B
rd_printf("# Big Obj"); rd_printf("# Big Obj");
rd_indent(); rd_indent();
rd_printf("Time Stamp: %S", time_stamp ); rd_printf("Time Stamp : %#x (%S)", header->time_stamp, time_stamp);
rd_printf("Machine: %S", machine ); rd_printf("Machine : %#x (%S)", header->machine, machine );
rd_printf("Section Count: %u", header->section_count ); rd_printf("Section Count: %u", header->section_count );
rd_printf("Symbol Table : %#x", header->symbol_table_foff); rd_printf("Symbol Table : %#x", header->symbol_table_foff);
rd_printf("Symbol Count : %u", header->symbol_count ); rd_printf("Symbol Count : %u", header->symbol_count );
@@ -6409,13 +6419,13 @@ coff_print_file_header(Arena *arena, String8List *out, String8 indent, COFF_File
rd_printf("# COFF File Header"); rd_printf("# COFF File Header");
rd_indent(); rd_indent();
rd_printf("Time Stamp: %S", time_stamp ); rd_printf("Time Stamp : %#x (%S)", header->time_stamp, time_stamp );
rd_printf("Machine: %S", machine ); rd_printf("Machine : %#x %S", header->machine, machine );
rd_printf("Section Count : %u", header->section_count ); rd_printf("Section Count : %u", header->section_count );
rd_printf("Symbol Table : %#x", header->symbol_table_foff ); rd_printf("Symbol Table : %#x", header->symbol_table_foff );
rd_printf("Symbol Count : %u", header->symbol_count ); rd_printf("Symbol Count : %u", header->symbol_count );
rd_printf("Optional Header Size: %m", header->optional_header_size); rd_printf("Optional Header Size: %#x (%m)", header->optional_header_size, header->optional_header_size);
rd_printf("Flags: %S", flags ); rd_printf("Flags : %#x (%S)", header->flags, flags );
rd_unindent(); rd_unindent();
scratch_end(scratch); scratch_end(scratch);
@@ -6433,8 +6443,8 @@ coff_print_import(Arena *arena, String8List *out, String8 indent, COFF_ParsedArc
rd_indent(); rd_indent();
rd_printf("Version : %u", header->version ); rd_printf("Version : %u", header->version );
rd_printf("Machine : %S", machine ); rd_printf("Machine : %S", machine );
rd_printf("Time Stamp: %S", time_stamp ); rd_printf("Time Stamp: %#x (%S)", header->time_stamp, time_stamp );
rd_printf("Data Size: %m", header->data_size ); rd_printf("Data Size : %#x (%m)", header->data_size, header->data_size);
rd_printf("Hint : %u", header->hint_or_ordinal); rd_printf("Hint : %u", header->hint_or_ordinal);
rd_printf("Type : %u", header->type ); rd_printf("Type : %u", header->type );
rd_printf("Import By : %u", header->import_by ); rd_printf("Import By : %u", header->import_by );
@@ -6593,7 +6603,7 @@ coff_print_archive(Arena *arena, String8List *out, String8 indent, String8 raw_a
rd_indent(); rd_indent();
rd_printf("Symbol Count : %u", first_member.symbol_count); rd_printf("Symbol Count : %u", first_member.symbol_count);
rd_printf("String Table Size: %M", first_member.string_table.size); rd_printf("String Table Size: %#llx (%M)", first_member.string_table.size, first_member.string_table.size);
rd_printf("Members:"); rd_printf("Members:");
rd_indent(); rd_indent();
@@ -6624,7 +6634,7 @@ coff_print_archive(Arena *arena, String8List *out, String8 indent, String8 raw_a
rd_printf("Member Count : %u", second_member.member_count); rd_printf("Member Count : %u", second_member.member_count);
rd_printf("Symbol Count : %u", second_member.symbol_count); rd_printf("Symbol Count : %u", second_member.symbol_count);
rd_printf("String Table Size: %M", second_member.string_table.size); rd_printf("String Table Size: %#llx (%M)", second_member.string_table.size, second_member.string_table.size);
String8List string_table = str8_split_by_string_chars(scratch.arena, second_member.string_table, str8_lit("\0"), 0); String8List string_table = str8_split_by_string_chars(scratch.arena, second_member.string_table, str8_lit("\0"), 0);
@@ -6744,7 +6754,7 @@ mscrt_print_eh_handler_type32(Arena *arena, String8List *out, String8 indent, RD
Temp scratch = scratch_begin(&arena, 1); Temp scratch = scratch_begin(&arena, 1);
String8 catch_line = rd_format_line_from_voff(scratch.arena, rdi, handler->catch_handler_voff, PathStyle_WindowsAbsolute); String8 catch_line = rd_format_line_from_voff(scratch.arena, rdi, handler->catch_handler_voff, PathStyle_WindowsAbsolute);
String8 adjectives_str = mscrt_string_from_eh_adjectives(scratch.arena, handler->adjectives); String8 adjectives_str = mscrt_string_from_eh_adjectives(scratch.arena, handler->adjectives);
rd_printf("Adjectives: %S", adjectives_str, handler->adjectives); rd_printf("Adjectives : %#x (%S)", handler->adjectives, adjectives_str);
rd_printf("Descriptor : %#x", handler->descriptor_voff); rd_printf("Descriptor : %#x", handler->descriptor_voff);
rd_printf("Catch Object Frame Offset: %#x", handler->catch_obj_frame_offset); rd_printf("Catch Object Frame Offset: %#x", handler->catch_obj_frame_offset);
rd_printf("Catch Handler : %#x%s%S", handler->catch_handler_voff, catch_line.size ? " " : "", catch_line); rd_printf("Catch Handler : %#x%s%S", handler->catch_handler_voff, catch_line.size ? " " : "", catch_line);
@@ -6785,9 +6795,9 @@ pe_print_optional_header32(Arena *arena, String8List *out, String8 indent, PE_Op
rd_indent(); rd_indent();
rd_printf("Magic : %#x", opt_header->magic); rd_printf("Magic : %#x", opt_header->magic);
rd_printf("Linker version : %u.%u", opt_header->major_linker_version, opt_header->minor_linker_version); rd_printf("Linker version : %u.%u", opt_header->major_linker_version, opt_header->minor_linker_version);
rd_printf("Size of code: %m", opt_header->sizeof_code); rd_printf("Size of code : %#-8x (%m)", opt_header->sizeof_code, opt_header->sizeof_code);
rd_printf("Size of inited data: %m", opt_header->sizeof_inited_data); rd_printf("Size of inited data : %#-8x (%m)", opt_header->sizeof_inited_data, opt_header->sizeof_inited_data);
rd_printf("Size of uninited data: %m", opt_header->sizeof_uninited_data); rd_printf("Size of uninited data: %#-8x (%m)", opt_header->sizeof_uninited_data, opt_header->sizeof_uninited_data);
rd_printf("Entry point : %#x", opt_header->entry_point_va); rd_printf("Entry point : %#x", opt_header->entry_point_va);
rd_printf("Code base : %#x", opt_header->code_base); rd_printf("Code base : %#x", opt_header->code_base);
rd_printf("Data base : %#x", opt_header->data_base); rd_printf("Data base : %#x", opt_header->data_base);
@@ -6798,15 +6808,15 @@ pe_print_optional_header32(Arena *arena, String8List *out, String8 indent, PE_Op
rd_printf("Image Version : %u.%u", opt_header->major_img_ver, opt_header->minor_img_ver); rd_printf("Image Version : %u.%u", opt_header->major_img_ver, opt_header->minor_img_ver);
rd_printf("Subsystem version : %u.%u", opt_header->major_subsystem_ver, opt_header->minor_subsystem_ver); rd_printf("Subsystem version : %u.%u", opt_header->major_subsystem_ver, opt_header->minor_subsystem_ver);
rd_printf("Win32 version : %u", opt_header->win32_version_value); rd_printf("Win32 version : %u", opt_header->win32_version_value);
rd_printf("Size of image: %m", opt_header->sizeof_image); rd_printf("Size of image : %#x (%m)", opt_header->sizeof_image, opt_header->sizeof_image);
rd_printf("Size of headers: %m", opt_header->sizeof_headers); rd_printf("Size of headers : %#x (%m)", opt_header->sizeof_headers, opt_header->sizeof_headers);
rd_printf("Checksum : %#x", opt_header->check_sum); rd_printf("Checksum : %#x", opt_header->check_sum);
rd_printf("Subsystem: %S", subsystem); rd_printf("Subsystem : %#x (%S)", opt_header->subsystem, subsystem);
rd_printf("DLL Characteristics: %S", dll_chars); rd_printf("DLL Characteristics : %#x (%S)", opt_header->dll_characteristics, dll_chars);
rd_printf("Stack reserve: %m", opt_header->sizeof_stack_reserve); rd_printf("Stack reserve : %#-8x (%m)", opt_header->sizeof_stack_reserve, opt_header->sizeof_stack_reserve);
rd_printf("Stack commit: %m", opt_header->sizeof_stack_commit); rd_printf("Stack commit : %#-8x (%m)", opt_header->sizeof_stack_commit, opt_header->sizeof_stack_commit);
rd_printf("Heap reserve: %m", opt_header->sizeof_heap_reserve); rd_printf("Heap reserve : %#-8x (%m)", opt_header->sizeof_heap_reserve, opt_header->sizeof_heap_reserve);
rd_printf("Heap commit: %m", opt_header->sizeof_heap_commit); rd_printf("Heap commit : %#-8x (%m)", opt_header->sizeof_heap_commit, opt_header->sizeof_heap_commit);
rd_printf("Loader flags : %#x", opt_header->loader_flags); rd_printf("Loader flags : %#x", opt_header->loader_flags);
rd_printf("RVA and offset count : %u", opt_header->data_dir_count); rd_printf("RVA and offset count : %u", opt_header->data_dir_count);
rd_newline(); rd_newline();
@@ -6829,9 +6839,9 @@ pe_print_optional_header32plus(Arena *arena, String8List *out, String8 indent, P
rd_indent(); rd_indent();
rd_printf("Magic : %#x", opt_header->magic); rd_printf("Magic : %#x", opt_header->magic);
rd_printf("Linker version : %u.%u", opt_header->major_linker_version, opt_header->minor_linker_version); rd_printf("Linker version : %u.%u", opt_header->major_linker_version, opt_header->minor_linker_version);
rd_printf("Size of code: %m", opt_header->sizeof_code); rd_printf("Size of code : %#-8x (%m)", opt_header->sizeof_code, opt_header->sizeof_code);
rd_printf("Size of inited data: %m", opt_header->sizeof_inited_data); rd_printf("Size of inited data : %#-8x (%m)", opt_header->sizeof_inited_data, opt_header->sizeof_inited_data);
rd_printf("Size of uninited data: %m", opt_header->sizeof_uninited_data); rd_printf("Size of uninited data: %#-8x (%m)", opt_header->sizeof_uninited_data, opt_header->sizeof_uninited_data);
rd_printf("Entry point : %#x", opt_header->entry_point_va); rd_printf("Entry point : %#x", opt_header->entry_point_va);
rd_printf("Code base : %#x", opt_header->code_base); rd_printf("Code base : %#x", opt_header->code_base);
rd_printf("Image base : %#llx", opt_header->image_base); rd_printf("Image base : %#llx", opt_header->image_base);
@@ -6841,15 +6851,15 @@ pe_print_optional_header32plus(Arena *arena, String8List *out, String8 indent, P
rd_printf("Image Version : %u.%u", opt_header->major_img_ver, opt_header->minor_img_ver); rd_printf("Image Version : %u.%u", opt_header->major_img_ver, opt_header->minor_img_ver);
rd_printf("Subsystem version : %u.%u", opt_header->major_subsystem_ver, opt_header->minor_subsystem_ver); rd_printf("Subsystem version : %u.%u", opt_header->major_subsystem_ver, opt_header->minor_subsystem_ver);
rd_printf("Win32 version : %u", opt_header->win32_version_value); rd_printf("Win32 version : %u", opt_header->win32_version_value);
rd_printf("Size of image: %m", opt_header->sizeof_image); rd_printf("Size of image : %#x (%m)", opt_header->sizeof_image, opt_header->sizeof_image);
rd_printf("Size of headers: %m", opt_header->sizeof_headers); rd_printf("Size of headers : %#x (%m)", opt_header->sizeof_headers, opt_header->sizeof_headers);
rd_printf("Checksum : %#x", opt_header->check_sum); rd_printf("Checksum : %#x", opt_header->check_sum);
rd_printf("Subsystem: %S", subsystem); rd_printf("Subsystem : %#llx (%S)", opt_header->subsystem, subsystem);
rd_printf("DLL Characteristics: %S", dll_chars); rd_printf("DLL Characteristics : %#llx (%S)", opt_header->dll_characteristics, dll_chars);
rd_printf("Stack reserve: %M", opt_header->sizeof_stack_reserve); rd_printf("Stack reserve : %#-8llx (%M)", opt_header->sizeof_stack_reserve, opt_header->sizeof_stack_reserve);
rd_printf("Stack commit: %M", opt_header->sizeof_stack_commit); rd_printf("Stack commit : %#-8llx (%M)", opt_header->sizeof_stack_commit, opt_header->sizeof_stack_commit);
rd_printf("Heap reserve: %M", opt_header->sizeof_heap_reserve); rd_printf("Heap reserve : %#-8llx (%M)", opt_header->sizeof_heap_reserve, opt_header->sizeof_heap_reserve);
rd_printf("Heap commit: %M", opt_header->sizeof_heap_commit); rd_printf("Heap commit : %#-8llx (%M)", opt_header->sizeof_heap_commit, opt_header->sizeof_heap_commit);
rd_printf("Loader flags : %#x", opt_header->loader_flags); rd_printf("Loader flags : %#x", opt_header->loader_flags);
rd_printf("RVA and offset count : %u", opt_header->data_dir_count); rd_printf("RVA and offset count : %u", opt_header->data_dir_count);
rd_newline(); rd_newline();
+1 -1
View File
@@ -213,7 +213,7 @@ internal void rdi_print_global_variable(Arena *arena, String8List *out, String8
internal void rdi_print_thread_variable(Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_ThreadVariable *tvar); internal void rdi_print_thread_variable(Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_ThreadVariable *tvar);
internal void rdi_print_procedure (Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_Procedure *proc, RDI_Arch arch); internal void rdi_print_procedure (Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_Procedure *proc, RDI_Arch arch);
internal void rdi_print_scope (Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_Scope *scope, RDI_Arch arch); internal void rdi_print_scope (Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_Scope *scope, RDI_Arch arch);
internal void rdi_print_inline_site (Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, RDI_InlineSite *inline_site); internal void rdi_print_inline_site (Arena *arena, String8List *out, String8 indent, RDI_Parsed *rdi, U64 idx, RDI_InlineSite *inline_site);
internal void rdi_print_vmap_entry (Arena *arena, String8List *out, String8 indent, RDI_VMapEntry *v); internal void rdi_print_vmap_entry (Arena *arena, String8List *out, String8 indent, RDI_VMapEntry *v);
// DWARF // DWARF
+7 -5
View File
@@ -274,17 +274,19 @@ entry_point(CmdLine *cmdline)
RDI_Parsed rdi = {0}; RDI_Parsed rdi = {0};
RDI_ParseStatus parse_status = rdi_parse(raw_data.str, raw_data.size, &rdi); RDI_ParseStatus parse_status = rdi_parse(raw_data.str, raw_data.size, &rdi);
switch (parse_status) { switch (parse_status) {
case RDI_ParseStatus_Good: rdi_print(arena, out, indent, &rdi, opts); break; case RDI_ParseStatus_Good: {
RD_Option rdi_print_opts = opts;
if ((rdi_print_opts & RD_Option_RdiAll) == 0) {
rdi_print_opts |= RD_Option_RdiAll;
}
rdi_print(arena, out, indent, &rdi, rdi_print_opts);
} break;
case RDI_ParseStatus_HeaderDoesNotMatch: rd_errorf("RDI Parse: header does not match"); break; case RDI_ParseStatus_HeaderDoesNotMatch: rd_errorf("RDI Parse: header does not match"); break;
case RDI_ParseStatus_UnsupportedVersionNumber: rd_errorf("RDI Parse: unsupported version"); break; case RDI_ParseStatus_UnsupportedVersionNumber: rd_errorf("RDI Parse: unsupported version"); break;
case RDI_ParseStatus_InvalidDataSecionLayout: rd_errorf("RDI Parse: invalid data section layout"); break; case RDI_ParseStatus_InvalidDataSecionLayout: rd_errorf("RDI Parse: invalid data section layout"); break;
case RDI_ParseStatus_MissingRequiredSection: rd_errorf("RDI Parse: missing required section"); break; case RDI_ParseStatus_MissingRequiredSection: rd_errorf("RDI Parse: missing required section"); break;
default: rd_errorf("RDI Parse: unknown parse status %u", parse_status); break; default: rd_errorf("RDI Parse: unknown parse status %u", parse_status); break;
} }
if ((opts & RD_Option_RdiAll) == 0) {
opts = RD_Option_RdiAll;
}
rdi_print(arena, out, indent, &rdi, opts);
} else if (coff_is_regular_archive(raw_data) || coff_is_thin_archive(raw_data)) { } else if (coff_is_regular_archive(raw_data) || coff_is_thin_archive(raw_data)) {
coff_print_archive(arena, out, indent, raw_data, opts); coff_print_archive(arena, out, indent, raw_data, opts);
} else if (coff_is_big_obj(raw_data)) { } else if (coff_is_big_obj(raw_data)) {