[Monodevelop-patches-list] r2716 - trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Mon Aug 8 07:41:12 EDT 2005
Author: lluis
Date: 2005-08-08 07:41:12 -0400 (Mon, 08 Aug 2005)
New Revision: 2716
Added:
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebugExecutionHandlerFactory.cs
Modified:
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs
trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Makefile.am
Log:
2005-08-08 Lluis Sanchez Gual <lluis at novell.com>
* DebuggingService.cs: Implement GetExecutionHandlerFactory method.
* DebugExecutionHandlerFactory: Moved from MonoDevelop.Base.
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog 2005-08-08 11:40:31 UTC (rev 2715)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/ChangeLog 2005-08-08 11:41:12 UTC (rev 2716)
@@ -1,3 +1,8 @@
+2005-08-08 Lluis Sanchez Gual <lluis at novell.com>
+
+ * DebuggingService.cs: Implement GetExecutionHandlerFactory method.
+ * DebugExecutionHandlerFactory: Moved from MonoDevelop.Base.
+
2005-08-06 John Luke <john.luke at gmail.com>
* Makefile.am: add DebuggerPaths.cs.in to EXTRA_DIST
Added: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebugExecutionHandlerFactory.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebugExecutionHandlerFactory.cs 2005-08-08 11:40:31 UTC (rev 2715)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebugExecutionHandlerFactory.cs 2005-08-08 11:41:12 UTC (rev 2716)
@@ -0,0 +1,135 @@
+//
+// DebugExecutionHandlerFactory.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+using System.Threading;
+using MonoDevelop.Services;
+
+namespace MonoDevelop.Debugger
+{
+ internal class DebugExecutionHandlerFactory: IExecutionHandlerFactory
+ {
+ DebuggingService service;
+
+ public DebugExecutionHandlerFactory (DebuggingService service)
+ {
+ this.service = service;
+ }
+
+ public IExecutionHandler CreateExecutionHandler (string platformId)
+ {
+ if (Runtime.DebuggingService == null)
+ return null;
+
+ if (platformId == "Mono")
+ return new DebugExecutionHandler (service);
+ else
+ return null;
+ }
+ }
+
+ class DebugExecutionHandler: IExecutionHandler, IProcessAsyncOperation
+ {
+ bool done;
+ ManualResetEvent stopEvent;
+ DebuggingService service;
+
+ public DebugExecutionHandler (DebuggingService service)
+ {
+ this.service = service;
+ service.StoppedEvent += new EventHandler (OnStopDebug);
+ }
+
+ public IProcessAsyncOperation Execute (string command, string arguments, string workingDirectory, IConsole console)
+ {
+ service.Run (console, new string[] { command } );
+ return this;
+ }
+
+ public void Cancel ()
+ {
+ service.Stop ();
+ }
+
+ public void WaitForCompleted ()
+ {
+ lock (this) {
+ if (done) return;
+ if (stopEvent == null)
+ stopEvent = new ManualResetEvent (false);
+ }
+ stopEvent.WaitOne ();
+ }
+
+ public int ExitCode {
+ get { return 0; }
+ }
+
+ public bool IsCompleted {
+ get { return done; }
+ }
+
+ public bool Success {
+ get { return true; }
+ }
+
+ void OnStopDebug (object sender, EventArgs args)
+ {
+ lock (this) {
+ done = true;
+ if (stopEvent != null)
+ stopEvent.Set ();
+ if (completedEvent != null)
+ completedEvent (this);
+ }
+
+ service.StoppedEvent -= new EventHandler (OnStopDebug);
+ }
+
+ event OperationHandler IAsyncOperation.Completed {
+ add {
+ bool raiseNow = false;
+ lock (this) {
+ if (done)
+ raiseNow = true;
+ else
+ completedEvent += value;
+ }
+ if (raiseNow)
+ value (this);
+ }
+ remove {
+ lock (this) {
+ completedEvent -= value;
+ }
+ }
+ }
+
+ event OperationHandler completedEvent;
+ }
+}
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs 2005-08-08 11:40:31 UTC (rev 2715)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/DebuggingService.cs 2005-08-08 11:41:12 UTC (rev 2716)
@@ -31,19 +31,25 @@
Hashtable breakpoints = new Hashtable ();
DebuggerBackend backend;
IConsole console;
-
IProgressMonitor current_monitor;
+ DebugExecutionHandlerFactory executionHandlerFactory;
#if NET_2_0
DebugAttributeHandler attr_handler;
#endif
public DebuggingService()
{
+ executionHandlerFactory = new DebugExecutionHandlerFactory (this);
#if NET_2_0
attr_handler = new DebugAttributeHandler();
#endif
}
+ public IExecutionHandlerFactory GetExecutionHandlerFactory ()
+ {
+ return executionHandlerFactory;
+ }
+
void Cleanup ()
{
if (!IsDebugging)
Modified: trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Makefile.am
===================================================================
--- trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Makefile.am 2005-08-08 11:40:31 UTC (rev 2715)
+++ trunk/MonoDevelop/Core/src/AddIns/DebuggerAddIn/Makefile.am 2005-08-08 11:41:12 UTC (rev 2716)
@@ -12,6 +12,7 @@
FILES = \
DebuggingService.cs \
+DebugExecutionHandlerFactory.cs \
EvaluationContext.cs \
Expression.cs \
DebuggerASTVisitor.cs \
More information about the Monodevelop-patches-list
mailing list