public void ReadWithInvalidInstruction()
        {
            uint numberInstructions      = 20;
            uint invalidPos              = 7;
            uint numberInstructionsAfter = numberInstructions - invalidPos - 1u;

            var mockBeforeAddress = Substitute.For <SbAddress>();
            var mockAfterAddress  = Substitute.For <SbAddress>();

            // Make sure that it will resolve to the correct address after the invalid instruction
            mockTarget.ResolveLoadAddress(TEST_ADDRESS + invalidPos + 1).Returns(mockAfterAddress);

            // Create valid instructions up to |invalidPos|
            var mockBeforeInvalidInstructions = MockRead(invalidPos, numberInstructions,
                                                         mockBeforeAddress, mockMemoryRegion);

            var mockAfterInvalidInstructions = MockRead(numberInstructionsAfter,
                                                        numberInstructionsAfter, mockAfterAddress, mockMemoryRegion);

            var instructions = remoteTarget.ReadInstructionInfos(mockBeforeAddress,
                                                                 numberInstructions, "intel");

            var invalidInstruction = instructions[(int)invalidPos];

            Assert.AreEqual(numberInstructions, instructions.Count);
            Assert.AreEqual("??", invalidInstruction.Operands);
            Assert.AreEqual("??", invalidInstruction.Mnemonic);
        }
示例#2
0
 public SbAddress ResolveLoadAddress(ulong address) => _sbTarget.ResolveLoadAddress(address);