Пример #1
0
 public void Attach(IDebuggable target)
 {
     _dataContext = new RegistersViewModel(target, this);
     _dataContext.Attach();
     Bind();
     _binding.DataContext = _dataContext;
 }
Пример #2
0
 public DebuggerViewModel(IDebuggable target, ISynchronizeInvoke synchronizeInvoke)
     : base(target, synchronizeInvoke)
 {
     CommandClose = new CommandDelegate(
         CommandClose_OnExecute,
         CommandClose_OnCanExecute,
         "Close");
     CommandContinue = new CommandDelegate(
         CommandContinue_OnExecute,
         CommandContinue_OnCanExecute,
         "Continue");
     CommandBreak = new CommandDelegate(
         CommandBreak_OnExecute,
         CommandBreak_OnCanExecute,
         "Break");
     CommandStepInto = new CommandDelegate(
         CommandStepInto_OnExecute,
         CommandStepInto_OnCanExecute,
         "Step Into");
     CommandStepOver = new CommandDelegate(
         CommandStepOver_OnExecute,
         CommandStepOver_OnCanExecute,
         "Step Over");
     CommandStepOut = new CommandDelegate(
         () => { },
         () => false,
         "Step Out");
 }
Пример #3
0
 public void Attach(IDebuggable dbg)
 {
     if (m_viewHolder != null && dbg != null)
     {
         m_viewHolder.Arguments = new [] { new Argument("debugTarget", dbg) };
     }
 }
Пример #4
0
        /// <summary>
        /// Stops the debugging process that is currently underway.
        /// </summary>
        public void Stop()
        {
            if (this.m_ActiveDesigner != null && !Central.Manager.IDE.IsDisposed)
            {
                // Inform them we have stopped debugging.
                (this.m_ActiveDesigner as IDesigner).Invoke(new Action(() =>
                {
                    this.m_ActiveDesigner.EndDebug();
                    this.m_ActiveDesigner = null;
                }));
            }

            if (this.m_Process == null)
            {
                return;
            }
            if (!this.m_Process.HasExited)
            {
                this.m_Process.Kill();
            }
            this.m_Process = null;
            if (this.m_Communicator != null)
            {
                this.m_Communicator.Close();
            }
            this.m_Communicator = null;
            this.p_Paused       = false;

            // Fire the event to say that debugging has stopped.
            if (this.DebugStop != null)
            {
                this.DebugStop(this, new EventArgs());
            }
        }
Пример #5
0
 public void SetSystemColor(Color color, IDebuggable system)
 {
     if (system != null && _gameSystems.ContainsKey(system))
     {
         _gameSystems[system].systemColor = color;
     }
 }
Пример #6
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);
            }
        }
Пример #7
0
    void OnGUI()
    {
        // Show only enabled and non-hidden systems
        // Avoid GC Alloc
        _systems.Clear();
        Dictionary <IDebuggable, SystemInfo> .Enumerator iter = _gameSystems.GetEnumerator();
        while (iter.MoveNext())
        {
            _systems.Add(iter.Current.Key);
        }
        iter.Dispose();
        for (int i = 0, cnt = _systems.Count; i < cnt; ++i)
        {
            IDebuggable system = _systems[i];
            if (IsEnabled(system))
            {
                system.OnDebugGUI();
            }
        }

        if (_isPanelShowing)
        {
            GUI.BringWindowToFront(0);
            GUI.FocusWindow(0);
        }
    }
Пример #8
0
        public void Init(IDebuggable debugTarget)
        {
            if (debugTarget != m_spectrum)
            {
                if (m_spectrum != null)
                {
                    m_spectrum.UpdateState -= new EventHandler(spectrum_OnUpdateState);
                    m_spectrum.Breakpoint -= new EventHandler(spectrum_OnBreakpoint);
                }
                if (debugTarget != null)
                {
                    m_spectrum = debugTarget;
                    // ZEK +++
                    bus = ((ZXMAK2.Engine.VirtualMachine)m_spectrum).Spectrum.BusManager;
                    sprint_mmu = bus.FindDevice<SprinterMMU>();
                    sprint_ula = bus.FindDevice<SprinterULA>();
                    //pevo_bdi = bus.FindDevice(typeof(BDI)) as BDI;
                    // ZEK ---

                    m_dasmUtils = new DasmUtils(m_spectrum.CPU, new OnRDBUS(debugTarget.ReadMemory));
                    m_spectrum.UpdateState += new EventHandler(spectrum_OnUpdateState);
                    m_spectrum.Breakpoint += new EventHandler(spectrum_OnBreakpoint);
                }
            }
        }
