diff options
author | Jeffrey Stedfast <jestedfa@microsoft.com> | 2019-05-02 18:47:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-02 18:47:03 +0300 |
commit | 9a1eac0e062c596775bf5449128684cca231e9f2 (patch) | |
tree | cacd3eb955715053867dbd095a5fcfba2d5570ae /main/src/addins/MonoDevelop.Debugger | |
parent | b9d13c5a484a37370617a52d8bafdf120a366e26 (diff) | |
parent | e1a4319281daeaf29259e79ce9ebb28031131fbe (diff) |
Merge pull request #657 from xamarin/jstedfast-debugger-variable-synchronization
[Debugger] Keep variable values synchronized across all debugger pads
Diffstat (limited to 'main/src/addins/MonoDevelop.Debugger')
7 files changed, 104 insertions, 49 deletions
diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs index 125863dc57..87683dd53f 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger.Visualizer/ValueVisualizerDialog.cs @@ -1,4 +1,4 @@ -// +// // ValueViewerDialog.cs // // Author: @@ -116,8 +116,14 @@ namespace MonoDevelop.Debugger.Viewers protected virtual void OnSaveClicked (object sender, EventArgs e) { - if (currentVisualizer == null || currentVisualizer.StoreValue (value)) + bool saved = false; + + if (currentVisualizer == null || (saved = currentVisualizer.StoreValue (value))) { Respond (Gtk.ResponseType.Ok); + + if (saved) + DebuggingService.NotifyVariableChanged (); + } } } } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs index e1fae83fb1..b338b7e708 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/DebuggingService.cs @@ -87,6 +87,7 @@ namespace MonoDevelop.Debugger static public event EventHandler CallStackChanged; static public event EventHandler CurrentFrameChanged; static public event EventHandler ExecutionLocationChanged; + static public event EventHandler VariableChanged; static public event EventHandler DisassemblyRequested; static public event EventHandler<DocumentEventArgs> DisableConditionalCompilation; @@ -1052,22 +1053,26 @@ namespace MonoDevelop.Debugger static void NotifyLocationChanged () { Runtime.AssertMainThread (); - if (ExecutionLocationChanged != null) - ExecutionLocationChanged (null, EventArgs.Empty); + + ExecutionLocationChanged?.Invoke (null, EventArgs.Empty); } static void NotifyCurrentFrameChanged () { if (currentBacktrace != null) pinnedWatches.InvalidateAll (); - if (CurrentFrameChanged != null) - CurrentFrameChanged (null, EventArgs.Empty); + + CurrentFrameChanged?.Invoke (null, EventArgs.Empty); } static void NotifyCallStackChanged () { - if (CallStackChanged != null) - CallStackChanged (null, EventArgs.Empty); + CallStackChanged?.Invoke (null, EventArgs.Empty); + } + + internal static void NotifyVariableChanged () + { + VariableChanged?.Invoke (null, EventArgs.Empty); } public static void Stop () diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs index 2a87c69c2d..a124f29236 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ImmediatePad.cs @@ -1,4 +1,4 @@ -// +// // ImmediatePad.cs // // Authors: Lluis Sanchez Gual <lluis@novell.com> @@ -78,9 +78,11 @@ namespace MonoDevelop.Debugger var val = frame.GetExpressionValue (expression, ops); if (val.IsEvaluating) { WaitForCompleted (val, frame.DebuggerSession); + DebuggingService.NotifyVariableChanged (); return; } + DebuggingService.NotifyVariableChanged (); PrintValue (val); } } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs index e0c66098b2..f8c4ea4717 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/LocalsPad.cs @@ -25,9 +25,6 @@ // // -using System; -using Mono.Debugging.Client; -using System.Collections.Generic; using System.Linq; namespace MonoDevelop.Debugger @@ -40,17 +37,27 @@ namespace MonoDevelop.Debugger tree.AllowAdding = false; } - public override void OnUpdateList () + void ReloadValues () { - base.OnUpdateList (); - var frame = DebuggingService.CurrentFrame; - + if (frame == null) return; tree.ClearValues (); tree.AddValues (frame.GetAllLocals ().Where (l => !string.IsNullOrWhiteSpace (l.Name) && l.Name != "?").ToArray ()); } + + public override void OnUpdateFrame () + { + base.OnUpdateFrame (); + ReloadValues (); + } + + public override void OnUpdateValues () + { + base.OnUpdateValues (); + ReloadValues (); + } } } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs index bb97027184..2f4e1dbab9 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValuePad.cs @@ -1,4 +1,4 @@ -// ObjectValuePad.cs +// ObjectValuePad.cs // // Author: // Lluis Sanchez Gual <lluis@novell.com> @@ -26,6 +26,8 @@ // using System; +using System.Collections.Generic; + using Gtk; using MonoDevelop.Ide.Gui; using Mono.Debugging.Client; @@ -33,45 +35,49 @@ using MonoDevelop.Components; namespace MonoDevelop.Debugger { - public class ObjectValuePad: PadContent + public class ObjectValuePad : PadContent { protected ObjectValueTreeView tree; readonly ScrolledWindow scrolled; - bool needsUpdate; + bool needsUpdateValues; + bool needsUpdateFrame; bool initialResume; StackFrame lastFrame; PadFontChanger fontChanger; - + public override Control Control { get { return scrolled; } } - + public ObjectValuePad () { scrolled = new ScrolledWindow (); scrolled.HscrollbarPolicy = PolicyType.Automatic; scrolled.VscrollbarPolicy = PolicyType.Automatic; - + tree = new ObjectValueTreeView (); - + fontChanger = new PadFontChanger (tree, tree.SetCustomFont, tree.QueueResize); - + tree.AllowEditing = true; tree.AllowAdding = false; tree.HeadersVisible = true; tree.RulesHint = true; scrolled.Add (tree); scrolled.ShowAll (); - + DebuggingService.CurrentFrameChanged += OnFrameChanged; DebuggingService.PausedEvent += OnDebuggerPaused; DebuggingService.ResumedEvent += OnDebuggerResumed; DebuggingService.StoppedEvent += OnDebuggerStopped; DebuggingService.EvaluationOptionsChanged += OnEvaluationOptionsChanged; + DebuggingService.VariableChanged += OnVariableChanged; + + needsUpdateValues = false; + needsUpdateFrame = true; - needsUpdate = true; //If pad is created/opened while debugging... initialResume = !DebuggingService.IsDebugging; } @@ -80,7 +86,7 @@ namespace MonoDevelop.Debugger { if (fontChanger == null) return; - + fontChanger.Dispose (); fontChanger = null; DebuggingService.CurrentFrameChanged -= OnFrameChanged; @@ -88,37 +94,58 @@ namespace MonoDevelop.Debugger DebuggingService.ResumedEvent -= OnDebuggerResumed; DebuggingService.StoppedEvent -= OnDebuggerStopped; DebuggingService.EvaluationOptionsChanged -= OnEvaluationOptionsChanged; + DebuggingService.VariableChanged -= OnVariableChanged; base.Dispose (); } protected override void Initialize (IPadWindow container) { container.PadContentShown += delegate { - if (needsUpdate) - OnUpdateList (); + if (needsUpdateFrame) + OnUpdateFrame (); + else if (needsUpdateValues) + OnUpdateValues (); }; } - public virtual void OnUpdateList () + public virtual void OnUpdateFrame () { - needsUpdate = false; + needsUpdateValues = false; + needsUpdateFrame = false; + if (DebuggingService.CurrentFrame != lastFrame) tree.Frame = DebuggingService.CurrentFrame; lastFrame = DebuggingService.CurrentFrame; } - + + public virtual void OnUpdateValues () + { + needsUpdateValues = false; + } + protected virtual void OnFrameChanged (object s, EventArgs a) { - if (Window != null && Window.ContentVisible) - OnUpdateList (); - else - needsUpdate = true; + if (Window != null && Window.ContentVisible) { + OnUpdateFrame (); + } else { + needsUpdateFrame = true; + needsUpdateValues = false; + } } - + + protected virtual void OnVariableChanged (object s, EventArgs e) + { + if (Window != null && Window.ContentVisible) { + OnUpdateValues (); + } else { + needsUpdateValues = true; + } + } + protected virtual void OnDebuggerPaused (object s, EventArgs a) { } - + protected virtual void OnDebuggerResumed (object s, EventArgs a) { if (!initialResume) @@ -127,7 +154,7 @@ namespace MonoDevelop.Debugger tree.ClearValues (); initialResume = false; } - + protected virtual void OnDebuggerStopped (object s, EventArgs a) { if (DebuggingService.IsDebugging) @@ -137,15 +164,15 @@ namespace MonoDevelop.Debugger lastFrame = null; initialResume = true; } - + protected virtual void OnEvaluationOptionsChanged (object s, EventArgs a) { if (!DebuggingService.IsRunning) { lastFrame = null; if (Window != null && Window.ContentVisible) - OnUpdateList (); + OnUpdateFrame (); else - needsUpdate = true; + needsUpdateFrame = true; } } } diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs index f65ce158c5..a7f5cb353d 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/ObjectValueTreeView.cs @@ -1509,14 +1509,14 @@ namespace MonoDevelop.Debugger try { string newVal = args.NewText; -/* if (newVal == null) { - MessageService.ShowError (GettextCatalog.GetString ("Unregognized escape sequence.")); + + if (val.Value == newVal) return; - } -*/ if (val.Value != newVal) - val.Value = newVal; + + val.Value = newVal; } catch (Exception ex) { LoggingService.LogError ("Could not set value for object '" + val.Name + "'", ex); + return; } store.SetValue (it, ValueColumn, val.DisplayValue); @@ -1535,6 +1535,8 @@ namespace MonoDevelop.Debugger store.SetValue (it, NameColorColumn, newColor); store.SetValue (it, ValueColorColumn, newColor); UpdateParentValue (it); + + DebuggingService.NotifyVariableChanged (); } private void UpdateParentValue (TreeIter it) diff --git a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/WatchPad.cs b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/WatchPad.cs index 368d044603..60b2e82043 100644 --- a/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/WatchPad.cs +++ b/main/src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/WatchPad.cs @@ -70,9 +70,15 @@ namespace MonoDevelop.Debugger { tree.AddExpression (expression); } - + + public override void OnUpdateValues () + { + base.OnUpdateValues (); + tree.Update (); + } + #region IMementoCapable implementation - + public ICustomXmlSerializer Memento { get { return this; |