Ejemplo n.º 1
0
 private void SelectAllMenuItem_Click(object sender, EventArgs e)
 {
     for (var i = 0; i < _instructions.Count; i++)
     {
         TraceView.SelectItem(i, true);
     }
 }
Ejemplo n.º 2
0
        public void Test()
        {
            // ×é×°
            Controler control = new Controler();

            control.Model = new Randomizer();
            control      += new TraceView();
            control      += new EventLogView();
            control.Process();
        }
Ejemplo n.º 3
0
 private void MediaOnTrace(object sender, TraceEventArgs e)
 {
     if (InvokeRequired)
     {
         BeginInvoke(new TraceEventHandler(MediaOnTrace), sender, e);
     }
     else
     {
         TraceView.AppendText(e.ToString() + Environment.NewLine);
     }
 }
        public void Test()
        {
            // 组装
            Controler control = new Controler();
            IModel    model   = new Model();

            control.Model = model;
            control      += new TraceView();
            control      += new EventLogView();

            // 后续Model修改时,不经过Controller,而是经由观察者完成View的变化
            model[1] = 2000;    // 第一次修改(修改的内容按照之前的随机数计算不会出现)
            model[3] = -100;    // 第二次修改(修改的内容按照之前的随机数计算不会出现)
        }
Ejemplo n.º 5
0
 private void OnReceived(object sender, ReceiveEventArgs e)
 {
     if (InvokeRequired)
     {
         BeginInvoke(new ReceivedEventHandler(OnReceived), sender, e);
     }
     else
     {
         try
         {
             TraceView.AppendText(GXCommon.ToHex((byte[])e.Data));
         }
         catch (Exception ex)
         {
             TraceView.AppendText(ex.Message);
         }
     }
 }
Ejemplo n.º 6
0
        public MainForm()
        {
            InitializeComponent();

            outputView = new OutputView(this);

            registersView = new RegisterView(this);

            displayView = new DisplayView(this);
            controlView = new ControlView(this);
            traceView   = new TraceView(this);

            callStackView  = new CallStackView(this);
            stackFrameView = new StackFrameView(this);

            statusView           = new StatusView(this);
            symbolView           = new SymbolView(this);
            watchView            = new WatchView(this);
            breakPointView       = new BreakpointView(this);
            instructionView      = new InstructionView(this);
            methodView           = new MethodView(this);
            methodParametersView = new MethodParametersView(this);

            //scriptView = new ScriptView(this);

            sourceView = new SourceView(this);

            sourceDataView = new SourceDataView(this);              // only useful when debugging this tool

            launchView = new LaunchView(this);

            Settings = AppLocationsSettings.GetAppLocations();

            Settings.SetValue("Emulator.GDB", true);
            Settings.SetValue("Emulator.Serial", "TCPServer");
            Settings.SetValue("Emulator.Serial.Port", 1250);
            Settings.SetValue("Emulator.Display", false);

            GDBPort = 1234;

            AppDomain.CurrentDomain.DomainUnload       += (s, e) => { KillVMProcess(); };
            AppDomain.CurrentDomain.ProcessExit        += (s, e) => { KillVMProcess(); };
            AppDomain.CurrentDomain.UnhandledException += (s, e) => { KillVMProcess(); };
        }
Ejemplo n.º 7
0
        private void TraceView_QueryItemText(int index, int column, out string text)
        {
            text = "";
            if (index < _instructions.Count)
            {
                var test = TraceView.AllColumns;

                switch (TraceView.GetOriginalColumnIndex(column))
                {
                case 0:
                    text = _instructions[index].Disassembly.TrimEnd();
                    break;

                case 1:
                    text = _instructions[index].RegisterInfo;
                    break;
                }
            }
        }
Ejemplo n.º 8
0
 private static GenericChart.GenericChart GetTrace(TraceView traceView) =>
 Chart.Line <double, double, StyleParam.DrawingStyle, int>(traceView.X, traceView.Y, traceView.TraceName, Dash: StyleParam.DrawingStyle.Solid, Width: 1000)
 .WithTraceName(traceView.TraceName, true)
 .WithX_AxisStyle("Time", Showgrid: false, Showline: true)
 .WithY_AxisStyle("Events", Showgrid: false, Showline: true);
Ejemplo n.º 9
0
 private void SetupColumns()
 {
     TraceView.AllColumns.Clear();
     TraceView.AddColumn("Disasm", "Disasm", 239, PlatformAgnosticVirtualListView.ListColumn.InputType.Text);
     TraceView.AddColumn("Registers", "Registers", 357, PlatformAgnosticVirtualListView.ListColumn.InputType.Text);
 }
Ejemplo n.º 10
0
        public void NewUpdate(ToolFormUpdateType type)
        {
            if (type == ToolFormUpdateType.PostFrame)
            {
                if (ToWindowRadio.Checked)
                {
                    TraceView.VirtualListSize = _instructions.Count;
                    if (GlobalWin.MainForm.EmulatorPaused)
                    {
                        if (AutoScroll && _instructions.Count != 0)
                        {
                            TraceView.ScrollToIndex(_instructions.IndexOf(_instructions.Last()));
                        }
                        TraceView.Refresh();
                    }
                }
                else
                {
                    CloseFile();
                }
            }

            if (type == ToolFormUpdateType.PreFrame)
            {
                if (LoggingEnabled.Checked)
                {
                    //connect tracer to sink for next frame
                    if (ToWindowRadio.Checked)
                    {
                        if (AutoScroll && _instructions.Count != 0)
                        {
                            TraceView.ScrollToIndex(_instructions.IndexOf(_instructions.Last()));
                        }

                        TraceView.Refresh();

                        Tracer.Sink = new CallbackSink()
                        {
                            putter = (info) =>
                            {
                                if (_instructions.Count >= MaxLines)
                                {
                                    _instructions.RemoveRange(0, _instructions.Count - MaxLines);
                                }
                                _instructions.Add(info);
                            }
                        };
                    }
                    else
                    {
                        if (_streamWriter == null)
                        {
                            StartLogFile(true);
                        }
                        Tracer.Sink = new CallbackSink {
                            putter = (info) =>
                            {
                                //no padding supported. core should be doing this!
                                var data = string.Format("{0} {1}", info.Disassembly, info.RegisterInfo);
                                _streamWriter.WriteLine(data);
                                _currentSize += (ulong)data.Length;
                                if (_splitFile)
                                {
                                    CheckSplitFile();
                                }
                            }
                        };
                    }
                }
                else
                {
                    Tracer.Sink = null;
                }
            }
        }