Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger')
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs17
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml17
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs3
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs73
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs115
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs100
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs34
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs51
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs43
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs12
-rw-r--r--main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs7
-rw-r--r--main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.BusyEvaluatorDialog.cs5
-rw-r--r--main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic5
13 files changed, 266 insertions, 216 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs
index cb2b881229..64b1153aea 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/TextVisualizer.cs
@@ -106,12 +106,12 @@ namespace MonoDevelop.Debugger.Visualizer
void PopulateTextView (ObjectValue value)
{
- var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
- ops.AllowTargetInvoke = true;
- ops.ChunkRawStrings = true;
+ var options = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+ options.ChunkRawStrings = true;
if (value.TypeName == "string") {
- rawString = value.GetRawValue (ops) as RawValueString;
+ rawString = value.GetRawValue (options) as RawValueString;
length = rawString.Length;
offset = 0;
@@ -125,7 +125,7 @@ namespace MonoDevelop.Debugger.Visualizer
};
}
} else if (value.TypeName == "char[]") {
- rawArray = value.GetRawValue (ops) as RawValueArray;
+ rawArray = value.GetRawValue (options) as RawValueArray;
length = rawArray.Length;
offset = 0;
@@ -173,12 +173,15 @@ namespace MonoDevelop.Debugger.Visualizer
public override bool StoreValue (ObjectValue val)
{
+ var options = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
+ options.AllowTargetInvoke = true;
+
switch (val.TypeName) {
case "char[]":
- val.SetRawValue (textView.Buffer.Text.ToCharArray ());
+ val.SetRawValue (textView.Buffer.Text.ToCharArray (), options);
return true;
case "string":
- val.SetRawValue (textView.Buffer.Text);
+ val.SetRawValue (textView.Buffer.Text, options);
return true;
default:
return false;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
index 402df196c7..19045ebe26 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.addin.xml
@@ -102,8 +102,20 @@
icon="md-step-out-debug"/>
<Command id = "MonoDevelop.Debugger.DebugCommands.NewBreakpoint"
defaultHandler = "MonoDevelop.Debugger.NewBreakpointHandler"
- _label = "New Breakpoint..."
+ _label = "New Breakpoint"
icon = "md-breakpoint-new" />
+ <Command id = "MonoDevelop.Debugger.DebugCommands.NewFunctionBreakpoint"
+ defaultHandler = "MonoDevelop.Debugger.NewFunctionBreakpointHandler"
+ _label = "New Function Breakpoint"
+ icon = "md-breakpoint-new" />
+ <Command id = "MonoDevelop.Debugger.DebugCommands.NewCatchpoint"
+ defaultHandler = "MonoDevelop.Debugger.NewCatchpointHandler"
+ _label = "New Exception Catchpoint"
+ icon = "md-breakpoint-new" />
+ <Command id = "MonoDevelop.Debugger.DebugCommands.ShowBreakpoints"
+ defaultHandler = "MonoDevelop.Debugger.ShowBreakpointsHandler"
+ _label = "View Breakpoints"
+ icon = "md-view-debug-breakpoints" />
<Command id = "MonoDevelop.Debugger.DebugCommands.RemoveBreakpoint"
defaultHandler = "MonoDevelop.Debugger.RemoveBreakpointHandler"
_label = "Remove Breakpoint" />
@@ -183,6 +195,9 @@
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.ShowCurrentExecutionLine" />
<SeparatorItem id = "MonoDevelop.Debugger.BreakpointsSection" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.NewBreakpoint" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.NewFunctionBreakpoint" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.NewCatchpoint" />
+ <CommandItem id = "MonoDevelop.Debugger.DebugCommands.ShowBreakpoints" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.ToggleBreakpoint" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.EnableDisableBreakpoint" />
<CommandItem id = "MonoDevelop.Debugger.DebugCommands.DisableAllBreakpoints" />
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
index 29742d7fd4..f468753ed1 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPad.cs
@@ -98,6 +98,9 @@ namespace MonoDevelop.Debugger
toolbarSet.AddItem (EditCommands.Delete);
toolbarSet.AddSeparator ();
toolbarSet.Add (propertiesCmd);
+ toolbarSet.AddSeparator ();
+ toolbarSet.Add (new CommandEntry (DebugCommands.NewFunctionBreakpoint){ DispayType = CommandEntryDisplayType.IconAndText });
+ toolbarSet.Add (new CommandEntry (DebugCommands.NewCatchpoint){ DispayType = CommandEntryDisplayType.IconAndText });
// The breakpoint list
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
index 683bc1d2e2..1df779cacc 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs
@@ -46,6 +46,13 @@ namespace MonoDevelop.Debugger
ExpressionChanges
}
+ public enum BreakpointType
+ {
+ Location,
+ Function,
+ Catchpoint
+ }
+
sealed class BreakpointPropertiesDialog : Dialog
{
// For button sensitivity.
@@ -193,15 +200,29 @@ namespace MonoDevelop.Debugger
string parsedFunction;
readonly HashSet<string> classes = new HashSet<string> ();
-
- public BreakpointPropertiesDialog (BreakEvent be)
+ public BreakpointPropertiesDialog (BreakEvent be, BreakpointType breakpointType)
{
this.be = be;
-
LoadExceptionList ();
Initialize ();
SetInitialData ();
SetLayout ();
+ if (be == null) {
+ switch (breakpointType) {
+ case BreakpointType.Location:
+ stopOnLocation.Active = true;
+ entryLocationFile.SetFocus ();
+ break;
+ case BreakpointType.Function:
+ stopOnFunction.Active = true;
+ entryFunctionName.SetFocus ();
+ break;
+ case BreakpointType.Catchpoint:
+ stopOnException.Active = true;
+ entryExceptionType.SetFocus ();
+ break;
+ }
+ }
}
void Initialize ()
@@ -258,8 +279,46 @@ namespace MonoDevelop.Debugger
entryPrintExpression.Changed += OnUpdateText;
buttonOk.Clicked += OnSave;
+
+ CompletionWindowManager.WindowShown += HandleCompletionWindowShown;
+ CompletionWindowManager.WindowClosed += HandleCompletionWindowClosed;
}
+ #region Modal and Dialog.Run workaround
+ /*
+ * If Dialog is ran with Dialog.Run and Modal=true it takes all events like mouse, keyboard... from other windows.
+ * So when CodeCompletionList window appears mouse events don't work on it(except if CodeCompletionList.Modal=true, but then
+ * events don't work on BreakpointPropertiesDialog(can't type rest of exception type name)).
+ * So what this workaround does is disables Modal on BreakpointProperties so CodeCompletionList mouse events work fine. But if user
+ * tries to access anything outside this two windows(e.g. MainWindow). CodeCompletionList loses focus and closes itself. Resulting
+ * in BreakpointProperties.Modal = true and user can't do anything on MainWindow.
+ * All this is done so fast(or in correct order) that user can't notice this Modal switching.
+ */
+
+ void HandleCompletionWindowClosed (object sender, EventArgs e)
+ {
+ var gtkWidget = Xwt.Toolkit.CurrentEngine.GetNativeWidget (vboxLocation) as Gtk.Widget;//Any widget is fine
+ if (gtkWidget != null) {
+ var topWindow = gtkWidget.Toplevel as Gtk.Window;
+ if (topWindow != null) {
+ topWindow.Modal = true;
+ }
+ }
+ }
+
+ void HandleCompletionWindowShown (object sender, EventArgs e)
+ {
+ var gtkWidget = Xwt.Toolkit.CurrentEngine.GetNativeWidget (vboxLocation) as Gtk.Widget;//Any widget is fine
+ if (gtkWidget != null) {
+ var topWindow = gtkWidget.Toplevel as Gtk.Window;
+ if (topWindow != null) {
+ topWindow.Modal = false;
+ }
+ }
+ }
+
+ #endregion
+
void SetInitialFunctionBreakpointData (FunctionBreakpoint fb)
{
stopOnLocation.Visible = false;
@@ -292,7 +351,7 @@ namespace MonoDevelop.Debugger
if (project != null) {
// Check the startup project of the solution too, since the current project may be a library
- SolutionEntityItem startup = project.ParentSolution.StartupItem;
+ SolutionItem startup = project.ParentSolution.StartupItem;
entryConditionalExpression.Sensitive = DebuggingService.IsFeatureSupported (project, DebuggerFeatures.ConditionalBreakpoints) ||
DebuggingService.IsFeatureSupported (startup, DebuggerFeatures.ConditionalBreakpoints);
@@ -758,5 +817,11 @@ namespace MonoDevelop.Debugger
OnUpdateControls (null, null);
}
+ protected override void Dispose (bool disposing)
+ {
+ CompletionWindowManager.WindowShown -= HandleCompletionWindowShown;
+ CompletionWindowManager.WindowClosed -= HandleCompletionWindowClosed;
+ base.Dispose (disposing);
+ }
}
} \ No newline at end of file
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
index 56c6f5cb5a..9c311dc928 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugCommands.cs
@@ -34,6 +34,7 @@ using MonoDevelop.Ide.Gui;
using MonoDevelop.Components.Commands;
using MonoDevelop.Projects;
using MonoDevelop.Ide;
+using System.Linq;
namespace MonoDevelop.Debugger
{
@@ -63,7 +64,9 @@ namespace MonoDevelop.Debugger
StopEvaluation,
RunToCursor,
SetNextStatement,
- ShowNextStatement
+ ShowNextStatement,
+ NewCatchpoint,
+ NewFunctionBreakpoint
}
class DebugHandler: CommandHandler
@@ -75,7 +78,7 @@ namespace MonoDevelop.Debugger
IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
}
- internal static void BuildAndDebug ()
+ internal async static void BuildAndDebug ()
{
if (!DebuggingService.IsDebuggingSupported && !IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted) {
MonoDevelop.Ide.Commands.StopHandler.StopBuildOperations ();
@@ -94,33 +97,14 @@ namespace MonoDevelop.Debugger
}
// Else continue building
}
- else {
- ExecuteDocument (IdeApp.Workbench.ActiveDocument);
- return;
- }
}
if (IdeApp.Workspace.IsOpen) {
var it = GetRunTarget ();
- IAsyncOperation op = IdeApp.ProjectOperations.Build (it);
- op.Completed += delegate {
- if (op.SuccessWithWarnings && !IdeApp.Preferences.RunWithWarnings)
- return;
- if (op.Success)
- ExecuteSolution (it);
- };
- } else {
- Document doc = IdeApp.Workbench.ActiveDocument;
- if (doc != null) {
- doc.Save ();
- IAsyncOperation op = doc.Build ();
- op.Completed += delegate {
- if (op.SuccessWithWarnings && !IdeApp.Preferences.RunWithWarnings)
- return;
- if (op.Success)
- ExecuteDocument (doc);
- };
- }
+ var res = await IdeApp.ProjectOperations.Build (it).Task;
+ if (res.HasErrors || (res.HasWarnings && !IdeApp.Preferences.RunWithWarnings))
+ return;
+ ExecuteSolution (it);
}
}
@@ -132,14 +116,6 @@ namespace MonoDevelop.Debugger
IdeApp.ProjectOperations.Execute (target);
}
- static void ExecuteDocument (Document doc)
- {
- if (doc.CanDebug ())
- doc.Debug ();
- else
- doc.Run ();
- }
-
protected override void Run ()
{
if (DebuggingService.IsPaused) {
@@ -180,8 +156,7 @@ namespace MonoDevelop.Debugger
info.Enabled = canExecute && (IdeApp.ProjectOperations.CurrentRunOperation.IsCompleted || !DebuggingService.IsDebuggingSupported);
} else {
- Document doc = IdeApp.Workbench.ActiveDocument;
- info.Enabled = (doc != null && doc.IsBuildTarget) && (doc.CanRun () || doc.CanDebug ());
+ info.Enabled = false;
}
}
@@ -226,19 +201,16 @@ namespace MonoDevelop.Debugger
class DebugEntryHandler: CommandHandler
{
- protected override void Run ()
+ protected async override void Run ()
{
IBuildTarget entry = IdeApp.ProjectOperations.CurrentSelectedBuildTarget;
DebugHandler.CheckResult cr = DebugHandler.CheckBeforeDebugging (entry);
if (cr == DebugHandler.CheckResult.BuildBeforeRun) {
- IAsyncOperation op = IdeApp.ProjectOperations.Build (entry);
- op.Completed += delegate {
- if (op.SuccessWithWarnings && !IdeApp.Preferences.RunWithWarnings)
- return;
- if (op.Success)
- IdeApp.ProjectOperations.Debug (entry);
- };
+ var res = await IdeApp.ProjectOperations.Build (entry).Task;
+ if (res.HasErrors || (res.HasWarnings && !IdeApp.Preferences.RunWithWarnings))
+ return;
+ IdeApp.ProjectOperations.Debug (entry);
} else if (cr == DebugHandler.CheckResult.Run)
IdeApp.ProjectOperations.Debug (entry);
}
@@ -535,7 +507,7 @@ namespace MonoDevelop.Debugger
}
}
}
-
+
class NewBreakpointHandler: CommandHandler
{
protected override void Run ()
@@ -548,7 +520,27 @@ namespace MonoDevelop.Debugger
breakpoints.Add (bp);
}
}
-
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints);
+ info.Enabled = !DebuggingService.Breakpoints.IsReadOnly;
+ }
+ }
+
+ class NewFunctionBreakpointHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ BreakEvent bp = null;
+ if (DebuggingService.ShowBreakpointProperties (ref bp, BreakpointType.Function)) {
+ var breakpoints = DebuggingService.Breakpoints;
+
+ lock (breakpoints)
+ breakpoints.Add (bp);
+ }
+ }
+
protected override void Update (CommandInfo info)
{
info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Breakpoints);
@@ -556,6 +548,37 @@ namespace MonoDevelop.Debugger
}
}
+ class NewCatchpointHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ BreakEvent bp = null;
+ if (DebuggingService.ShowBreakpointProperties (ref bp, BreakpointType.Catchpoint)) {
+ var breakpoints = DebuggingService.Breakpoints;
+
+ lock (breakpoints)
+ breakpoints.Add (bp);
+ }
+ }
+
+ protected override void Update (CommandInfo info)
+ {
+ info.Visible = DebuggingService.IsFeatureSupported (DebuggerFeatures.Catchpoints);
+ info.Enabled = !DebuggingService.Breakpoints.IsReadOnly;
+ }
+ }
+
+ class ShowBreakpointsHandler: CommandHandler
+ {
+ protected override void Run ()
+ {
+ var breakpointsPad = IdeApp.Workbench.Pads.FirstOrDefault (p => p.Id == "MonoDevelop.Debugger.BreakpointPad");
+ if (breakpointsPad != null) {
+ breakpointsPad.BringToFront ();
+ }
+ }
+ }
+
class RunToCursorHandler : CommandHandler
{
protected override void Run ()
@@ -589,7 +612,7 @@ namespace MonoDevelop.Debugger
info.Enabled = target != null && IdeApp.ProjectOperations.CanDebug (target);
} else {
- info.Enabled = doc.IsBuildTarget && doc.CanDebug ();
+ info.Enabled = false;
}
} else {
info.Enabled = false;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs
index 55cc770269..df9f1806d2 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebugExecutionHandlerFactory.cs
@@ -34,6 +34,7 @@ using MonoDevelop.Core.Execution;
using Mono.Debugging.Client;
using MonoDevelop.Ide.Gui;
using Mono.Debugging;
+using System.Threading.Tasks;
namespace MonoDevelop.Debugger
{
@@ -44,103 +45,36 @@ namespace MonoDevelop.Debugger
return DebuggingService.CanDebugCommand (command);
}
- public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
+ public ProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
{
if (!CanExecute (command))
return null;
- DebugExecutionHandler h = new DebugExecutionHandler (null);
- return h.Execute (command, console);
+ return DebuggingService.Run (command, console);
}
}
-
- class DebugExecutionHandler: IProcessAsyncOperation
+
+ class DebugAsyncOperation: ProcessAsyncOperation
{
- bool done;
ManualResetEvent stopEvent;
- DebuggerEngine factory;
-
- public DebugExecutionHandler (DebuggerEngine factory)
- {
- this.factory = factory;
- DebuggingService.StoppedEvent += new EventHandler (OnStopDebug);
- }
-
- public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
- {
- DebuggingService.InternalRun (command, factory, console);
- return this;
- }
-
- public void Cancel ()
- {
- DebuggingService.Stop ();
- }
-
- public void WaitForCompleted ()
+
+ public DebugAsyncOperation ()
{
- lock (this) {
- if (done) return;
- if (stopEvent == null)
- stopEvent = new ManualResetEvent (false);
- }
- stopEvent.WaitOne ();
- }
-
- public int ExitCode {
- get { return 0; }
- }
-
- public bool IsCompleted {
- get { return done; }
- }
-
- public bool Success {
- get { return true; }
+ stopEvent = new ManualResetEvent (false);
+ DebuggingService.StoppedEvent += OnStopDebug;
+ CancellationTokenSource = new CancellationTokenSource ();
+ CancellationTokenSource.Token.Register (DebuggingService.Stop);
+ Task = Task.Factory.StartNew (() => stopEvent.WaitOne ());
}
- public bool SuccessWithWarnings {
- get { return true; }
+ public void Cleanup ()
+ {
+ stopEvent.Set (); // Just in case there was something running
+ DebuggingService.StoppedEvent -= OnStopDebug;
}
void OnStopDebug (object sender, EventArgs args)
{
- lock (this) {
- done = true;
- if (stopEvent != null)
- stopEvent.Set ();
- if (completedEvent != null)
- completedEvent (this);
- }
-
- DebuggingService.StoppedEvent -= new EventHandler (OnStopDebug);
- }
-
- event OperationHandler IAsyncOperation.Completed {
- add {
- bool raiseNow = false;
- lock (this) {
- if (done)
- raiseNow = true;
- else
- completedEvent += value;
- }
- if (raiseNow)
- value (this);
- }
- remove {
- lock (this) {
- completedEvent -= value;
- }
- }
- }
-
- //FIXME:
- public int ProcessId {
- get { return -1; }
+ stopEvent.Set ();
}
-
- event OperationHandler completedEvent;
-
- void IDisposable.Dispose () {}
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
index 31b1c55808..05050e81b0 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs
@@ -46,6 +46,7 @@ using ICSharpCode.NRefactory.Semantics;
*/
using MonoDevelop.Ide.TextEditing;
using System.Linq;
+using System.Threading.Tasks;
namespace MonoDevelop.Debugger
{
@@ -76,6 +77,8 @@ namespace MonoDevelop.Debugger
static StatusBarIcon busyStatusIcon;
static bool isBusy;
+ static DebugAsyncOperation currentDebugOperation = new DebugAsyncOperation ();
+
static public event EventHandler DebugSessionStarted;
static public event EventHandler PausedEvent;
static public event EventHandler ResumedEvent;
@@ -187,9 +190,9 @@ namespace MonoDevelop.Debugger
MessageService.ShowCustomDialog (dlg);
}
- public static bool ShowBreakpointProperties (ref BreakEvent bp)
+ public static bool ShowBreakpointProperties (ref BreakEvent bp, BreakpointType breakpointType = BreakpointType.Location)
{
- using (var dlg = new BreakpointPropertiesDialog (bp)) {
+ using (var dlg = new BreakpointPropertiesDialog (bp, breakpointType)) {
Xwt.Command response = dlg.Run ();
if (bp == null)
bp = dlg.GetBreakEvent ();
@@ -303,6 +306,7 @@ namespace MonoDevelop.Debugger
session.ConnectionDialogCreator = delegate {
return new StatusBarConnectionDialog ();
};
+ currentDebugOperation = new DebugAsyncOperation ();
console.CancelRequested += OnCancelRequested;
@@ -353,7 +357,8 @@ namespace MonoDevelop.Debugger
currentSession.TypeResolverHandler = null;
currentSession.OutputWriter = null;
currentSession.LogWriter = null;
-
+ currentDebugOperation.Cleanup ();
+
if (currentConsole != null) {
currentConsole.CancelRequested -= OnCancelRequested;
currentConsole.Dispose ();
@@ -460,20 +465,24 @@ namespace MonoDevelop.Debugger
NotifyLocationChanged ();
}
- public static IProcessAsyncOperation Run (string file, IConsole console)
+ public static ProcessAsyncOperation Run (string file, IConsole console)
{
- var h = new DebugExecutionHandler (null);
var cmd = Runtime.ProcessService.CreateCommand (file);
+ return Run (cmd, console);
+ }
- return h.Execute (cmd, console);
+ public static ProcessAsyncOperation Run (ExecutionCommand cmd, IConsole console, DebuggerEngine engine = null)
+ {
+ InternalRun (cmd, engine, console);
+ return currentDebugOperation;
}
- public static IAsyncOperation AttachToProcess (DebuggerEngine debugger, ProcessInfo proc)
+ public static AsyncOperation AttachToProcess (DebuggerEngine debugger, ProcessInfo proc)
{
currentEngine = debugger;
session = debugger.CreateSession ();
session.ExceptionHandler = ExceptionHandler;
- IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ();
+ ProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ();
console = monitor as IConsole;
SetupSession ();
session.TargetExited += delegate {
@@ -481,7 +490,7 @@ namespace MonoDevelop.Debugger
};
SetDebugLayout ();
session.AttachToProcess (proc, GetUserOptions ());
- return monitor.AsyncOperation;
+ return currentDebugOperation;
}
public static DebuggerSessionOptions GetUserOptions ()
@@ -1022,7 +1031,7 @@ namespace MonoDevelop.Debugger
return SupportedFeatures != DebuggerFeatures.None;
}
- public IProcessAsyncOperation Execute (ExecutionCommand cmd, IConsole console)
+ public ProcessAsyncOperation Execute (ExecutionCommand cmd, IConsole console)
{
// Never called
throw new NotImplementedException ();
@@ -1043,10 +1052,9 @@ namespace MonoDevelop.Debugger
return engine.CanDebugCommand (command);
}
- public IProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
+ public ProcessAsyncOperation Execute (ExecutionCommand command, IConsole console)
{
- var h = new DebugExecutionHandler (engine);
- return h.Execute (command, console);
+ return DebuggingService.Run (command, console, engine);
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
index b8dc53e274..6b65ff6c34 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ExceptionCaughtDialog.cs
@@ -27,6 +27,7 @@
using System;
using System.IO;
+using System.Linq;
using Gtk;
@@ -74,8 +75,8 @@ namespace MonoDevelop.Debugger
Widget CreateExceptionInfoHeader ()
{
- ExceptionMessageLabel = new Label () { UseMarkup = true, Selectable = true, Wrap = true, WidthRequest = 500, Xalign = 0.0f, Yalign = 0.0f };
- ExceptionTypeLabel = new Label () { UseMarkup = true, Xalign = 0.0f };
+ ExceptionMessageLabel = new Label { UseMarkup = true, Selectable = true, Wrap = true, WidthRequest = 500, Xalign = 0.0f, Yalign = 0.0f };
+ ExceptionTypeLabel = new Label { UseMarkup = true, Xalign = 0.0f };
ExceptionMessageLabel.Show ();
ExceptionTypeLabel.Show ();
@@ -124,7 +125,7 @@ namespace MonoDevelop.Debugger
ExceptionValueTreeView.Selection.Changed += ExceptionValueSelectionChanged;
ExceptionValueTreeView.Show ();
- var scrolled = new ScrolledWindow () { HeightRequest = 180 };
+ var scrolled = new ScrolledWindow { HeightRequest = 180, HscrollbarPolicy = PolicyType.Automatic, VscrollbarPolicy = PolicyType.Automatic };
scrolled.ShadowType = ShadowType.None;
scrolled.Add (ExceptionValueTreeView);
@@ -138,17 +139,21 @@ namespace MonoDevelop.Debugger
var frame = (ExceptionStackFrame) model.GetValue (iter, (int) ModelColumn.StackFrame);
var renderer = (StackFrameCellRenderer) cr;
- if (!(renderer.IsStackFrame = frame != null))
+ renderer.Markup = (string) model.GetValue (iter, (int) ModelColumn.Markup);
+
+ if (!(renderer.IsStackFrame = frame != null)) {
+ renderer.IsUserCode = false;
+ renderer.LineNumber = -1;
return;
+ }
renderer.IsUserCode = (bool) model.GetValue (iter, (int) ModelColumn.IsUserCode);
renderer.LineNumber = !string.IsNullOrEmpty (frame.File) ? frame.Line : -1;
- renderer.Markup = (string) model.GetValue (iter, (int) ModelColumn.Markup);
}
Widget CreateStackTraceTreeView ()
{
- var store = new ListStore (typeof (ExceptionStackFrame), typeof (string), typeof (bool), typeof (int), typeof (int));
+ var store = new ListStore (typeof (ExceptionStackFrame), typeof (string), typeof (bool));
StackTraceTreeView = new TreeView (store);
StackTraceTreeView.FixedHeightMode = false;
StackTraceTreeView.HeadersVisible = false;
@@ -164,7 +169,7 @@ namespace MonoDevelop.Debugger
StackTraceTreeView.SizeAllocated += (o, args) => renderer.Width = args.Allocation.Width;
StackTraceTreeView.RowActivated += StackFrameActivated;
- var scrolled = new ScrolledWindow () { HeightRequest = 180 };
+ var scrolled = new ScrolledWindow { HeightRequest = 180, HscrollbarPolicy = PolicyType.Automatic, VscrollbarPolicy = PolicyType.Automatic };
scrolled.ShadowType = ShadowType.None;
scrolled.Add (StackTraceTreeView);
scrolled.Show ();
@@ -174,7 +179,7 @@ namespace MonoDevelop.Debugger
Widget CreateButtonBox ()
{
- var buttons = new HButtonBox () { Layout = ButtonBoxStyle.End, Spacing = 12 };
+ var buttons = new HButtonBox { Layout = ButtonBoxStyle.End, Spacing = 12 };
var copy = new Button (Stock.Copy);
copy.Clicked += CopyClicked;
@@ -194,7 +199,7 @@ namespace MonoDevelop.Debugger
return buttons;
}
- Widget CreateSeparator ()
+ static Widget CreateSeparator ()
{
var separator = new HSeparator ();
separator.Show ();
@@ -297,7 +302,7 @@ namespace MonoDevelop.Debugger
if (frame != null && !string.IsNullOrEmpty (frame.File) && File.Exists (frame.File)) {
try {
- IdeApp.Workbench.OpenDocument (frame.File, null, frame.Line, frame.Column);
+ IdeApp.Workbench.OpenDocument (frame.File, null, frame.Line, frame.Column, MonoDevelop.Ide.Gui.OpenDocumentOptions.Debugger);
} catch (FileNotFoundException) {
}
}
@@ -308,7 +313,7 @@ namespace MonoDevelop.Debugger
if (frame == null || string.IsNullOrEmpty (frame.File))
return false;
- return IdeApp.Workspace.GetProjectContainingFile (frame.File) != null;
+ return IdeApp.Workspace.GetProjectsContainingFile (frame.File).Any ();
}
void ShowStackTrace (ExceptionInfo ex)
@@ -633,11 +638,11 @@ namespace MonoDevelop.Debugger
class ExceptionCaughtButton: TopLevelWidgetExtension
{
+ readonly Xwt.Drawing.Image closeSelOverImage;
+ readonly Xwt.Drawing.Image closeSelImage;
readonly ExceptionCaughtMessage dlg;
readonly ExceptionInfo exception;
- Gtk.Label messageLabel;
- readonly Xwt.Drawing.Image closeSelImage;
- readonly Xwt.Drawing.Image closeSelOverImage;
+ Label messageLabel;
public ExceptionCaughtButton (ExceptionInfo val, ExceptionCaughtMessage dlg, FilePath file, int line)
{
@@ -667,23 +672,23 @@ namespace MonoDevelop.Debugger
var icon = Xwt.Drawing.Image.FromResource ("lightning-light-16.png");
var image = new Xwt.ImageView (icon).ToGtkWidget ();
- HBox box = new HBox (false, 6);
- VBox vb = new VBox ();
+ var box = new HBox (false, 6);
+ var vb = new VBox ();
vb.PackStart (image, false, false, 0);
box.PackStart (vb, false, false, 0);
vb = new VBox (false, 6);
- vb.PackStart (new Gtk.Label () {
+ vb.PackStart (new Label {
Markup = GettextCatalog.GetString ("<b>{0}</b> has been thrown", exception.Type),
Xalign = 0
});
- messageLabel = new Gtk.Label () {
+ messageLabel = new Label {
Xalign = 0,
NoShowAll = true
};
vb.PackStart (messageLabel);
var detailsBtn = new Xwt.LinkLabel (GettextCatalog.GetString ("Show Details"));
- HBox hh = new HBox ();
+ var hh = new HBox ();
detailsBtn.NavigateToUrl += (o,e) => dlg.ShowDialog ();
hh.PackStart (detailsBtn.ToGtkWidget (), false, false, 0);
vb.PackStart (hh, false, false, 0);
@@ -691,7 +696,7 @@ namespace MonoDevelop.Debugger
box.PackStart (vb, true, true, 0);
vb = new VBox ();
- var closeButton = new ImageButton () {
+ var closeButton = new ImageButton {
InactiveImage = closeSelImage,
Image = closeSelOverImage
};
@@ -708,7 +713,7 @@ namespace MonoDevelop.Debugger
};
LoadData ();
- PopoverWidget eb = new PopoverWidget ();
+ var eb = new PopoverWidget ();
eb.ShowArrow = true;
eb.EnableAnimation = true;
eb.PopupPosition = PopupPosition.Left;
@@ -758,12 +763,12 @@ namespace MonoDevelop.Debugger
public override Widget CreateWidget ()
{
- Gtk.EventBox box = new EventBox ();
+ var box = new EventBox ();
box.VisibleWindow = false;
var icon = Xwt.Drawing.Image.FromResource ("lightning-light-16.png");
box.Add (new Xwt.ImageView (icon).ToGtkWidget ());
box.ButtonPressEvent += (o,e) => dlg.ShowButton ();
- PopoverWidget eb = new PopoverWidget ();
+ var eb = new PopoverWidget ();
eb.Theme.Padding = 2;
eb.ShowArrow = true;
eb.EnableAnimation = true;
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs
index 12d1eb8c51..3d929f96c0 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/Extensions.cs
@@ -42,14 +42,14 @@ namespace MonoDevelop.Debugger
return opers.CanExecute (entry, context);
}
- public static IAsyncOperation Debug (this ProjectOperations opers, IBuildTarget entry)
+ public static AsyncOperation Debug (this ProjectOperations opers, IBuildTarget entry)
{
if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
return opers.CurrentRunOperation;
ExecutionContext context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);
- IAsyncOperation op = opers.Execute (entry, context);
+ AsyncOperation op = opers.Execute (entry, context);
SwitchToDebugLayout (op);
return op;
}
@@ -60,13 +60,13 @@ namespace MonoDevelop.Debugger
return opers.CanExecuteFile (file, context);
}
- public static IAsyncOperation DebugFile (this ProjectOperations opers, string file)
+ public static AsyncOperation DebugFile (this ProjectOperations opers, string file)
{
var context = new ExecutionContext (DebuggingService.GetExecutionHandler (), IdeApp.Workbench.ProgressMonitors, IdeApp.Workspace.ActiveExecutionTarget);
return opers.ExecuteFile (file, context);
}
- public static IAsyncOperation DebugApplication (this ProjectOperations opers, string executableFile)
+ public static AsyncOperation DebugApplication (this ProjectOperations opers, string executableFile)
{
if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
return opers.CurrentRunOperation;
@@ -77,18 +77,17 @@ namespace MonoDevelop.Debugger
var monitor = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor ();
var oper = DebuggingService.Run (executableFile, (IConsole) monitor);
- oper.Completed += delegate {
+ opers.CurrentRunOperation = oper;
+
+ oper.Task.ContinueWith (t => {
monitor.Dispose ();
- Gtk.Application.Invoke (delegate {
- IdeApp.Workbench.CurrentLayout = oldLayout;
- });
- };
+ IdeApp.Workbench.CurrentLayout = oldLayout;
+ });
- opers.CurrentRunOperation = monitor.AsyncOperation;
- return opers.CurrentRunOperation;
+ return oper;
}
- public static IAsyncOperation AttachToProcess (this ProjectOperations opers, DebuggerEngine debugger, ProcessInfo proc)
+ public static AsyncOperation AttachToProcess (this ProjectOperations opers, DebuggerEngine debugger, ProcessInfo proc)
{
if (opers.CurrentRunOperation != null && !opers.CurrentRunOperation.IsCompleted)
return opers.CurrentRunOperation;
@@ -100,26 +99,14 @@ namespace MonoDevelop.Debugger
return opers.CurrentRunOperation;
}
- public static IAsyncOperation Debug (this Document doc)
- {
- return IdeApp.ProjectOperations.DebugFile (doc.FileName);
- }
-
- public static bool CanDebug (this Document doc)
- {
- return doc.FileName != FilePath.Null && IdeApp.ProjectOperations.CanDebugFile (doc.FileName);
- }
-
- static void SwitchToDebugLayout (IAsyncOperation oper)
+ static void SwitchToDebugLayout (AsyncOperation oper)
{
string oldLayout = IdeApp.Workbench.CurrentLayout;
IdeApp.Workbench.CurrentLayout = "Debug";
- oper.Completed += delegate {
- DispatchService.GuiDispatch (delegate {
- IdeApp.Workbench.CurrentLayout = oldLayout;
- });
- };
+ oper.Task.ContinueWith (t => {
+ IdeApp.Workbench.CurrentLayout = oldLayout;
+ });
}
}
}
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
index 04a92599ca..892f150861 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs
@@ -558,14 +558,14 @@ namespace MonoDevelop.Debugger
parent = TreeIter.Zero;
if (CanQueryDebugger && frame != null) {
- EvaluationOptions ops = frame.DebuggerSession.Options.EvaluationOptions.Clone ();
- ops.AllowMethodEvaluation = true;
- ops.AllowToStringCalls = true;
- ops.AllowTargetInvoke = true;
- ops.EllipsizeStrings = false;
+ var options = frame.DebuggerSession.Options.EvaluationOptions.Clone ();
+ options.AllowMethodEvaluation = true;
+ options.AllowToStringCalls = true;
+ options.AllowTargetInvoke = true;
+ options.EllipsizeStrings = false;
string oldName = val.Name;
- val.Refresh (ops);
+ val.Refresh (options);
// Don't update the name for the values entered by the user
if (store.IterDepth (iter) == 0)
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
index b20d6f1952..85c087e1b5 100644
--- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
+++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ThreadsPad.cs
@@ -186,13 +186,14 @@ namespace MonoDevelop.Debugger
foreach (var thread in threads) {
ThreadInfo activeThread = DebuggingService.DebuggerSession.ActiveThread;
+ var name = thread.Name == null && thread.Id == 1 ? "Main Thread" : thread.Name;
var weight = thread == activeThread ? Pango.Weight.Bold : Pango.Weight.Normal;
var icon = thread == activeThread ? Gtk.Stock.GoForward : null;
if (iter.Equals (TreeIter.Zero))
- store.AppendValues (icon, thread.Id.ToString (), thread.Name, thread, (int) weight, thread.Location);
+ store.AppendValues (icon, thread.Id.ToString (), name, thread, (int) weight, thread.Location);
else
- store.AppendValues (iter, icon, thread.Id.ToString (), thread.Name, thread, (int) weight, thread.Location);
+ store.AppendValues (iter, icon, thread.Id.ToString (), name, thread, (int) weight, thread.Location);
}
}
@@ -233,7 +234,7 @@ namespace MonoDevelop.Debugger
void OnRowActivated (object s, RowActivatedArgs args)
{
- TreeIter iter, selected;
+ TreeIter selected;
if (!tree.Selection.GetSelected (out selected))
return;
diff --git a/main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.BusyEvaluatorDialog.cs b/main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.BusyEvaluatorDialog.cs
index d496a65960..20c77c6ed8 100644
--- a/main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.BusyEvaluatorDialog.cs
+++ b/main/src/addins/MonoDevelop.Debugger/gtk-gui/MonoDevelop.Debugger.BusyEvaluatorDialog.cs
@@ -56,7 +56,10 @@ namespace MonoDevelop.Debugger
this.labelMethod = new global::Gtk.Label ();
this.labelMethod.Name = "labelMethod";
this.labelMethod.Xalign = 0F;
- this.labelMethod.LabelProp = "<mehtod>";
+ this.labelMethod.LabelProp = "<method>";
+ this.labelMethod.Wrap = true;
+ this.labelMethod.Selectable = true;
+ this.labelMethod.MaxWidthChars = 120;
this.hbox1.Add (this.labelMethod);
global::Gtk.Box.BoxChild w4 = ((global::Gtk.Box.BoxChild)(this.hbox1 [this.labelMethod]));
w4.Position = 1;
diff --git a/main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic
index 0516e36cc0..009262703f 100644
--- a/main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic
+++ b/main/src/addins/MonoDevelop.Debugger/gtk-gui/gui.stetic
@@ -336,7 +336,10 @@
<widget class="Gtk.Label" id="labelMethod">
<property name="MemberName" />
<property name="Xalign">0</property>
- <property name="LabelProp">&lt;mehtod&gt;</property>
+ <property name="LabelProp">&lt;method&gt;</property>
+ <property name="Wrap">True</property>
+ <property name="Selectable">True</property>
+ <property name="MaxWidthChars">120</property>
</widget>
<packing>
<property name="Position">1</property>