Пример #9
0
        private void Init(IDebuggable debugTarget)
        {
            if (debugTarget != m_spectrum)
            {
                if (m_spectrum != null)
                {
                    m_spectrum.UpdateState -= new EventHandler(spectrum_OnUpdateState);
                    m_spectrum.Breakpoint  -= new EventHandler(spectrum_OnBreakpoint);
                }
                if (debugTarget != null)
                {
                    m_spectrum = debugTarget;
                    // ZEK +++
                    sprint_mmu = m_spectrum.Bus.FindDevice <SprinterMMU>();
                    sprint_ula = m_spectrum.Bus.FindDevice <SprinterULA>();
                    //pevo_bdi = m_spectrum.Bus.FindDevice(typeof(BDI)) as BDI;
                    // ZEK ---

                    m_dasmTool              = new DasmTool(debugTarget.ReadMemory);
                    m_timingTool            = new TimingTool(m_spectrum.CPU, debugTarget.ReadMemory);
                    m_spectrum.UpdateState += new EventHandler(spectrum_OnUpdateState);
                    m_spectrum.Breakpoint  += new EventHandler(spectrum_OnBreakpoint);
                }
            }
        }
Пример #10
0
 public static void SetSystemColor(IDebuggable system, Color color)
 {
     if (!_isInitialized)
     {
         return;
     }
     _instance._component.SetSystemColor(color, system);
 }
Пример #11
0
 public static string GetSystemPath(IDebuggable system)
 {
     if (!_isInitialized)
     {
         return("");
     }
     return(_instance._component.GetSystemPath(system));
 }
Пример #12
0
        public static void Log(this IDebuggable obj, string message, params object[] args)
        {
#if UNITY
            UnityEngine.Debug.LogFormat($"[{obj.FriendlyName}] {message}", args);
#else
            System.Diagnostics.Debug.Print($"[{obj.FriendlyName}] {message}", args);
#endif
        }
Пример #13
0
 public void wrapInterface(IDebuggable i_debuggable)
 {
     readMemory8BitDelegate  = delegate(ushort memAdress) { return(i_debuggable.ReadMemory(memAdress)); };
     readMemory16BitDelegate = delegate(ushort memAdress)
     {
         return((ushort)(i_debuggable.ReadMemory(memAdress) | i_debuggable.ReadMemory(++memAdress) << 8));
     };
 }
Пример #14
0
 public static Color GetSystemColor(IDebuggable system)
 {
     if (!_isInitialized)
     {
         return(default(Color));
     }
     return(_instance._component.GetSystemColor(system));
 }
Пример #15
0
 /// <summary>
 /// Returns the direct parent of <code>system</code>.
 /// </summary>
 /// <param name="system"></param>
 /// <returns>The direct parent of this system, or null if no parent.</returns>
 public static IDebuggable GetParentOf(IDebuggable system)
 {
     if (!_isInitialized)
     {
         return(null);
     }
     return(_instance._component.GetParentOf(system));
 }
Пример #16
0
 /// <summary>
 /// Unregisters the instance from the debugger.
 /// </summary>
 /// <param name="obj">System to unregister.</param>
 /// <param name="unregisterSubSystems">True will unregister all the subsystems of <code>obj</code>.</param>
 public static void UnregisterSystem(IDebuggable obj, bool unregisterSubSystems = true)
 {
     if (!_isInitialized)
     {
         return;
     }
     _instance._component.UnregisterSystem(obj, unregisterSubSystems);
 }
Пример #17
0
 public Color GetSystemColor(IDebuggable system)
 {
     if (system != null && _gameSystems.ContainsKey(system))
     {
         return(_gameSystems[system].systemColor);
     }
     return(Color.white);
 }
Пример #18
0
 public IDebuggable GetParentOf(IDebuggable system)
 {
     if (_gameSystems.ContainsKey(system))
     {
         return(_gameSystems[system].parent);
     }
     return(null);
 }
Пример #19
0
 public static IDebuggable[] GetAllSystems(string systemName, IDebuggable parent)
 {
     if (!_isInitialized)
     {
         return(null);
     }
     return(_instance._component.GetAllSystems(systemName, parent));
 }
