예제 #1
0
 public MessageEventArgs(Debugger.Message m)
 {
     Message = m;
 }
예제 #2
0
        // Process a shell message
        void HandleShell(Debugger.Message msg)
        {
            int spc = msg.Text.IndexOf(' ');

            if (spc < 0)
            return;

            string kind = msg.Text.Substring(0, spc);
            string arg = msg.Text.Substring(spc + 1,
            msg.Text.Length - spc - 1);

            if (kind.Equals("power-sample-us"))
            {
            int period = XmlConvert.ToInt32(arg);

            powerData = new SampleQueue(period, 131072);
            if (PowerChanged != null)
            PowerChanged(this, null);
            }
            else if (kind.Equals("power-samples"))
            {
            if (powerData != null)
            {
            int[] samples = DecodeSamples(arg);

            powerData.Push(samples);
            if (PowerChanged != null)
            PowerChanged(this, null);
            }
            }
        }
예제 #3
0
        // A message has been received from the debugger, or it has
        // exited.
        void OnMessage(object sender, EventArgs args)
        {
            Debugger.Message msg;

            while (debug.Output.TryReceive(out msg))
            {
            switch (msg.Type)
            {
            case Debugger.MessageType.Normal:
            case Debugger.MessageType.Debug:
            Console.Out.WriteLine(stripANSI(msg.Text));
            break;

            case Debugger.MessageType.Error:
            Console.Error.WriteLine(stripANSI(msg.Text));
            break;

            case Debugger.MessageType.Shell:
            break;
            }

            if (msg.Type == Debugger.MessageType.Shell)
            HandleShell(msg);
            else if (MessageReceived != null)
            MessageReceived(this, new MessageEventArgs(msg));
            }

            if (debug.Output.IsClosed)
            {
            messageEvent.Disable();
            readyEvent.Disable();
            debug = null;
            messageEvent = null;
            readyEvent = null;

            if (DebuggerExited != null)
            DebuggerExited(this, null);
            }
        }
예제 #4
0
        // Start a new debugger process if the debugger is not already
        // running.
        public void Start(string cmdline)
        {
            if (debug != null)
            return;

            string path = settings.MSPDebugPath;
            string args = "--embed " + cmdline;

            if (settings.UseBundledDebugger)
            {
            string self = Assembly.GetExecutingAssembly().Location;

            path = Path.Combine
            (Path.GetDirectoryName(self), "mspdebug.exe");
            }

            isReady = false;
            try {
            debug = new Debugger(path, args);
            }
            catch (Exception ex)
            {
            MessageDialog dlg = new MessageDialog
            (null, DialogFlags.Modal, MessageType.Error,
             ButtonsType.Ok, "Can't start debugger: {0}",
             ex.Message);

            dlg.Title = "Olishell";
            dlg.Run();
            dlg.Hide();
            return;
            }

            messageEvent = new ITC.GtkListener(debug.Output);
            messageEvent.Signalled += OnMessage;

            readyEvent = new ITC.GtkListener(debug.Ready);
            readyEvent.Signalled += OnReady;

            if (DebuggerStarted != null)
            DebuggerStarted(this, null);
        }