Пример #1
0
        private static void Write(CommandLine cmdLine)
        {
            if ((_srv.Caps & DebuggerCapabilities.CAPS_RAM_W_BIT) != DebuggerCapabilities.CAPS_RAM_W_BIT)
            {
                SysConsole.WriteLine("No support for RAM change");
                return;
            }

            var location = cmdLine.GetArgument <uint>("location");
            var data     = cmdLine.GetArgument <byte[]>("data");

            _srv.AddCommand(new DebugCommand_Ram_Write(location, data));
            _srv.AddCommand(new DebugCommand_Ram_Read(location, (uint)data.Length)
            {
                Done = response =>
                {
                    for (int i = 0; i < response.Length; i++)
                    {
                        if (data[i] != response[i])
                        {
                            Console.WriteLine("The data does not match");
                            return;
                        }
                    }
                    Console.WriteLine("Done.");
                }
            });
        }
Пример #2
0
        private byte[] WaitForData(IDebugCommand cmd)
        {
            var cmdTask = _debugServer.AddCommand(cmd);

            cmdTask.Wait();
            return(cmdTask.Result);
        }
Пример #3
0
        private void EventsOnMemoryChanged(string memId, long addr, long size)
        {
            DebugWrite(MethodBase.GetCurrentMethod().Name + " " + _dte.Debugger.CurrentMode +
                       $" {_debugTarget.TargetState}");
            if (_state != State.InDebug)
            {
                return;
            }

            MemoryError[] errRanges;
            if (memId == _debugTarget.GetMemType("data") && _server.Caps.HasFlag(DebuggerCapabilities.CAPS_RAM_W_BIT))
            {
                // The memory changed we need to update the physical device
                var data = _debugTarget.Memory.GetMemory(memId, (ulong)addr, 1, (int)size, 0, out errRanges);
                _server.AddCommand(new DebugCommand_Ram_Write((uint)addr, data));
            }
            if (memId == _debugTarget.GetMemType("eeprom") && _server.Caps.HasFlag(DebuggerCapabilities.CAPS_EEPROM_W_BIT))
            {
                var data = _debugTarget.Memory.GetMemory(memId, (ulong)addr, 1, (int)size, 0, out errRanges);
                _server.AddCommand(new DebugCommand_EEPROM_Write((uint)addr, data));
            }
        }