public void Store()
        {
            EvaluationOptions ops = options.EvaluationOptions;

            ops.AllowTargetInvoke   = checkAllowEval.Active;
            ops.AllowToStringCalls  = checkToString.Active;
            ops.FlattenHierarchy    = !checkShowBaseGroup.Active;
            ops.GroupPrivateMembers = checkGroupPrivate.Active;
            ops.GroupStaticMembers  = checkGroupStatic.Active;
            int t = (int)spinTimeout.Value;

            ops.EvaluationTimeout = t;

            options.ProjectAssembliesOnly = projectCodeOnly.Active;
            options.EvaluationOptions     = ops;

            DebuggingService.SetUserOptions(options);

            Gtk.TreeIter  it;
            List <string> prios = new List <string> ();

            if (engineStore.GetIterFirst(out it))
            {
                do
                {
                    string id = (string)engineStore.GetValue(it, 0);
                    prios.Add(id);
                } while (engineStore.IterNext(ref it));
            }
            DebuggingService.EnginePriority = prios.ToArray();
        }
        public void Store()
        {
            var ops = options.EvaluationOptions;

            ops.AllowTargetInvoke   = checkAllowEval.Active;
            ops.AllowToStringCalls  = checkAllowToString.Active;
            ops.FlattenHierarchy    = !checkShowBaseGroup.Active;
            ops.GroupPrivateMembers = checkGroupPrivate.Active;
            ops.GroupStaticMembers  = checkGroupStatic.Active;
            ops.EvaluationTimeout   = (int)spinTimeout.Value;

            options.StepOverPropertiesAndOperators = checkStepOverPropertiesAndOperators.Active;
            options.ProjectAssembliesOnly          = checkProjectCodeOnly.Active;
            options.EvaluationOptions = ops;

            DebuggingService.SetUserOptions(options);
        }
Esempio n. 3
0
        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;
            }
        }
Esempio n. 4
0
        public void Store()
        {
            var ops = options.EvaluationOptions;

            ops.AllowTargetInvoke   = checkAllowEval.Active;
            ops.AllowToStringCalls  = checkAllowToString.Active;
            ops.FlattenHierarchy    = !checkShowBaseGroup.Active;
            ops.GroupPrivateMembers = checkGroupPrivate.Active;
            ops.GroupStaticMembers  = checkGroupStatic.Active;
            ops.EvaluationTimeout   = (int)spinTimeout.Value;

            options.StepOverPropertiesAndOperators = checkStepOverPropertiesAndOperators.Active;
            options.ProjectAssembliesOnly          = !checkStepIntoExternalCode.Active;
            options.AutomaticSourceLinkDownload    = (AutomaticSourceDownload)comboAutomaticSourceDownload.SelectedItem;
            options.EvaluationOptions = ops;

            DebuggingService.SetUserOptions(options);
            PropertyService.Set("MonoDevelop.Debugger.DebuggingService.DebuggerLogging", enableLogging.Active);
            PropertyService.Set("MonoDevelop.Debugger.UseNewTreeView", useNewTreeView.Active);
        }
Esempio n. 5
0
		async void OnDownloadSourceClicked (object sender, EventArgs e)
		{
			if (downloading)
				return;

			downloading = true;

			try {
				if (sourceLinkCheckbox != null && sourceLinkCheckbox.Active) {
					options.AutomaticSourceLinkDownload = AutomaticSourceDownload.Always;
					DebuggingService.SetUserOptions (options);
				}

				var doc = await DownloadAndOpenAsync (frame);

				if (doc != null) {
					// close the NoSourceView document tab
					await Document.Close (false);
				}
			} finally {
				downloading = false;
			}
		}
Esempio n. 6
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;
            }
        }
Esempio n. 7
0
        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);
        }