Exemplo n.º 1
0
        public static (FastFormatter formatter, ISymbolResolver symbolResolver) Create_Resolver(ISymbolResolver symbolResolver)
        {
            var fast = new FastFormatter(symbolResolver);

            fast.Options.RipRelativeAddresses = true;
            return(fast, symbolResolver);
        }
Exemplo n.º 2
0
        public static FastFormatter Create_Options()
        {
            var fast = new FastFormatter();

            fast.Options.RipRelativeAddresses = true;
            return(fast);
        }
Exemplo n.º 3
0
        void Verify_default_formatter_options()
        {
            var options = new FastFormatter().Options;

            Assert.False(options.SpaceAfterOperandSeparator);
            Assert.False(options.AlwaysShowSegmentRegister);
            Assert.True(options.UppercaseHex);
            Assert.False(options.UseHexPrefix);
            Assert.False(options.AlwaysShowMemorySize);
            Assert.False(options.RipRelativeAddresses);
            Assert.True(options.UsePseudoOps);
            Assert.False(options.ShowSymbolAddress);
        }
Exemplo n.º 4
0
        public static FastFormatter Create_Inverted()
        {
            var fast = new FastFormatter();

            fast.Options.SpaceAfterOperandSeparator ^= true;
            fast.Options.RipRelativeAddresses       ^= true;
            fast.Options.UsePseudoOps              ^= true;
            fast.Options.ShowSymbolAddress         ^= true;
            fast.Options.AlwaysShowSegmentRegister ^= true;
            fast.Options.AlwaysShowMemorySize      ^= true;
            fast.Options.UppercaseHex              ^= true;
            fast.Options.UseHexPrefix              ^= true;
            return(fast);
        }
Exemplo n.º 5
0
 protected void FormatBase(int index, InstructionInfo info, string formattedString, FastFormatter formatter) =>
 FormatterTestUtils.FormatTest(info.Bitness, info.HexBytes, info.IP, info.Code, info.Options, formattedString, formatter);
Exemplo n.º 6
0
 protected void FormatBase(int index, Instruction instruction, string formattedString, FastFormatter formatter) =>
 FormatterTestUtils.FormatTest(instruction, formattedString, formatter);
Exemplo n.º 7
0
        public static void FormatTest(int bitness, string hexBytes, Code code, DecoderOptions options, string formattedString, FastFormatter formatter)
        {
            var decoder     = CreateDecoder(bitness, hexBytes, options, out ulong nextRip);
            var instruction = decoder.Decode();

            Assert.Equal(code, instruction.Code);
            Assert.Equal((ushort)nextRip, instruction.IP16);
            Assert.Equal((uint)nextRip, instruction.IP32);
            Assert.Equal(nextRip, instruction.IP);
            nextRip += (uint)instruction.Length;
            Assert.Equal(nextRip, decoder.IP);
            Assert.Equal((ushort)nextRip, instruction.NextIP16);
            Assert.Equal((uint)nextRip, instruction.NextIP32);
            Assert.Equal(nextRip, instruction.NextIP);
            FormatTest(instruction, formattedString, formatter);
        }
Exemplo n.º 8
0
 protected void FormatBase(int index, OptionsInstructionInfo info, string formattedString, FastFormatter formatter)
 {
     info.Initialize(formatter.Options);
     FormatterTestUtils.SimpleFormatTest(info.Bitness, info.HexBytes, info.Code, info.DecoderOptions, formattedString, formatter, decoder => info.Initialize(decoder));
 }