Example #1
0
 public void PrefetchBacktrace()
 {
     if (backtrace == null)
     {
         backtrace = session.GetBacktrace(processId, id);
     }
 }
 public ThreadInfo(long processId, long id, string name, string location, Backtrace backtrace)
 {
     this.id        = id;
     this.name      = name;
     this.processId = processId;
     this.location  = location;
     this.backtrace = backtrace;
 }
Example #3
0
 internal Backtrace GetBacktrace(long processId, long threadId)
 {
     lock (slock) {
         Backtrace bt = OnGetThreadBacktrace(processId, threadId);
         if (bt != null)
         {
             bt.Attach(this);
         }
         return(bt);
     }
 }
Example #4
0
		static void SetCurrentBacktrace (Backtrace bt)
		{
			currentBacktrace = bt;
			if (currentBacktrace != null)
				currentFrame = 0;
			else
				currentFrame = -1;

			DispatchService.GuiDispatch (delegate {
				NotifyCallStackChanged ();
				NotifyCurrentFrameChanged ();
			});
		}
Example #5
0
		static void OnStarted (object s, EventArgs a)
		{
			currentBacktrace = null;
			DispatchService.GuiDispatch (delegate {
				if (ResumedEvent != null)
					ResumedEvent (null, a);
				NotifyCallStackChanged ();
				NotifyCurrentFrameChanged ();
				NotifyLocationChanged ();
			});
		}
Example #6
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 ();
			}
		}
Example #7
0
		public StackTracePad ()
		{
			this.ShadowType = ShadowType.None;

			ActionCommand evalCmd = new ActionCommand ("StackTracePad.EvaluateMethodParams", GettextCatalog.GetString ("Evaluate Method Parameters"));
			ActionCommand gotoCmd = new ActionCommand ("StackTracePad.ActivateFrame", GettextCatalog.GetString ("Activate Stack Frame"));
			
			menuSet = new CommandEntrySet ();
			menuSet.Add (evalCmd);
			menuSet.Add (gotoCmd);
			menuSet.AddSeparator ();
			menuSet.AddItem (EditCommands.SelectAll);
			menuSet.AddItem (EditCommands.Copy);
			
			store = new ListStore (typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (Pango.Style), typeof (object), typeof (bool));

			tree = new PadTreeView (store);
			tree.RulesHint = true;
			tree.HeadersVisible = true;
			tree.Selection.Mode = SelectionMode.Multiple;
			tree.EnableSearch = true;
			tree.SearchColumn = 1;
			tree.ButtonPressEvent += HandleButtonPressEvent;
			tree.DoPopupMenu = ShowPopup;

			TreeViewColumn col = new TreeViewColumn ();
			CellRenderer crp = new CellRendererIcon ();
			col.PackStart (crp, false);
			col.AddAttribute (crp, "stock_id", 0);
			tree.AppendColumn (col);
			
			TreeViewColumn FrameCol = new TreeViewColumn ();
			FrameCol.Title = GettextCatalog.GetString ("Name");
			refresh = new CellRendererIcon ();
			refresh.Pixbuf = ImageService.GetPixbuf (Gtk.Stock.Refresh).ScaleSimple (12, 12, Gdk.InterpType.Hyper);
			FrameCol.PackStart (refresh, false);
			FrameCol.AddAttribute (refresh, "visible", 8);
			FrameCol.PackStart (tree.TextRenderer, true);
			FrameCol.AddAttribute (tree.TextRenderer, "text", 1);
			FrameCol.AddAttribute (tree.TextRenderer, "foreground", 5);
			FrameCol.AddAttribute (tree.TextRenderer, "style", 6);
			FrameCol.Resizable = true;
			FrameCol.Alignment = 0.0f;
			tree.AppendColumn (FrameCol);

			col = new TreeViewColumn ();
			col.Title = GettextCatalog.GetString ("File");
			col.PackStart (tree.TextRenderer, false);
			col.AddAttribute (tree.TextRenderer, "text", 2);
			col.AddAttribute (tree.TextRenderer, "foreground", 5);
			tree.AppendColumn (col);

			col = new TreeViewColumn ();
			col.Title = GettextCatalog.GetString ("Language");
			col.PackStart (tree.TextRenderer, false);
			col.AddAttribute (tree.TextRenderer, "text", 3);
			col.AddAttribute (tree.TextRenderer, "foreground", 5);
			tree.AppendColumn (col);

			col = new TreeViewColumn ();
			col.Title = GettextCatalog.GetString ("Address");
			col.PackStart (tree.TextRenderer, false);
			col.AddAttribute (tree.TextRenderer, "text", 4);
			col.AddAttribute (tree.TextRenderer, "foreground", 5);
			tree.AppendColumn (col);
			
			Add (tree);
			ShowAll ();

			current_backtrace = DebuggingService.CurrentCallStack;
			UpdateDisplay ();
			
			DebuggingService.CallStackChanged += (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnClassStackChanged));
			DebuggingService.CurrentFrameChanged += (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnFrameChanged));
			tree.RowActivated += OnRowActivated;
		}
