SharpTreeNodeAdapter MakeNode(string name) { LoggingService.Info("Evaluating watch: " + name); TreeNode node = null; try { node = new ValueNode(null, name, () => { if (string.IsNullOrWhiteSpace(name)) { return(null); } return(WindowsDebugger.Evaluate(name)); }); } catch (GetValueException e) { node = new TreeNode(null, name, e.Message, string.Empty, null); } node.CanDelete = true; node.CanSetName = true; node.PropertyChanged += (s, e) => { if (e.PropertyName == "Name") { WindowsDebugger.RefreshPads(); } }; return(node.ToSharpTreeNode()); }
string Evaluate(string code) { Process process = WindowsDebugger.CurrentProcess; StackFrame frame = WindowsDebugger.CurrentStackFrame; if (process == null) { return("No process is being debugged"); } if (process.IsRunning) { return("The process is running"); } if (frame == null) { return("No current execution frame"); } try { var val = WindowsDebugger.Evaluate(code, allowSetValue: true); return(ExpressionEvaluationVisitor.FormatValue(WindowsDebugger.EvalThread, val)); } catch (GetValueException e) { return(e.Message); } }
void FillContextMenuStrip(object sender, RoutedEventArgs e) { var items = listView.SelectedItems.OfType <ThreadItem>(); // Suspended property is safe to access at any point bool suspended = items.All(t => t.Thread.Suspended); ContextMenu menu = sender as ContextMenu; menu.Items.Clear(); MenuItem freezeItem; freezeItem = new MenuItem(); freezeItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.Threads.Freeze"); freezeItem.IsChecked = suspended; freezeItem.Click += delegate { if (WindowsDebugger.CurrentProcess == null || WindowsDebugger.CurrentProcess.IsRunning) { MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotFreezeWhileRunning}", "${res:MainWindow.Windows.Debug.Threads.Freeze}"); return; } foreach (ThreadItem item in items.OfType <ThreadItem>()) { item.Thread.Suspended = !suspended; } WindowsDebugger.RefreshPads(); }; menu.Items.Add(freezeItem); }
ContextMenu CreateMenu() { MenuItem extMethodsItem = new MenuItem(); extMethodsItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowExternalMethods"); extMethodsItem.IsChecked = DebuggingOptions.Instance.ShowExternalMethods; extMethodsItem.Click += delegate { extMethodsItem.IsChecked = DebuggingOptions.Instance.ShowExternalMethods = !DebuggingOptions.Instance.ShowExternalMethods; WindowsDebugger.RefreshPads(); }; MenuItem moduleItem = new MenuItem(); moduleItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowModuleNames"); moduleItem.IsChecked = DebuggingOptions.Instance.ShowModuleNames; moduleItem.Click += delegate { moduleItem.IsChecked = DebuggingOptions.Instance.ShowModuleNames = !DebuggingOptions.Instance.ShowModuleNames; WindowsDebugger.RefreshPads(); }; MenuItem argNamesItem = new MenuItem(); argNamesItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowArgumentNames"); argNamesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentNames; argNamesItem.Click += delegate { argNamesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentNames = !DebuggingOptions.Instance.ShowArgumentNames; WindowsDebugger.RefreshPads(); }; MenuItem argValuesItem = new MenuItem(); argValuesItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowArgumentValues"); argValuesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentValues; argValuesItem.Click += delegate { argValuesItem.IsChecked = DebuggingOptions.Instance.ShowArgumentValues = !DebuggingOptions.Instance.ShowArgumentValues; WindowsDebugger.RefreshPads(); }; MenuItem lineItem = new MenuItem(); lineItem.Header = ResourceService.GetString("MainWindow.Windows.Debug.CallStack.ShowLineNumber"); lineItem.IsChecked = DebuggingOptions.Instance.ShowLineNumbers; lineItem.Click += delegate { lineItem.IsChecked = DebuggingOptions.Instance.ShowLineNumbers = !DebuggingOptions.Instance.ShowLineNumbers; WindowsDebugger.RefreshPads(); }; return(new ContextMenu() { Items = { extMethodsItem, new Separator(), moduleItem, argNamesItem, argValuesItem, lineItem } }); }
public PinDebuggerControl() { InitializeComponent(); if (!DebuggerService.IsDebuggerStarted) { Opacity = MINIMUM_OPACITY; } this.PinCloseControl.Opacity = 0; Loaded += OnLoaded; this.PinCloseControl.Closed += PinCloseControl_Closed; this.PinCloseControl.ShowingComment += PinCloseControl_ShowingComment; this.PinCloseControl.PinningChanged += PinCloseControl_PinningChanged; BookmarkManager.Removed += OnBookmarkRemoved; currentDebugger = (WindowsDebugger)DebuggerService.CurrentDebugger; currentDebugger.DebugStopped += OnDebugStopped; currentDebugger.ProcessSelected += OnProcessSelected; if (currentDebugger.DebuggedProcess != null) { currentDebugger.DebuggedProcess.Paused += OnDebuggedProcessPaused; } }
private void debuggerStarted(object sender, EventArgs e) { WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger; winDebugger.DebuggerCore.Processes.Added -= processAdded; winDebugger.DebuggerCore.Processes.Removed -= processRemoved; }
public ConsolePad() { WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) { editor.Process = e.Process; }; editor.Process = debugger.DebuggedProcess; }
private void deubggerStop(object sender, EventArgs e) { WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger; foreach (KeyValuePair <Process, EnCManager> item in managers) { item.Value.StopEnC(); } }
public override void Run() { if (this.Owner is WatchPad) { WatchPad pad = (WatchPad)this.Owner; pad.Items.Remove(pad.Tree.SelectedItem as SharpTreeNodeAdapter); WindowsDebugger.RefreshPads(); } }
private ObjectGraphWindow() { InitializeComponent(); debuggerService = DebuggerService.CurrentDebugger as WindowsDebugger; if (debuggerService == null) { throw new DebuggerVisualizerException("Only windows debugger is currently supported"); } }
public DebuggerPad() { debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; InitializeComponents(); debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) { SelectProcess(e.Process); }; SelectProcess(debugger.DebuggedProcess); }
public GridVisualizerWindow() { InitializeComponent(); this.debuggerService = DebuggerService.CurrentDebugger as WindowsDebugger; if (debuggerService == null) { throw new ApplicationException("Only windows debugger is currently supported"); } instance = this; this.Deactivated += GridVisualizerWindow_Deactivated; }
public ObjectGraphWindow() { InitializeComponent(); debuggerService = DebuggerService.CurrentDebugger as WindowsDebugger; if (debuggerService == null) { throw new ApplicationException("Only windows debugger is currently supported"); } registerEvents(); instance = this; }
public void Close() { CloseChildPopups(); Unpin(); BookmarkManager.Removed -= OnBookmarkRemoved; if (currentDebugger != null) { currentDebugger.DebugStopped -= OnDebugStopped; currentDebugger.ProcessSelected -= OnProcessSelected; currentDebugger = null; } }
void InitializeComponents() { debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; if (debugger.ServiceInitialized) { InitializeDebugger(); } else { debugger.Initialize += delegate { InitializeDebugger(); }; } }
public ObjectGraphControl() { InitializeComponent(); debuggerService = DebuggerService.CurrentDebugger as WindowsDebugger; if (debuggerService == null) { throw new ApplicationException("Only windows debugger is currently supported"); } this.layoutViewModel = new EnumViewModel <LayoutDirection>(); this.layoutViewModel.PropertyChanged += new PropertyChangedEventHandler(layoutViewModel_PropertyChanged); this.cmbLayoutDirection.DataContext = this.layoutViewModel; this.graphDrawer = new GraphDrawer(this.canvas); }
/// <summary> /// Is called by debugger before continueing in debug. /// </summary> /// <returns>Returns true if succeed.</returns> public bool BeforeContinue() { if (!eventCreator.UpToDate) { lastEvent = eventCreator.GetChanges(); if (!this.patchWithEnC(lastEvent)) { MessageService.ShowError("EnC was not to able to propagate changes. See Errors for detials."); WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger; winDebugger.Stop(); return(false); } eventCreator.Reset(); } return(true); }
void listView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { ThreadItem item = listView.SelectedItem as ThreadItem; if (WindowsDebugger.CurrentProcess != null) { if (WindowsDebugger.CurrentProcess.IsPaused) { WindowsDebugger.CurrentThread = item.Thread; WindowsDebugger.Instance.JumpToCurrentLine(); WindowsDebugger.RefreshPads(); } else { MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotSwitchWhileRunning}", "${res:MainWindow.Windows.Debug.Threads.ThreadSwitch}"); } } }
bool InjectInterpreter() { if (!DebuggerService.IsDebuggerLoaded) { PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorDebuggerNotLoaded")); return(false); } WindowsDebugger winDebugger = DebuggerService.CurrentDebugger as WindowsDebugger; if (winDebugger == null) { PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorIncompatibleDebugger")); return(false); } if (winDebugger.DebuggedProcess == null) { PrintLine(ResourceService.GetString("ICSharpCode.BooInterpreter.Debuggee.ErrorNoProgramDebugged")); return(false); } process = winDebugger.DebuggedProcess; process.Expired += delegate { interpreter = null; }; process.LogMessage -= OnDebuggerLogMessage; process.LogMessage += OnDebuggerLogMessage; Value assembly; // Boo.Lang.Interpreter.dll string path = Path.Combine(Path.GetDirectoryName(typeof(InterpreterContext).Assembly.Location), "Boo.Lang.Interpreter.dll"); assembly = LoadAssembly(path); // Debugger.BooInterpreter.dll assembly = LoadAssembly(typeof(DebugeeInteractiveInterpreter).Assembly.Location); Value interpreterType = Eval.NewString(process, typeof(DebugeeInteractiveInterpreter).FullName); interpreter = Eval.InvokeMethod(process, typeof(Assembly), "CreateInstance", assembly, new Value[] { interpreterType }); interpreter_localVariable = interpreter.GetMember("localVariable"); RunCommand( "import System\n" + "import System.IO\n" + "import System.Text\n" + "interpreter.RememberLastValue = true\n" + "interpreter.Print = def(msg): System.Diagnostics.Debugger.Log(0xB00, \"DebugeeInterpreterContext.PrintLine\", msg)"); return(true); }
IEnumerable <TreeNode> LazyGetChildNodes() { foreach (DebugParameterInfo par in stackFrame.MethodInfo.GetParameters()) { string imageName; var image = ExpressionNode.GetImageForParameter(out imageName); var expression = new ExpressionNode(this, image, par.Name, par.GetExpression()); expression.ImageName = imageName; yield return(expression); } if (this.stackFrame.HasSymbols) { foreach (DebugLocalVariableInfo locVar in stackFrame.MethodInfo.GetLocalVariables(this.StackFrame.IP)) { string imageName; var image = ExpressionNode.GetImageForLocalVariable(out imageName); var expression = new ExpressionNode(this, image, locVar.Name, locVar.GetExpression()); expression.ImageName = imageName; yield return(expression); } } else { WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; if (debugger.debuggerDecompilerService != null) { int typeToken = this.stackFrame.MethodInfo.DeclaringType.MetadataToken; int methodToken = this.stackFrame.MethodInfo.MetadataToken; foreach (var localVar in debugger.debuggerDecompilerService.GetLocalVariables(typeToken, methodToken)) { string imageName; var image = ExpressionNode.GetImageForLocalVariable(out imageName); var expression = new ExpressionNode(this, image, localVar, ExpressionEvaluator.ParseExpression(localVar, SupportedLanguage.CSharp)); expression.ImageName = imageName; yield return(expression); } } } if (stackFrame.Thread.CurrentException != null) { yield return(new ExpressionNode(this, null, "__exception", new IdentifierExpression("__exception"))); } }
public WatchListAutoCompleteCell() { InitializeComponent(); console = new ConsoleControl(); console.TextAreaTextEntered += new TextCompositionEventHandler(consoleControl_TextAreaTextEntered); console.TextAreaPreviewKeyDown += new KeyEventHandler(console_TextAreaPreviewKeyDown); console.LostFocus += new RoutedEventHandler(console_LostFocus); console.HideScrollBar(); ConsolePanel.Content = console; // get language if (ProjectService.CurrentProject == null) { language = "C#"; } else { language = ProjectService.CurrentProject.Language; } resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language)); // FIXME set language if (language == "VB" || language == "VBNet") { console.SetHighlighting("VBNET"); } else { console.SetHighlighting("C#"); } // get process WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) { this.Process = e.Process; }; this.Process = debugger.DebuggedProcess; }
void listView_MouseDoubleClick(object sender, MouseButtonEventArgs e) { CallStackItem item = listView.SelectedItem as CallStackItem; if ((item == null) || (item.Frame == null)) { return; } if (item.Frame.Process.IsPaused) { if (item.Frame != null) { WindowsDebugger.CurrentStackFrame = item.Frame; WindowsDebugger.Instance.JumpToCurrentLine(); WindowsDebugger.RefreshPads(); } } else { MessageService.ShowMessage("${res:MainWindow.Windows.Debug.CallStack.CannotSwitchWhileRunning}", "${res:MainWindow.Windows.Debug.CallStack.FunctionSwitch}"); } }
public DebuggerPad() { // UI this.panel = new DockPanel(); this.toolbar = BuildToolBar(); if (this.toolbar != null) { this.toolbar.SetValue(DockPanel.DockProperty, Dock.Top); this.panel.Children.Add(toolbar); } // logic debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; InitializeComponents(); debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) { SelectProcess(e.Process); }; SelectProcess(debugger.DebuggedProcess); }
public WatchInputBox(string text, string caption) : base() { InitializeComponent(); // UI text = StringParser.Parse(text); this.Title = StringParser.Parse(caption); this.ConsolePanel.Content = console; if (ProjectService.CurrentProject == null) { return; } // get language language = ProjectService.CurrentProject.Language; resolver = new NRefactoryResolver(LanguageProperties.GetLanguage(language)); // FIXME set language if (language == "VB" || language == "VBNet") { console.SetHighlighting("VBNET"); } else { console.SetHighlighting("C#"); } // get process WindowsDebugger debugger = (WindowsDebugger)DebuggerService.CurrentDebugger; debugger.ProcessSelected += delegate(object sender, ProcessEventArgs e) { this.Process = e.Process; }; this.Process = debugger.DebuggedProcess; }
/// <summary> /// Creates ObjectGraphBuilder. /// </summary> /// <param name="debuggerService">Debugger service.</param> public ObjectGraphBuilder(WindowsDebugger debuggerService) { this.debuggerService = debuggerService; }
public ConsolePad() { WindowsDebugger debugger = (WindowsDebugger)SD.Debugger; }