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")); }
void RemoveThread(Thread thread) { if (thread == null) { return; } runningThreads.RemoveWhere(model => model.Thread == thread); }
void RemoveThread(Thread thread) { foreach (ListViewItem item in runningThreadsList.Items) { if (thread.ID.ToString() == item.Text) { item.Remove(); } } }
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"); }
void AddThread(Thread thread) { runningThreadsList.Items.Add(new ListViewItem(thread.ID.ToString())); RefreshThread(thread); thread.NameChanged += delegate { RefreshThread(thread); }; thread.Exited += delegate { RemoveThread(thread); }; }
ListViewItem FindItem(Thread thread) { foreach (ListViewItem item in runningThreadsList.Items) { if (item.Text == thread.ID.ToString()) { return(item); } } return(null); }
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); }
void RemoveThread(Thread thread) { if (thread == null) { return; } foreach (dynamic item in runningThreadsList.ItemCollection) { if (thread.ID == item.ID) { runningThreadsList.ItemCollection.Remove(item); break; } } }
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}"); } }
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); }
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}"); } } }
void RemoveThread(Thread thread) { if (thread == null) return; foreach (dynamic item in runningThreadsList.ItemCollection) { if (thread.ID == item.ID) { runningThreadsList.ItemCollection.Remove(item); break; } } }
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); }
void RemoveThread(Thread thread) { if (thread == null) return; runningThreads.RemoveWhere(model => model.Thread == thread); }
ListViewItem FindItem(Thread thread) { foreach (ListViewItem item in runningThreadsList.Items) { if (item.Text == thread.ID.ToString()) { return item; } } return null; }
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); }
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); }