public void ClearBreakpoint(ushort address)
        {
            // Search for breakpoint at specified address
            DebugBreakpoint breakpoint = FindBreakpoint(address);

            if (breakpoint == null)
            {
                return;
            }

            // Restore instruction at memory location
            WriteMemoryRequest request =
                new WriteMemoryRequest(breakpoint.Address, 1, new byte[] { breakpoint.Code });

            engine.SendAndWait(request);
        }
        public void SetBreakpoint(ushort address, string name = null)
        {
            // Check whether breakpoint already exists
            DebugBreakpoint breakpoint = breakpoints.Where(bp => bp.Address == address).FirstOrDefault();

            if (breakpoint == null)
            {
                return;
            }

            // First read instruction at breakpoint location
            ReadMemoryResponse response = engine.SendAndReceive <ReadMemoryResponse>(new ReadMemoryRequest(address, 1));
            byte instruction            = response.Memory[0];

            // Overwrite memory with BRK (0x00) command
            engine.SendAndWait(new WriteMemoryRequest(address, 0, new byte[] { 0x00 }));

            // Store breakpoint for later
            breakpoint = new DebugBreakpoint(address, instruction);
            breakpoints.Add(breakpoint);
        }
示例#3
0
        public void Step()
        {
            EnsureAttached();
            EnsureInBreakmode();

            ushort nextBreakpointAddress;

            byte[] expressionBytes = InspectMemory(currentRegisters.PS, 3);

            // Find potential breakpoint
            DebugBreakpoint breakPoint = manager.FindBreakpoint(currentRegisters.PC);

            if (breakPoint != null)
            {
                expressionBytes[0] = breakPoint.Code;
            }

            // TODO: Determine new address
            nextBreakpointAddress = 0x0000;

            manager.SetBreakpoint(nextBreakpointAddress);
            Continue();
        }