public override bool Equals(object obj)
        {
            ThreadInfo ot = obj as ThreadInfo;

            if (ot == null)
            {
                return(false);
            }
            return(id == ot.id && processId == ot.processId && session == ot.session);
        }
Example #2
0
        public ThreadInfo[] GetThreads(long processId)
        {
            MD.Process p = GetProcess(processId);
            if (p == null)
            {
                return(new ThreadInfo [0]);
            }
            List <DL.ThreadInfo> list = new List <DL.ThreadInfo> ();

            foreach (MD.Thread t in p.GetThreads())
            {
                DL.ThreadInfo ct = CreateThreadInfo(t);
                list.Add(ct);
            }
            return(list.ToArray());
        }
		ThreadInfo GetThread (CorThread thread)
		{
			ThreadInfo info;
			lock (threads) {
				if (!threads.TryGetValue (thread.Id, out info)) {
					string loc = string.Empty;
					try {
						if (thread.ActiveFrame != null) {
							StackFrame frame = CorBacktrace.CreateFrame (this, thread.ActiveFrame);
							loc = frame.ToString ();
						}
						else {
							loc = "<Unknown>";
						}
					}
					catch {
						loc = "<Unknown>";
					}
					
					info = new ThreadInfo (thread.Process.Id, thread.Id, GetThreadName (thread), loc);
					threads[thread.Id] = info;
				}
				return info;
			}
		}
		private StoppedEvent CreateStoppedEvent(string reason, SourceLocation sl, ThreadInfo ti, string text = null)
		{
			return new StoppedEvent(reason, new Source(ConvertDebuggerPathToClient(sl.FileName)), ConvertDebuggerLineToClient(sl.Line), sl.Column, text, (int)ti.Id);
		}
 private StoppedEvent CreateStoppedEvent(string reason, ThreadInfo ti, string text = null)
 {
     return new StoppedEvent((int)ti.Id, reason, text);
 }
Example #6
0
        internal protected void OnTargetEvent(TargetEventArgs args)
        {
            currentProcesses = null;

            if (args.Process != null)
            {
                args.Process.Attach(this);
            }
            if (args.Thread != null)
            {
                args.Thread.Attach(this);
                activeThread = args.Thread;
            }
            if (args.Backtrace != null)
            {
                args.Backtrace.Attach(this);
            }

            switch (args.Type)
            {
            case TargetEventType.ExceptionThrown:
                lock (slock) {
                    isRunning = false;
                }
                if (TargetExceptionThrown != null)
                {
                    TargetExceptionThrown(this, args);
                }
                break;

            case TargetEventType.TargetExited:
                lock (slock) {
                    isRunning = false;
                    started   = false;
                    foreach (BreakEvent bp in Breakpoints)
                    {
                        Breakpoints.NotifyStatusChanged(bp);
                    }
                }
                if (TargetExited != null)
                {
                    TargetExited(this, args);
                }
                break;

            case TargetEventType.TargetHitBreakpoint:
                lock (slock) {
                    isRunning = false;
                }
                if (TargetHitBreakpoint != null)
                {
                    TargetHitBreakpoint(this, args);
                }
                break;

            case TargetEventType.TargetInterrupted:
                lock (slock) {
                    isRunning = false;
                }
                if (TargetInterrupted != null)
                {
                    TargetInterrupted(this, args);
                }
                break;

            case TargetEventType.TargetSignaled:
                lock (slock) {
                    isRunning = false;
                }
                if (TargetSignaled != null)
                {
                    TargetSignaled(this, args);
                }
                break;

            case TargetEventType.TargetStopped:
                lock (slock) {
                    isRunning = false;
                }
                if (TargetStopped != null)
                {
                    TargetStopped(this, args);
                }
                break;

            case TargetEventType.UnhandledException:
                lock (slock) {
                    isRunning = false;
                }
                if (TargetUnhandledException != null)
                {
                    TargetUnhandledException(this, args);
                }
                break;
            }
            if (TargetEvent != null)
            {
                TargetEvent(this, args);
            }
        }
Example #7
0
		void UpdateThreads (ThreadInfo activeThread)
		{
			TreeIter iter;

			if (!store.GetIterFirst (out iter))
				return;

			do {
				var thread = store.GetValue (iter, (int)Columns.Object) as ThreadInfo;

				if (thread == null) {
					store.SetValue (iter, (int)Columns.Weight, (int)(((ProcessInfo)store.GetValue (iter, (int)Columns.Object)).GetThreads ().Contains (activeThread) ? Pango.Weight.Bold : Pango.Weight.Normal));
					var sessionActiveThread = ((DebuggerSession)store.GetValue (iter, (int)Columns.Session)).ActiveThread;
					// this is a process... descend into our children
					TreeIter child;

					if (store.IterChildren (out child, iter)) {
						do {
							thread = store.GetValue (child, (int)Columns.Object) as ThreadInfo;
							UpdateThread (child, thread, sessionActiveThread);
						} while (store.IterNext (ref child));
					}
				} else {
					UpdateThread (iter, thread, activeThread);
				}
			} while (store.IterNext (ref iter));
		}
Example #8
0
		void UpdateThread (TreeIter iter, ThreadInfo thread, ThreadInfo activeThread)
		{
			var weight = thread == activeThread ? Pango.Weight.Bold : Pango.Weight.Normal;
			var icon = thread == activeThread ? Gtk.Stock.GoForward : null;

			store.SetValue (iter, (int)Columns.Weight, (int)weight);
			store.SetValue (iter, (int)Columns.Icon, icon);
		}
Example #9
0
		void UpdateThreads (ThreadInfo activeThread)
		{
			TreeIter iter;

			if (!store.GetIterFirst (out iter))
				return;

			do {
				var thread = store.GetValue (iter, (int) Columns.Object) as ThreadInfo;

				if (thread == null) {
					// this is a process... descend into our children
					TreeIter child;

					if (store.IterChildren (out child)) {
						do {
							thread = store.GetValue (iter, (int) Columns.Object) as ThreadInfo;
							UpdateThread (child, thread, activeThread);
						} while (store.IterNext (ref child));
					}
				} else {
					UpdateThread (iter, thread, activeThread);
				}
			} while (store.IterNext (ref iter));
		}
		public ThreadInfo GetThread (CorDebugThread thread)
		{
			ThreadInfo info;
			lock (threadsInfo) {
				if (!threadsInfo.TryGetValue (thread.Id, out info)) {
					string loc = string.Empty;
					try {
						if (thread.ActiveFrame != null) {
							//TODO: StackFrame frame = CorDebugBacktrace.CreateFrame(m_corDebug, thread.ActiveFrame);
							loc = "0x10 in LOL.haha";//frame.ToString();
						} else {
							loc = "<Unknown>";
						}
					} catch {
						loc = "<Unknown>";
					}
					//TODO: Check if there is better posiblity with thread name
					info = new ThreadInfo (thread.Process.Id, thread.Id, thread.Id == 1 ? "Main Thread" : "", loc);
					threadsInfo [thread.Id] = info;
				}
				return info;
			}
		}