Пример #1
0
        private void gotoCurrentToolButton_Click(object sender, EventArgs e)
        {
            IWabbitcodeDebugger debugger = _debuggerService.CurrentDebugger;
            DocumentLocation    location = debugger.GetAddressLocation(debugger.CPU.PC);

            AbstractUiAction.RunCommand(new GotoLineAction(location));
        }
Пример #2
0
        private void UpdateStack()
        {
            _callLocations.Clear();

            // Add instruction pointer first
            DocumentLocation currentLoc = _debugger.GetAddressLocation(_debugger.CPU.PC);

            _callLocations.Add(new DocumentLocation(currentLoc.FileName, currentLoc.LineNumber - 1));

            callStackView.Rows.Clear();
            var dataGridViewRows = new List <DataGridViewRow>();

            foreach (var call in _debugger.CallStack.Reverse())
            {
                var row = new DataGridViewRow();

                CallerInformation callerInformation = call.CallerInformation;
                string            callType          = callerInformation.Command + " " + callerInformation.Condition;
                row.CreateCells(callStackView, callType, callerInformation.CallName);
                dataGridViewRows.Add(row);

                currentLoc = call.CallerInformation.DocumentLocation;
                _callLocations.Add(new DocumentLocation(currentLoc.FileName, currentLoc.LineNumber - 1));
            }

            // We added an extra location for the instruction pointer, so add an extra row for the top level call
            var appRow = new DataGridViewRow();

            appRow.CreateCells(callStackView, "Top level", "OS");
            dataGridViewRows.Add(appRow);
            callStackView.Rows.AddRange(dataGridViewRows.ToArray());
        }
Пример #3
0
        private void gotoSourceMenuItem_Click(object sender, EventArgs e)
        {
            ContextMenu menu = ((MenuItem)sender).GetContextMenu();

            if (menu == null)
            {
                return;
            }
            TextBox          box      = (TextBox)menu.SourceControl;
            ushort           address  = ushort.Parse(box.Text, System.Globalization.NumberStyles.HexNumber);
            DocumentLocation location = _debugger.GetAddressLocation(address);

            AbstractUiAction.RunCommand(new GotoLineAction(location));
        }
Пример #4
0
        private void stackView_DoubleClick(object sender, EventArgs e)
        {
            if (stackView.SelectedRows.Count == 0)
            {
                return;
            }

            string stackValue = stackView.SelectedRows[0].Cells[StackDataColIndex].Value.ToString();

            stackValue = stackValue.TrimStart().Substring(0, 4);
            ushort           address  = ushort.Parse(stackValue, NumberStyles.HexNumber);
            DocumentLocation location = _debugger.GetAddressLocation(address);

            AbstractUiAction.RunCommand(new GotoLineAction(location));
        }
Пример #5
0
        private void UpdateDebugHighlight()
        {
            IWabbitcodeDebugger debugger = _debuggerService.CurrentDebugger;

            if (debugger == null)
            {
                return;
            }

            DocumentLocation debugLine = debugger.GetAddressLocation(_debuggerService.CurrentDebugger.CPU.PC);

            if (debugLine == null || debugLine.FileName != FileName)
            {
                return;
            }

            editorBox.HighlightDebugLine(debugLine.LineNumber - 1);
        }