Author: arty
Date: Fri Aug 8 13:03:59 2008
New Revision: 35190
URL:
http://svn.reactos.org/svn/reactos?rev=35190&view=rev
Log:
Patches by Gregor Schneider <grschneider at gmail dot com>
Added serial support, some bugfixes.
Modified:
trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs
trunk/tools/reactosdbg/DebugProtocol/KDBG.cs
trunk/tools/reactosdbg/Pipe/Pipe.csproj
trunk/tools/reactosdbg/RosDBG/BackTrace.cs
trunk/tools/reactosdbg/RosDBG/MainWindow.Designer.cs
trunk/tools/reactosdbg/RosDBG/MainWindow.cs
trunk/tools/reactosdbg/RosDBG/RosDBG.csproj
trunk/tools/reactosdbg/RosDBG/Settings.cs
Modified: trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/Deb…
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/DebugConnection.cs [iso-8859-1] Fri Aug 8
13:03:59 2008
@@ -4,6 +4,7 @@
using System.Text;
using
System.Net;
using System.Net.Sockets;
+using System.IO.Ports;
using AbstractPipe;
using DebugProtocol;
using KDBGProtocol;
@@ -68,7 +69,7 @@
public class DebugConnection
{
#region Primary State
- public enum Mode { ClosedMode, SocketMode }
+ public enum Mode { ClosedMode, SocketMode, SerialMode }
public Mode ConnectionMode
{
get { return mConnectionMode; }
@@ -104,6 +105,10 @@
SocketAsyncEventArgs mAsyncConnect;
AsyncCallback mDnsLookup;
IAsyncResult mDnsAsyncResult;
+ #endregion
+
+ #region Serial Mode Members
+ SerialPort mSerialPort;
#endregion
public event DebugRegisterChangeEventHandler DebugRegisterChangeEvent;
@@ -154,6 +159,33 @@
mDnsAsyncResult = Dns.BeginGetHostEntry(host, mDnsLookup, this);
}
+ public void Start(int baudrate, string port)
+ {
+ Close();
+ ConnectionMode = Mode.SerialMode;
+ mSerialPort = new SerialPort(port, baudrate, Parity.None, 8, StopBits.One);
+ mSerialPort.Handshake = Handshake.None;
+ try
+ {
+ //opening could fail for occupied, not existing or misconfigured ports
+ mSerialPort.Open();
+ //create pipe and kdb instances, connect internal receive pipe
+ mMedium = new SerialPipe(mSerialPort);
+ mMedium.PipeReceiveEvent += PipeReceiveEvent;
+ mKdb = new KDBG(mMedium);
+ //set up tab handlers
+ mKdb.RegisterChangeEvent += RegisterChangeEvent;
+ mKdb.ModuleListEvent += ModuleListEvent;
+ mKdb.MemoryUpdateEvent += MemoryUpdateEvent;
+ Running = true;
+ }
+ catch (Exception)
+ {
+ ConnectionMode = Mode.ClosedMode;
+ //error signal?
+ }
+ }
+
public void Close()
{
switch (ConnectionMode)
@@ -161,6 +193,11 @@
case Mode.SocketMode:
mSocket.Close();
mSocket = null;
+ break;
+ case Mode.SerialMode:
+ mSerialPort.Close();
+ mSerialPort = null;
+ Running = false;
break;
}
@@ -231,7 +268,7 @@
DebugModuleChangedEvent(this, new
DebugModuleChangedEventArgs((uint)args.Address, args.Module));
}
- void RegisterChangeEvent(object sender, RegisterChangeEventArgs args)
+ void RegisterChangeEvent(object sender, RegisterChangeEventArgs args)
{
args.Registers.CopyTo(mRegisters.RegisterSet);
Running = false;
Modified: trunk/tools/reactosdbg/DebugProtocol/KDBG.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/DebugProtocol/KDB…
==============================================================================
--- trunk/tools/reactosdbg/DebugProtocol/KDBG.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/DebugProtocol/KDBG.cs [iso-8859-1] Fri Aug 8 13:03:59 2008
@@ -287,7 +287,10 @@
{
mCommandBuffer.Add(command);
if (mCommandBuffer.Count == 1)
+ {
mConnection.Write(command + "\r");
+ mCommandBuffer.RemoveAt(0); //useful???
+ }
}
}
Modified: trunk/tools/reactosdbg/Pipe/Pipe.csproj
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/Pipe/Pipe.csproj?…
==============================================================================
--- trunk/tools/reactosdbg/Pipe/Pipe.csproj [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/Pipe/Pipe.csproj [iso-8859-1] Fri Aug 8 13:03:59 2008
@@ -45,6 +45,7 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="serialpipe.cs" />
<Compile Include="pipe.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="socketpipe.cs" />
Modified: trunk/tools/reactosdbg/RosDBG/BackTrace.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/BackTrace.…
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/BackTrace.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/BackTrace.cs [iso-8859-1] Fri Aug 8 13:03:59 2008
@@ -135,8 +135,11 @@
private void StackFrames_SelectedIndexChanged(object sender, EventArgs e)
{
- string []parsedEntry = ((string)StackFrames.SelectedItem).Split(new char []
{' '});
- mSelectedAddr = ulong.Parse(parsedEntry[0], NumberStyles.HexNumber);
+ if (StackFrames.SelectedItem != null) //crashed with argumentnullexception
+ {
+ string[] parsedEntry = ((string)StackFrames.SelectedItem).Split(new
char[] { ' ' });
+ mSelectedAddr = ulong.Parse(parsedEntry[0], NumberStyles.HexNumber);
+ }
}
private void StackFrames_MouseDoubleClick(object sender, MouseEventArgs e)
Modified: trunk/tools/reactosdbg/RosDBG/MainWindow.Designer.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/MainWindow…
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/MainWindow.Designer.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/MainWindow.Designer.cs [iso-8859-1] Fri Aug 8 13:03:59
2008
@@ -131,6 +131,7 @@
this.connectSerialToolStripMenuItem.Name =
"connectSerialToolStripMenuItem";
this.connectSerialToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
this.connectSerialToolStripMenuItem.Text = "Connect Serial ...";
+ this.connectSerialToolStripMenuItem.Click += new
System.EventHandler(this.connectSerialToolStripMenuItem_Click);
//
// connectPipeToolStripMenuItem
//
Modified: trunk/tools/reactosdbg/RosDBG/MainWindow.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/MainWindow…
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/MainWindow.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/MainWindow.cs [iso-8859-1] Fri Aug 8 13:03:59 2008
@@ -251,6 +251,16 @@
mSourceRoot = Settings.SourceDirectory;
mSymbolContext.ReactosOutputPath = Settings.OutputDirectory;
}
+
+ private void connectSerialToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ SerialTargetSelect targetSelect = new SerialTargetSelect();
+ if (targetSelect.ShowDialog() == DialogResult.OK)
+ {
+ mConnection.Close();
+ mConnection.Start(targetSelect.Baudrate, targetSelect.Port);
+ }
+ }
}
public class InteractiveInputEventArgs : EventArgs
Modified: trunk/tools/reactosdbg/RosDBG/RosDBG.csproj
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/RosDBG.csp…
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/RosDBG.csproj [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/RosDBG.csproj [iso-8859-1] Fri Aug 8 13:03:59 2008
@@ -166,6 +166,10 @@
<DependentUpon>Settings.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
+ <EmbeddedResource Include="SerialTargetSelect.resx">
+ <DependentUpon>SerialTargetSelect.cs</DependentUpon>
+ <SubType>Designer</SubType>
+ </EmbeddedResource>
<EmbeddedResource Include="SourceView.resx">
<DependentUpon>SourceView.cs</DependentUpon>
<SubType>Designer</SubType>
@@ -211,6 +215,12 @@
</Compile>
<Compile Include="Settings.Designer.cs">
<DependentUpon>Settings.cs</DependentUpon>
+ </Compile>
+ <Compile Include="SerialTargetSelect.cs">
+ <SubType>Form</SubType>
+ </Compile>
+ <Compile Include="SerialTargetSelect.Designer.cs">
+ <DependentUpon>SerialTargetSelect.cs</DependentUpon>
</Compile>
<Compile Include="SourceView.cs">
<SubType>UserControl</SubType>
@@ -272,4 +282,4 @@
<PropertyGroup>
<PostBuildEvent>copy $(SolutionDir)dbghelptest\dbghelp.dll
$(TargetDir)</PostBuildEvent>
</PropertyGroup>
-</Project>
+</Project>
Modified: trunk/tools/reactosdbg/RosDBG/Settings.cs
URL:
http://svn.reactos.org/svn/reactos/trunk/tools/reactosdbg/RosDBG/Settings.c…
==============================================================================
--- trunk/tools/reactosdbg/RosDBG/Settings.cs [iso-8859-1] (original)
+++ trunk/tools/reactosdbg/RosDBG/Settings.cs [iso-8859-1] Fri Aug 8 13:03:59 2008
@@ -7,7 +7,6 @@
using System.Text;
using System.Configuration;
using System.Windows.Forms;
-using System.ComponentModel;
using System.Drawing.Design;
namespace RosDBG