Пример #20
0
 /// <summary>
 /// Whether the system is enabled or not.
 /// If any system in the parent hierarchy of <code>system</code> is disabled,
 /// this system will also be disabled.
 /// </summary>
 /// <param name="system">The system for which we want to know whether it is enabled or not.</param>
 /// <returns>True if enabled, false if disabled.</returns>
 public static bool IsEnabled(IDebuggable system)
 {
     if (!_isInitialized)
     {
         return(false);
     }
     return(_instance._component.IsEnabled(system));
 }
Пример #21
0
        public static void Log(this IDebuggable obj, string message)
        {
#if UNITY
            UnityEngine.Debug.Log($"[{obj.FriendlyName}] {message}");
#else
            System.Diagnostics.Debug.Print($"[{obj.FriendlyName}] {message}");
#endif
        }
Пример #22
0
 /// <summary>
 /// Returns all direct subsystems of <code>system</code>.
 /// </summary>
 /// <param name="system"></param>
 /// <returns>The direct registered subsystems of this system, or null if no subsystem.</returns>
 public static IDebuggable[] GetSubSystemsOf(IDebuggable system)
 {
     if (!_isInitialized)
     {
         return(null);
     }
     return(_instance._component.GetSubSystems(system));
 }
Пример #23
0
        public static void Assert(this IDebuggable obj, bool condition, string message)
        {
#if UNITY
            UnityEngine.Debug.Assert(condition, $"[{obj.FriendlyName}] {message}");
#else
            System.Diagnostics.Debug.Assert(condition, $"[{obj.FriendlyName}] {message}");
#endif
        }
Пример #24
0
        public static void Assert(this IDebuggable obj, bool condition, string message, params object[] args)
        {
#if UNITY
            UnityEngine.Debug.AssertFormat(condition, $"[{obj.FriendlyName}] {message}", args);
#else
            System.Diagnostics.Debug.Assert(condition, string.Format($"[{obj.FriendlyName}] {message}", args));
#endif
        }
Пример #25
0
 public IDebuggable[] GetSubSystems(IDebuggable system)
 {
     if (_gameSystems.ContainsKey(system))
     {
         return(_gameSystems[system].subSystems.ToArray());
     }
     return(new IDebuggable[0]);
 }
Пример #26
0
 private string GetSystemPrefix(IDebuggable system)
 {
     if (system == null || !_gameSystems.ContainsKey(system))
     {
         return("");
     }
     return(GetSystemPrefix(_gameSystems[system].parent) + "/" + system.GetType().Name);
 }
Пример #27
0
 /// <summary>
 /// Writes log to the in-game console and to the Unity console, but only if the specified system is enabled and its
 /// <code>showLog</code> variable is true.
 /// </summary>
 /// <param name="system">System from which the message originates.</param>
 /// <param name="message">Body of the message.</param>
 /// <param name="importance">Type of message.</param>
 public static void Log(IDebuggable system, object message, LogType importance = LogType.Log)
 {
     if (!_isInitialized)
     {
         return;
     }
     _instance._component.Log(system, message, importance);
 }
Пример #28
0
 /// <summary>
 /// Registers the instance to the debugger.
 /// Registering a system to the debugger means its public bools (and private bools
 /// marked with [ShowFieldInDebugger]) will be displayed in the section
 /// or subsection named <code>systemName</code> in the debugging panel.
 /// It will also allow it to get its IDebuggable interface methods called
 /// at the appropriate moment, and to log to the in-game console under control of the
 /// system (i.e. can be hidden if the user wishes).
 /// Through this function, you can register several objects with the
 /// same name, as long as this name is not already registered by another system
 /// through <code>RegisterSystem</code>.
 /// If you want to register this system uniquely, use <see cref="RegisterSystem"/>.
 /// </summary>
 /// <param name="instanceName">Name of this system.</param>
 /// <param name="system">Instance to be registered.</param>
 /// <param name="parentName">Name of the parent system of which <code>system</code> is a subsystem.</param>
 public static void RegisterInstance(string instanceName, IDebuggable system, string parentName, bool showInDebugger = true)
 {
     if (!_isInitialized)
     {
         return;
     }
     _instance._component.RegisterSystem(system, instanceName, GetSystem(parentName), false, showInDebugger);
 }
