rendered paste bodydiff --git a/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sources b/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sourcesindex c3920d3..7b066b2 100644--- a/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sources+++ b/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sources@@ -59,3 +59,5 @@ Mono.Debugger.Soft/ThreadMirror.cs Mono.Debugger.Soft/TypeLoadEvent.cs Mono.Debugger.Soft/VMDisconnectEvent.cs Mono.Debugger.Soft/InvokeOptions.cs+Mono.Debugger.Soft/IInvokeAsyncResult.cs+diff --git a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLogindex 37fce59..eeddaa0 100644--- a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog+++ b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog@@ -1,3 +1,20 @@+2010-03-05 Martin Baulig <martin@ximian.com>++ **** Backport of r153125 and r153336 ****++ Add support for aborting invocations.++ * IInvokeAsyncResult.cs: New file.+ (IInvokeAsyncResult): New public interface; derives from+ `IAsyncResult' and contains an Abort() method.++ * Connection.cs+ (Connection.VM_BeginInvokeMethod): Return the `id'.+ (Connection.VM_AbortInvoke): New method.++ * ObjectMirror.cs+ (ObjectMirror.AbortInvoke): New internal static method.+ 2010-03-01 Zoltan Varga <vargaz@gmail.com> * VirtualMachine.cs: Allow working with runtimes implementing a differentdiff --git a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.csindex 40b3fd4..4088fb6 100644--- a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs+++ b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs@@ -200,7 +200,9 @@ namespace Mono.Debugger.Soft INVALID_FRAMEID = 30, NOT_IMPLEMENTED = 100, NOT_SUSPENDED = 101,- INVALID_ARGUMENT = 102+ INVALID_ARGUMENT = 102,+ ERR_UNLOADED = 103,+ ERR_NO_INVOCATION = 104 } public class ErrorHandlerEventArgs : EventArgs {@@ -289,7 +291,8 @@ namespace Mono.Debugger.Soft EXIT = 5, DISPOSE = 6, INVOKE_METHOD = 7,- SET_PROTOCOL_VERSION = 8+ SET_PROTOCOL_VERSION = 8,+ ABORT_INVOKE = 9 } enum CmdEvent {@@ -1047,7 +1050,7 @@ namespace Mono.Debugger.Soft } /* Send a request and call cb when a result is received */- void Send (CommandSet command_set, int command, PacketWriter packet, Action<PacketReader> cb) {+ int Send (CommandSet command_set, int command, PacketWriter packet, Action<PacketReader> cb) { int id = IdGenerator; lock (reply_packets_monitor) {@@ -1062,6 +1065,8 @@ namespace Mono.Debugger.Soft WritePacket (EncodePacket (id, (int)command_set, command, null, 0)); else WritePacket (EncodePacket (id, (int)command_set, command, packet.Data, packet.Offset));++ return id; } PacketReader SendReceive (CommandSet command_set, int command, PacketWriter packet) {@@ -1218,8 +1223,8 @@ namespace Mono.Debugger.Soft public delegate void InvokeMethodCallback (ValueImpl v, ValueImpl exc, ErrorCode error, object state); - public void VM_BeginInvokeMethod (long thread, long method, ValueImpl this_arg, ValueImpl[] arguments, InvokeFlags flags, InvokeMethodCallback callback, object state) {- Send (CommandSet.VM, (int)CmdVM.INVOKE_METHOD, new PacketWriter ().WriteId (thread).WriteInt ((int)flags).WriteId (method).WriteValue (this_arg).WriteInt (arguments.Length).WriteValues (arguments), delegate (PacketReader r) {+ public int VM_BeginInvokeMethod (long thread, long method, ValueImpl this_arg, ValueImpl[] arguments, InvokeFlags flags, InvokeMethodCallback callback, object state) {+ return Send (CommandSet.VM, (int)CmdVM.INVOKE_METHOD, new PacketWriter ().WriteId (thread).WriteInt ((int)flags).WriteId (method).WriteValue (this_arg).WriteInt (arguments.Length).WriteValues (arguments), delegate (PacketReader r) { ValueImpl v, exc; if (r.ErrorCode != 0) {@@ -1238,6 +1243,11 @@ namespace Mono.Debugger.Soft }); } + public void VM_AbortInvoke (long thread, int id)+ {+ SendReceive (CommandSet.VM, (int)CmdVM.ABORT_INVOKE, new PacketWriter ().WriteId (thread).WriteInt (id));+ }+ /* * DOMAIN */diff --git a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/IInvokeAsyncResult.cs b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/IInvokeAsyncResult.csnew file mode 100644index 0000000..19b0ae7--- /dev/null+++ b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/IInvokeAsyncResult.cs@@ -0,0 +1,10 @@+using System;+using System.Collections.Generic;++namespace Mono.Debugger.Soft+{+ public interface IInvokeAsyncResult : IAsyncResult+ {+ void Abort ();+ }+}diff --git a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.csindex e6e25fd..8b0db99 100644--- a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs+++ b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs@@ -115,7 +115,7 @@ namespace Mono.Debugger.Soft return BeginInvokeMethod (vm, thread, method, this, arguments, options, callback, state); } - public Value EndInvokeMethod (IAsyncResult asyncResult) {+ public Value EndInvokeMethod (IAsyncResult asyncResult) { return EndInvokeMethodInternal (asyncResult); } @@ -123,7 +123,7 @@ namespace Mono.Debugger.Soft * Common implementation for invokes */ - class InvokeAsyncResult : IAsyncResult {+ class InvokeAsyncResult : IInvokeAsyncResult { public object AsyncState { get; set;@@ -155,6 +155,10 @@ namespace Mono.Debugger.Soft get; set; } + public ThreadMirror Thread {+ get; set;+ }+ public ValueImpl Value { get; set; }@@ -162,9 +166,21 @@ namespace Mono.Debugger.Soft public ValueImpl Exception { get; set; }++ public int ID {+ get; set;+ }++ public void Abort ()+ {+ if (ID == 0) // Ooops+ return;++ ObjectMirror.AbortInvoke (VM, Thread, ID);+ } } - internal static IAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, Value this_obj, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {+ internal static IInvokeAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, Value this_obj, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) { if (thread == null) throw new ArgumentNullException ("thread"); if (method == null)@@ -179,9 +195,9 @@ namespace Mono.Debugger.Soft if ((options & InvokeOptions.SingleThreaded) != 0) f |= InvokeFlags.SINGLE_THREADED; - InvokeAsyncResult r = new InvokeAsyncResult { AsyncState = state, AsyncWaitHandle = new ManualResetEvent (false), VM = vm, Callback = callback };+ InvokeAsyncResult r = new InvokeAsyncResult { AsyncState = state, AsyncWaitHandle = new ManualResetEvent (false), VM = vm, Thread = thread, Callback = callback }; - vm.conn.VM_BeginInvokeMethod (thread.Id, method.Id, this_obj != null ? vm.EncodeValue (this_obj) : vm.EncodeValue (vm.CreateValue (null)), vm.EncodeValues (arguments), f, InvokeCB, r);+ r.ID = vm.conn.VM_BeginInvokeMethod (thread.Id, method.Id, this_obj != null ? vm.EncodeValue (this_obj) : vm.EncodeValue (vm.CreateValue (null)), vm.EncodeValues (arguments), f, InvokeCB, r); return r; }@@ -234,5 +250,10 @@ namespace Mono.Debugger.Soft internal static Value InvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, Value this_obj, IList<Value> arguments, InvokeOptions options) { return EndInvokeMethodInternal (BeginInvokeMethod (vm, thread, method, this_obj, arguments, options, null, null)); }++ internal static void AbortInvoke (VirtualMachine vm, ThreadMirror thread, int id)+ {+ vm.conn.VM_AbortInvoke (thread.Id, id);+ } } }diff --git a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.csindex 922eb8b..1db6037 100644--- a/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs+++ b/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs@@ -68,4 +68,4 @@ namespace Mono.Debugger.Soft return ObjectMirror.EndInvokeMethodInternal (asyncResult); } }-}\ No newline at end of file+}