Esempio n. 1
0
        public static bool Start()
        {
            if (DebuggerService.CurrentDebugger == null || DebuggerService.CurrentDebugger.IsDebugging)
            {
                return(false);
            }

            if (DebuggerSettings.Instance.AskForArguments)
            {
                bool?result;
                var  debugOpts = SavedDebuggedOptions.ShowDebugExecutableDialogBox(null, out result);
                if (result == true)
                {
                    MainWindow.Instance.OpenFiles(new[] { debugOpts.Executable }, false);
                    DebuggerPlugin.StartExecutable(debugOpts.Executable, debugOpts.WorkingDirectory, debugOpts.Arguments, debugOpts.BreakAtBeginning);
                    return(true);
                }
            }
            else
            {
                OpenFileDialog dialog = new OpenFileDialog()
                {
                    Filter           = ".NET Executable (*.exe) | *.exe",
                    RestoreDirectory = true,
                    DefaultExt       = "exe"
                };
                if (dialog.ShowDialog() == true)
                {
                    MainWindow.Instance.OpenFiles(new[] { dialog.FileName }, false);
                    DebuggerPlugin.StartExecutable(dialog.FileName, null, null, DebuggerSettings.Instance.BreakAtBeginning);
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
        public static bool Start(string filename)
        {
            var debugger = DebuggerService.CurrentDebugger;

            if (debugger == null || debugger.IsDebugging)
            {
                return(false);
            }

            if (DebuggerSettings.Instance.AskForArguments)
            {
                bool?result;
                var  debugOpts = SavedDebuggedOptions.ShowDebugExecutableDialogBox(filename, out result);
                if (result == true)
                {
                    DebuggerPlugin.StartExecutable(debugOpts.Executable, debugOpts.WorkingDirectory, debugOpts.Arguments, debugOpts.BreakAtBeginning);
                    return(true);
                }
                return(false);
            }
            else
            {
                DebuggerPlugin.StartExecutable(filename, null, null, DebuggerSettings.Instance.BreakAtBeginning);
                return(true);
            }
        }
Esempio n. 3
0
        public void Execute(ContextMenuEntryContext context)
        {
            var loadedAsm = GetAssembly(context);

            if (loadedAsm != null)
            {
                DebuggerPlugin.Start(loadedAsm.FileName);
            }
        }
Esempio n. 4
0
        public void Execute(TextViewContext context)
        {
            if (context.SelectedTreeNodes == null)
            {
                return;
            }
            AssemblyTreeNode n = context.SelectedTreeNodes[0] as AssemblyTreeNode;

            DebuggerPlugin.Start(n.LoadedAssembly.FileName);
        }
Esempio n. 5
0
        public static bool Restart()
        {
            if (!RestartCanExecute())
            {
                return(false);
            }
            if (!Stop())
            {
                return(false);
            }

            var inst = SavedDebuggedOptions.Instance;

            MainWindow.Instance.OpenFiles(new[] { inst.Executable }, false);
            DebuggerPlugin.StartExecutable(inst.Executable, inst.WorkingDirectory, inst.Arguments, inst.BreakAtBeginning);
            return(true);
        }
Esempio n. 6
0
        public static bool Attach()
        {
            if (DebuggerService.CurrentDebugger == null || DebuggerService.CurrentDebugger.IsDebugging)
            {
                return(false);
            }

            MainWindow.Instance.ShowIgnorableMessageBox("debug: attach warning",
                                                        "Warning: When attaching to an application, some local variables might not be available. If possible, use the \"Debug an Executable\" command.",
                                                        MessageBoxButton.OK);

            var window = new AttachToProcessWindow {
                Owner = MainWindow.Instance
            };

            if (window.ShowDialog() == true)
            {
                DebuggerPlugin.StartAttaching(window.SelectedProcess);
                return(true);
            }

            return(false);
        }
Esempio n. 7
0
 public override void Execute(object parameter)
 {
     DebuggerPlugin.DebugShowNextStatement();
 }
Esempio n. 8
0
 public void Execute(TextViewContext context)
 {
     DebuggerPlugin.DebugEnableDisableBreakpoint();
 }
Esempio n. 9
0
 public bool IsVisible(TextViewContext context)
 {
     return((context == null || context.TextView != null) &&
            DebuggerPlugin.DebugEnableDisableBreakpointCanExecute());
 }
Esempio n. 10
0
 public void Execute(ContextMenuEntryContext context)
 {
     DebuggerPlugin.DebugEnableDisableBreakpoint();
 }
Esempio n. 11
0
 public void Execute(TextViewContext context)
 {
     DebuggerPlugin.DebugToggleBreakpoint();
 }
Esempio n. 12
0
 public bool IsVisible(ContextMenuEntryContext context)
 {
     return((context == null || context.Element is DecompilerTextView) &&
            DebuggerPlugin.DebugCanSetNextStatement());
 }
Esempio n. 13
0
 public void Execute(TextViewContext context)
 {
     DebuggerPlugin.DebugSetNextStatement();
 }
Esempio n. 14
0
 public override void Execute(object parameter)
 {
     DebuggerPlugin.DebugStepInto();
 }
Esempio n. 15
0
 public override void Execute(object parameter)
 {
     DebuggerPlugin.Detach();
 }
Esempio n. 16
0
 public override void Execute(object parameter)
 {
     DebuggerPlugin.Restart();
 }
Esempio n. 17
0
 protected override bool CanExecuteInternal()
 {
     return(base.CanExecuteInternal() &&
            DebuggerPlugin.RestartCanExecute());
 }
Esempio n. 18
0
 public override void Execute(object parameter)
 {
     DebuggerPlugin.DebugContinue();
 }
Esempio n. 19
0
 public bool IsVisible(TextViewContext context)
 {
     return((context == null || context.TextView != null) &&
            DebuggerPlugin.DebugShowNextStatementCanExecute());
 }
Esempio n. 20
0
 public bool IsVisible(ContextMenuEntryContext context)
 {
     return((context == null || context.Element is DecompilerTextView) &&
            DebuggerPlugin.DebugEnableDisableBreakpointCanExecute());
 }
Esempio n. 21
0
 public bool IsVisible(TextViewContext context)
 {
     return((context == null || context.TextView != null) &&
            DebuggerPlugin.DebugCanSetNextStatement());
 }
Esempio n. 22
0
 public override void Execute(object parameter)
 {
     DebuggerPlugin.DebugToggleBreakpoint();
 }
Esempio n. 23
0
 public override void Execute(object parameter)
 {
     DebuggerPlugin.DebugDeleteAllBreakpoints();
 }
Esempio n. 24
0
 public void Execute(ContextMenuEntryContext context)
 {
     DebuggerPlugin.DebugSetNextStatement();
 }
Esempio n. 25
0
        void OnKeyDown(object sender, KeyEventArgs e)
        {
            var  debugger  = DebuggerService.CurrentDebugger;
            bool debugging = debugger != null && debugger.IsDebugging;

            if (debugging && Keyboard.Modifiers == ModifierKeys.Shift && e.Key == Key.F5)
            {
                Stop();
                e.Handled = true;
                return;
            }
            if (debugging && Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && e.Key == Key.F5)
            {
                if (RestartCanExecute())
                {
                    Restart();
                }
                e.Handled = true;
                return;
            }
            if (Keyboard.Modifiers == ModifierKeys.None && e.Key == Key.F9)
            {
                DebugToggleBreakpoint();
                e.Handled = true;
                return;
            }
            if (Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.F9)
            {
                if (DebugEnableDisableBreakpointCanExecute())
                {
                    DebugEnableDisableBreakpoint();
                }
                e.Handled = true;
                return;
            }
            if (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && e.Key == Key.F9)
            {
                if (DebugDeleteAllBreakpointsCanExecute())
                {
                    DebugDeleteAllBreakpoints();
                }
                e.Handled = true;
                return;
            }
            if (debugging && Keyboard.Modifiers == ModifierKeys.None && (e.SystemKey == Key.F10 ? e.SystemKey : e.Key) == Key.F10)
            {
                DebugStepOver();
                e.Handled = true;
                return;
            }
            if (debugging && Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Shift) && (e.SystemKey == Key.F10 ? e.SystemKey : e.Key) == Key.F10)
            {
                if (DebugCanSetNextStatement())
                {
                    DebugSetNextStatement();
                }
                else
                {
                    // Show the error message
                    SourceCodeMapping mapping;
                    string            errMsg;
                    if (!DebugGetSourceCodeMappingForSetNextStatement(out errMsg, out mapping))
                    {
                        MainWindow.Instance.ShowMessageBox(errMsg);
                    }
                }
                e.Handled = true;
                return;
            }
            if (debugging && Keyboard.Modifiers == ModifierKeys.None && e.Key == Key.F11)
            {
                DebugStepInto();
                e.Handled = true;
                return;
            }
            if (debugging && Keyboard.Modifiers == ModifierKeys.Shift && e.Key == Key.F11)
            {
                DebugStepOut();
                e.Handled = true;
                return;
            }
            if (debugging && Keyboard.Modifiers == ModifierKeys.Control && e.Key == Key.Cancel)
            {
                DebugBreak();
                e.Handled = true;
                return;
            }
            if (Keyboard.Modifiers == (ModifierKeys.Control | ModifierKeys.Alt) && e.Key == Key.P)
            {
                DebuggerPlugin.Attach();
                e.Handled = true;
                return;
            }
            if (debugging && Keyboard.Modifiers == ModifierKeys.Alt && e.SystemKey == Key.Multiply)
            {
                if (DebugShowNextStatementCanExecute())
                {
                    DebugShowNextStatement();
                }
                e.Handled = true;
                return;
            }
        }
Esempio n. 26
0
 protected override bool CanExecuteInternal()
 {
     return(base.CanExecuteInternal() &&
            DebuggerPlugin.DebugDeleteAllBreakpointsCanExecute());
 }