Пример #29
0
 public DisassemblyViewModel(IDebuggable target, ISynchronizeInvoke synchronizeInvoke)
     : base(target, synchronizeInvoke)
 {
     _dasmTool            = new DasmTool(target.ReadMemory);
     _timingTool          = new TimingTool(target.CPU, target.ReadMemory);
     CommandSetBreakpoint = new CommandDelegate(
         CommandSetBreakpoint_OnExecute,
         CommandSetBreakpoint_OnCanExecute);
 }
Пример #30
0
        /*public void Analyze()
         * {
         *  var semantic = new SemanticAnalyzer(astTree);
         *  semantic.analyze();
         *
         *  var aTree = semantic.annotatedTree;
         *  printDebug("Semantic tree:\n" + aTree + "\n");
         *
         *  //var semantic = new SemanticAnalyzer(tree);
         *  //semantic.generateTables();
         *  //semantic.analyze();
         *  //printDebug("Semantic tree:\n" + tree + "\n");
         * }*/

        /*public void Generate()
         * {
         *  var codeGen = new CodeGenerator(aTree, semantic.moduleTable, semantic.dataTable);
         *  codeGen.generate();
         *
         *  var asmCode = codeGen.assembly.ToString();
         *  printDebug("Generated assembly:\n" + asmCode);
         * }*/

        private static void PrintDebug(IDebuggable o, string description = null)
        {
            if (description == null)
            {
                description = o.GetType().ToString();
            }

            PrintDebug(description + ":\n" + o.ToDebugString());
            PrintDebug("");
        }
Пример #31
0
        public Breakpoint(IDebuggable core, Action callBack, uint address, MemoryCallbackType type, bool enabled = true)
        {
            _core    = core;
            Type     = type;
            Callback = callBack;
            Address  = address;
            Name     = "Pause";

            Active = enabled;
        }
Пример #32
0
        public GDBNetworkServer(IDebuggable emulator, GDBJtagDevice jtagDevice)
        {
            this.emulator = emulator;
            this.jtagDevice = jtagDevice;

            listener = new TcpListener(IPAddress.Any, 2000);
            listener.Start ();

            socketListener = new Thread(ListeningThread);
            socketListener.Start();
        }
Пример #33
0
        public void Attach(IDebuggable dbg)
        {
            emulator = dbg;
            emulator.Breakpoint += OnBreakpoint;

            // For memory read/write breakpoints:
            busManager.SubscribeWrMem(0x0000, 0x0000, new BusWriteProc(OnMemoryWrite));
            busManager.SubscribeRdMem(0x0000, 0x0000, new BusReadProc(OnMemoryRead));

            server = new GDBNetworkServer(emulator, this);
        }
Пример #34
0
 public void Init(IDebuggable debugTarget)
 {
     if (debugTarget == m_spectrum)
         return;
     if (m_spectrum != null)
     {
         m_spectrum.UpdateState -= spectrum_OnUpdateState;
         m_spectrum.Breakpoint -= spectrum_OnBreakpoint;
     }
     if (debugTarget != null)
     {
         m_spectrum = debugTarget;
         m_dasmUtils = new DasmUtils(m_spectrum.CPU, debugTarget.ReadMemory);
         m_spectrum.UpdateState += spectrum_OnUpdateState;
         m_spectrum.Breakpoint += spectrum_OnBreakpoint;
     }
 }
Пример #35
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;
        }
Пример #36
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>();
			}
Пример #37
0
 private void InitializeParent()
 {
     Parent = null;
 }
Пример #38
0
 public GDBSession(IDebuggable emulator, GDBJtagDevice server)
 {
     this.emulator = emulator;
     this.jtagDevice = server;
 }
Пример #39
0
 public void Attach(IDebuggable dbg)
 {
     m_target = dbg;
     m_target.Breakpoint += new EventHandler(OnBreakpoint);
 }
Пример #40
0
 public GPGXTraceBuffer(IDebuggable debuggableCore, IMemoryDomains memoryDomains, IDisassemblable disassembler)
     : base(debuggableCore, memoryDomains, disassembler)
 {
     Header = "M68K: PC, machine code, mnemonic, arguments, registers (D0-D7, A0-A7, SR, USP, status flags)";
 }
Пример #41
0
 private void SetDefaultDebuggable()
 {
     _selectedDebuggable = GetAvailableDebuggables().First();
 }
Пример #42
0
 private void SetParent(IDebuggable parent)
 {
     Parent = parent;
 }
