Пример #1
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Removes the break point at address described by addr. </summary>
        ///
        /// <remarks> 08/09/2018. </remarks>
        ///
        /// <param name="addr"> The address. </param>
        ///
        /// <returns> True if it succeeds, false if it fails. </returns>
        /// -------------------------------------------------------------------------------------------------
        public static bool RemoveBreakPointAtAddress(int addr)
        {
            int b = FindFreeBreakpointAtAddress(addr);

            if (b < 0)
            {
                return(false);
            }

            if (breakpointData[b].markerset)
            {
                if (SourceCodeView.SetBreakPointMarker(false, breakpointData[b].markerSourcefilename, breakpointData[b].markerSourceLine))
                {
                }
            }


            breakpointData[b].address         = -1;
            breakpointData[b].used            = false;
            breakpointData[b].IsEnabled       = false;
            breakpointData[b].ConditionString = "";
            breakpointData[b].breakpointType  = BreakpointType.disabled;
            breakpointData[b].markerset       = false;

            Program.telnetConnection.SendCommand("sb " + (b + 1), null);
            Program.telnetConnection.SendCommand("disable-breakpoint " + (b + 1), Program.myMainForm.myBreakpoints.UpdateCallback);


            MainForm.mySourceWindow.UpdateSourceButtons();
            return(true);
        }
Пример #2
0
        /// -------------------------------------------------------------------------------------------------
        /// <summary> Sets break point. </summary>
        ///
        /// <remarks> 08/09/2018. </remarks>
        ///
        /// <param name="addr">		 The address. </param>
        /// <param name="type">		 The type. </param>
        /// <param name="Condition"> The condition. </param>
        /// <param name="filename">  Filename of the file. </param>
        /// <param name="linenum">   The linenum. </param>
        ///
        /// <returns> True if it succeeds, false if it fails. </returns>
        /// -------------------------------------------------------------------------------------------------
        public static bool SetBreakPoint(int addr, BreakpointType type, string Condition, string filename, int linenum)
        {
            int b = FindFreeBreakpoint();

            if (b < 0)
            {
                return(false);
            }


            breakpointData[b].address         = addr;
            breakpointData[b].used            = true;
            breakpointData[b].IsEnabled       = true;
            breakpointData[b].ConditionString = Condition;
            breakpointData[b].breakpointType  = type;
            breakpointData[b].markerset       = false;



            //set a marker in the source code
            if (!string.IsNullOrEmpty(filename))
            {
                //no filename then we dont set a marker

                if (SourceCodeView.SetBreakPointMarker(true, filename, linenum))
                {
                    breakpointData[b].markerset            = true;
                    breakpointData[b].markerSourceLine     = linenum;
                    breakpointData[b].markerSourcefilename = filename;
                }
            }
            Program.telnetConnection.SendCommand("sba " + (b + 1) + " break", null);
            Program.telnetConnection.SendCommand("sb " + (b + 1) + " PC=" + addr.ToString("X4") + "H", Program.myMainForm.myBreakpoints.UpdateCallback);

            //Program.myMainForm.UpdateBreakpoints();


            MainForm.mySourceWindow.UpdateSourceButtons();

            return(true);
        }
Пример #3
0
        public void OpenFile(string file)
        {
            if (!Path.IsPathRooted(file))
            {
                file = Path.GetFullPath(file);
            }
            var fileName = Path.GetFileName(file);
            var docKV    = _documents.FirstOrDefault(d => d.Key == fileName);

            if (docKV.Value != null)
            {
                docKV.Value.Activate();
                docKV.Value.BringToFront();
            }
            else
            {
                var scv = new SourceCodeView();
                scv.LoadDataFromFile(file);
                AddDocument(fileName, scv);
                scv.Activate();
                scv.BringToFront();
            }
        }
