From dc7d0dc66b4ea436ebf2d7e830e05dbbbb512544 Mon Sep 17 00:00:00 2001 From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498> Date: Sun, 19 Jun 2011 14:12:44 +0000 Subject: [PATCH] --- source2/Debug/Cosmos.Debug.VSDebugEngine/DebugWindows.cs | 8 ++++---- .../Engine.Impl/EngineCallback.cs | 3 +++ source2/VSIP/Cosmos.VS.Debug/MainWindow.xaml.cs | 8 ++++++-- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/DebugWindows.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/DebugWindows.cs index 374d4c3cd..a1db61672 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/DebugWindows.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/DebugWindows.cs @@ -8,15 +8,15 @@ using System.Text; namespace Cosmos.Debug.VSDebugEngine { public class DebugWindows { - + public static void Test(string aData) { - using (var xPipe = new NamedPipeClientStream(".", "CosmosDebug", PipeDirection.Out)) { - // The connect function will indefinately wait for the pipe to become available - // If that is not acceptable specify a maximum waiting time (in ms) + using (var xPipe = new NamedPipeClientStream(".", "CosmosDebugWindows", PipeDirection.Out)) { xPipe.Connect(); using (var xWriter = new StreamWriter(xPipe)) { xWriter.WriteLine(aData); } + xPipe.Flush(); + xPipe.WaitForPipeDrain(); } } diff --git a/source2/Debug/Cosmos.Debug.VSDebugEngine/Engine.Impl/EngineCallback.cs b/source2/Debug/Cosmos.Debug.VSDebugEngine/Engine.Impl/EngineCallback.cs index dd3d841d8..67346ec1b 100644 --- a/source2/Debug/Cosmos.Debug.VSDebugEngine/Engine.Impl/EngineCallback.cs +++ b/source2/Debug/Cosmos.Debug.VSDebugEngine/Engine.Impl/EngineCallback.cs @@ -139,6 +139,9 @@ namespace Cosmos.Debug.VSDebugEngine var eventObject = new AD7BreakpointEvent(boundBreakpointsEnum); var ad7Thread = (AD7Thread)thread; Send(eventObject, AD7BreakpointEvent.IID, ad7Thread); + // We catch and resend data rather than using a second serial port because + // while this would work fine in a VM, it puts extra requirements on the setup + // when real hardware is used. DebugWindows.Test("Test"); } diff --git a/source2/VSIP/Cosmos.VS.Debug/MainWindow.xaml.cs b/source2/VSIP/Cosmos.VS.Debug/MainWindow.xaml.cs index 19f6f74b6..26055bcef 100644 --- a/source2/VSIP/Cosmos.VS.Debug/MainWindow.xaml.cs +++ b/source2/VSIP/Cosmos.VS.Debug/MainWindow.xaml.cs @@ -18,12 +18,16 @@ using System.Windows.Threading; namespace Cosmos.VS.Debug { public partial class MainWindow : Window { + public MainWindow() { InitializeComponent(); + + var xServerThread = new Thread(ThreadStartServer); + xServerThread.Start(); } - public void ThreadStartClient(object obj) { - using (var xPipe = new NamedPipeServerStream("CosmosDebug", PipeDirection.In)) { + public void ThreadStartServer() { + using (var xPipe = new NamedPipeServerStream("CosmosDebugWindows", PipeDirection.In)) { xPipe.WaitForConnection(); using (var xReader = new StreamReader(xPipe)) { string xLine = xReader.ReadLine();