コード例 #1
0
ファイル: Backtrace.cs プロジェクト: segaman/monodevelop
		internal void Attach (DebuggerSession session)
		{
			this.session = session;
			if (frames != null) {
				foreach (StackFrame f in frames)
					f.Attach (session);
			}
		}
コード例 #2
0
ファイル: ProcessInfo.cs プロジェクト: 0xb1dd1e/debugger-libs
		internal void Attach (DebuggerSession session)
		{
			this.session = session;
			if (currentThreads != null) {
				foreach (ThreadInfo t in currentThreads)
					t.Attach (session);
			}
		}
コード例 #3
0
		internal void AttachSession (DebuggerSession s, BreakEvent ev)
		{
			session = s;
			BreakEvent = ev;
			session.NotifyBreakEventStatusChanged (BreakEvent);
			if (adjustedLine != -1)
				session.AdjustBreakpointLocation ((Breakpoint)BreakEvent, adjustedLine);
		}
コード例 #4
0
		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;
		}
コード例 #5
0
		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);
		}
コード例 #6
0
		public void Cleanup ()
		{
			if (taskSource != null) {
				taskSource.SetResult (0);
				taskSource = null;
			}
			DebuggingService.StoppedEvent -= OnStopDebug;
			session = null;
		}
コード例 #7
0
ファイル: Backtrace.cs プロジェクト: 0xb1dd1e/debugger-libs
		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;
				}
			}
		}
コード例 #8
0
		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 ();
		}
コード例 #9
0
 void IRawObject.Connect(DebuggerSession session, EvaluationOptions options)
 {
     this.options = options;
     source       = session.WrapDebuggerObject(source);
 }
コード例 #10
0
		public abstract string Resolve (DebuggerSession session, SourceLocation location, string exp);
コード例 #11
0
 internal void Attach(DebuggerSession debugSession)
 {
     session = debugSession;
 }
コード例 #12
0
		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;
		}
コード例 #13
0
		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 ();
			}
		}
コード例 #14
0
		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;
			}
		}
コード例 #15
0
 public NRefactoryExpressionResolverVisitor(DebuggerSession session, SourceLocation location, string expression)
 {
     this.expression = expression.Replace ("\n", "").Replace ("\r", "");
     this.session = session;
     this.location = location;
 }
コード例 #16
0
		public InternalDebuggerSession (DebuggerSession session)
		{
			this.session = session;
		}
コード例 #17
0
 internal void Attach(DebuggerSession session)
 {
     this.session = session;
 }
コード例 #18
0
ファイル: ThreadsPad.cs プロジェクト: kdubau/monodevelop
		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);
			}
		}
コード例 #19
0
 internal void Attach(DebuggerSession debugSession)
 {
     session = debugSession;
 }
コード例 #20
0
ファイル: RawValue.cs プロジェクト: 0xb1dd1e/debugger-libs
 void IRawObject.Connect(DebuggerSession session, EvaluationOptions options)
 {
     source = session.WrapDebuggerObject (source);
 }
コード例 #21
0
		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;
		}
コード例 #22
0
		public override string Resolve (DebuggerSession session, SourceLocation location, string exp)
		{
			return Resolve (session, location, exp, false);
		}
コード例 #23
0
		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;
			}
		}
コード例 #24
0
		public void Setup ()
		{
			ds = Start ("TestEvaluation");
			frame = ds.ActiveThread.Backtrace.GetFrame (0);
		}
コード例 #25
0
ファイル: DisassemblyView.cs プロジェクト: kdubau/monodevelop
		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);
		}
コード例 #26
0
ファイル: StackFrame.cs プロジェクト: yayanyang/monodevelop
		internal void Attach (DebuggerSession session)
		{
			this.session = session;
		}
コード例 #27
0
ファイル: DisassemblyView.cs プロジェクト: kdubau/monodevelop
		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;
		}
コード例 #28
0
		public override void Setup ()
		{
			base.Setup ();
			ds = Start ("TestEvaluation");
			frame = ds.ActiveThread.Backtrace.GetFrame (0);
		}
コード例 #29
0
ファイル: DisassemblyView.cs プロジェクト: kdubau/monodevelop
		public override void Dispose ()
		{
			base.Dispose ();
			DebuggingService.StoppedEvent -= OnStop;
			session = null;
		}
コード例 #30
0
		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 ();
			}
		}
コード例 #31
0
ファイル: Executer.cs プロジェクト: minuowa/Monos
 public Executer()
 {
     mDebuggerSession = CreateDebuggerSession();
     mDebuggerSession.OutputWriter = WriteCallBack;
     mDebuggerSession.TargetStopped += MDebuggerSession_TargetStopped;
 }
コード例 #32
0
		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;
			}
		}
コード例 #33
0
ファイル: Executer.cs プロジェクト: minuowa/Monos
 public void Setup()
 {
     mDebuggerSession = Start(string.Empty);
     frame = mDebuggerSession.ActiveThread.Backtrace.GetFrame(0);
 }