Пример #4
0
        // -------------------------------------------------------------------------------------------------
        // Default constructor
        // -------------------------------------------------------------------------------------------------
        public MainForm()
        {
            Program.myMainForm = this;
            //myDocks = new List<BaseDock>();
            InitializeComponent();

            sourceCodeView = new SourceCodeView();



            //spawn source window and dock it
            mySourceWindow          = new SourceWindow("", "");
            mySourceWindow.TopLevel = false;
            LeftsplitContainer.Panel1.Controls.Add(mySourceWindow);
            mySourceWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            mySourceWindow.Dock            = DockStyle.Fill;
            mySourceWindow.Show();



            //spawn register window
            myNewRegisters          = new Registers("", "");
            myNewRegisters.TopLevel = false;
            RightFlow.Controls.Add(myNewRegisters);
            myNewRegisters.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            //myNewRegisters.Dock = DockStyle.Fill;
            myNewRegisters.Show();

            //add dissasembly window
            myDisassembly          = new Disassembly("", "");
            myDisassembly.TopLevel = false;
            RightFlow.Controls.Add(myDisassembly);
            myDisassembly.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            myDisassembly.Dock            = DockStyle.Fill;
            myDisassembly.Show();


            //add watch window
            myWatchWindow          = new Watch();
            myWatchWindow.TopLevel = false;
            RightFlow.Controls.Add(myWatchWindow);
            myWatchWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            myWatchWindow.Dock            = DockStyle.Fill;
            myWatchWindow.Show();


            UpdateStatus();



            if (!string.IsNullOrEmpty(TraceDataPath))
            {
                if (System.IO.File.Exists(TraceDataPath))
                {
                    TraceFile.ParseTraceData(TraceDataPath);
                    if (mySourceWindow != null)
                    {
                        mySourceWindow.InitSourceWindow(Path.GetDirectoryName(TraceDataPath));
                    }
                }
            }

            Invalidate();
        }
Пример #5
0
        public MainForm()
        {
            Program.myMainForm = this;
            //myDocks = new List<BaseDock>();
            InitializeComponent();

            sourceCodeView = new SourceCodeView();



            //spawn source window and dock it
            mySourceWindow          = new SourceWindow("", "");
            mySourceWindow.TopLevel = false;
            LeftsplitContainer.Panel1.Controls.Add(mySourceWindow);
            mySourceWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            mySourceWindow.Dock            = DockStyle.Fill;
            mySourceWindow.Show();

            //spawn log
            myLog          = new LogView("", "");
            myLog.TopLevel = false;
            LeftsplitContainer.Panel2.Controls.Add(myLog);
            myLog.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            myLog.Dock            = DockStyle.Fill;
            myLog.Show();



            //spawn register window
            myNewRegisters          = new Registers("", "");
            myNewRegisters.TopLevel = false;
            RightFlow.Controls.Add(myNewRegisters);
            myNewRegisters.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            //myNewRegisters.Dock = DockStyle.Fill;
            myNewRegisters.Show();

            //add dissasembly window
            myDisassembly          = new Disassembly("", "");
            myDisassembly.TopLevel = false;
            RightFlow.Controls.Add(myDisassembly);
            myDisassembly.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            myDisassembly.Dock            = DockStyle.Fill;
            myDisassembly.Show();


            //add watch window
            myWatchWindow          = new Watch();
            myWatchWindow.TopLevel = false;
            RightFlow.Controls.Add(myWatchWindow);
            myWatchWindow.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            myWatchWindow.Dock            = DockStyle.Fill;
            myWatchWindow.Show();



            //this.IsMdiContainer = true;
            //this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel();
            //this.dockPanel.Dock = System.Windows.Forms.DockStyle.Fill;
            //this.Controls.Add(this.dockPanel);

            UpdateStatus();

            /*
             * if (File.Exists("layout.xml"))
             * {
             * dockPanel.LoadFromXml("layout.xml",DelegateHandler);
             * }
             * else
             * {
             * myButtonBar = new ButtonBar("Control");
             * myLogs.Add(new LogView("Log", "Log"));
             * myNewRegisters = new Registers("Registers", "Registers");
             * myDisassembly = new Disassembly("Disassembly", "Disassembly");
             * myScreen = new SpectrumScreen("Screen", "Screen");
             * myBreakpoints = new Breakpoint("Breakpoints", "Breakpoints");
             * myDocks.Add(new SpriteView("Sprite Patterns", "SpritePatterns"));
             *
             * myButtonBar.Show(this.dockPanel, DockState.DockTop);
             * myNewRegisters.Show(this.dockPanel, DockState.DockLeft);
             * myDisassembly.Show(this.dockPanel, DockState.DockRight);
             * myLogs[0].Show(this.dockPanel, DockState.DockBottom);
             * myBreakpoints.Show(this.dockPanel, DockState.DockLeft);
             * myScreen.Show(this.dockPanel, DockState.DockRight);
             * myDocks[0].Show(this.dockPanel, DockState.Float);
             * }
             */
            Program.telnetConnection.SendCommand("help", null);
            refreshScreen = false;


            if (!string.IsNullOrEmpty(TraceDataPath))
            {
                if (System.IO.File.Exists(TraceDataPath))
                {
                    TraceFile.ParseTraceData(TraceDataPath);
                    if (mySourceWindow != null)
                    {
                        mySourceWindow.InitSourceWindow(Path.GetDirectoryName(TraceDataPath));
                    }
                }
            }

            Invalidate();
        }