Пример #43
0
 private DebugLabel(LayerBase layer, IDebuggable parent)
     : base(layer)
 {
     SetParent(parent);
 }
Пример #44
0
        /// <summary>
        /// Stops the debugging process that is currently underway.
        /// </summary>
        public void Stop()
        {
            if (this.m_ActiveDesigner != null && !Central.Manager.IDE.IsDisposed)
            {
                // Inform them we have stopped debugging.
                (this.m_ActiveDesigner as IDesigner).Invoke(new Action(() =>
                    {
                        this.m_ActiveDesigner.EndDebug();
                        this.m_ActiveDesigner = null;
                    }));
            }

            if (this.m_Process == null)
                return;
            if (!this.m_Process.HasExited)
                this.m_Process.Kill();
            this.m_Process = null;
            if (this.m_Communicator != null)
                this.m_Communicator.Close();
            this.m_Communicator = null;
            this.p_Paused = false;

            // Fire the event to say that debugging has stopped.
            if (this.DebugStop != null)
                this.DebugStop(this, new EventArgs());
        }
 public void AttachDebuggerTo(IDebuggable debuggable)
 {
     debuggable.setDebugger(this);
     Debug(this, "Attached debugger to " + debuggable.GetType().ToString());
 }
Пример #46
0
        internal static DebugLabel CreateDebugLabel(DrawEngine2d drawEngine2d, LayerType type, IDebuggable parent = null)
        {
            if (drawEngine2d == null || drawEngine2d.IsDisposed)
                throw new ArgumentNullException();

            LayerBase layer;

            switch (type)
            {
                case LayerType.Screen :
                    layer = drawEngine2d.Layers.GetOrCreateScreenDebugLayer();
                    break;
                case LayerType.World :
                    layer = drawEngine2d.Layers.GetOrCreateWorldDebugLayer();
                    break;
                default :
                    throw new ArgumentException();
            }

            return new DebugLabel(layer, parent);
        }
Пример #47
0
        /// <summary>
        /// This event is raised when the game sends a debugging message to the IDE.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The event information.</param>
        private void m_Communicator_MessageArrived(object sender, MessageEventArgs e)
        {
            // Invoke the message handling on the IDE's thread.
            Central.Manager.IDE.Invoke(new Action(() =>
            {
                if (e.Message is WaitMessage)
                {
                    // This is the game signalling that it is ready to receive
                    // message requests such as setting breakpoints before the
                    // game starts executing.
                    foreach (IBreakpoint b in this.Breakpoints)
                    {
                        BreakpointSetAlwaysMessage bm = new BreakpointSetAlwaysMessage();
                        bm.FileName = b.SourceFile;
                        bm.LineNumber = b.SourceLine;
                        this.m_Communicator.Send(bm);
                        Thread.Sleep(10); // Give the game a little bit of time to receive the message.
                    }

                    // After we have set breakpoints, we must tell the game to
                    // continue executing.
                    this.m_Communicator.Send(new ContinueMessage());
                }
                else if (e.Message is BreakMessage)
                {
                    // This is the game signalling that it has hit a breakpoint
                    // and is now paused.

                    // Open the designer window for the specified file.
                    Moai.Platform.Management.File f = Central.Manager.ActiveProject.GetByPath((e.Message as BreakMessage).FileName);
                    IDesigner d = Central.Manager.DesignersManager.OpenDesigner(f);
                    if (d is IDebuggable)
                    {
                        // We can only go to a specific line in the file if the
                        // designer supports it.
                        (d as IDebuggable).Debug(f, (e.Message as BreakMessage).LineNumber);

                        // Set current active line information so when we resume we can
                        // send the EndDebug call.
                        this.m_ActiveDesigner = d as IDebuggable;
                    }

                    // Inform the IDE that the game is now paused.
                    this.p_Paused = true;
                    if (this.DebugPause != null)
                        this.DebugPause(this, new EventArgs());
                }
                else if (e.Message is ExcpInternalMessage)
                {
                    /* FIXME: Implement this.
                    ExcpInternalMessage m = e.Message as ExcpInternalMessage;
                    ExceptionDialog d = new ExceptionDialog();
                    d.IDEWindow = this.p_Parent.IDEWindow;
                    d.MessageInternal = m;
                    d.Show(); */
                    // TODO: Indicate to the UI that the game is now paused.
                }
                else if (e.Message is ExcpUserMessage)
                {
                    /* FIXME: Implement this.
                    ExcpUserMessage m = e.Message as ExcpUserMessage;
                    ExceptionDialog d = new ExceptionDialog();
                    d.IDEWindow = this.p_Parent.IDEWindow;
                    d.MessageUser = m;
                    d.Show(); */
                    // TODO: Indicate to the UI that the game is now paused.
                }
                else if (e.Message is ResultMessage)
                {
                    ResultMessage m = e.Message as ResultMessage;
                    // TODO: Use a queue to track messages sent to the engine and match them up with the result messages.
                }
                else
                {
                    // Unknown message!
                    // TODO: Handle this properly?
                    Central.Platform.UI.ShowMessage(e.Message.ID);
                }
            }));
        }
