Example #1
0
        public MemoryBasedInputCallbackSystem(IDebuggable debuggableCore, string scope, IEnumerable <uint> addresses)
        {
            if (addresses == null)
            {
                throw new ArgumentException($"{nameof(addresses)} cannot be null.");
            }

            if (!debuggableCore.MemoryCallbacksAvailable())
            {
                throw new InvalidOperationException("Memory callbacks are required");
            }

            foreach (var address in addresses)
            {
                var callback = new MemoryCallback(
                    scope,
                    MemoryCallbackType.Read,
                    "InputCallback" + address,
                    MemoryCallback,
                    address,
                    null);

                debuggableCore.MemoryCallbacks.Add(callback);
            }
        }
Example #2
0
        public CallbackBasedTraceBuffer(IDebuggable debuggableCore, IMemoryDomains memoryDomains, IDisassemblable disassembler)
        {
            if (!debuggableCore.MemoryCallbacksAvailable())
            {
                throw new InvalidOperationException("Memory callbacks are required");
            }

            try
            {
                debuggableCore.GetCpuFlagsAndRegisters();
            }
            catch (NotImplementedException)
            {
                throw new InvalidOperationException("GetCpuFlagsAndRegisters is required");
            }

            Header         = "Instructions";
            DebuggableCore = debuggableCore;
            MemoryDomains  = memoryDomains;
            Disassembler   = disassembler;
        }
        protected CallbackBasedTraceBuffer(IDebuggable debuggableCore, IMemoryDomains memoryDomains, IDisassemblable disassembler, string header = DEFAULT_HEADER)
        {
            if (!debuggableCore.MemoryCallbacksAvailable())
            {
                throw new InvalidOperationException("Memory callbacks are required");
            }

            try
            {
                debuggableCore.GetCpuFlagsAndRegisters();
            }
            catch (NotImplementedException)
            {
                throw new InvalidOperationException($"{nameof(IDebuggable.GetCpuFlagsAndRegisters)} is required");
            }

            Header         = header;
            DebuggableCore = debuggableCore;
            MemoryDomains  = memoryDomains;
            Disassembler   = disassembler;
        }
Example #4
0
        public CallbackBasedTraceBuffer(IDebuggable debuggableCore, IMemoryDomains memoryDomains, IDisassemblable disassembler)
        {
            if (!debuggableCore.MemoryCallbacksAvailable())
            {
                throw new InvalidOperationException("Memory callbacks are required");
            }

            try
            {
                debuggableCore.GetCpuFlagsAndRegisters();
            }
            catch (NotImplementedException)
            {
                throw new InvalidOperationException("GetCpuFlagsAndRegisters is required");
            }

            Header = "Instructions";
            DebuggableCore = debuggableCore;
            MemoryDomains = memoryDomains;
            Disassembler = disassembler;
        }
Example #5
0
			public CallbackBasedTraceBuffer(IDebuggable debuggableCore)
			{
				if (!debuggableCore.MemoryCallbacksAvailable())
				{
					throw new InvalidOperationException("Memory callbacks are required");
				}

				try
				{
					var dummy = debuggableCore.GetCpuFlagsAndRegisters();
				}
				catch(NotImplementedException)
				{
					throw new InvalidOperationException("GetCpuFlagsAndRegisters is required");
				}

				Header = "Instructions";
				DebuggableCore = debuggableCore;

				// TODO: refactor
				MemoryDomains = (debuggableCore as IEmulator).ServiceProvider.GetService<IMemoryDomains>();
				Disassembler = (debuggableCore as IEmulator).ServiceProvider.GetService<IDisassemblable>();
			}