Esempio n. 1
0
        private void FrameList_DoubleClick(object sender, EventArgs e)
        {
            Frame selectedFrame = FrameList.SelectedItems.Count == 0 ? null : FrameList.SelectedItems[0].Tag as Frame;

            if (selectedFrame == null)
            {
                return;
            }

            PdbLineNumber line = PdbSession.FindLinesByVirtualAddress(selectedFrame.Eip, 1).FirstOrDefault();

            if (line == null)
            {
                return;
            }

            PdbSourceFile sourceFile = line.SourceFile;

            if (sourceFile == null)
            {
                return;
            }

            EnvDTE.Window        window    = VisualStudio.Instance.ItemOperations.OpenFile(sourceFile.FileName);
            EnvDTE.TextSelection selection = window.Document.Selection as EnvDTE.TextSelection;
            if (selection == null)
            {
                return;
            }

            selection.GotoLine((int)line.LineNumber);
        }
Esempio n. 2
0
        private void StepGdbButton_Click(object sender, EventArgs e)
        {
            if (Gdb.Running)
            {
                return;
            }

            Gdb.Step();

            OnUpdateControls();
            OnUpdate();

            PdbLineNumber line = PdbSession.FindLinesByVirtualAddress(Gdb.Registers.Eip, 1).FirstOrDefault();

            if (line == null)
            {
                return;
            }

            PdbSourceFile sourceFile = line.SourceFile;

            if (sourceFile == null)
            {
                return;
            }

            EnvDTE.Window        window    = VisualStudio.Instance.ItemOperations.OpenFile(sourceFile.FileName);
            EnvDTE.TextSelection selection = window.Document.Selection as EnvDTE.TextSelection;
            if (selection == null)
            {
                return;
            }

            selection.GotoLine((int)line.LineNumber);
        }
Esempio n. 3
0
        private void StepLineButton_Click(object sender, EventArgs e)
        {
            if (Gdb.Running)
            {
                return;
            }

            PdbLineNumber origin, line;

            origin = PdbSession.FindLinesByVirtualAddress(Gdb.Registers.Eip, 1).FirstOrDefault();

            while (true)
            {
                Gdb.Step();

                line = PdbSession.FindLinesByVirtualAddress(Gdb.Registers.Eip, 1).FirstOrDefault();
                if (line == null)
                {
                    continue;
                }

                if (origin == null && line != null)
                {
                    break;
                }
                if (line.SourceFileId != origin.SourceFileId)
                {
                    break;
                }
                if (line.LineNumber != origin.LineNumber || line.ColumnNumber != origin.ColumnNumber)
                {
                    break;
                }
            }

            OnUpdateControls();
            OnUpdate();

            PdbSourceFile sourceFile = line.SourceFile;

            if (sourceFile == null)
            {
                return;
            }

            EnvDTE.Window        window    = VisualStudio.Instance.ItemOperations.OpenFile(sourceFile.FileName);
            EnvDTE.TextSelection selection = window.Document.Selection as EnvDTE.TextSelection;
            if (selection == null)
            {
                return;
            }

            selection.GotoLine((int)line.LineNumber);
        }
Esempio n. 4
0
        private void StepOverButton_Click(object sender, EventArgs e)
        {
            if (Gdb.Running)
            {
                return;
            }

            List <PdbLineNumber> lines = PdbSession.FindLinesByVirtualAddress(Gdb.Registers.Eip, 100).ToList();

            if (lines.Count < 1)
            {
                StepLineButton_Click(sender, e);
                return;
            }

            PdbLineNumber currentLine = lines.First();
            PdbLineNumber nextLine    = currentLine == null ? null : lines.FirstOrDefault(l => l.SourceFileId == currentLine.SourceFileId && l.VirtualAddress > currentLine.VirtualAddress);

            if (nextLine == null)
            {
                StepLineButton_Click(sender, e);
                return;
            }

            PdbLineNumber line = null;

            while (true)
            {
                Gdb.Step();

                line = PdbSession.FindLinesByVirtualAddress(Gdb.Registers.Eip, 1).FirstOrDefault();
                if (line == null)
                {
                    continue;
                }

                if (line.SourceFileId == nextLine.SourceFileId && line.LineNumber == nextLine.LineNumber && line.ColumnNumber == nextLine.ColumnNumber)
                {
                    break;
                }
            }

            OnUpdateControls();
            OnUpdate();

            PdbSourceFile sourceFile = line.SourceFile;

            if (sourceFile == null)
            {
                return;
            }

            EnvDTE.Window        window    = VisualStudio.Instance.ItemOperations.OpenFile(sourceFile.FileName);
            EnvDTE.TextSelection selection = window.Document.Selection as EnvDTE.TextSelection;
            if (selection == null)
            {
                return;
            }

            selection.GotoLine((int)line.LineNumber);
        }