Пример #48
0
 private void CleanupParent()
 {
     Parent = null;
 }
Пример #49
0
        /// <summary>
        /// Runs the specified project with debugging.
        /// </summary>
        /// <param name="project">The project to run under the debugger.</param>
        public bool Start(Moai.Platform.Management.Project project)
        {
            // Check to see whether we are paused or not.
            if (this.p_Paused)
            {
                // Unpause, optionally sending an EndDebug call to
                // the appropriate place.
                if (this.m_ActiveDesigner != null)
                {
                    // Inform them we have stopped debugging.
                    this.m_ActiveDesigner.EndDebug();
                    this.m_ActiveDesigner = null;
                }

                // Now send the continue message.
                this.m_Communicator.Send(new ContinueMessage());
                this.p_Paused = false;
                if (this.DebugContinue != null)
                    this.DebugContinue(this, new EventArgs());
            }

            // Otherwise make sure we have no process running.
            if (this.m_Process != null)
            {
                // Can't run.
                return false;
            }

            // Check to see if the launch path exists.
            if (!File.Exists(Manager.m_LaunchPath))
            {
                Central.Platform.UI.ShowMessage(@"Moai IDE was unable to start debugging because it could not
            locate the engine executable.  Ensure that you have installed
            the engine executable in the required path and try again.", "Debugging Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            // Fire the event to say that debugging has started.
            if (this.DebugStart != null)
                this.DebugStart(this, new EventArgs());

            // Clear the existing output log.
            this.m_OutputTool = Central.Manager.ToolsManager.Get(typeof(IOutputTool)) as IOutputTool;
            if (this.m_OutputTool != null)
                this.m_OutputTool.ClearLog();

            // Start the debug listening service.
            try
            {
                this.m_Communicator = new Communicator(7018);
            }
            catch (ConnectionFailureException)
            {
                // It seems we can't start the debugging communicator.  Stop debugging
                // (forcibly terminate the process) and alert the user.
                if (this.DebugStop != null)
                    this.DebugStop(this, new EventArgs());
                Central.Platform.UI.ShowMessage(@"Moai IDE was unable to start debugging because it could not
            listen or connect to the debugging socket.  Ensure there
            are no other instances of the Moai engine running in debug
            mode and try again.", "Debugging Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            this.m_Communicator.MessageArrived += new EventHandler<MessageEventArgs>(m_Communicator_MessageArrived);

            this.m_Process = new Process();
            this.m_Process.StartInfo.FileName = Manager.m_LaunchPath;
            this.m_Process.StartInfo.WorkingDirectory = project.ProjectInfo.Directory.FullName;
            this.m_Process.StartInfo.UseShellExecute = false;
            this.m_Process.StartInfo.Arguments = "Main.lua";
            this.m_Process.EnableRaisingEvents = true;
            this.m_Process.Exited += new EventHandler(m_Process_Exited);

            // FIXME: Find some way to make this work.  We need the Moai output to be completely unbuffered,
            //        and changing things around in .NET and on the engine side seems to make absolutely no
            //        difference what-so-ever.  My suggestion is to make the engine-side of the debugger replace
            //        the Lua print() function and send it over the network directly back to the IDE (this
            //        means that print would work even during remote debugging!)
            //
            // this.m_Process.StartInfo.RedirectStandardOutput = true;
            // this.m_Process.OutputDataReceived += new DataReceivedEventHandler(m_Process_OutputDataReceived);

            this.m_Process.Start();
            //this.m_Process.BeginOutputReadLine();

            this.p_Paused = false;
            return true;
        }