[ros-diffs] [arty] 35287: Processes and Threads view. Somewhat WIP.

arty at svn.reactos.org arty at svn.reactos.org
Tue Aug 12 12:48:39 CEST 2008


Author: arty
Date: Tue Aug 12 05:48:38 2008
New Revision: 35287

URL: http://svn.reactos.org/svn/reactos?rev=35287&view=rev
Log:
Processes and Threads view.  Somewhat WIP.

Added:
    trunk/tools/reactosdbg/RosDBG/ProcThread.Designer.cs
    trunk/tools/reactosdbg/RosDBG/ProcThread.cs
    trunk/tools/reactosdbg/RosDBG/ProcThread.resx
Modified:
    trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs
    trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs
    trunk/tools/reactosdbg/DebugProtocol/KDBG.cs
    trunk/tools/reactosdbg/RosDBG/RegisterView.cs
    trunk/tools/reactosdbg/RosDBG/RosDBG.csproj

Modified: trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs?rev=35287&r1=35286&r2=35287&view=diff
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs [iso-8859-1] Tue Aug 12 05:48:38 2008
@@ -66,6 +66,35 @@
     }
     public delegate void DebugRawTrafficEventHandler(object sender, DebugRawTrafficEventArgs args);
 
+    public class ThreadElement
+    {
+        bool mCurrent;
+        public bool Current { get { return mCurrent; } set { mCurrent = value; } }
+        ulong mTid;
+        public ulong ThreadId { get { return mTid; } set { mTid = value; } }
+        public ThreadElement(ulong tid, bool current) { mTid = tid; mCurrent = current; }
+    }
+
+    public class ProcessElement
+    {
+        bool mCurrent;
+        public bool Current { get { return mCurrent; } set { mCurrent = value; } }
+        ulong mPid;
+        public ulong ProcessId { get { return mPid; } set { mPid = value; } }
+        public Dictionary<ulong, ThreadElement> Threads = new Dictionary<ulong,ThreadElement>();
+        public ProcessElement(ulong pid, bool current) { mPid = pid; mCurrent = current; }
+    }
+
+    public class DebugProcessThreadChangeEventArgs : EventArgs
+    {
+        public readonly Dictionary<ulong, ProcessElement> Processes;
+        public DebugProcessThreadChangeEventArgs(Dictionary<ulong, ProcessElement> processes)
+        {
+            Processes = processes;
+        }
+    }
+    public delegate void DebugProcessThreadChangeEventHandler(object sender, DebugProcessThreadChangeEventArgs args);
+
     public class DebugConnection
     {
         #region Primary State
@@ -80,7 +109,8 @@
                     DebugConnectionModeChangedEvent(this, new DebugConnectionModeChangedEventArgs(value));
             }
         }
-        public bool mRunning = true;
+
+        bool mRunning = true;
         public bool Running
         {
             get { return mRunning; }
@@ -91,12 +121,30 @@
                     DebugRunningChangeEvent(this, new DebugRunningChangeEventArgs(value));
             }
         }
+
+        ulong mCurrentProcess;
+        public ulong CurrentProcess
+        {
+            get { return mCurrentProcess; }
+            set { mKdb.SetProcess(value); }
+        }
+
+        ulong mCurrentThread;
+        public ulong CurrentThread
+        {
+            get { return mCurrentThread; }
+            set { mKdb.SetThread(value); }
+        }
+
         KDBG mKdb;
         Registers mRegisters = new Registers();
+        ulong mNewCurrentThread, mNewCurrentProcess;
         public IDebugProtocol Debugger { get { return mKdb; } }
         Pipe mMedium;
         Mode mConnectionMode;
         List<WeakReference> mMemoryReaders = new List<WeakReference>();
+        Dictionary<ulong, ProcessElement> mProcesses = new Dictionary<ulong, ProcessElement>();
+        Dictionary<ulong, ProcessElement> mAccumulateProcesses = new Dictionary<ulong, ProcessElement>();
         #endregion
 
         #region Socket Mode State
@@ -120,6 +168,7 @@
         public event DebugConnectionModeChangedEventHandler DebugConnectionModeChangedEvent;
         public event DebugRunningChangeEventHandler DebugRunningChangeEvent;
         public event DebugModuleChangedEventHandler DebugModuleChangedEvent;
