public DebuggerOptionsPanelWidget() { this.Build(); options = DebuggingService.GetUserOptions(); projectCodeOnly.Active = options.ProjectAssembliesOnly; checkAllowEval.Active = options.EvaluationOptions.AllowTargetInvoke; checkToString.Active = options.EvaluationOptions.AllowToStringCalls; checkShowBaseGroup.Active = !options.EvaluationOptions.FlattenHierarchy; checkGroupPrivate.Active = options.EvaluationOptions.GroupPrivateMembers; checkGroupStatic.Active = options.EvaluationOptions.GroupStaticMembers; checkToString.Sensitive = checkAllowEval.Active; spinTimeout.Value = options.EvaluationOptions.EvaluationTimeout; // Debugger priorities engineStore = new Gtk.ListStore(typeof(string), typeof(string)); engineList.Model = engineStore; engineList.AppendColumn("", new Gtk.CellRendererText(), "text", 1); foreach (DebuggerEngine engine in DebuggingService.GetDebuggerEngines()) { engineStore.AppendValues(engine.Id, engine.Name); } UpdatePriorityButtons(); engineList.Selection.Changed += HandleEngineListSelectionChanged; }
void UpdateSelectedException(ExceptionInfo ex) { selected = ex; var model = (ListStore)StackTraceTreeView.Model; bool external = false; model.Clear(); var parentException = ex; while (parentException != null) { foreach (var frame in parentException.StackTrace) { bool isUserCode = IsUserCode(frame); if (OnlyShowMyCodeCheckbox.Active && !isUserCode) { if (!external) { var str = "<b>" + GettextCatalog.GetString("[External Code]") + "</b>"; model.AppendValues(null, str, false); external = true; } continue; } model.AppendValues(frame, null, isUserCode); external = false; } if (!ReverseInnerExceptions.TryGetValue(parentException, out parentException)) { parentException = null; } } ExceptionValueTreeView.ClearAll(); if (!ex.IsEvaluating && ex.Instance != null) { var opts = DebuggingService.GetUserOptions().EvaluationOptions.Clone(); opts.FlattenHierarchy = true; ExceptionValueTreeView.AddValues(ex.Instance.GetAllChildren(opts)); } if (ex.StackIsEvaluating) { var str = GettextCatalog.GetString("Loading..."); model.AppendValues(null, str, false); } if (InnerExceptionTypeLabel != null) { InnerExceptionTypeLabel.Markup = "<b>" + GLib.Markup.EscapeText(ex.Type) + "</b>"; InnerExceptionMessageLabel.Text = ex.Message; } }
public DebuggerOptionsPanelWidget() { Build(); options = DebuggingService.GetUserOptions(); checkProjectCodeOnly.Active = options.ProjectAssembliesOnly; checkStepOverPropertiesAndOperators.Active = options.StepOverPropertiesAndOperators; checkAllowEval.Active = options.EvaluationOptions.AllowTargetInvoke; checkAllowToString.Active = options.EvaluationOptions.AllowToStringCalls; checkShowBaseGroup.Active = !options.EvaluationOptions.FlattenHierarchy; checkGroupPrivate.Active = options.EvaluationOptions.GroupPrivateMembers; checkGroupStatic.Active = options.EvaluationOptions.GroupStaticMembers; checkAllowToString.Sensitive = checkAllowEval.Active; spinTimeout.Value = options.EvaluationOptions.EvaluationTimeout; }
void Build() { Title = GettextCatalog.GetString("Exception Caught"); DefaultHeight = 500; DefaultWidth = 600; VBox.Spacing = 0; VBox.PackStart(CreateExceptionHeader(), false, true, 0); var paned = new VPaned(); paned.Add1(CreateExceptionValueTreeView()); paned.Add2(CreateStackTraceTreeView()); paned.Show(); var vbox = new VBox(false, 0); vbox.PackStart(CreateSeparator(), false, true, 0); vbox.PackStart(paned, true, true, 0); vbox.PackStart(CreateSeparator(), false, true, 0); vbox.Show(); VBox.PackStart(vbox, true, true, 0); var actionArea = new HBox(false, 12) { BorderWidth = 6 }; OnlyShowMyCodeCheckbox = new CheckButton(GettextCatalog.GetString("_Only show my code.")); OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled; OnlyShowMyCodeCheckbox.Show(); OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions().ProjectAssembliesOnly; var alignment = new Alignment(0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox }; alignment.Show(); actionArea.PackStart(alignment, true, true, 0); actionArea.PackStart(CreateButtonBox(), false, true, 0); actionArea.Show(); VBox.PackStart(actionArea, false, true, 0); ActionArea.Hide(); }
static EvaluationOptions GetEvaluationOptions(bool membersPrint) { var ops = DebuggingService.GetUserOptions().EvaluationOptions; if (!membersPrint) { ops.AllowMethodEvaluation = true; ops.AllowToStringCalls = true; ops.AllowTargetInvoke = true; } ops.EvaluationTimeout = 20000; ops.EllipsizeStrings = false; ops.MemberEvaluationTimeout = 20000; ops.GroupPrivateMembers = false; return(ops); }
public DebuggerOptionsPanelWidget() { Build(); options = DebuggingService.GetUserOptions(); checkStepIntoExternalCode.Active = !options.ProjectAssembliesOnly; comboAutomaticSourceDownload.SelectedItem = PropertyService.Get("MonoDevelop.Debugger.DebuggingService.AutomaticSourceDownload", AutomaticSourceDownload.Ask); checkStepOverPropertiesAndOperators.Active = options.StepOverPropertiesAndOperators; checkAllowEval.Active = options.EvaluationOptions.AllowTargetInvoke; checkAllowToString.Active = options.EvaluationOptions.AllowToStringCalls; checkShowBaseGroup.Active = !options.EvaluationOptions.FlattenHierarchy; checkGroupPrivate.Active = options.EvaluationOptions.GroupPrivateMembers; checkGroupStatic.Active = options.EvaluationOptions.GroupStaticMembers; checkAllowToString.Sensitive = checkAllowEval.Active; spinTimeout.Value = options.EvaluationOptions.EvaluationTimeout; enableLogging.Active = PropertyService.Get("MonoDevelop.Debugger.DebuggingService.DebuggerLogging", false); useNewTreeView.Active = PropertyService.Get("MonoDevelop.Debugger.UseNewTreeView", true); }
void ActivateFrame() { var selected = tree.Selection.GetSelectedRows(); TreeIter iter; if (selected.Length > 0 && store.GetIter(out iter, selected [0])) { var frameIndex = (int)store.GetValue(iter, FrameIndexColumn); if (frameIndex == -1) { var opts = DebuggingService.GetUserOptions(); opts.EvaluationOptions.StackFrameFormat.ExternalCode = true; DebuggingService.SetUserOptions(opts); UpdateDisplay(); return; } DebuggingService.CurrentFrameIndex = frameIndex; } }
async void OnFrameChanged(object s, EventArgs a) { if (changingFrame) { return; } changingFrame = true; try { if (disassemblyDoc != null && DebuggingService.IsFeatureSupported(DebuggerFeatures.Disassembly)) { disassemblyView.Update(); } var frame = DebuggingService.CurrentFrame; if (frame == null) { return; } var debuggerOptions = DebuggingService.GetUserOptions(); FilePath file = frame.SourceLocation.FileName; int line = frame.SourceLocation.Line; if (line != -1) { if (!file.IsNullOrEmpty && File.Exists(file)) { var doc = await IdeApp.Workbench.OpenDocument(file, null, line, 1, OpenDocumentOptions.Debugger); if (doc != null) { return; } } if (frame.SourceLocation.FileHash != null) { var newFilePath = SourceCodeLookup.FindSourceFile(file, frame.SourceLocation.FileHash); if (newFilePath != null && File.Exists(newFilePath)) { frame.UpdateSourceFile(newFilePath); var doc = await IdeApp.Workbench.OpenDocument(newFilePath, null, line, 1, OpenDocumentOptions.Debugger); if (doc != null) { return; } } } var automaticSourceDownload = debuggerOptions.AutomaticSourceLinkDownload; var sourceLink = frame.SourceLocation.SourceLink; if (sourceLink != null && automaticSourceDownload != AutomaticSourceDownload.Never) { var downloadLocation = sourceLink.GetDownloadLocation(symbolCachePath); Document doc = null; // ~/Library/Caches/VisualStudio/8.0/Symbols/org/projectname/git-sha/path/to/file.cs if (!File.Exists(downloadLocation)) { if (automaticSourceDownload == AutomaticSourceDownload.Always) { doc = await NoSourceView.DownloadAndOpenAsync(frame); } } else { // The file has previously been downloaded for a different solution. // We need to map the cached location frame.UpdateSourceFile(downloadLocation); doc = await IdeApp.Workbench.OpenDocument(downloadLocation, null, line, 1, OpenDocumentOptions.Debugger); } if (doc != null) { return; } } } bool disassemblySupported = !string.IsNullOrEmpty(frame.AddressSpace) && DebuggingService.CurrentSessionSupportsFeature(DebuggerFeatures.Disassembly); if (!disassemblySupported && disassemblyDoc != null) { disassemblyDoc.Close().Ignore(); disassemblyDoc = null; disassemblyView = null; } // If disassembly is open don't show NoSourceView if (disassemblyDoc == null) { if (noSourceDoc == null) { noSourceView = new NoSourceView(); noSourceView.Update(debuggerOptions, frame, disassemblySupported); noSourceDoc = await IdeApp.Workbench.OpenDocument(noSourceView, true); noSourceDoc.Closed += delegate { noSourceDoc = null; noSourceView = null; }; } else { noSourceView.Update(debuggerOptions, frame, disassemblySupported); noSourceDoc.Select(); } } else { disassemblyDoc.Select(); } } finally { changingFrame = false; } }
void Build() { Title = GettextCatalog.GetString("Exception Caught"); DefaultWidth = 500; DefaultHeight = 500; HeightRequest = 350; WidthRequest = 350; VBox.Foreach(VBox.Remove); VBox.PackStart(CreateExceptionHeader(), false, true, 0); paned = new VPanedThin(); paned.GrabAreaSize = 10; paned.Pack1(CreateStackTraceTreeView(), true, false); paned.Pack2(CreateExceptionValueTreeView(), true, false); paned.Show(); var vbox = new VBox(false, 0); var whiteBackground = new EventBox(); whiteBackground.Show(); whiteBackground.ModifyBg(StateType.Normal, Ide.Gui.Styles.PrimaryBackgroundColor.ToGdkColor()); whiteBackground.Add(vbox); hadInnerException = HasInnerException(); if (hadInnerException) { vbox.PackStart(new VBox(), false, false, 6); vbox.PackStart(CreateInnerExceptionMessage(), false, true, 0); vbox.ShowAll(); } vbox.PackStart(paned, true, true, 0); vbox.Show(); if (hadInnerException) { var box = new HBox(); box.PackStart(CreateInnerExceptionsTree(), false, false, 0); box.PackStart(whiteBackground, true, true, 0); box.Show(); VBox.PackStart(box, true, true, 0); DefaultWidth = 900; DefaultHeight = 700; WidthRequest = 550; HeightRequest = 450; } else { VBox.PackStart(whiteBackground, true, true, 0); } var actionArea = new HBox(false, 0) { BorderWidth = 14 }; OnlyShowMyCodeCheckbox = new CheckButton(GettextCatalog.GetString("_Only show my code.")); OnlyShowMyCodeCheckbox.Toggled += OnlyShowMyCodeToggled; OnlyShowMyCodeCheckbox.Show(); OnlyShowMyCodeCheckbox.Active = DebuggingService.GetUserOptions().ProjectAssembliesOnly; var alignment = new Alignment(0.0f, 0.5f, 0.0f, 0.0f) { Child = OnlyShowMyCodeCheckbox }; alignment.Show(); actionArea.PackStart(alignment, true, true, 0); actionArea.PackStart(CreateButtonBox(), false, true, 0); actionArea.PackStart(new VBox(), false, true, 3); // dummy just to take extra 6px at end to make it 20pixels actionArea.ShowAll(); VBox.PackStart(actionArea, false, true, 0); }
async void OnFrameChanged(object s, EventArgs a) { if (changingFrame) { return; } try { changingFrame = true; if (disassemblyDoc != null && DebuggingService.IsFeatureSupported(DebuggerFeatures.Disassembly)) { disassemblyView.Update(); } var frame = DebuggingService.CurrentFrame; if (frame == null) { return; } FilePath file = frame.SourceLocation.FileName; int line = frame.SourceLocation.Line; if (line != -1) { if (!file.IsNullOrEmpty && File.Exists(file)) { var doc = await IdeApp.Workbench.OpenDocument(file, null, line, 1, OpenDocumentOptions.Debugger); if (doc != null) { return; } } bool alternateLocationExists = false; if (frame.SourceLocation.FileHash != null) { var newFilePath = SourceCodeLookup.FindSourceFile(file, frame.SourceLocation.FileHash); if (newFilePath != null && File.Exists(newFilePath)) { frame.UpdateSourceFile(newFilePath); var doc = await IdeApp.Workbench.OpenDocument(newFilePath, null, line, 1, OpenDocumentOptions.Debugger); if (doc != null) { return; } } } var debuggerOptions = DebuggingService.GetUserOptions(); var automaticSourceDownload = debuggerOptions.AutomaticSourceLinkDownload; var sourceLink = frame.SourceLocation.SourceLink; if (sourceLink != null && automaticSourceDownload != AutomaticSourceDownload.Never) { var downloadLocation = sourceLink.GetDownloadLocation(symbolCachePath); Document doc = null; // ~/Library/Caches/VisualStudio/8.0/Symbols/org/projectname/git-sha/path/to/file.cs if (!File.Exists(downloadLocation)) { if (automaticSourceDownload == AutomaticSourceDownload.Always) { doc = await DownloadAndOpenFileAsync(frame, line, sourceLink); } else { var hyperlink = $"<a href='{ sourceLink.Uri }'>{ Path.GetFileName (sourceLink.RelativeFilePath) }</a>"; var stackframeText = $"<b>{frame.FullStackframeText}</b>"; var text = GettextCatalog.GetString ("{0} is a call to external source code. Would you like to get '{1}' and view it?", stackframeText, hyperlink); var message = new Ide.GenericMessage { Text = GettextCatalog.GetString("External source code available"), SecondaryText = text }; message.AddOption(nameof(automaticSourceDownload), GettextCatalog.GetString("Always get source code automatically"), false); message.Buttons.Add(AlertButton.Cancel); message.Buttons.Add(new AlertButton(GettextCatalog.GetString("Get and Open"))); message.DefaultButton = 1; var didNotCancel = MessageService.GenericAlert(message) != AlertButton.Cancel; if (didNotCancel) { if (message.GetOptionValue(nameof(automaticSourceDownload))) { debuggerOptions.AutomaticSourceLinkDownload = AutomaticSourceDownload.Always; DebuggingService.SetUserOptions(debuggerOptions); } doc = await DownloadAndOpenFileAsync(frame, line, sourceLink); } } } else { // The file has previously been downloaded for a different solution. // We need to map the cached location frame.UpdateSourceFile(downloadLocation); doc = await IdeApp.Workbench.OpenDocument(downloadLocation, null, line, 1, OpenDocumentOptions.Debugger); } if (doc != null) { return; } } } bool disassemblyNotSupported = false; // If we don't have an address space, we can't disassemble if (string.IsNullOrEmpty(frame.AddressSpace)) { disassemblyNotSupported = true; } if (!DebuggingService.CurrentSessionSupportsFeature(DebuggerFeatures.Disassembly)) { disassemblyNotSupported = true; } if (disassemblyNotSupported && disassemblyDoc != null) { disassemblyDoc.Close().Ignore(); disassemblyDoc = null; disassemblyView = null; } // If disassembly is open don't show NoSourceView if (disassemblyDoc == null) { if (noSourceDoc == null) { noSourceView = new NoSourceView(); noSourceView.Update(disassemblyNotSupported); noSourceDoc = await IdeApp.Workbench.OpenDocument(noSourceView, true); noSourceDoc.Closed += delegate { noSourceDoc = null; noSourceView = null; }; } else { noSourceView.Update(disassemblyNotSupported); noSourceDoc.Select(); } } else { disassemblyDoc.Select(); } } finally { changingFrame = false; } }
void UpdateSelectedException(ExceptionInfo ex) { selected = ex; var model = (ListStore)stackTraceTreeView.Model; bool external = false; model.Clear(); var parentException = ex; while (parentException != null) { foreach (var frame in parentException.StackTrace) { bool isUserCode = IsUserCode(frame); if (onlyShowMyCodeCheckbox.Active && !isUserCode) { if (!external) { var str = "<b>" + GettextCatalog.GetString("[External Code]") + "</b>"; model.AppendValues(null, str, false); external = true; } continue; } model.AppendValues(frame, null, isUserCode); external = false; } if (!reverseInnerExceptions.TryGetValue(parentException, out parentException)) { parentException = null; } } if (useNewTreeView) { controller.ClearAll(); } else { ((ObjectValueTreeView)exceptionValueTreeView).ClearAll(); } if (!ex.IsEvaluating && ex.Instance != null) { var opts = DebuggingService.GetUserOptions().EvaluationOptions.Clone(); opts.FlattenHierarchy = true; var values = ex.Instance.GetAllChildren(opts); if (useNewTreeView) { controller.AddValues(values); } else { ((ObjectValueTreeView)exceptionValueTreeView).AddValues(values); } } if (ex.StackIsEvaluating) { var str = GettextCatalog.GetString("Loading..."); model.AppendValues(null, str, false); } if (innerExceptionTypeLabel != null) { innerExceptionTypeLabel.Markup = "<b>" + GLib.Markup.EscapeText(ex.Type) + "</b>"; innerExceptionMessageLabel.Text = ex.Message; if (!string.IsNullOrEmpty(ex.HelpLink)) { innerExceptionHelpLinkButton.Label = GettextCatalog.GetString("Read More…"); innerExceptionHelpLink = ex.HelpLink; innerExceptionHelpLinkButton.Show(); } else { innerExceptionHelpLink = string.Empty; innerExceptionHelpLinkButton.Hide(); } } }
void ShowPopup(Gdk.EventButton evt) { var context_menu = new ContextMenu(); context_menu.Items.Add(new SeparatorContextMenuItem()); var selectAllItem = new ContextMenuItem(GettextCatalog.GetString("Select All")); selectAllItem.Clicked += delegate { OnSelectAll(); }; context_menu.Items.Add(selectAllItem); var copyItem = new ContextMenuItem(GettextCatalog.GetString("Copy")); copyItem.Clicked += delegate { OnCopy(); }; context_menu.Items.Add(copyItem); context_menu.Items.Add(new SeparatorContextMenuItem()); var showExternalCodeCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Show External Code")); showExternalCodeCheckbox.Clicked += delegate { var opts = DebuggingService.GetUserOptions(); opts.EvaluationOptions.StackFrameFormat.ExternalCode = showExternalCodeCheckbox.Checked = !GetExternalCodeValue(opts); DebuggingService.SetUserOptions(opts); UpdateDisplay(); }; var userOptions = DebuggingService.GetUserOptions(); var frameOptions = userOptions.EvaluationOptions.StackFrameFormat; showExternalCodeCheckbox.Checked = GetExternalCodeValue(userOptions); context_menu.Items.Add(showExternalCodeCheckbox); context_menu.Items.Add(new SeparatorContextMenuItem()); var assemblyCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Show Module Name")); assemblyCheckbox.Clicked += delegate { var opts = DebuggingService.GetUserOptions(); opts.EvaluationOptions.StackFrameFormat.Module = assemblyCheckbox.Checked = !opts.EvaluationOptions.StackFrameFormat.Module; DebuggingService.SetUserOptions(opts); UpdateDisplay(); }; assemblyCheckbox.Checked = frameOptions.Module; context_menu.Items.Add(assemblyCheckbox); var typeCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Show Parameter Type")); typeCheckbox.Clicked += delegate { var opts = DebuggingService.GetUserOptions(); opts.EvaluationOptions.StackFrameFormat.ParameterTypes = typeCheckbox.Checked = !opts.EvaluationOptions.StackFrameFormat.ParameterTypes; DebuggingService.SetUserOptions(opts); UpdateDisplay(); }; typeCheckbox.Checked = frameOptions.ParameterTypes; context_menu.Items.Add(typeCheckbox); var nameCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Show Parameter Name")); nameCheckbox.Clicked += delegate { var opts = DebuggingService.GetUserOptions(); opts.EvaluationOptions.StackFrameFormat.ParameterNames = nameCheckbox.Checked = !opts.EvaluationOptions.StackFrameFormat.ParameterNames; DebuggingService.SetUserOptions(opts); UpdateDisplay(); }; nameCheckbox.Checked = frameOptions.ParameterNames; context_menu.Items.Add(nameCheckbox); var valueCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Show Parameter Value")); valueCheckbox.Clicked += delegate { var opts = DebuggingService.GetUserOptions(); opts.EvaluationOptions.StackFrameFormat.ParameterValues = valueCheckbox.Checked = !opts.EvaluationOptions.StackFrameFormat.ParameterValues; DebuggingService.SetUserOptions(opts); UpdateDisplay(); }; valueCheckbox.Checked = frameOptions.ParameterValues; context_menu.Items.Add(valueCheckbox); var lineCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Show Line Number")); lineCheckbox.Clicked += delegate { var opts = DebuggingService.GetUserOptions(); opts.EvaluationOptions.StackFrameFormat.Line = lineCheckbox.Checked = !opts.EvaluationOptions.StackFrameFormat.Line; DebuggingService.SetUserOptions(opts); UpdateDisplay(); }; lineCheckbox.Checked = frameOptions.Line; context_menu.Items.Add(lineCheckbox); context_menu.Items.Add(new SeparatorContextMenuItem()); var columnsVisibilitySubMenu = new ContextMenu(); var nameColumnVisibilityCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Name")); nameColumnVisibilityCheckbox.Clicked += delegate { nameColumnVisibilityCheckbox.Checked = tree.Columns [MethodColumn].Visible = !tree.Columns [MethodColumn].Visible; StoreColumnsVisibility(); }; nameColumnVisibilityCheckbox.Checked = tree.Columns [MethodColumn].Visible; columnsVisibilitySubMenu.Items.Add(nameColumnVisibilityCheckbox); var fileColumnVisibilityCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("File")); fileColumnVisibilityCheckbox.Clicked += delegate { fileColumnVisibilityCheckbox.Checked = tree.Columns [FileColumn].Visible = !tree.Columns [FileColumn].Visible; StoreColumnsVisibility(); }; fileColumnVisibilityCheckbox.Checked = tree.Columns [FileColumn].Visible; columnsVisibilitySubMenu.Items.Add(fileColumnVisibilityCheckbox); var languageColumnVisibilityCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Language")); languageColumnVisibilityCheckbox.Clicked += delegate { languageColumnVisibilityCheckbox.Checked = tree.Columns [LangColumn].Visible = !tree.Columns [LangColumn].Visible; StoreColumnsVisibility(); }; languageColumnVisibilityCheckbox.Checked = tree.Columns [LangColumn].Visible; columnsVisibilitySubMenu.Items.Add(languageColumnVisibilityCheckbox); var addressColumnVisibilityCheckbox = new CheckBoxContextMenuItem(GettextCatalog.GetString("Address")); addressColumnVisibilityCheckbox.Clicked += delegate { addressColumnVisibilityCheckbox.Checked = tree.Columns [AddrColumn].Visible = !tree.Columns [AddrColumn].Visible; StoreColumnsVisibility(); }; addressColumnVisibilityCheckbox.Checked = tree.Columns [AddrColumn].Visible; columnsVisibilitySubMenu.Items.Add(addressColumnVisibilityCheckbox); context_menu.Items.Add(new ContextMenuItem(GettextCatalog.GetString("Columns")) { SubMenu = columnsVisibilitySubMenu }); context_menu.Show(this, evt); }