Exemplo n.º 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"));
        }
Exemplo n.º 2
0
        void RemoveThread(Thread thread)
        {
            if (thread == null)
            {
                return;
            }

            runningThreads.RemoveWhere(model => model.Thread == thread);
        }
Exemplo n.º 3
0
 void RemoveThread(Thread thread)
 {
     foreach (ListViewItem item in runningThreadsList.Items)
     {
         if (thread.ID.ToString() == item.Text)
         {
             item.Remove();
         }
     }
 }
Exemplo n.º 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");
 }
Exemplo n.º 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);
     };
 }
Exemplo n.º 6
0
 ListViewItem FindItem(Thread thread)
 {
     foreach (ListViewItem item in runningThreadsList.Items)
     {
         if (item.Text == thread.ID.ToString())
         {
             return(item);
         }
     }
     return(null);
 }
Exemplo n.º 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);
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 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}");
     }
 }
Exemplo n.º 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);
        }
Exemplo n.º 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}");
                }
            }
        }
Exemplo n.º 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;
				}
			}
		}
Exemplo n.º 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);
		}
Exemplo n.º 14
0
		void RemoveThread(Thread thread)
		{
			if (thread == null)
				return;
			
			runningThreads.RemoveWhere(model => model.Thread == thread);
		}
Exemplo n.º 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);
			};
		}
Exemplo n.º 16
0
		ListViewItem FindItem(Thread thread)
		{
			foreach (ListViewItem item in runningThreadsList.Items) {
				if (item.Text == thread.ID.ToString()) {
					return item;
				}
			}
			return null;
		}
Exemplo n.º 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"));
		}
Exemplo n.º 18
0
		void RemoveThread(Thread thread)
		{
			foreach (ListViewItem item in runningThreadsList.Items) {
				if (thread.ID.ToString() == item.Text) {
					item.Remove();
				}
			}
		}
Exemplo n.º 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);
		}
Exemplo n.º 20
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");
		}
Exemplo n.º 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);
		}