Author: gschneider Date: Sat Aug 29 18:03:13 2009 New Revision: 42962
URL: http://svn.reactos.org/svn/reactos?rev=42962&view=rev Log: - Differentiate between immediate commands and queued commands, remove command queue shortcut, reorder functions accordingly - Do not duplicate register and process updates upon breaking into kdbg, fixes multiple thread lists - Remove end line hack from named pipe implementation - Handle all exception types for sockets, fixes a crash when disconnecting while receiving data
Modified: trunk/tools/reactosdbg/DebugProtocol/KDBG.cs trunk/tools/reactosdbg/Pipe/namedpipe.cs trunk/tools/reactosdbg/Pipe/socketpipe.cs trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs
Modified: trunk/tools/reactosdbg/DebugProtocol/KDBG.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/KDBG... ============================================================================== --- trunk/tools/reactosdbg/DebugProtocol/KDBG.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/DebugProtocol/KDBG.cs [iso-8859-1] Sat Aug 29 18:03:13 2009 @@ -78,8 +78,6 @@ if (mRunning) { mRunning = false; - GetRegisterUpdate(); - GetProcesses(); } tookText = true; } @@ -334,22 +332,6 @@ public event ProcessListEventHandler ProcessListEvent; public event ThreadListEventHandler ThreadListEvent;
- public void GetRegisterUpdate() - { - QueueCommand("regs"); - QueueCommand("sregs"); - } - - public void GetModuleUpdate() - { - QueueCommand("mod"); - } - - public void GetMemoryUpdate(ulong address, int len) - { - QueueCommand(string.Format("x 0x{0:X} L {1}", address, len)); - } - public void WriteMemory(ulong address, byte[] buf) { } @@ -359,70 +341,10 @@ lock (mCommandBuffer) { mCommandBuffer.Add(command); - if (mCommandBuffer.Count == 1) - { - mConnection.Write(command + "\r"); - /* remove the command after sending */ - mCommandBuffer.RemoveAt(0); - } } }
- public void Step() - { - QueueCommand("step"); - GetRegisterUpdate(); - GetModuleUpdate(); - GetProcesses(); - } - - public void Next() - { - QueueCommand("next"); - Thread.Sleep(100); - GetRegisterUpdate(); - GetModuleUpdate(); - GetProcesses(); - } - - public void Break() - { - mConnection.Write("\r"); - GetRegisterUpdate(); - GetModuleUpdate(); - } - - public void Go(ulong address) - { - mRunning = true; - mFirstModuleUpdate = false; - QueueCommand("cont"); - } - - public void GetProcesses() - { - QueueCommand("proc list"); - } - - public void GetThreads(ulong pid) - { - if (pid != 0) - 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) + public void Write(string wr) { /* Forward user input from RawTraffic if connected to kdbg */ if (!mRunning) @@ -434,5 +356,77 @@ public void Close() { } + + /* Immediately executed commands */ + public void Step() + { + Write("step"); + GetRegisterUpdate(); + GetModuleUpdate(); + GetProcesses(); + } + + public void Next() + { + Write("next"); + Thread.Sleep(100); + GetRegisterUpdate(); + GetModuleUpdate(); + GetProcesses(); + } + + public void Break() + { + Write(""); + GetRegisterUpdate(); + GetModuleUpdate(); + } + + public void Go(ulong address) + { + Write("cont"); + mRunning = true; + mFirstModuleUpdate = false; + } + + public void GetMemoryUpdate(ulong address, int len) + { + Write(string.Format("x 0x{0:X} L {1}", address, len)); + } + + /* Commands placed into the cmd queue */ + public void GetProcesses() + { + QueueCommand("proc list"); + } + + public void GetThreads(ulong pid) + { + if (pid != 0) + 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 GetRegisterUpdate() + { + QueueCommand("regs"); + QueueCommand("sregs"); + } + + public void GetModuleUpdate() + { + QueueCommand("mod"); + } } }
Modified: trunk/tools/reactosdbg/Pipe/namedpipe.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/namedpipe.cs?... ============================================================================== --- trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/Pipe/namedpipe.cs [iso-8859-1] Sat Aug 29 18:03:13 2009 @@ -264,14 +264,11 @@ /* only forward a complete line */ wCommand += str;
- if (str[str.Length-1] == '\r') //FIXME: remove this - { - cmdList.Add(wCommand); - wCommand = null; - - /* wake up the write thread */ - newWriteData.Set(); - } + cmdList.Add(wCommand); + wCommand = null; + + /* wake up the write thread */ + newWriteData.Set(); return true; } }
Modified: trunk/tools/reactosdbg/Pipe/socketpipe.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/socketpipe.cs... ============================================================================== --- trunk/tools/reactosdbg/Pipe/socketpipe.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/Pipe/socketpipe.cs [iso-8859-1] Sat Aug 29 18:03:13 2009 @@ -57,11 +57,11 @@ } while (mResult.CompletedSynchronously);
} - catch (System.Net.Sockets.SocketException se) + catch (Exception e) { mSocket.Close(); if (PipeErrorEvent != null) - PipeErrorEvent.Invoke(this, new PipeErrorEventArgs(se.Message)); + PipeErrorEvent.Invoke(this, new PipeErrorEventArgs(e.Message)); } }
Modified: trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs URL: http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Properties/... ============================================================================== --- trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs [iso-8859-1] (original) +++ trunk/tools/reactosdbg/RosDBG/Properties/AssemblyInfo.cs [iso-8859-1] Sat Aug 29 18:03:13 2009 @@ -39,5 +39,5 @@ // will be increased as well. MSI installers must not be generated with the same Build Number // otherwise they won't upgrade the old installation!
-[assembly: AssemblyVersion("1.0.2.81")] -[assembly: AssemblyFileVersion("1.0.2.81")] +[assembly: AssemblyVersion("1.0.2.84")] +[assembly: AssemblyFileVersion("1.0.2.84")]