コード例 #1
0
        void RefreshThread(Thread thread)
        {
            ListViewItem item = FindItem(thread);

            if (item == null)
            {
                AddThread(thread);
                return;
            }
            item.SubItems.Clear();
            item.Text = thread.ID.ToString();
            item.Tag  = thread;
            item.SubItems.Add(thread.Name);
            StackFrame location = null;

            if (thread.Process.IsPaused)
            {
                location = thread.MostRecentStackFrameWithLoadedSymbols;
                if (location == null)
                {
                    location = thread.MostRecentStackFrame;
                }
            }
            if (location != null)
            {
                item.SubItems.Add(location.MethodInfo.Name);
            }
            else
            {
                item.SubItems.Add(ResourceService.GetString("Global.NA"));
            }
            switch (thread.Priority)
            {
            case ThreadPriority.Highest:
                item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Highest"));
                break;

            case ThreadPriority.AboveNormal:
                item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.AboveNormal"));
                break;

            case ThreadPriority.Normal:
                item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Normal"));
                break;

            case ThreadPriority.BelowNormal:
                item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.BelowNormal"));
                break;

            case ThreadPriority.Lowest:
                item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Lowest"));
                break;

            default:
                item.SubItems.Add(thread.Priority.ToString());
                break;
            }
            item.SubItems.Add(ResourceService.GetString(thread.Suspended ? "Global.Yes" : "Global.No"));
        }
コード例 #2
0
        void RemoveThread(Thread thread)
        {
            if (thread == null)
            {
                return;
            }

            runningThreads.RemoveWhere(model => model.Thread == thread);
        }
コード例 #3
0
 void RemoveThread(Thread thread)
 {
     foreach (ListViewItem item in runningThreadsList.Items)
     {
         if (thread.ID.ToString() == item.Text)
         {
             item.Remove();
         }
     }
 }
コード例 #4
0
 public ThreadItem(Thread thread)
 {
     // We want to egarly evaluate the properties while the process is paused
     // rather then wait until the GUI acesses them at some unspecified point
     this.Thread   = thread;
     this.ID       = thread.ID;
     this.Name     = thread.Name;
     this.Priority = PriorityToString(thread.Priority);
     this.Frozen   = ResourceService.GetString(thread.Suspended ? "Global.Yes" : "Global.No");
 }
コード例 #5
0
 void AddThread(Thread thread)
 {
     runningThreadsList.Items.Add(new ListViewItem(thread.ID.ToString()));
     RefreshThread(thread);
     thread.NameChanged += delegate {
         RefreshThread(thread);
     };
     thread.Exited += delegate {
         RemoveThread(thread);
     };
 }
コード例 #6
0
 ListViewItem FindItem(Thread thread)
 {
     foreach (ListViewItem item in runningThreadsList.Items)
     {
         if (item.Text == thread.ID.ToString())
         {
             return(item);
         }
     }
     return(null);
 }
コード例 #7
0
        void AddThread(Thread thread)
        {
            if (thread == null)
            {
                return;
            }

            // remove the object if exists
            RemoveThread(thread);

            ThreadModel obj = new ThreadModel(thread);

            runningThreads.Add(obj);
            thread.Exited += (s, e) => RemoveThread(e.Thread);
        }
コード例 #8
0
        void RemoveThread(Thread thread)
        {
            if (thread == null)
            {
                return;
            }

            foreach (dynamic item in runningThreadsList.ItemCollection)
            {
                if (thread.ID == item.ID)
                {
                    runningThreadsList.ItemCollection.Remove(item);
                    break;
                }
            }
        }
コード例 #9
0
 void RunningThreadsListItemActivate(object sender, EventArgs e)
 {
     if (debuggedProcess.IsPaused)
     {
         if (debuggedProcess != null)
         {
             dynamic obj    = runningThreadsList.SelectedItems[0];
             Thread  thread = (Thread)(obj.Tag);
             debuggedProcess.SelectedThread = thread;
             debuggedProcess.OnPaused();
         }
     }
     else
     {
         MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotSwitchWhileRunning}", "${res:MainWindow.Windows.Debug.Threads.ThreadSwitch}");
     }
 }
コード例 #10
0
        void AddThread(Thread thread)
        {
            if (thread == null)
            {
                return;
            }

            // remove the object if exists
            RemoveThread(thread);

            dynamic obj = new ExpandoObject();

            obj.Tag = thread;
            RefreshItem(obj);
            runningThreadsList.ItemCollection.Add(obj);
            thread.NameChanged += delegate {
                RefreshItem(obj);
            };
            thread.Exited += (s, e) => RemoveThread(e.Thread);
        }
コード例 #11
0
        void RunningThreadsListItemActivate(object sender, EventArgs e)
        {
            if (debuggedProcess != null)
            {
                if (debuggedProcess.IsPaused)
                {
                    ThreadModel obj    = runningThreadsList.SelectedItems[0] as ThreadModel;
                    Thread      thread = obj.Thread;

                    // check for options - if these options are enabled, selecting the frame should not continue
                    if ((thread.MostRecentStackFrame == null || !thread.MostRecentStackFrame.HasSymbols) &&
                        !DebuggingOptions.Instance.DecompileCodeWithoutSymbols)
                    {
                        MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotSwitchWithoutDecompiledCodeOptions}",
                                                   "${res:MainWindow.Windows.Debug.Threads.ThreadSwitch}");
                        return;
                    }

                    debuggedProcess.SelectedThread = thread;
                    debuggedProcess.SelectedThread.SelectedStackFrame = debuggedProcess.SelectedThread.MostRecentStackFrame;
                    if (debuggedProcess.SelectedThread.SelectedStackFrame != null)
                    {
                        debuggedProcess.PauseSession.PausedReason = PausedReason.CurrentThreadChanged;
                        debuggedProcess.OnPaused();                         // Force refresh of pads - artificial pause
                    }
                    else
                    {
                        MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotSwitchOnNAFrame}", "${res:MainWindow.Windows.Debug.Threads.ThreadSwitch}");
                    }
                }
                else
                {
                    MessageService.ShowMessage("${res:MainWindow.Windows.Debug.Threads.CannotSwitchWhileRunning}", "${res:MainWindow.Windows.Debug.Threads.ThreadSwitch}");
                }
            }
        }
