PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/source2/VSIP/Cosmos.VS.Windows/StackUC.xaml.cs

https://bitbucket.org/mvptracker/cosmos
C# | 96 lines | 86 code | 7 blank | 3 comment | 7 complexity | a6d194d73dab0e512a3bba2f4eff2eb5 MD5 | raw file
Possible License(s): BSD-2-Clause
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.ComponentModel.Design;
  6. using System.Data;
  7. using System.Linq;
  8. using System.Runtime.InteropServices;
  9. using System.Text;
  10. using System.Threading;
  11. using System.Windows;
  12. using System.Windows.Controls;
  13. using System.Windows.Data;
  14. using System.Windows.Documents;
  15. using System.Windows.Input;
  16. using System.Windows.Media;
  17. using System.Windows.Media.Imaging;
  18. using System.Windows.Navigation;
  19. using System.Windows.Shapes;
  20. using System.Windows.Threading;
  21. using Cosmos.Debug.Common;
  22. using Microsoft.VisualStudio.Shell;
  23. using Microsoft.VisualStudio.Shell.Interop;
  24. namespace Cosmos.VS.Windows {
  25. [Guid("A64D0FCC-8DCC-439A-9B16-3C43128AAD51")]
  26. public class StackTW : ToolWindowPane2 {
  27. public StackTW() {
  28. Caption = "Cosmos Stack";
  29. BitmapResourceID = 301;
  30. BitmapIndex = 1;
  31. mUserControl = new StackUC();
  32. Content = mUserControl;
  33. }
  34. }
  35. public partial class StackUC : DebuggerUC {
  36. public StackUC() {
  37. InitializeComponent();
  38. }
  39. protected override void DoUpdate(string aTag) {
  40. if (aTag == "STACK") {
  41. System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
  42. (Action)delegate()
  43. {
  44. UpdateStack(mData);
  45. }
  46. );
  47. } else if (aTag == "FRAME") {
  48. System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
  49. (Action)delegate()
  50. {
  51. UpdateFrame(mData);
  52. }
  53. );
  54. }
  55. }
  56. public void UpdateFrame(byte[] aData)
  57. {
  58. System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
  59. (Action)delegate()
  60. {
  61. var xValues = MemoryViewUC.Split(aData);
  62. int xCount = xValues.Count;
  63. memvEBP.Clear();
  64. for (int i = 0; i < xCount; i++)
  65. {
  66. // We start at EBP + 8, because lower is not transmitted
  67. // [EBP] is old EBP - not needed
  68. // [EBP + 4] is saved EIP - not needed
  69. memvEBP.Add("[EBP + " + (i * 4 + 8) + "]", xValues[i]);
  70. }
  71. }
  72. );
  73. }
  74. public void UpdateStack(byte[] aData) {
  75. System.Windows.Threading.Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.Normal,
  76. (Action)delegate()
  77. {
  78. var xValues = MemoryViewUC.Split(aData);
  79. int xCount = xValues.Count;
  80. memvESP.Clear();
  81. for (int i = 0; i < xCount; i++)
  82. {
  83. memvESP.Add(("[EBP - " + ((xCount - i) * 4) + "]").PadRight(10) + " [ESP + " + (i * 4) + "]", xValues[i]);
  84. }
  85. }
  86. );
  87. }
  88. }
  89. }