private List <SbInstruction> MockRead(uint instructionsToCreate, uint instructionsToRead,
                                              SbAddress startSbAddress, SbMemoryRegionInfo memoryRegion,
                                              ulong startAddress = TEST_ADDRESS, bool isMapped = true,
                                              bool hasAddress    = true, ulong regionEnd       = ulong.MaxValue)
        {
            var instructions = CreateMockInstructions(instructionsToCreate, startAddress,
                                                      hasAddress);

            mockTarget
            .ReadInstructions(startSbAddress, instructionsToRead, "intel")
            .Returns(instructions);

            startSbAddress.GetLoadAddress(mockTarget).Returns(startAddress);
            mockTarget.ResolveLoadAddress(startAddress).Returns(startSbAddress);

            memoryRegion.IsMapped().Returns(isMapped);
            if (!isMapped)
            {
                memoryRegion.GetRegionEnd().Returns(regionEnd);
            }

            SbMemoryRegionInfo memRegion;

            mockProcess.GetMemoryRegionInfo(startAddress, out memRegion).Returns(
                x =>
            {
                x[1] = memoryRegion;
                return(mockError);
            });

            return(instructions);
        }
        /// <summary>
        /// Creates unknown/invalid instructions for an unmapped region.
        /// </summary>
        /// <returns> The address of the next instruction. </returns>
        ulong AddUnmappedInstructions(SbAddress address, uint instructionsLeft,
                                      SbMemoryRegionInfo memoryRegion,
                                      List <InstructionInfo> instructions)
        {
            // SbMemoryRegionInfo holds information about the end address even for unmapped
            // memory regions so we can use that to determine how far we can pad with
            // invalid/unknown instructions before checking again.
            ulong memoryRegionEndAddress = memoryRegion.GetRegionEnd();

            ulong startAddress = address.GetLoadAddress(_sbTarget);
            ulong endAddress   = Math.Min(memoryRegionEndAddress, startAddress + instructionsLeft);

            for (ulong currentAddress = startAddress; currentAddress < endAddress; currentAddress++)
            {
                instructions.Add(new InstructionInfo {
                    Address  = currentAddress, Operands = "??",
                    Mnemonic = "??"
                });
            }

            return(endAddress);
        }