Example #8
0
		protected void OnClassStackChanged (object o, EventArgs args)
		{
			current_backtrace = DebuggingService.CurrentCallStack;
			UpdateDisplay ();
		}
Example #9
0
		public StackTracePad ()
		{
			this.ShadowType = ShadowType.None;

			ActionCommand gotoCmd = new ActionCommand ("StackTracePad.ActivateFrame", GettextCatalog.GetString ("Activate Stack Frame"));
			
			menuSet = new CommandEntrySet ();
			menuSet.Add (gotoCmd);
			menuSet.AddSeparator ();
			menuSet.AddItem (EditCommands.SelectAll);
			menuSet.AddItem (EditCommands.Copy);
			
			store = new ListStore (typeof(string), typeof (string), typeof(string), typeof(string), typeof(string), typeof(string), typeof (Pango.Style));

			tree = new MonoDevelop.Ide.Gui.Components.PadTreeView (store);
			tree.RulesHint = true;
			tree.HeadersVisible = true;
			tree.Selection.Mode = SelectionMode.Multiple;
			tree.DoPopupMenu = ShowPopup;

			TreeViewColumn col = new TreeViewColumn ();
			CellRenderer crp = new CellRendererIcon ();
			col.PackStart (crp, false);
			col.AddAttribute (crp, "stock_id", 0);
			tree.AppendColumn (col);
			
			TreeViewColumn FrameCol = new TreeViewColumn ();
			FrameCol.Title = GettextCatalog.GetString ("Name");
			FrameCol.PackStart (tree.TextRenderer, true);
			FrameCol.AddAttribute (tree.TextRenderer, "text", 1);
			FrameCol.AddAttribute (tree.TextRenderer, "foreground", 5);
			FrameCol.AddAttribute (tree.TextRenderer, "style", 6);
			FrameCol.Resizable = true;
			FrameCol.Alignment = 0.0f;
			tree.AppendColumn (FrameCol);

			col = new TreeViewColumn ();
			col.Title = GettextCatalog.GetString ("File");
			col.PackStart (tree.TextRenderer, false);
			col.AddAttribute (tree.TextRenderer, "text", 2);
			col.AddAttribute (tree.TextRenderer, "foreground", 5);
			tree.AppendColumn (col);

			col = new TreeViewColumn ();
			col.Title = GettextCatalog.GetString ("Language");
			col.PackStart (tree.TextRenderer, false);
			col.AddAttribute (tree.TextRenderer, "text", 3);
			col.AddAttribute (tree.TextRenderer, "foreground", 5);
			tree.AppendColumn (col);

			col = new TreeViewColumn ();
			col.Title = GettextCatalog.GetString ("Address");
			col.PackStart (tree.TextRenderer, false);
			col.AddAttribute (tree.TextRenderer, "text", 4);
			col.AddAttribute (tree.TextRenderer, "foreground", 5);
			tree.AppendColumn (col);
			
			Add (tree);
			ShowAll ();

			current_backtrace = DebuggingService.CurrentCallStack;
			UpdateDisplay ();
			
			DebuggingService.CallStackChanged += (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnClassStackChanged));
			DebuggingService.CurrentFrameChanged += (EventHandler) DispatchService.GuiDispatch (new EventHandler (OnFrameChanged));
			tree.RowActivated += OnRowActivated;
		}
Example #10
0
		static void OnStarted (object s, EventArgs a)
		{
			nextStatementLocations.Clear ();
			currentBacktrace = null;

			DispatchService.GuiDispatch (delegate {
				HideExceptionCaughtDialog ();
				if (ResumedEvent != null)
					ResumedEvent (null, a);
				NotifyCallStackChanged ();
				NotifyCurrentFrameChanged ();
				NotifyLocationChanged ();
			});
		}
Example #11
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 ();
		}
Example #12
0
        public static void SetBacktrace(Backtrace bt)
        {
            var list = new List<StackFrame>();

            for (var i = 0; i < bt.FrameCount; i++)
                list.Add(bt.GetFrame(i - 1));

            Backtrace = new BacktraceInfo(list);
            Backtrace.SetActiveFrame(0);
        }
Example #13
0
		public ThreadInfo (long processId, long id, string name, string location, Backtrace backtrace)
		{
			this.id = id;
			this.name = name;
			this.processId = processId;
			this.location = location;
			this.backtrace = backtrace;
		}
		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 ();
			}
		}
Example #15
0
		static void Cleanup ()
		{
			DebuggerSession currentSession;
			StatusBarIcon currentIcon;
			IConsole currentConsole;

			lock (cleanup_lock) {
				if (!IsDebugging)
					return;

				currentIcon = busyStatusIcon;
				currentSession = session;
				currentConsole = console;

				currentBacktrace = null;
				busyStatusIcon = null;
				session = null;
				console = null;
			}

			if (oldLayout != null) {
				string layout = oldLayout;
				oldLayout = null;

				// Dispatch synchronously to avoid start/stop races
				DispatchService.GuiSyncDispatch (delegate {
					IdeApp.Workbench.HideCommandBar ("Debug");
					if (IdeApp.Workbench.CurrentLayout == "Debug")
						IdeApp.Workbench.CurrentLayout = 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 ();
		}