+        public event DebugProcessThreadChangeEventHandler DebugProcessThreadChangeEvent;
         public event DebugRawTrafficEventHandler DebugRawTrafficEvent;
 
         public DebugConnection()
@@ -150,6 +199,16 @@
             }
         }
 
+        void ConnectEventHandlers()
+        {
+            //set up tab handlers
+            mKdb.RegisterChangeEvent += RegisterChangeEvent;
+            mKdb.ModuleListEvent += ModuleListEvent;
+            mKdb.MemoryUpdateEvent += MemoryUpdateEvent;
+            mKdb.ProcessListEvent += ProcessListEvent;
+            mKdb.ThreadListEvent += ThreadListEvent;
+        }
+
         public void Start(string host, int port)
         {
             Close();
@@ -166,6 +225,7 @@
         public void Start(string pipeName)
         {
             Close();
+            ConnectionMode = Mode.PipeMode;
             mNamedPipe = new NamedPipe();
             mNamedPipe.Create(pipeName);
             mNamedPipe.Listen();
@@ -185,10 +245,7 @@
                 mMedium = new SerialPipe(mSerialPort);
                 mMedium.PipeReceiveEvent += PipeReceiveEvent;
                 mKdb = new KDBG(mMedium);
-                //set up tab handlers
-                mKdb.RegisterChangeEvent += RegisterChangeEvent;
-                mKdb.ModuleListEvent += ModuleListEvent;
-                mKdb.MemoryUpdateEvent += MemoryUpdateEvent;
+                ConnectEventHandlers();
                 Running = true;
             }
             catch (Exception)
@@ -196,6 +253,46 @@
                 ConnectionMode = Mode.ClosedMode;
                 //error signal?
             }
+        }
+
+        void ProcessListEvent(object sender, ProcessListEventArgs args)
+        {
+            if (args.Reset)
+            {
+                mAccumulateProcesses.Clear();
+            }
+            else if (args.End)
+            {
+                mKdb.GetThreads(mNewCurrentProcess);
+            }
+            else
+                mAccumulateProcesses[args.Pid] = new ProcessElement(args.Pid, args.Current);
+
+            if (args.Current)
+                mNewCurrentProcess = args.Pid;
+        }
+
+        void ThreadListEvent(object sender, ThreadListEventArgs args)
+        {
+            if (args.Reset)
+            {
+                mAccumulateProcesses[mNewCurrentProcess].Threads.Clear();
+            }
+            else if (args.End)
+            {
+                mCurrentProcess = mNewCurrentProcess;
+                mCurrentThread = mNewCurrentThread;
+                mProcesses = mAccumulateProcesses;
+                if (DebugProcessThreadChangeEvent != null)
+                    DebugProcessThreadChangeEvent(this, new DebugProcessThreadChangeEventArgs(mProcesses));
+            }
+            else
+            {
+                mAccumulateProcesses[mNewCurrentProcess].Threads[args.Tid] = new ThreadElement(args.Tid, args.Current);
+            }
+
+            if (args.Current)
+                mNewCurrentThread = args.Tid;
         }
 
         public void Close()
@@ -238,9 +335,7 @@
                 mMedium.PipeErrorEvent += MediumError;
                 mMedium.PipeReceiveEvent += PipeReceiveEvent;
                 mKdb = new KDBG(mMedium);
-                mKdb.RegisterChangeEvent += RegisterChangeEvent;
-                mKdb.ModuleListEvent += ModuleListEvent;
-                mKdb.MemoryUpdateEvent += MemoryUpdateEvent;
+                ConnectEventHandlers();
                 Running = true;
                 if (DebugConnectionConnectedEvent != null)
                     DebugConnectionConnectedEvent(this, new DebugConnectedEventArgs());
@@ -315,6 +410,16 @@
             }
         }
 
+        public void SetProcess(ulong pid)
+        {
+            mKdb.SetProcess(pid);
+        }
+
+        public void SetThread(ulong tid)
+        {
+            mKdb.SetThread(tid);
+        }
+
         public DebugMemoryStream NewMemoryStream()
         {
             lock (mMemoryReaders)

Modified: trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs?rev=35287&r1=35286&r2=35287&view=diff
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs [iso-8859-1] Tue Aug 12 05:48:38 2008
@@ -69,6 +69,28 @@
         }
     }
     public delegate void ModuleListEventHandler(object sender, ModuleListEventArgs args);
+
+    public class ProcessListEventArgs : EventArgs
+    {
+        public readonly bool Reset, Current, End;
+        public readonly ulong Pid;
+        public ProcessListEventArgs() { Reset = true; }
+        public ProcessListEventArgs(bool end) { End = true; }
+        public ProcessListEventArgs(ulong pid, bool current) { Current = current; Pid = pid; }
+    }
+
+    public delegate void ProcessListEventHandler(object sender, ProcessListEventArgs args);
+
+    public class ThreadListEventArgs : EventArgs
+    {
+        public readonly bool Reset, Current, End;
+        public readonly ulong Tid;
+        public ThreadListEventArgs() { Reset = true; }
+        public ThreadListEventArgs(bool end) { End = true; }
+        public ThreadListEventArgs(ulong tid, bool current) { Current = current; Tid = tid; }
+    }
+
+    public delegate void ThreadListEventHandler(object sender, ThreadListEventArgs args);
     #endregion
 
     public interface IDebugProtocol
@@ -82,16 +104,23 @@
         event RemoteGDBErrorHandler RemoteGDBError;
         event MemoryUpdateEventHandler MemoryUpdateEvent;
         event ModuleListEventHandler ModuleListEvent;
+        event ProcessListEventHandler ProcessListEvent;
+        event ThreadListEventHandler ThreadListEvent;
 
         void GetRegisterUpdate();
         void GetModuleUpdate();
         void GetMemoryUpdate(ulong address, int len);
+        void GetProcesses();
+        void GetThreads(ulong pid);
         void WriteMemory(ulong address, byte[] buf);
         void Step();
         void Next();
         void Break();
         void Go(ulong address);
 
+        void SetProcess(ulong pid);
+        void SetThread(ulong tid);
+
         void Write(string wr);
 
         void Close();

Modified: trunk/tools/reactosdbg/DebugProtocol/KDBG.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/KDBG.cs?rev=35287&r1=35286&r2=35287&view=diff
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/KDBG.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/KDBG.cs [iso-8859-1] Tue Aug 12 05:48:38 2008
@@ -38,10 +38,16 @@
         static Regex mRegLineEBP = new Regex("EBP  0x(?<ebp>[0-9a-fA-F]+).*");
         static Regex mRegLineEFLAGS = new Regex("EFLAGS  0x(?<eflags>[0-9a-fA-F]+).*");
         static Regex mSregLine = new Regex("[CDEFGS]S  0x(?<seg>[0-9a-fA-F]+).*");
+        static Regex mProcListHeading = new Regex("PID[ \\t]+State[ \\t]+Filename.*");
+        static Regex mThreadListHeading = new Regex("TID[ \\t]+State[ \\t]+Prio.*");
+        static Regex mProcListEntry = new Regex("^(?<cur>([*]|))0x(?<pid>[0-9a-fA-F]+)[ \\t]+(?<state>.*)");
+        static Regex mThreadListEntry = new Regex("^(?<cur>([*]|))0x(?<tid>[0-9a-fA-F]+)[ \\t]+(?<state>.*)");
 
         bool mFirstModuleUpdate = false;
+        bool mReceivingProcs = false;
+        bool mReceivingThreads = false;
         StringBuilder mInputBuffer = new StringBuilder();
-        int usedInput;
+        int mUsedInput;
 
         void PipeReceiveEvent(object sender, PipeReceiveEventArgs args)
         {
@@ -51,10 +57,10 @@
 
             mInputBuffer.Append(args.Received);
 
-            if (mInputBuffer.ToString().Substring(usedInput).Contains("key to continue"))
+            if (mInputBuffer.ToString().Substring(mUsedInput).Contains("key to continue"))
             {
                 mConnection.Write("\r");
-                usedInput = mInputBuffer.Length;
+                mUsedInput = mInputBuffer.Length;
             }
 
             while ((promptIdx = (inbufStr = mInputBuffer.ToString()).IndexOf("kdb:> ")) != -1)
@@ -64,7 +70,7 @@
                 int remove = pretext.Length + "kdb:> ".Length;
 
                 mInputBuffer.Remove(0, remove);
-                usedInput = Math.Max(0, usedInput - remove);
+                mUsedInput = Math.Max(0, mUsedInput - remove);
 
                 if (!tookText)
                 {
@@ -72,6 +78,7 @@
                     {
                         mRunning = false;
                         GetRegisterUpdate();
+                        GetProcesses();
                     }
                     tookText = true;
                 }
@@ -83,7 +90,10 @@
                     {
                         if (cleanedLine.StartsWith("Entered debugger on "))
                         {
+                            mReceivingProcs = false;
+                            mReceivingThreads = false;
                             GetRegisterUpdate();
+                            GetProcesses();
                             continue;
                         }
 
@@ -149,7 +159,6 @@
                             mModuleList[moduleName.ToUpper()] = baseAddress;
                             if (ModuleListEvent != null)
                                 ModuleListEvent(this, new ModuleListEventArgs(moduleName, baseAddress));
-
                             continue;
                         }
 
@@ -170,6 +179,7 @@
                             ulong esp = ulong.Parse(ssEspMatch.Groups["esp"].ToString(), NumberStyles.HexNumber);
                             mRegisters[4] = esp;
                             mRegisters[15] = ss;
+                            continue;
                         }
 
                         Match eaxEbxMatch = mRegLineEAX_EBX.Match(cleanedLine);
@@ -228,7 +238,56 @@
                             }
                             continue;
                         }
-                    } catch (Exception) { /* Error line ... we'll ignore it for now */ }
+
+                        Match pidHeadMatch = mProcListHeading.Match(cleanedLine);
+                        if (pidHeadMatch.Success)
+                        {
+                            mReceivingThreads = false;
+                            mReceivingProcs = true;
+                            if (ProcessListEvent != null)
+                                ProcessListEvent(this, new ProcessListEventArgs());
+                            continue;
+                        }
+                        else
+                        {
+                            Match pidEntryMatch = mProcListEntry.Match(cleanedLine);
+                            if (pidEntryMatch.Success)
+                            {
+                                if (ProcessListEvent != null)
+                                    ProcessListEvent(this, new ProcessListEventArgs(ulong.Parse(pidEntryMatch.Groups["pid"].ToString(), NumberStyles.HexNumber), pidEntryMatch.Groups["cur"].Length > 0));
+                            }
+                            else
+                            {
+                                if ((mReceivingProcs || cleanedLine.Contains("No processes")) && ProcessListEvent != null)
+                                    ProcessListEvent(this, new ProcessListEventArgs(true));
+                            }
+                        }
+
+                        Match tidHeadMatch = mThreadListHeading.Match(cleanedLine);
+                        if (tidHeadMatch.Success)
+                        {
+                            mReceivingThreads = true;
+                            mReceivingProcs = false;
+                            if (ThreadListEvent != null)
+                                ThreadListEvent(this, new ThreadListEventArgs());
+                            continue;
+                        }
+                        else
+                        {
+                            Match tidEntryMatch = mThreadListEntry.Match(cleanedLine);
+                            if (tidEntryMatch.Success)
+                            {
+                                if (ThreadListEvent != null)
+                                    ThreadListEvent(this, new ThreadListEventArgs(ulong.Parse(tidEntryMatch.Groups["tid"].ToString(), NumberStyles.HexNumber), tidEntryMatch.Groups["cur"].Length > 0));
+                            }
+                            else
+                            {
+                                if (mReceivingThreads && ThreadListEvent != null)
+                                    ThreadListEvent(this, new ThreadListEventArgs(true));
+                            }
+                        }
+                    }
+                    catch (Exception) { /* Error line ... we'll ignore it for now */ }
                 }
             }
 
@@ -260,6 +319,8 @@
         public event RemoteGDBErrorHandler RemoteGDBError;
         public event MemoryUpdateEventHandler MemoryUpdateEvent;
         public event ModuleListEventHandler ModuleListEvent;
+        public event ProcessListEventHandler ProcessListEvent;
+        public event ThreadListEventHandler ThreadListEvent;
 
         public void GetRegisterUpdate()
         {
@@ -299,6 +360,7 @@
             QueueCommand("step");
             GetRegisterUpdate();
             GetModuleUpdate();
+            GetProcesses();
         }
 
         public void Next()
@@ -306,6 +368,7 @@
             QueueCommand("next");
             GetRegisterUpdate();
             GetModuleUpdate();
+            GetProcesses();
         }
 
         public void Break()
@@ -322,6 +385,28 @@
             QueueCommand("cont");
         }
 
+        public void GetProcesses()
+        {
+            QueueCommand("proc list");
+        }
+
+        public void GetThreads(ulong pid)
+        {
+            QueueCommand(string.Format("thread list 0x{0:X8}", pid));
+        }
+
+        public void SetProcess(ulong pid)
+        {
+            QueueCommand(string.Format("proc attach 0x{0:X8}", pid));
+            GetRegisterUpdate();
+        }
+
+        public void SetThread(ulong tid)
+        {
+            QueueCommand(string.Format("thread attach 0x{0:X8}", tid));
+            GetRegisterUpdate();
+        }
+
         public void Write(string wr) { mConnection.Write(wr); }
 
         public void Close()

Added: trunk/tools/reactosdbg/RosDBG/ProcThread.Designer.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/ProcThread.Designer.cs?rev=35287&view=auto
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/ProcThread.Designer.cs (added)
+++ trunk/tools/reactosdbg/RosDBG/ProcThread.Designer.cs [iso-8859-1] Tue Aug 12 05:48:38 2008
@@ -1,0 +1,101 @@
+namespace RosDBG
+{
+    partial class ProcThread
+    {
+        /// <summary> 
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary> 
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Component Designer generated code
+
+        /// <summary> 
+        /// Required method for Designer support - do not modify 
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+            this.Processes = new System.Windows.Forms.DataGridView();
+            this.Threads = new System.Windows.Forms.DataGridView();
+            this.splitContainer1.Panel1.SuspendLayout();
+            this.splitContainer1.Panel2.SuspendLayout();
+            this.splitContainer1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.Processes)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.Threads)).BeginInit();
+            this.SuspendLayout();
+            // 
+            // splitContainer1
+            // 
+            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+            this.splitContainer1.Name = "splitContainer1";
+            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+            // 
+            // splitContainer1.Panel1
+            // 
+            this.splitContainer1.Panel1.Controls.Add(this.Processes);
+            // 
+            // splitContainer1.Panel2
+            // 
+            this.splitContainer1.Panel2.Controls.Add(this.Threads);
+            this.splitContainer1.Size = new System.Drawing.Size(419, 349);
+            this.splitContainer1.SplitterDistance = 139;
+            this.splitContainer1.TabIndex = 0;
+            // 
+            // Processes
+            // 
+            this.Processes.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.Processes.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.Processes.Location = new System.Drawing.Point(0, 0);
+            this.Processes.Name = "Processes";
+            this.Processes.Size = new System.Drawing.Size(419, 139);
+            this.Processes.TabIndex = 0;
+            this.Processes.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Processes_CellDoubleClick);
+            // 
+            // Threads
+            // 
+            this.Threads.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.Threads.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.Threads.Location = new System.Drawing.Point(0, 0);
+            this.Threads.Name = "Threads";
+            this.Threads.Size = new System.Drawing.Size(419, 206);
+            this.Threads.TabIndex = 0;
+            this.Threads.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.Threads_CellDoubleClick);
+            // 
+            // ProcThread
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.Controls.Add(this.splitContainer1);
+            this.Name = "ProcThread";
+            this.Size = new System.Drawing.Size(419, 349);
+            this.splitContainer1.Panel1.ResumeLayout(false);
+            this.splitContainer1.Panel2.ResumeLayout(false);
+            this.splitContainer1.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.Processes)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.Threads)).EndInit();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.SplitContainer splitContainer1;
+        private System.Windows.Forms.DataGridView Processes;
+        private System.Windows.Forms.DataGridView Threads;
+    }
+}

Added: trunk/tools/reactosdbg/RosDBG/ProcThread.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/ProcThread.cs?rev=35287&view=auto
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/ProcThread.cs (added)
+++ trunk/tools/reactosdbg/RosDBG/ProcThread.cs [iso-8859-1] Tue Aug 12 05:48:38 2008
@@ -1,0 +1,66 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using DebugProtocol;
+
+namespace RosDBG
+{
+    [DebugControl, BuildAtStartup]
+    public partial class ProcThread : UserControl, IUseDebugConnection
+    {
+        DebugConnection mConnection;
+        Dictionary<ulong, ProcessElement> mProcesses = new Dictionary<ulong,ProcessElement>();
+
+        public ProcThread()
+        {
+            InitializeComponent();
+        }
+
+        public void SetDebugConnection(DebugConnection conn)
+        {
+            mConnection = conn;
+            mConnection.DebugProcessThreadChangeEvent += DebugProcessThreadChangeEvent;
+        }
+
+        void DebugProcessThreadChangeEvent(object sender, DebugProcessThreadChangeEventArgs args)
+        {
+            mProcesses = args.Processes;
+            Invoke(Delegate.CreateDelegate(typeof(NoParamsDelegate), this, "RefreshProcThreads"));
+        }
+
+        void RefreshProcThreads()
+        {
+            Processes.DataSource = new List<ProcessElement>(mProcesses.Values);
+            foreach (ProcessElement pe in mProcesses.Values)
+            {
+                if (pe.Current)
+                {
+                    Threads.DataSource = new List<ThreadElement>(mProcesses[pe.ProcessId].Threads.Values);
+                }
+            }
+        }
+
+        void DebugRunningChangeEvent(object sender, DebugRunningChangeEventArgs args)
+        {
+            if (!args.Running)
+            {
+                mConnection.Debugger.GetProcesses();
+            }
+        }
+
+        private void Processes_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
+        {
+            mConnection.SetProcess(((ProcessElement)Processes.Rows[e.RowIndex].DataBoundItem).ProcessId);
+        }
+
+        private void Threads_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
+        {
+            mConnection.SetThread(((ThreadElement)Threads.Rows[e.RowIndex].DataBoundItem).ThreadId);
+        }
+    }
+}

Added: trunk/tools/reactosdbg/RosDBG/ProcThread.resx
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/ProcThread.resx?rev=35287&view=auto
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/ProcThread.resx (added)
+++ trunk/tools/reactosdbg/RosDBG/ProcThread.resx [iso-8859-1] Tue Aug 12 05:48:38 2008
@@ -1,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

Modified: trunk/tools/reactosdbg/RosDBG/RegisterView.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/RegisterView.cs?rev=35287&r1=35286&r2=35287&view=diff
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/RegisterView.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/RegisterView.cs [iso-8859-1] Tue Aug 12 05:48:38 2008
@@ -30,7 +30,10 @@
             mConnection.DebugRegisterChangeEvent += DebugRegisterChangeEvent;
             mConnection.DebugRunningChangeEvent += DebugRunningChangeEvent;
             if (!mConnection.Running)
+            {
                 mConnection.Debugger.GetRegisterUpdate();
+                mConnection.Debugger.GetProcesses();
+            }
         }
 
         void UpdateGridEnabled()

Modified: trunk/tools/reactosdbg/RosDBG/RosDBG.csproj
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/RosDBG.csproj?rev=35287&r1=35286&r2=35287&view=diff
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/RosDBG.csproj [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/RosDBG.csproj [iso-8859-1] Tue Aug 12 05:48:38 2008
@@ -121,6 +121,12 @@
     <Compile Include="PipeTargetSelect.Designer.cs">
       <DependentUpon>PipeTargetSelect.cs</DependentUpon>
     </Compile>
+    <Compile Include="ProcThread.cs">
+      <SubType>UserControl</SubType>
+    </Compile>
+    <Compile Include="ProcThread.Designer.cs">
+      <DependentUpon>ProcThread.cs</DependentUpon>
+    </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <EmbeddedResource Include="BackTrace.resx">
@@ -153,6 +159,10 @@
     </EmbeddedResource>
     <EmbeddedResource Include="PipeTargetSelect.resx">
       <DependentUpon>PipeTargetSelect.cs</DependentUpon>
+      <SubType>Designer</SubType>
+    </EmbeddedResource>
+    <EmbeddedResource Include="ProcThread.resx">
+      <DependentUpon>ProcThread.cs</DependentUpon>
       <SubType>Designer</SubType>
     </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">



More information about the Ros-diffs mailing list