public HunkFile() { this.type = FileType.TYPE_UNKNOWN; this.hunks = new List<Hunk>(); this.header = null; this.segments = new List<List<Hunk>>(); this.overlay = null; this.overlay_headers = null; this.overlay_segments = null; this.libs = null; this.units = null; }
public HunkShow(HunkFile hunk_file, bool show_relocs = false, bool show_debug = false, bool disassemble = false, uint disassemble_start = 0, bool hexdump = false, bool brief = false, bool use_objdump = false, string cpu = "68000") { this.hunk_file = hunk_file; // clone file refs this.header = hunk_file.header; this.segments = hunk_file.segments; this.overlay = hunk_file.overlay; this.overlay_headers = hunk_file.overlay_headers; this.overlay_segments = hunk_file.overlay_segments; this.libs = hunk_file.libs; this.units = hunk_file.units; this.show_relocs = show_relocs; this.show_debug = show_debug; this.disassemble = disassemble; this.disassemble_start = disassemble_start; this.use_objdump = use_objdump; this.cpu = cpu; this.hexdump = hexdump; this.brief = brief; }
private void WriteSignatureBytes(Hunk main, Dictionary<int, int> extRefs, int iStart, int iEnd, string name) { int i; int cbVariant = 0; iEnd = Math.Min(iStart + MaxSignatureLength, iEnd); for (i = iStart; i < iEnd; ++i) { if (cbVariant > 0 || extRefs.TryGetValue(i, out cbVariant)) { Output.Write(".."); --cbVariant; } else { Output.Write("{0:X2}", (uint)main.Data[i]); } } var cPadding = (iStart + MaxSignatureLength) - iEnd; if (cPadding > 0) Output.Write(new string(' ', 2 * cPadding)); Output.WriteLine(" {0}", name); }
public virtual void show_extra_hunk(Hunk hunk) { var hunk_type = hunk.HunkType; if (HunkFileParser.reloc_hunks.Contains(hunk_type)) { var type_name = hunk.HunkType.ToString().Replace("HUNK_", "").ToLower(); this.print_extra("reloc", String.Format("{0} #{1}", type_name, ((RelocHunk)hunk).reloc)); if (!this.brief) { this.show_reloc_hunk((RelocHunk)hunk); } } else if (hunk_type == HunkType.HUNK_DEBUG) { this.print_extra("debug", String.Format("{0} offset={1:X8}", ((DebugHunk)hunk).debug_type, ((DebugHunk)hunk).debug_offset)); if (!this.brief) { this.show_debug_hunk((DebugHunk)hunk); } } else if (hunk_type == HunkType.HUNK_SYMBOL) { var h = (SymbolHunk)hunk; this.print_extra("symbol", String.Format("#{0}", h.symbols.Count)); if (!this.brief) { this.show_symbol_hunk(h); } } else if (hunk_type == HunkType.HUNK_EXT) { var h = (ExtHunk)hunk; this.print_extra("ext", String.Format("def #{0} ref #{1} common #{1}", h.ext_def, h.ext_ref.Count, h.ext_common.Count)); if (!this.brief) { this.show_ext_hunk(h); } } else { this.print_extra("extra", String.Format("{0}", hunk.HunkType)); } }