|
|
|
@ -10,6 +10,11 @@ using System.Windows.Controls; |
|
|
|
using System.Windows.Input; |
|
|
|
using System.Windows.Input; |
|
|
|
using System.Windows.Media; |
|
|
|
using System.Windows.Media; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using ICSharpCode.Core.Presentation; |
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Debugging; |
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Gui.Pads; |
|
|
|
|
|
|
|
using ICSharpCode.SharpDevelop.Services; |
|
|
|
|
|
|
|
|
|
|
|
namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
{ |
|
|
|
{ |
|
|
|
public partial class ThreadStack : UserControl |
|
|
|
public partial class ThreadStack : UserControl |
|
|
|
@ -20,15 +25,20 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
DependencyProperty.Register("IsSelected", typeof(bool), typeof(ThreadStack), |
|
|
|
DependencyProperty.Register("IsSelected", typeof(bool), typeof(ThreadStack), |
|
|
|
new FrameworkPropertyMetadata()); |
|
|
|
new FrameworkPropertyMetadata()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public event EventHandler FrameSelected; |
|
|
|
|
|
|
|
|
|
|
|
private ObservableCollection<ExpandoObject> itemCollection = new ObservableCollection<ExpandoObject>(); |
|
|
|
private ObservableCollection<ExpandoObject> itemCollection = new ObservableCollection<ExpandoObject>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ToolTip toolTip = new ToolTip(); |
|
|
|
|
|
|
|
|
|
|
|
public ThreadStack() |
|
|
|
public ThreadStack() |
|
|
|
{ |
|
|
|
{ |
|
|
|
InitializeComponent(); |
|
|
|
InitializeComponent(); |
|
|
|
|
|
|
|
ToolTip = toolTip; |
|
|
|
|
|
|
|
ToolTipOpening += new ToolTipEventHandler(OnToolTipOpening); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
internal bool IsAdded { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Process Process { get; set; } |
|
|
|
public Process Process { get; set; } |
|
|
|
|
|
|
|
|
|
|
|
public bool IsSelected { |
|
|
|
public bool IsSelected { |
|
|
|
@ -71,7 +81,14 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void SelectParent(bool isSelected) |
|
|
|
public void ClearImages() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach(dynamic item in itemCollection) { |
|
|
|
|
|
|
|
item.Image = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void SelectParent(bool isSelected) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var ts = this.ThreadStackParent; |
|
|
|
var ts = this.ThreadStackParent; |
|
|
|
while(ts != null) { |
|
|
|
while(ts != null) { |
|
|
|
@ -99,9 +116,18 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
|
|
|
|
|
|
|
|
void SelectFrame(uint threadId, ExpandoObject selectedItem) |
|
|
|
void SelectFrame(uint threadId, ExpandoObject selectedItem) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
if (selectedItem == null) |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
var thread = Process.Threads.Find(t => t.ID == threadId); |
|
|
|
var thread = Process.Threads.Find(t => t.ID == threadId); |
|
|
|
if (thread == null) |
|
|
|
if (thread == null) |
|
|
|
return; |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (FrameSelected != null) |
|
|
|
|
|
|
|
FrameSelected(this, EventArgs.Empty); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.IsSelected = true; |
|
|
|
|
|
|
|
|
|
|
|
dynamic obj = selectedItem; |
|
|
|
dynamic obj = selectedItem; |
|
|
|
Process.SelectedThread = thread; |
|
|
|
Process.SelectedThread = thread; |
|
|
|
foreach(var frame in thread.Callstack) |
|
|
|
foreach(var frame in thread.Callstack) |
|
|
|
@ -109,11 +135,11 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
if (frame.GetMethodName() == obj.MethodName) |
|
|
|
if (frame.GetMethodName() == obj.MethodName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Process.SelectedThread.SelectedStackFrame = frame; |
|
|
|
Process.SelectedThread.SelectedStackFrame = frame; |
|
|
|
|
|
|
|
obj.Image = PresentationResourceService.GetImage("Bookmarks.CurrentLine").Source; |
|
|
|
|
|
|
|
((WindowsDebugger)DebuggerService.CurrentDebugger).JumpToCurrentLine(); |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Process.OnPaused(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void Datagrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e) |
|
|
|
void Datagrid_MouseRightButtonUp(object sender, MouseButtonEventArgs e) |
|
|
|
@ -138,7 +164,7 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
MenuItem m = new MenuItem(); |
|
|
|
MenuItem m = new MenuItem(); |
|
|
|
m.IsCheckable = true; |
|
|
|
m.IsCheckable = true; |
|
|
|
m.IsChecked = id == Process.SelectedThread.ID; |
|
|
|
m.IsChecked = id == Process.SelectedThread.ID; |
|
|
|
m.Checked += delegate(object sender, RoutedEventArgs e) { |
|
|
|
m.Click += delegate(object sender, RoutedEventArgs e) { |
|
|
|
var menuItem = e.OriginalSource as MenuItem; |
|
|
|
var menuItem = e.OriginalSource as MenuItem; |
|
|
|
SelectFrame((uint)menuItem.Tag, item); |
|
|
|
SelectFrame((uint)menuItem.Tag, item); |
|
|
|
}; |
|
|
|
}; |
|
|
|
@ -150,5 +176,36 @@ namespace Debugger.AddIn.Pads.ParallelPad |
|
|
|
|
|
|
|
|
|
|
|
return menu; |
|
|
|
return menu; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OnToolTipOpening(object sender, ToolTipEventArgs e) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
StackPanel panel = new StackPanel(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dynamic selectedItem = datagrid.SelectedItem; |
|
|
|
|
|
|
|
if (selectedItem == null) { |
|
|
|
|
|
|
|
panel.Children.Add(new TextBlock { Text = "No item selected" }); |
|
|
|
|
|
|
|
this.toolTip.Content = panel; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach(var thread in Process.Threads) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (ThreadIds.Contains(thread.ID)) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (var frame in thread.Callstack) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (selectedItem.MethodName == frame.GetMethodName()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
// TODO : get method parameter values
|
|
|
|
|
|
|
|
TextBlock tb = new TextBlock(); |
|
|
|
|
|
|
|
tb.Text = thread.ID + ": " + CallStackPadContent.GetFullName(frame); |
|
|
|
|
|
|
|
panel.Children.Add(tb); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.toolTip.Content = panel; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |