[ros-diffs] [arty] 35405: Add per-thread EIP and EIP decoding.

arty at svn.reactos.org arty at svn.reactos.org
Sun Aug 17 13:44:03 CEST 2008


Author: arty
Date: Sun Aug 17 06:44:03 2008
New Revision: 35405

URL: http://svn.reactos.org/svn/reactos?rev=35405&view=rev
Log:
Add per-thread EIP and EIP decoding.

Modified:
    trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs
    trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs
    trunk/tools/reactosdbg/DebugProtocol/KDBG.cs
    trunk/tools/reactosdbg/RosDBG/ProcThread.cs

Modified: trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs?rev=35405&r1=35404&r2=35405&view=diff
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs [iso-8859-1] Sun Aug 17 06:44:03 2008
@@ -72,7 +72,11 @@
         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; }
+        ulong mEip;
+        public ulong Eip { get { return mEip; } set { mEip = value; } }
+        string mDescription;
+        public string Description { get { return mDescription; } set { mDescription = value; } }
+        public ThreadElement(ulong tid, bool current, ulong eip) { mTid = tid; mCurrent = current; mEip = eip; }
     }
 
     public class ProcessElement
@@ -288,7 +292,7 @@
             }
             else
             {
-                mAccumulateProcesses[mNewCurrentProcess].Threads[args.Tid] = new ThreadElement(args.Tid, args.Current);
+                mAccumulateProcesses[mNewCurrentProcess].Threads[args.Tid] = new ThreadElement(args.Tid, args.Current, args.Eip);
             }
 
             if (args.Current)

Modified: trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs?rev=35405&r1=35404&r2=35405&view=diff
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/IDebugProtocol.cs [iso-8859-1] Sun Aug 17 06:44:03 2008
@@ -84,10 +84,10 @@
     public class ThreadListEventArgs : EventArgs
     {
         public readonly bool Reset, Current, End;
-        public readonly ulong Tid;
+        public readonly ulong Tid, Eip;
         public ThreadListEventArgs() { Reset = true; }
         public ThreadListEventArgs(bool end) { End = true; }
-        public ThreadListEventArgs(ulong tid, bool current) { Current = current; Tid = tid; }
+        public ThreadListEventArgs(ulong tid, bool current, ulong eip) { Current = current; Tid = tid; Eip = eip; }
     }
 
     public delegate void ThreadListEventHandler(object sender, ThreadListEventArgs args);

Modified: trunk/tools/reactosdbg/DebugProtocol/KDBG.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/KDBG.cs?rev=35405&r1=35404&r2=35405&view=diff
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/KDBG.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/KDBG.cs [iso-8859-1] Sun Aug 17 06:44:03 2008
@@ -41,7 +41,7 @@
         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>.*)");
+        static Regex mThreadListEntry = new Regex("^(?<cur>([*]|))0x(?<tid>[0-9a-fA-F]+)[ \\t]+(?<state>.*)0x(?<eip>[0-9a-fA-F]*)");
 
         bool mFirstModuleUpdate = false;
         bool mReceivingProcs = false;
@@ -278,7 +278,7 @@
                             if (tidEntryMatch.Success && mReceivingThreads)
                             {
                                 if (ThreadListEvent != null)
-                                    ThreadListEvent(this, new ThreadListEventArgs(ulong.Parse(tidEntryMatch.Groups["tid"].ToString(), NumberStyles.HexNumber), tidEntryMatch.Groups["cur"].Length > 0));
+                                    ThreadListEvent(this, new ThreadListEventArgs(ulong.Parse(tidEntryMatch.Groups["tid"].ToString(), NumberStyles.HexNumber), tidEntryMatch.Groups["cur"].Length > 0, ulong.Parse(tidEntryMatch.Groups["eip"].ToString(), NumberStyles.HexNumber)));
                             }
                             else
                             {

Modified: trunk/tools/reactosdbg/RosDBG/ProcThread.cs
URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/ProcThread.cs?rev=35405&r1=35404&r2=35405&view=diff
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/ProcThread.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/ProcThread.cs [iso-8859-1] Sun Aug 17 06:44:03 2008
@@ -7,13 +7,15 @@
 using System.Text;
 using System.Windows.Forms;
 using DebugProtocol;
+using DbgHelpAPI;
 
 namespace RosDBG
 {
     [DebugControl, BuildAtStartup]
-    public partial class ProcThread : UserControl, IUseDebugConnection
+    public partial class ProcThread : UserControl, IUseDebugConnection, IUseSymbols
     {
         DebugConnection mConnection;
+        SymbolContext mSymcon;
         Dictionary<ulong, ProcessElement> mProcesses = new Dictionary<ulong,ProcessElement>();
 
         public ProcThread()
@@ -25,6 +27,11 @@
         {
             mConnection = conn;
             mConnection.DebugProcessThreadChangeEvent += DebugProcessThreadChangeEvent;
+        }
+
+        public void SetSymbolProvider(SymbolContext symcon)
+        {
+            mSymcon = symcon;
         }
 
         void DebugProcessThreadChangeEvent(object sender, DebugProcessThreadChangeEventArgs args)
@@ -40,7 +47,13 @@
             {
                 if (pe.Current)
                 {
-                    Threads.DataSource = new List<ThreadElement>(mProcesses[pe.ProcessId].Threads.Values);
+                    List<ThreadElement> telist = new List<ThreadElement>(mProcesses[pe.ProcessId].Threads.Values);
+                    foreach (ThreadElement te in telist)
+                    {
+                        KeyValuePair<string, int> fileLine = mSymcon.GetFileAndLine(te.Eip);
+                        te.Description = fileLine.Key + ":" + fileLine.Value;
+                    }
+                    Threads.DataSource = telist;
                 }
             }
         }



More information about the Ros-diffs mailing list