示例#1
0
文件: Dumper.cs 项目: qcyb/reko
        public bool DumpAssemblerLine(
            MemoryArea mem,
            IProcessorArchitecture arch,
            MachineInstruction instr,
            InstrWriter writer,
            MachineInstructionRendererOptions options)
        {
            var     instrAddress = instr.Address;
            Address addrBegin    = instrAddress;

            if (ShowAddresses)
            {
                writer.WriteFormat("{0} ", addrBegin);
            }
            if (ShowCodeBytes)
            {
                WriteOpcodes(mem, arch, instrAddress, instrAddress + instr.Length, writer);
                if (instr.Length * 3 < 16)
                {
                    writer.WriteString(new string(' ', 16 - (instr.Length * 3)));
                }
            }
            writer.WriteString("\t");
            instr.Render(writer, options);
            writer.WriteLine();
            return(true);
        }
示例#2
0
        public void WriteByteRange(MemoryArea image, Address begin, Address addrEnd, InstrWriter writer)
        {
            EndianImageReader rdr = arch.CreateImageReader(image, begin);

            while (rdr.Address < addrEnd)
            {
                var v = rdr.Read(this.instrByteSize);
                writer.WriteFormat(this.instrByteFormat, v.ToUInt64());
            }
        }
示例#3
0
文件: Dumper.cs 项目: nemerle/reko
        public void WriteOpcodes(MemoryArea image, IProcessorArchitecture arch, Address begin, Address addrEnd, InstrWriter writer)
        {
            EndianImageReader rdr  = arch.CreateImageReader(image, begin);
            var    byteSize        = (7 + arch.InstructionBitSize) / 8;
            string instrByteFormat = $"{{0:X{byteSize * 2}}} "; // each byte is two nybbles.
            var    instrByteSize   = PrimitiveType.CreateWord(arch.InstructionBitSize);

            while (rdr.Address < addrEnd && rdr.TryRead(instrByteSize, out var v))
            {
                writer.WriteFormat(instrByteFormat, v.ToUInt64());
            }
        }
示例#4
0
        public void WriteByteRange(MemoryArea image, IProcessorArchitecture arch, Address begin, Address addrEnd, InstrWriter writer)
        {
            EndianImageReader rdr = arch.CreateImageReader(image, begin);
            var byteSize          = (7 + arch.InstructionBitSize) / 8;

            this.instrByteFormat = $"{{0:X{byteSize * 2}}} "; // each byte is two nybbles.
            this.instrByteSize   = PrimitiveType.CreateWord(arch.InstructionBitSize);

            while (rdr.Address < addrEnd)
            {
                var v = rdr.Read(this.instrByteSize);
                writer.WriteFormat(this.instrByteFormat, v.ToUInt64());
            }
        }
示例#5
0
        public bool DumpAssemblerLine(MemoryArea mem, MachineInstruction instr, InstrWriter writer)
        {
            Address addrBegin = instr.Address;

            if (ShowAddresses)
            {
                writer.WriteFormat("{0} ", addrBegin);
            }
            if (ShowCodeBytes)
            {
                WriteByteRange(mem, instr.Address, instr.Address + instr.Length, writer);
                if (instr.Length * 3 < 16)
                {
                    writer.WriteString(new string(' ', 16 - (instr.Length * 3)));
                }
            }
            writer.WriteString("\t");
            writer.Address = addrBegin;
            writer.Address = instr.Address;
            instr.Render(writer, MachineInstructionWriterOptions.None);
            writer.WriteLine();
            return(true);
        }