Exemplo n.º 1
0
        public void Start(ITransport transport)
        {
            if (_running)
            {
                return;
            }
            _state       = State.None;
            _target      = ATServiceProvider.GetService <STargetService, ITargetService>();
            _debugTarget = _target.GetCurrentTarget();

            _pc       = 0;
            _ramSpace = _debugTarget.Device.GetAddressSpace("data");

            _events.DebugLeave    += EventsOnDebugLeave;
            _events.DebugEnter    += EventsOnDebugEnter;
            _events.MemoryChanged += EventsOnMemoryChanged;
            _events.Start(_debugTarget);

            _server.SetTransport(transport);
            _server.UnknownData      += ServerOnUnknownData;
            _server.DebuggerAttached += ServerDebuggerAttached;
            // Start the debug server
            _server.Start();
            _output.Activate(Output.SDSerialOutputPane);

            DebugStateChanged?.Invoke();
            _running = true;
        }
Exemplo n.º 2
0
        private static void RunDebugServer()
        {
            DebugServer server      = new DebugServer(context.VirtualMachine);
            Thread      debugThread = new Thread(() => {
                server.Start(new IPEndPoint(IPAddress.Loopback, 6569));
            });

            debugThread.Start();
            Console.WriteLine("Debug server listening on 127.0.0.1:6569");
        }
Exemplo n.º 3
0
        public static void Main(string[] args)
        {
            string input   = null;
            uint   ramsize = 0x20000000;
            bool   debug   = false;

            for (int i = 0; i < args.Length; i++)
            {
                if (!args[i].StartsWith("-") && input == null)
                {
                    input = args[i];
                }
                else if (args[i] == "-S")
                {
                    debug = true;
                }
                else if (args[i] == "-m")
                {
                    string amount = args[++i];
                    uint   rs;
                    if (uint.TryParse(amount, out rs))
                    {
                        ramsize = rs * 0x100000;
                    }
                    else
                    {
                        Fail("Size {0} is not valid!", amount);
                    }
                }
            }

            if (input == null)
            {
                Fail("No input specified!");
            }


            Emulator emu = new Emulator(new QuasarRam(ramsize));

            byte[] data = File.ReadAllBytes(input);
            for (uint i = 0; i < data.Length; i++)
            {
                emu.Memory[i] = data[i];
            }
            if (debug)
            {
                DebugServer serv = new DebugServer(emu);
                serv.Start();
                serv.WaitForConnection();
            }

            emu.Emulate();
        }
Exemplo n.º 4
0
 public void Connect(string port, int speed)
 {
     if (_debugServer.InDebug)
     {
         return;
     }
     FireEvent(Events.Debug_Starting);
     _debugServer.DebuggerAttached     += _debugServer_DebuggerAttached;
     _debugServer.DebuggerDetached     += _debugServer_DebuggerDetached;
     _debugServer.DebuggerDisconnected += _debugServer_DebuggerDisconnected;
     _debugServer.UnknownData          += _debugServer_UnknownData;
     _transport.SetPort(port);
     _transport.SetSpeed(speed);
     _debugServer.SetTransport(_transport);
     _debugServer.Start();
     _debugServer.ResetTarget();
     FireEvent(Events.Debug_Started);
 }
Exemplo n.º 5
0
        // LIMITS
        //  WRITING TO UART REGISTERS WILL STOP THE COMMUNICATION
        static void Main(string[] args)
        {
            SetupCommandProcessor();

            var transport = new SerialTransport();

            transport.SetPort("COM4");
            transport.SetSpeed(500000);

            _srv = new DebugServer();
            _srv.SetTransport(transport);
            _srv.DebuggerAttached += _srv_DebuggerAttached;
            _srv.DebuggerDetached += _srv_DebuggerDetached;
            _srv.UnknownData      += SrvOnUnknownData;
            _th = new Thread(CommandLoop);

            SysConsole.WriteLine("Available register names");
            SysConsole.WriteLine("**************************************");
            SysConsole.WriteLine(Registers.RegisterMappings.Aggregate("", (s, pair) => s + ", " + pair.Key).Trim(','));
            SysConsole.WriteLine("**************************************");
            SysConsole.WriteLine("Available commands");
            SysConsole.WriteLine("c - Continue execution");
            SysConsole.WriteLine("t - Toggle all of PORTB (usually a led is on PB5)");
            SysConsole.WriteLine("w - write to memory, w (location, or IO reg) data");
            SysConsole.WriteLine("    the data is in the following format (number)[,(number)]");
            SysConsole.WriteLine("    Exp. ");
            SysConsole.WriteLine("    w pinb 0xFF");
            SysConsole.WriteLine("    w 0x0123 0xFF,0xF0,0xF1,100,255");
            SysConsole.WriteLine("r - read from memory, r (location, or IO reg) size");
            SysConsole.WriteLine("    Exp. ");
            SysConsole.WriteLine("    r pinb 1");
            SysConsole.WriteLine("    r 0x0123 0xFF");
            SysConsole.WriteLine("**************************************");

            SysConsole.WriteLine("Press any key to continue");
            SysConsole.ReadLine();

            _srv.Start();
            _th.Start();
            SysConsole.WriteLine("Powercycle the target");

            // Block everything
            _th.Join();
        }