internal void Attach (DebuggerSession session) { this.session = session; if (frames != null) { foreach (StackFrame f in frames) f.Attach (session); } }
internal void Attach (DebuggerSession session) { this.session = session; if (currentThreads != null) { foreach (ThreadInfo t in currentThreads) t.Attach (session); } }
internal void AttachSession (DebuggerSession s, BreakEvent ev) { session = s; BreakEvent = ev; session.NotifyBreakEventStatusChanged (BreakEvent); if (adjustedLine != -1) session.AdjustBreakpointLocation ((Breakpoint)BreakEvent, adjustedLine); }
public DebugAsyncOperation (DebuggerSession session) { this.session = session; taskSource = new TaskCompletionSource<int> (); DebuggingService.StoppedEvent += OnStopDebug; CancellationTokenSource = new CancellationTokenSource (); CancellationTokenSource.Token.Register (DebuggingService.Stop); Task = taskSource.Task; }
public override void SetUp () { base.SetUp (); ds = Start ("TestEvaluation"); if (ds == null) Assert.Ignore ("Engine not found: {0}", EngineId); frame = ds.ActiveThread.Backtrace.GetFrame (0); }
public void Cleanup () { if (taskSource != null) { taskSource.SetResult (0); taskSource = null; } DebuggingService.StoppedEvent -= OnStopDebug; session = null; }
internal void Attach (DebuggerSession session) { this.session = session; serverBacktrace = session.WrapDebuggerObject (serverBacktrace); if (frames != null) { foreach (StackFrame f in frames) { f.Attach (session); f.SourceBacktrace = serverBacktrace; } } }
static void Cleanup () { DebuggerSession currentSession; StatusBarIcon currentIcon; IConsole currentConsole; lock (cleanup_lock) { if (!IsDebugging) return; currentIcon = busyStatusIcon; currentSession = session; currentConsole = console; nextStatementLocations.Clear (); currentBacktrace = null; busyStatusIcon = null; session = null; console = null; pinnedWatches.InvalidateAll (); } if (oldLayout != null) { string layout = oldLayout; oldLayout = null; UnsetDebugLayout (layout); } currentSession.BusyStateChanged -= OnBusyStateChanged; currentSession.TargetEvent -= OnTargetEvent; currentSession.TargetStarted -= OnStarted; currentSession.BreakpointTraceHandler = null; currentSession.GetExpressionEvaluator = null; currentSession.TypeResolverHandler = null; currentSession.OutputWriter = null; currentSession.LogWriter = null; if (currentConsole != null) { currentConsole.CancelRequested -= OnCancelRequested; currentConsole.Dispose (); } DispatchService.GuiDispatch (delegate { HideExceptionCaughtDialog (); if (currentIcon != null) { currentIcon.Dispose (); currentIcon = null; } if (StoppedEvent != null) StoppedEvent (null, new EventArgs ()); NotifyCallStackChanged (); NotifyCurrentFrameChanged (); NotifyLocationChanged (); }); currentSession.Dispose (); }
void IRawObject.Connect(DebuggerSession session, EvaluationOptions options) { this.options = options; source = session.WrapDebuggerObject(source); }
public abstract string Resolve (DebuggerSession session, SourceLocation location, string exp);
internal void Attach(DebuggerSession debugSession) { session = debugSession; }
public static IAsyncOperation AttachToProcess (DebuggerEngine debugger, ProcessInfo proc) { currentEngine = debugger; session = debugger.CreateSession (); session.ExceptionHandler = ExceptionHandler; IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor (); console = monitor as IConsole; SetupSession (); session.TargetExited += delegate { monitor.Dispose (); }; session.AttachToProcess (proc, GetUserOptions ()); return monitor.AsyncOperation; }
static void Cleanup () { currentBacktrace = null; if (!IsDebugging) return; if (busyStatusIcon != null) { busyStatusIcon.Dispose (); busyStatusIcon = null; } session.TargetEvent -= OnTargetEvent; session.TargetStarted -= OnStarted; session.OutputWriter = null; session.LogWriter = null; session.ExceptionHandler = null; session.BusyStateChanged -= OnBusyStateChanged; session.TypeResolverHandler = null; session.BreakpointTraceHandler = null; session.GetExpressionEvaluator = null; console.CancelRequested -= OnCancelRequested; // Dispose the session at the end, since it may take a while. DebuggerSession oldSession = session; session = null; if (StoppedEvent != null) StoppedEvent (null, new EventArgs ()); if (console != null) { console.Dispose (); console = null; } DispatchService.GuiDispatch (delegate { NotifyCallStackChanged (); NotifyCurrentFrameChanged (); NotifyLocationChanged (); }); if (oldSession != null) { oldSession.BusyStateChanged -= OnBusyStateChanged; oldSession.Dispose (); } }
internal static void InternalRun (ExecutionCommand cmd, DebuggerEngine factory, IConsole c) { if (factory == null) { factory = GetFactoryForCommand (cmd); if (factory == null) throw new InvalidOperationException ("Unsupported command: " + cmd); } DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo (cmd); startInfo.UseExternalConsole = c is ExternalConsole; startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose; currentEngine = factory; session = factory.CreateSession (); session.Initialize (); console = c; SetupSession (); try { session.Run (startInfo, GetUserOptions ()); } catch { Cleanup (); throw; } }
public NRefactoryExpressionResolverVisitor(DebuggerSession session, SourceLocation location, string expression) { this.expression = expression.Replace ("\n", "").Replace ("\r", ""); this.session = session; this.location = location; }
public InternalDebuggerSession (DebuggerSession session) { this.session = session; }
internal void Attach(DebuggerSession session) { this.session = session; }
void AppendThreads (TreeIter iter, ProcessInfo process, DebuggerSession session) { var threads = process.GetThreads (); Array.Sort (threads, (ThreadInfo t1, ThreadInfo t2) => t1.Id.CompareTo (t2.Id)); session.FetchFrames (threads); var activeThread = session.ActiveThread; foreach (var thread in threads) { var name = thread.Name == null && thread.Id == 1 ? GettextCatalog.GetString ("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 (), name, thread, (int)weight, thread.Location, session); else store.AppendValues (iter, icon, thread.Id.ToString (), name, thread, (int)weight, thread.Location, session); } }
void IRawObject.Connect(DebuggerSession session, EvaluationOptions options) { source = session.WrapDebuggerObject (source); }
string Resolve (DebuggerSession session, SourceLocation location, string exp, bool tryTypeOf) { exp = exp.TrimStart (); if (exp.StartsWith ("?")) return "?" + Resolve (session, location, exp.Substring (1).Trim ()); if (exp.StartsWith ("var ")) return "var " + Resolve (session, location, exp.Substring (4).Trim (' ','\t')); exp = ReplaceExceptionTag (exp, session.Options.EvaluationOptions.CurrentExceptionTag); StringReader codeStream = new StringReader (exp); IParser parser = ParserFactory.CreateParser (SupportedLanguage.CSharp, codeStream); Expression expObj = parser.ParseExpression (); if (expObj == null) return exp; NRefactoryResolverVisitor ev = new NRefactoryResolverVisitor (session, location, exp); expObj.AcceptVisitor (ev, null); string r = ev.GetResolvedExpression (); if (r == exp && !tryTypeOf && (expObj is BinaryOperatorExpression) && IsTypeName (exp)) { // This is a hack to be able to parse expressions such as "List<string>". The NRefactory parser // can parse a single type name, so a solution is to wrap it around a typeof(). We do it if // the evaluation fails. string res = Resolve (session, location, "typeof(" + exp + ")", true); return res.Substring (7, res.Length - 8); } return r; }
public override string Resolve (DebuggerSession session, SourceLocation location, string exp) { return Resolve (session, location, exp, false); }
internal static void InternalRun (ExecutionCommand cmd, DebuggerEngine factory, IConsole c) { if (factory == null) { factory = GetFactoryForCommand (cmd); if (factory == null) throw new InvalidOperationException ("Unsupported command: " + cmd); } DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo (cmd); startInfo.UseExternalConsole = c is ExternalConsole; startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose; currentEngine = factory; session = factory.CreateSession (); session.ExceptionHandler = ExceptionHandler; session.Initialize (); // When using an external console, create a new internal console which will be used // to show the debugger log if (startInfo.UseExternalConsole) console = (IConsole) IdeApp.Workbench.ProgressMonitors.GetOutputProgressMonitor (GettextCatalog.GetString ("Application Output"), Stock.RunProgramIcon, true, true); else console = c; SetupSession (); try { session.Run (startInfo, GetUserOptions ()); } catch { Cleanup (); throw; } }
public void Setup () { ds = Start ("TestEvaluation"); frame = ds.ActiveThread.Backtrace.GetFrame (0); }
public void FillWithSource () { cachedLines.Clear (); StackFrame sf = DebuggingService.CurrentFrame; session = sf.DebuggerSession; if (currentFile != sf.SourceLocation.FileName) { AssemblyLine[] asmLines = sf.DebuggerSession.DisassembleFile (sf.SourceLocation.FileName); if (asmLines == null) { // Mixed disassemble not supported Fill (); return; } currentFile = sf.SourceLocation.FileName; addressLines.Clear (); editor.Text = string.Empty; using (var sr = new StreamReader (sf.SourceLocation.FileName)) { string line; int sourceLine = 1; int na = 0; int editorLine = 1; var sb = new StringBuilder (); var asmLineNums = new List<int> (); while ((line = sr.ReadLine ()) != null) { InsertSourceLine (sb, editorLine++, line); while (na < asmLines.Length && asmLines [na].SourceLine == sourceLine) { asmLineNums.Add (editorLine); InsertAssemblerLine (sb, editorLine++, asmLines [na++]); } sourceLine++; } editor.Text = sb.ToString (); foreach (int li in asmLineNums) editor.AddMarker (li, asmMarker); } } int aline; if (!addressLines.TryGetValue (GetAddrId (sf.Address, sf.AddressSpace), out aline)) return; UpdateCurrentLineMarker (true); }
internal void Attach (DebuggerSession session) { this.session = session; }
void OnStop (object s, EventArgs args) { if (session != s) return; addressLines.Clear (); currentFile = null; if (messageOverlayContent != null) { editor.RemoveOverlay (messageOverlayContent); messageOverlayContent = null; } sw.Sensitive = false; autoRefill = false; editor.Text = string.Empty; cachedLines.Clear (); session = null; }
public override void Setup () { base.Setup (); ds = Start ("TestEvaluation"); frame = ds.ActiveThread.Backtrace.GetFrame (0); }
public override void Dispose () { base.Dispose (); DebuggingService.StoppedEvent -= OnStop; session = null; }
static void Cleanup () { if (oldLayout != null) { string layout = oldLayout; oldLayout = null; // Dispatch asynchronously to avoid start/stop races DispatchService.GuiSyncDispatch (delegate { if (IdeApp.Workbench.CurrentLayout == "Debug") IdeApp.Workbench.CurrentLayout = layout; }); } currentBacktrace = null; if (!IsDebugging) return; if (busyStatusIcon != null) { busyStatusIcon.Dispose (); busyStatusIcon = null; } session.TargetEvent -= OnTargetEvent; session.TargetStarted -= OnStarted; session.OutputWriter = null; session.LogWriter = null; session.BusyStateChanged -= OnBusyStateChanged; session.TypeResolverHandler = null; session.BreakpointTraceHandler = null; session.GetExpressionEvaluator = null; console.CancelRequested -= OnCancelRequested; // Dispose the session at the end, since it may take a while. DebuggerSession oldSession = session; session = null; DispatchService.GuiDispatch (delegate { if (StoppedEvent != null) StoppedEvent (null, new EventArgs ()); }); if (console != null) { console.Dispose (); console = null; } DispatchService.GuiDispatch (delegate { NotifyCallStackChanged (); NotifyCurrentFrameChanged (); NotifyLocationChanged (); }); if (oldSession != null) { oldSession.BusyStateChanged -= OnBusyStateChanged; oldSession.Dispose (); } }
public Executer() { mDebuggerSession = CreateDebuggerSession(); mDebuggerSession.OutputWriter = WriteCallBack; mDebuggerSession.TargetStopped += MDebuggerSession_TargetStopped; }
internal static void InternalRun (ExecutionCommand cmd, DebuggerEngine factory, IConsole c) { if (factory == null) { factory = GetFactoryForCommand (cmd); if (factory == null) throw new InvalidOperationException ("Unsupported command: " + cmd); } if (session != null) throw new InvalidOperationException ("A debugger session is already started"); DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo (cmd); startInfo.UseExternalConsole = c is ExternalConsole; startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose; currentEngine = factory; session = factory.CreateSession (); session.ExceptionHandler = ExceptionHandler; // When using an external console, create a new internal console which will be used // to show the debugger log if (startInfo.UseExternalConsole) console = (IConsole) IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor (); else console = c; SetupSession (); // Dispatch synchronously to avoid start/stop races DispatchService.GuiSyncDispatch (delegate { oldLayout = IdeApp.Workbench.CurrentLayout; IdeApp.Workbench.CurrentLayout = "Debug"; }); try { session.Run (startInfo, GetUserOptions ()); } catch { Cleanup (); throw; } }
public void Setup() { mDebuggerSession = Start(string.Empty); frame = mDebuggerSession.ActiveThread.Backtrace.GetFrame(0); }