Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorMartin Baulig <martin@novell.com>2010-04-06 18:58:58 +0400
committerMartin Baulig <martin@novell.com>2010-04-06 18:58:58 +0400
commit350c3485c5d44bd3ce6dec8d6e3a0350011fd5e0 (patch)
tree38a385c6b03380fde33d9cbb565287870577ec62 /mcs
parent841b835cf8db79d2b48cfa1153cf5a1d23eed545 (diff)
Backport of 153125+153336: Add support for aborting invocations.
2010-03-05 Martin Baulig <martin@ximian.com> 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.BeginInvokeMethod): Return `IInvokeAsyncResult' instead of `IAsyncResult'. Connection.VM_BeginInvokeMethod() now returns its id, store it in `InvokeAsyncResult.ID' because we need to pass it to VM_AbortInvoke(). (ObjectMirror.AbortInvoke): New internal static method. * StructMirror.cs (StructMirror.BeginInvokeMethod): Return `IInvokeAsyncResult' instead of `IAsyncResult'. * TypeMirror.cs (TypeMirror.BeginInvokeMethod): Return `IInvokeAsyncResult' instead of `IAsyncResult'. svn path=/branches/mono-2-6/mcs/; revision=154849
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sources2
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog15
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs20
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/IInvokeAsyncResult.cs10
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs35
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs6
-rw-r--r--mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs4
7 files changed, 75 insertions, 17 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sources b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sources
index c3920d3a946..7b066b2243e 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft.dll.sources
+++ b/mcs/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/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog
index 37fce59d67e..a2e095eaf19 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ChangeLog
@@ -1,3 +1,18 @@
+2010-03-05 Martin Baulig <martin@ximian.com>
+
+ 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 different
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
index 40b3fd46e18..4088fb66715 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs
+++ b/mcs/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/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/IInvokeAsyncResult.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/IInvokeAsyncResult.cs
new file mode 100644
index 00000000000..19b0ae72860
--- /dev/null
+++ b/mcs/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/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs
index e6e25fd8c0f..778252a13e6 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ObjectMirror.cs
@@ -107,15 +107,15 @@ namespace Mono.Debugger.Soft
}
[Obsolete ("Use the overload without the 'vm' argument")]
- public IAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
+ public IInvokeAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
return BeginInvokeMethod (vm, thread, method, this, arguments, options, callback, state);
}
- public IAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
+ public IInvokeAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
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/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs
index 922eb8bc89b..ae218c22a7f 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StructMirror.cs
@@ -56,11 +56,11 @@ namespace Mono.Debugger.Soft
}
[Obsolete ("Use the overload without the 'vm' argument")]
- public IAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
+ public IInvokeAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
return ObjectMirror.BeginInvokeMethod (vm, thread, method, this, arguments, options, callback, state);
}
- public IAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
+ public IInvokeAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
return ObjectMirror.BeginInvokeMethod (vm, thread, method, this, arguments, options, callback, state);
}
@@ -68,4 +68,4 @@ namespace Mono.Debugger.Soft
return ObjectMirror.EndInvokeMethodInternal (asyncResult);
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
index d73b2df372c..7b37df37dfe 100644
--- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
+++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
@@ -623,11 +623,11 @@ namespace Mono.Debugger.Soft
}
[Obsolete ("Use the overload without the 'vm' argument")]
- public IAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
+ public IInvokeAsyncResult BeginInvokeMethod (VirtualMachine vm, ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
return ObjectMirror.BeginInvokeMethod (vm, thread, method, null, arguments, options, callback, state);
}
- public IAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
+ public IInvokeAsyncResult BeginInvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments, InvokeOptions options, AsyncCallback callback, object state) {
return ObjectMirror.BeginInvokeMethod (vm, thread, method, null, arguments, options, callback, state);
}