- 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

svn path=/trunk/tools/reactosdbg/; revision=1101
This commit is contained in:
Gregor Schneider 2009-08-29 16:03:13 +00:00
parent 11d641c1f5
commit e6810d7597
4 changed files with 37 additions and 46 deletions

View File

@ -78,8 +78,6 @@ namespace KDBGProtocol
if (mRunning)
{
mRunning = false;
GetRegisterUpdate();
GetProcesses();
}
tookText = true;
}
@ -334,22 +332,6 @@ namespace KDBGProtocol
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,18 +341,26 @@ namespace KDBGProtocol
lock (mCommandBuffer)
{
mCommandBuffer.Add(command);
if (mCommandBuffer.Count == 1)
{
mConnection.Write(command + "\r");
/* remove the command after sending */
mCommandBuffer.RemoveAt(0);
}
}
}
public void Write(string wr)
{
/* Forward user input from RawTraffic if connected to kdbg */
if (!mRunning)
{
mConnection.Write(wr + "\r");
}
}
public void Close()
{
}
/* Immediately executed commands */
public void Step()
{
QueueCommand("step");
Write("step");
GetRegisterUpdate();
GetModuleUpdate();
GetProcesses();
@ -378,7 +368,7 @@ namespace KDBGProtocol
public void Next()
{
QueueCommand("next");
Write("next");
Thread.Sleep(100);
GetRegisterUpdate();
GetModuleUpdate();
@ -387,18 +377,24 @@ namespace KDBGProtocol
public void Break()
{
mConnection.Write("\r");
Write("");
GetRegisterUpdate();
GetModuleUpdate();
}
public void Go(ulong address)
{
Write("cont");
mRunning = true;
mFirstModuleUpdate = false;
QueueCommand("cont");
}
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");
@ -422,17 +418,15 @@ namespace KDBGProtocol
GetRegisterUpdate();
}
public void Write(string wr)
public void GetRegisterUpdate()
{
/* Forward user input from RawTraffic if connected to kdbg */
if (!mRunning)
{
mConnection.Write(wr + "\r");
}
QueueCommand("regs");
QueueCommand("sregs");
}
public void Close()
public void GetModuleUpdate()
{
QueueCommand("mod");
}
}
}

View File

@ -264,14 +264,11 @@ namespace AbstractPipe
/* only forward a complete line */
wCommand += str;
if (str[str.Length-1] == '\r') //FIXME: remove this
{
cmdList.Add(wCommand);
wCommand = null;
cmdList.Add(wCommand);
wCommand = null;
/* wake up the write thread */
newWriteData.Set();
}
/* wake up the write thread */
newWriteData.Set();
return true;
}
}

View File

@ -57,11 +57,11 @@ namespace AbstractPipe
} 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));
}
}

View File

@ -39,5 +39,5 @@ using System.Runtime.InteropServices;
// 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")]