コード例 #12
0
		void RemoveThread(Thread thread)
		{
			if (thread == null)
				return;
			
			foreach (dynamic item in runningThreadsList.ItemCollection) {
				if (thread.ID == item.ID) {
					runningThreadsList.ItemCollection.Remove(item);
					break;
				}
			}
		}
コード例 #13
0
		void AddThread(Thread thread)
		{
			if (thread == null) return;
			
			// remove the object if exists
			RemoveThread(thread);
			
			dynamic obj = new ExpandoObject();
			obj.Tag = thread;
			RefreshItem(obj);
			runningThreadsList.ItemCollection.Add(obj);
			thread.NameChanged += delegate {
				RefreshItem(obj);
			};
			thread.Exited += (s, e) => RemoveThread(e.Thread);
		}
コード例 #14
0
		void RemoveThread(Thread thread)
		{
			if (thread == null)
				return;
			
			runningThreads.RemoveWhere(model => model.Thread == thread);
		}
コード例 #15
0
		void AddThread(Thread thread)
		{
			runningThreadsList.Items.Add(new ListViewItem(thread.ID.ToString()));
			RefreshThread(thread);
			thread.NameChanged += delegate {
				RefreshThread(thread);
			};
			thread.Exited += delegate {
				RemoveThread(thread);
			};
		}
コード例 #16
0
		ListViewItem FindItem(Thread thread)
		{
			foreach (ListViewItem item in runningThreadsList.Items) {
				if (item.Text == thread.ID.ToString()) {
					return item;
				}
			}
			return null;
		}
コード例 #17
0
		void RefreshThread(Thread thread)
		{
			ListViewItem item = FindItem(thread);
			if (item == null) {
				AddThread(thread);
				return;
			}
			item.SubItems.Clear();
			item.Text = thread.ID.ToString();
			item.Tag = thread;
			item.SubItems.Add(thread.Name);
			StackFrame location = null;
			if (thread.Process.IsPaused) {
				location = thread.MostRecentStackFrameWithLoadedSymbols;
				if (location == null) {
					location = thread.MostRecentStackFrame;
				}
			}
			if (location != null) {
				item.SubItems.Add(location.MethodInfo.Name);
			} else {
				item.SubItems.Add(ResourceService.GetString("Global.NA"));
			}
			switch (thread.Priority) {
				case ThreadPriority.Highest:
					item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Highest"));
					break;
				case ThreadPriority.AboveNormal:
					item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.AboveNormal"));
					break;
				case ThreadPriority.Normal:
					item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Normal"));
					break;
				case ThreadPriority.BelowNormal:
					item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.BelowNormal"));
					break;
				case ThreadPriority.Lowest:
					item.SubItems.Add(ResourceService.GetString("MainWindow.Windows.Debug.Threads.Priority.Lowest"));
					break;
				default:
					item.SubItems.Add(thread.Priority.ToString());
					break;
			}
			item.SubItems.Add(ResourceService.GetString(thread.Suspended ? "Global.Yes" : "Global.No"));
		}
コード例 #18
0
		void RemoveThread(Thread thread)
		{
			foreach (ListViewItem item in runningThreadsList.Items) {
				if (thread.ID.ToString() == item.Text) {
					item.Remove();
				}
			}
		}
コード例 #19
0
		void AddThread(Thread thread)
		{
			if (thread == null) return;
			
			// remove the object if exists
			RemoveThread(thread);
			
			ThreadModel obj = new ThreadModel(thread);
			
			runningThreads.Add(obj);
			thread.Exited += (s, e) => RemoveThread(e.Thread);
		}
コード例 #20
0
ファイル: ThreadsPad.cs プロジェクト: 2594636985/SharpDevelop
		public ThreadItem(Thread thread)
		{
			// We want to egarly evaluate the properties while the process is paused
			// rather then wait until the GUI acesses them at some unspecified point
			this.Thread = thread;
			this.ID = thread.ID;
			this.Name = thread.Name;
			this.Priority = PriorityToString(thread.Priority);
			this.Frozen = ResourceService.GetString(thread.Suspended ? "Global.Yes" : "Global.No");
		}
コード例 #21
0
		internal StackFrame(Thread thread, ICorDebugILFrame corILFrame, uint chainIndex, uint frameIndex)
		{
			this.process = thread.Process;
			this.thread = thread;
			this.corILFrame = corILFrame;
			this.corILFramePauseSession = process.PauseSession;
			this.corFunction = corILFrame.Function;
			this.chainIndex = chainIndex;
			this.frameIndex = frameIndex;
			
			DebugType debugType = DebugType.Create(
				this.Process, 
				corFunction.Class,
				corILFrame.CastTo<ICorDebugILFrame2>().EnumerateTypeParameters().ToList().ToArray()
			);
			this.methodInfo = debugType.GetMethod(corFunction.Token);
		}