Beispiel #1
0
		public void X86Rw_CallTable()
		{
			DoRewriteFile("Fragments/multiple/calltables.asm");
			using (FileUnitTester fut = new FileUnitTester("Intel/RwCallTable.txt"))
			{
				Dumper dump = new Dumper(prog.Architecture);
				dump.Dump(prog, prog.ImageMap, fut.TextWriter);
				fut.TextWriter.WriteLine();
				prog.CallGraph.Write(fut.TextWriter);

				fut.AssertFilesEqual();
			}
		}
Beispiel #2
0
 public void DumpAssembler(Program program, TextWriter wr)
 {
     if (wr == null || program.Architecture == null)
         return;
     Dumper dump = new Dumper(program.Architecture);
     dump.Dump(program, program.ImageMap, wr);
 }
Beispiel #3
0
 public void DumpAssembler(Program program, Formatter wr)
 {
     if (wr == null || program.Architecture == null)
         return;
     Dumper dump = new Dumper(program.Architecture);
     dump.Dump(program, wr);
 }
Beispiel #4
0
        public void Dumper_Structure()
        {
            var str = new StructureType
            {
                Fields =
                {
                    { 0, PrimitiveType.Byte  },
                    { 2, PrimitiveType.Word16 },
                    { 8, PrimitiveType.Word32 }
                }
            };
            Given_32bit_Program();
            program.ImageMap.AddItemWithSize(
                Address.Ptr32(0x10004),
                new ImageMapItem
                {
                    Address = Address.Ptr32(0x10004),
                    DataType = str,
                    Size = 12,
                });
            mr.ReplayAll();

            var dmp = new Dumper(program.Architecture);

            var sw = new StringWriter();
            dmp.Dump(program, new TextFormatter(sw));

            string sExp =
            #region Expected
@";;; Segment .text (00010000)
00010000 00 01 02 03                                     ....           
l00010004		db	0x04
	db	0x05	; padding
	dw	0x0706
	db	0x08,0x09,0x0A,0x0B	; padding
	dd	0x0F0E0D0C
00010010 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F ................
";
            #endregion
            AssertOutput(sExp, sw);
            mr.VerifyAll();
        }
Beispiel #5
0
        public void Dumper_Word32()
        {
            Given_32bit_Program();
            program.ImageMap.AddItemWithSize(
                Address.Ptr32(0x10004),
                new ImageMapItem
                {
                    Address = Address.Ptr32(0x10004),
                    DataType = PrimitiveType.Word32,
                    Size = 4,
                });
            mr.ReplayAll();

            var dmp = new Dumper(program.Architecture);

            var sw = new StringWriter();
            dmp.Dump(program, new TextFormatter(sw));

            string sExp =
            #region Expected
@";;; Segment .text (00010000)
00010000 00 01 02 03                                     ....           
l00010004	dd	0x07060504
00010008                         08 09 0A 0B 0C 0D 0E 0F         ........
00010010 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F ................
";
            #endregion
            AssertOutput(sExp, sw);
            mr.VerifyAll();
        }
Beispiel #6
0
        public void Dumper_NamedProc()
        {
            Given_32bit_Program();
            var proc = Given_ProcedureAt(Address.Ptr32(0x10010));
            proc.Name = "__foo@8";
            mr.ReplayAll();

            var dmp = new Dumper(program.Architecture);

            var sw = new StringWriter();
            dmp.Dump(program, new TextFormatter(sw));

            string sExp =
            #region Expected
@";;; Segment .text (00010000)
00010000 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ................

;; __foo@8: 00010010
__foo@8 proc
	add
	mul
	add
	ret
00010018                         18 19 1A 1B 1C 1D 1E 1F         ........
";
            #endregion
            AssertOutput(sExp, sw);
            mr.VerifyAll();
        }