4 using System.Net.Sockets;
5 using System.Threading;
6 using System.Collections.Generic;
8 using Mono.Cecil.Metadata;
10 namespace Mono.Debugger.Soft
13 public string VMVersion {
17 public int MajorVersion {
21 public int MinorVersion {
27 public int max_il_offset;
28 public string filename;
29 public int[] il_offsets;
30 public int[] line_numbers;
37 public StackFrameFlags flags;
41 public string ns, name, full_name;
42 public long assembly, module, base_type, element_type;
43 public int token, rank, attributes;
44 public bool is_byref, is_pointer, is_primitive, is_valuetype, is_enum;
49 public int attributes, iattributes, token;
52 class MethodBodyInfo {
58 public int param_count;
59 public int generic_param_count;
61 public long[] param_types;
62 public string[] param_names;
67 public string[] names;
68 public int[] live_range_start;
69 public int[] live_range_end;
75 public long get_method, set_method;
79 class CattrNamedArgInfo {
80 public bool is_property;
82 public ValueImpl value;
87 public ValueImpl[] ctor_args;
88 public CattrNamedArgInfo[] named_args;
92 public bool is_thread_pool;
96 VALUE_TYPE_ID_NULL = 0xf0,
97 VALUE_TYPE_ID_TYPE = 0xf1
102 DISABLE_BREAKPOINTS = 0x1,
103 SINGLE_THREADED = 0x2
107 public ElementType Type; /* or one of the VALUE_TYPE_ID constants */
110 public long Klass; // For ElementType.ValueType
111 public ValueImpl[] Fields; // for ElementType.ValueType
112 public bool IsEnum; // For ElementType.ValueType
113 public long Id; /* For VALUE_TYPE_ID_TYPE */
117 public string Name, ScopeName, FQName, Guid;
118 public long Assembly;
129 enum StackFrameFlags {
133 class ResolvedToken {
134 public TokenType Type;
142 class CountModifier : Modifier {
148 class LocationModifier : Modifier {
153 public long Location {
158 class StepModifier : Modifier {
172 class ThreadModifier : Modifier {
178 class ExceptionModifier : Modifier {
185 public bool Uncaught {
190 class AssemblyModifier : Modifier {
191 public long[] Assemblies {
196 public enum ErrorCode {
199 INVALID_FIELDID = 25,
200 INVALID_FRAMEID = 30,
201 NOT_IMPLEMENTED = 100,
203 INVALID_ARGUMENT = 102,
205 ERR_NO_INVOCATION = 104
208 public class ErrorHandlerEventArgs : EventArgs {
210 public ErrorCode ErrorCode {
216 * Represents the connection to the debuggee
221 * The protocol and the packet format is based on JDWP, the differences
222 * are in the set of supported events, and the commands.
224 public const string HANDSHAKE_STRING = "DWP-Handshake";
226 public const int HEADER_LENGTH = 11;
229 * Th version of the wire-protocol implemented by the library. The library
230 * and the debuggee can communicate if they implement the same major version.
231 * If they implement a different minor version, they can communicate, but some
232 * features might not be available. This allows older clients to communicate
233 * with newer runtimes, and vice versa.
235 public const int MAJOR_VERSION = 2;
236 public const int MINOR_VERSION = 1;
238 enum WPSuspendPolicy {
265 APPDOMAIN_CREATE = 4, // Not in JDI
266 APPDOMAIN_UNLOAD = 5, // Not in JDI
294 SET_PROTOCOL_VERSION = 8,
309 enum CmdEventRequest {
312 CLEAR_ALL_BREAKPOINTS = 3
317 GET_FRIENDLY_NAME = 2,
319 GET_ENTRY_ASSEMBLY = 4,
322 CREATE_BOXED_VALUE = 7
328 GET_MANIFEST_MODULE = 3,
340 GET_DECLARING_TYPE = 2,
355 GET_SOURCE_FILES = 6,
357 IS_ASSIGNABLE_FROM = 8,
360 GET_FIELD_CATTRS = 11,
361 GET_PROPERTY_CATTRS = 12
391 public int command_set;
396 public static int GetPacketLength (byte[] header) {
398 return decode_int (header, ref offset);
401 public static bool IsReplyPacket (byte[] packet) {
403 return decode_byte (packet, ref offset) == 0x80;
406 public static int GetPacketId (byte[] packet) {
408 return decode_int (packet, ref offset);
411 static int decode_byte (byte[] packet, ref int offset) {
412 return packet [offset++];
415 static int decode_short (byte[] packet, ref int offset) {
416 int res = ((int)packet [offset] << 8) | (int)packet [offset + 1];
421 static int decode_int (byte[] packet, ref int offset) {
422 int res = ((int)packet [offset] << 24) | ((int)packet [offset + 1] << 16) | ((int)packet [offset + 2] << 8) | (int)packet [offset + 3];
427 static long decode_id (byte[] packet, ref int offset) {
428 return decode_int (packet, ref offset);
431 static long decode_long (byte[] packet, ref int offset) {
432 uint high = (uint)decode_int (packet, ref offset);
433 uint low = (uint)decode_int (packet, ref offset);
435 return (long)(((ulong)high << 32) | (ulong)low);
438 public static SuspendPolicy decode_suspend_policy (int suspend_policy) {
439 switch ((WPSuspendPolicy)suspend_policy) {
440 case WPSuspendPolicy.NONE:
441 return SuspendPolicy.None;
442 case WPSuspendPolicy.EVENT_THREAD:
443 return SuspendPolicy.EventThread;
444 case WPSuspendPolicy.ALL:
445 return SuspendPolicy.All;
447 throw new NotImplementedException ();
451 static Header decode_command_header (byte[] packet) {
453 Header res = new Header ();
455 decode_int (packet, ref offset);
456 res.id = decode_int (packet, ref offset);
457 res.flags = decode_byte (packet, ref offset);
458 res.command_set = decode_byte (packet, ref offset);
459 res.command = decode_byte (packet, ref offset);
464 static void encode_byte (byte[] buf, int b, ref int offset) {
465 buf [offset] = (byte)b;
469 static void encode_int (byte[] buf, int i, ref int offset) {
470 buf [offset] = (byte)((i >> 24) & 0xff);
471 buf [offset + 1] = (byte)((i >> 16) & 0xff);
472 buf [offset + 2] = (byte)((i >> 8) & 0xff);
473 buf [offset + 3] = (byte)((i >> 0) & 0xff);
477 static void encode_id (byte[] buf, long id, ref int offset) {
478 encode_int (buf, (int)id, ref offset);
481 static void encode_long (byte[] buf, long l, ref int offset) {
482 encode_int (buf, (int)((l >> 32) & 0xffffffff), ref offset);
483 encode_int (buf, (int)(l & 0xffffffff), ref offset);
486 public static byte[] EncodePacket (int id, int commandSet, int command, byte[] data, int dataLen) {
487 byte[] buf = new byte [dataLen + 11];
490 encode_int (buf, buf.Length, ref offset);
491 encode_int (buf, id, ref offset);
492 encode_byte (buf, 0, ref offset);
493 encode_byte (buf, commandSet, ref offset);
494 encode_byte (buf, command, ref offset);
496 for (int i = 0; i < dataLen; ++i)
497 buf [offset + i] = data [i];
506 public PacketReader (byte[] packet) {
507 this.packet = packet;
510 Header header = decode_command_header (packet);
511 CommandSet = (CommandSet)header.command_set;
512 Command = header.command;
516 ReadInt (); // length
518 ReadByte (); // flags
519 ErrorCode = ReadShort ();
522 public CommandSet CommandSet {
530 public int ErrorCode {
540 public int ReadByte () {
541 return decode_byte (packet, ref offset);
544 public int ReadShort () {
545 return decode_short (packet, ref offset);
548 public int ReadInt () {
549 return decode_int (packet, ref offset);
552 public long ReadId () {
553 return decode_id (packet, ref offset);
556 public long ReadLong () {
557 return decode_long (packet, ref offset);
560 public float ReadFloat () {
561 float f = DataConverter.FloatFromBE (packet, offset);
566 public double ReadDouble () {
567 double d = DataConverter.DoubleFromBE (packet, offset);
572 public string ReadString () {
573 int len = decode_int (packet, ref offset);
574 string res = new String (Encoding.UTF8.GetChars (packet, offset, len));
579 public ValueImpl ReadValue () {
580 ElementType etype = (ElementType)ReadByte ();
583 case ElementType.Void:
584 return new ValueImpl { Type = etype };
586 return new ValueImpl { Type = etype, Value = (sbyte)ReadInt () };
588 return new ValueImpl { Type = etype, Value = (byte)ReadInt () };
589 case ElementType.Boolean:
590 return new ValueImpl { Type = etype, Value = ReadInt () != 0 };
592 return new ValueImpl { Type = etype, Value = (short)ReadInt () };
594 return new ValueImpl { Type = etype, Value = (ushort)ReadInt () };
595 case ElementType.Char:
596 return new ValueImpl { Type = etype, Value = (char)ReadInt () };
598 return new ValueImpl { Type = etype, Value = ReadInt () };
600 return new ValueImpl { Type = etype, Value = (uint)ReadInt () };
602 return new ValueImpl { Type = etype, Value = ReadLong () };
604 return new ValueImpl { Type = etype, Value = (ulong)ReadLong () };
606 return new ValueImpl { Type = etype, Value = ReadFloat () };
608 return new ValueImpl { Type = etype, Value = ReadDouble () };
611 case ElementType.Ptr:
612 // FIXME: The client and the debuggee might have different word sizes
613 return new ValueImpl { Type = etype, Value = ReadLong () };
614 case ElementType.String:
615 case ElementType.SzArray:
616 case ElementType.Class:
617 case ElementType.Array:
618 case ElementType.Object:
619 long objid = ReadId ();
620 return new ValueImpl () { Type = etype, Objid = objid };
621 case ElementType.ValueType:
622 bool is_enum = ReadByte () == 1;
623 long klass = ReadId ();
624 long nfields = ReadInt ();
625 ValueImpl[] fields = new ValueImpl [nfields];
626 for (int i = 0; i < nfields; ++i)
627 fields [i] = ReadValue ();
628 return new ValueImpl () { Type = etype, Klass = klass, Fields = fields, IsEnum = is_enum };
629 case (ElementType)ValueTypeId.VALUE_TYPE_ID_NULL:
630 return new ValueImpl { Type = etype };
631 case (ElementType)ValueTypeId.VALUE_TYPE_ID_TYPE:
632 return new ValueImpl () { Type = etype, Id = ReadId () };
634 throw new NotImplementedException ("Unable to handle type " + etype);
644 public PacketWriter () {
646 data = new byte [1024];
650 public PacketWriter WriteByte (byte val) {
651 encode_byte (data, val, ref offset);
655 public PacketWriter WriteInt (int val) {
656 encode_int (data, val, ref offset);
660 public PacketWriter WriteId (long id) {
661 encode_id (data, id, ref offset);
665 public PacketWriter WriteLong (long val) {
666 encode_long (data, val, ref offset);
670 public PacketWriter WriteFloat (float f) {
671 byte[] b = DataConverter.GetBytesBE (f);
672 for (int i = 0; i < 4; ++i)
673 data [offset + i] = b [i];
678 public PacketWriter WriteDouble (double d) {
679 byte[] b = DataConverter.GetBytesBE (d);
680 for (int i = 0; i < 8; ++i)
681 data [offset + i] = b [i];
686 public PacketWriter WriteInts (int[] ids) {
687 for (int i = 0; i < ids.Length; ++i)
692 public PacketWriter WriteIds (long[] ids) {
693 for (int i = 0; i < ids.Length; ++i)
698 public PacketWriter WriteString (string s) {
699 encode_int (data, s.Length, ref offset);
700 byte[] b = Encoding.UTF8.GetBytes (s);
701 Buffer.BlockCopy (b, 0, data, offset, b.Length);
706 public PacketWriter WriteBool (bool val) {
707 WriteByte (val ? (byte)1 : (byte)0);
711 public PacketWriter WriteValue (ValueImpl v) {
715 t = TypeCodeToElementType (Type.GetTypeCode (v.Value.GetType ()));
720 case ElementType.Boolean:
721 WriteInt ((bool)v.Value ? 1 : 0);
723 case ElementType.Char:
724 WriteInt ((int)(char)v.Value);
727 WriteInt ((int)(sbyte)v.Value);
730 WriteInt ((int)(byte)v.Value);
733 WriteInt ((int)(short)v.Value);
736 WriteInt ((int)(ushort)v.Value);
739 WriteInt ((int)(int)v.Value);
742 WriteInt ((int)(uint)v.Value);
745 WriteLong ((long)(long)v.Value);
748 WriteLong ((long)(ulong)v.Value);
751 WriteFloat ((float)v.Value);
754 WriteDouble ((double)v.Value);
756 case ElementType.String:
757 case ElementType.SzArray:
758 case ElementType.Class:
759 case ElementType.Array:
760 case ElementType.Object:
763 case ElementType.ValueType:
766 throw new NotImplementedException ();
769 WriteInt (v.Fields.Length);
770 for (int i = 0; i < v.Fields.Length; ++i)
771 WriteValue (v.Fields [i]);
773 case (ElementType)ValueTypeId.VALUE_TYPE_ID_NULL:
776 throw new NotImplementedException ();
782 public PacketWriter WriteValues (ValueImpl[] values) {
783 for (int i = 0; i < values.Length; ++i)
784 WriteValue (values [i]);
801 delegate void ReplyCallback (int packet_id, byte[] packet);
805 Thread receiver_thread;
806 Dictionary<int, byte[]> reply_packets;
807 Dictionary<int, ReplyCallback> reply_cbs;
808 object reply_packets_monitor;
810 public event EventHandler<ErrorHandlerEventArgs> ErrorHandler;
812 public Connection (Socket socket) {
813 this.socket = socket;
814 //socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.NoDelay, 1);
816 reply_packets = new Dictionary<int, byte[]> ();
817 reply_cbs = new Dictionary<int, ReplyCallback> ();
818 reply_packets_monitor = new Object ();
821 int Receive (byte[] buf, int buf_offset, int len) {
824 while (offset < len) {
825 int n = socket.Receive (buf, buf_offset + offset, len - offset, SocketFlags.None);
835 public VersionInfo Version;
837 // Do the wire protocol handshake
838 public void Connect () {
839 byte[] buf = new byte [HANDSHAKE_STRING.Length];
840 char[] cbuf = new char [buf.Length];
842 // FIXME: Add a timeout
843 int n = Receive (buf, 0, buf.Length);
845 throw new IOException ("DWP Handshake failed.");
846 for (int i = 0; i < buf.Length; ++i)
847 cbuf [i] = (char)buf [i];
849 if (new String (cbuf) != HANDSHAKE_STRING)
850 throw new IOException ("DWP Handshake failed.");
854 receiver_thread = new Thread (new ThreadStart (receiver_thread_main));
855 receiver_thread.Start ();
857 Version = VM_GetVersion ();
860 // Tell the debuggee our protocol version, so newer debuggees can work
861 // with older clients
865 // Older debuggees might not support this request
866 EventHandler<ErrorHandlerEventArgs> OrigErrorHandler = ErrorHandler;
868 ErrorHandler += delegate (object sender, ErrorHandlerEventArgs args) {
869 throw new NotSupportedException ();
872 VM_SetProtocolVersion (MAJOR_VERSION, MINOR_VERSION);
873 } catch (NotSupportedException) {
875 ErrorHandler = OrigErrorHandler;
878 public EndPoint EndPoint {
880 return socket.RemoteEndPoint;
884 public byte[] ReadPacket () {
885 // FIXME: Throw ClosedConnectionException () if the connection is closed
886 // FIXME: Throw ClosedConnectionException () if another thread closes the connection
888 byte[] header = new byte [HEADER_LENGTH];
890 int len = Receive (header, 0, header.Length);
893 if (len != HEADER_LENGTH) {
895 throw new IOException ("Packet of length " + len + " is read.");
898 int packetLength = GetPacketLength (header);
899 if (packetLength < 11)
900 throw new IOException ("Invalid packet length.");
902 if (packetLength == 11) {
905 byte[] buf = new byte [packetLength];
906 for (int i = 0; i < header.Length; ++i)
907 buf [i] = header [i];
908 len = Receive (buf, header.Length, packetLength - header.Length);
909 if (len != packetLength - header.Length)
910 throw new IOException ();
915 public void WritePacket (byte[] packet) {
916 // FIXME: Throw ClosedConnectionException () if the connection is closed
917 // FIXME: Throw ClosedConnectionException () if another thread closes the connection
919 socket.Send (packet);
922 public void Close () {
926 public bool IsClosed {
934 void receiver_thread_main () {
937 bool res = ReceivePacket ();
940 } catch (Exception ex) {
941 Console.WriteLine (ex);
946 lock (reply_packets_monitor) {
948 Monitor.PulseAll (reply_packets_monitor);
950 EventHandler.VMDisconnect (0, 0, null);
953 bool ReceivePacket () {
954 byte[] packet = ReadPacket ();
956 if (packet.Length == 0) {
960 if (IsReplyPacket (packet)) {
961 int id = GetPacketId (packet);
962 ReplyCallback cb = null;
963 lock (reply_packets_monitor) {
964 reply_cbs.TryGetValue (id, out cb);
966 reply_packets [id] = packet;
967 Monitor.PulseAll (reply_packets_monitor);
972 cb.Invoke (id, packet);
974 PacketReader r = new PacketReader (packet);
976 if (r.CommandSet == CommandSet.EVENT && r.Command == (int)CmdEvent.COMPOSITE) {
977 r.ReadByte (); // suspend_policy
978 int nevents = r.ReadInt ();
980 for (int i = 0; i < nevents; ++i) {
981 EventKind kind = (EventKind)r.ReadByte ();
982 int req_id = r.ReadInt ();
984 if (kind == EventKind.VM_START) {
985 long thread_id = r.ReadId ();
986 EventHandler.VMStart (req_id, thread_id, null);
987 } else if (kind == EventKind.VM_DEATH) {
988 EventHandler.VMDeath (req_id, 0, null);
989 } else if (kind == EventKind.THREAD_START) {
990 long thread_id = r.ReadId ();
991 EventHandler.ThreadStart (req_id, thread_id, thread_id);
992 } else if (kind == EventKind.THREAD_DEATH) {
993 long thread_id = r.ReadId ();
994 EventHandler.ThreadDeath (req_id, thread_id, thread_id);
995 } else if (kind == EventKind.ASSEMBLY_LOAD) {
996 long thread_id = r.ReadId ();
997 long id = r.ReadId ();
998 EventHandler.AssemblyLoad (req_id, thread_id, id);
999 } else if (kind == EventKind.ASSEMBLY_UNLOAD) {
1000 long thread_id = r.ReadId ();
1001 long id = r.ReadId ();
1002 EventHandler.AssemblyUnload (req_id, thread_id, id);
1003 } else if (kind == EventKind.TYPE_LOAD) {
1004 long thread_id = r.ReadId ();
1005 long id = r.ReadId ();
1006 EventHandler.TypeLoad (req_id, thread_id, id);
1007 } else if (kind == EventKind.METHOD_ENTRY) {
1008 long thread_id = r.ReadId ();
1009 long id = r.ReadId ();
1010 EventHandler.MethodEntry (req_id, thread_id, id);
1011 } else if (kind == EventKind.METHOD_EXIT) {
1012 long thread_id = r.ReadId ();
1013 long id = r.ReadId ();
1014 EventHandler.MethodExit (req_id, thread_id, id);
1015 } else if (kind == EventKind.BREAKPOINT) {
1016 long thread_id = r.ReadId ();
1017 long id = r.ReadId ();
1018 long loc = r.ReadLong ();
1019 EventHandler.Breakpoint (req_id, thread_id, id, loc);
1020 } else if (kind == EventKind.STEP) {
1021 long thread_id = r.ReadId ();
1022 long id = r.ReadId ();
1023 long loc = r.ReadLong ();
1024 EventHandler.Step (req_id, thread_id, id, loc);
1025 } else if (kind == EventKind.EXCEPTION) {
1026 long thread_id = r.ReadId ();
1027 long id = r.ReadId ();
1028 long loc = 0; // FIXME
1029 EventHandler.Exception (req_id, thread_id, id, loc);
1030 } else if (kind == EventKind.APPDOMAIN_CREATE) {
1031 long thread_id = r.ReadId ();
1032 long id = r.ReadId ();
1033 EventHandler.AppDomainCreate (req_id, thread_id, id);
1034 } else if (kind == EventKind.APPDOMAIN_UNLOAD) {
1035 long thread_id = r.ReadId ();
1036 long id = r.ReadId ();
1037 EventHandler.AppDomainUnload (req_id, thread_id, id);
1039 throw new NotImplementedException ("Unknown event kind: " + kind);
1048 public IEventHandler EventHandler {
1052 /* Send a request and call cb when a result is received */
1053 int Send (CommandSet command_set, int command, PacketWriter packet, Action<PacketReader> cb) {
1054 int id = IdGenerator;
1056 lock (reply_packets_monitor) {
1057 reply_cbs [id] = delegate (int packet_id, byte[] p) {
1058 /* Run the callback on a tp thread to avoid blocking the receive thread */
1059 PacketReader r = new PacketReader (p);
1060 cb.BeginInvoke (r, null, null);
1065 WritePacket (EncodePacket (id, (int)command_set, command, null, 0));
1067 WritePacket (EncodePacket (id, (int)command_set, command, packet.Data, packet.Offset));
1072 PacketReader SendReceive (CommandSet command_set, int command, PacketWriter packet) {
1073 int id = IdGenerator;
1076 WritePacket (EncodePacket (id, (int)command_set, command, null, 0));
1078 WritePacket (EncodePacket (id, (int)command_set, command, packet.Data, packet.Offset));
1082 /* Wait for the reply packet */
1084 lock (reply_packets_monitor) {
1085 if (reply_packets.ContainsKey (packetId)) {
1086 byte[] reply = reply_packets [packetId];
1087 reply_packets.Remove (packetId);
1088 PacketReader r = new PacketReader (reply);
1089 if (r.ErrorCode != 0) {
1090 if (ErrorHandler != null)
1091 ErrorHandler (this, new ErrorHandlerEventArgs () { ErrorCode = (ErrorCode)r.ErrorCode });
1092 throw new NotImplementedException ("No error handler set.");
1098 throw new VMDisconnectedException ();
1099 Monitor.Wait (reply_packets_monitor);
1105 PacketReader SendReceive (CommandSet command_set, int command) {
1106 return SendReceive (command_set, command, null);
1109 int packet_id_generator;
1113 return Interlocked.Increment (ref packet_id_generator);
1117 CattrInfo[] ReadCattrs (PacketReader r) {
1118 CattrInfo[] res = new CattrInfo [r.ReadInt ()];
1119 for (int i = 0; i < res.Length; ++i) {
1120 CattrInfo info = new CattrInfo ();
1121 info.ctor_id = r.ReadId ();
1122 info.ctor_args = new ValueImpl [r.ReadInt ()];
1123 for (int j = 0; j < info.ctor_args.Length; ++j) {
1124 info.ctor_args [j] = r.ReadValue ();
1126 info.named_args = new CattrNamedArgInfo [r.ReadInt ()];
1127 for (int j = 0; j < info.named_args.Length; ++j) {
1128 CattrNamedArgInfo arg = new CattrNamedArgInfo ();
1129 int arg_type = r.ReadByte ();
1130 arg.is_property = arg_type == 0x54;
1131 arg.id = r.ReadId ();
1132 arg.value = r.ReadValue ();
1133 info.named_args [j] = arg;
1140 static ElementType TypeCodeToElementType (TypeCode c) {
1142 case TypeCode.Boolean:
1143 return ElementType.Boolean;
1145 return ElementType.Char;
1146 case TypeCode.SByte:
1147 return ElementType.I1;
1149 return ElementType.U1;
1150 case TypeCode.Int16:
1151 return ElementType.I2;
1152 case TypeCode.UInt16:
1153 return ElementType.U2;
1154 case TypeCode.Int32:
1155 return ElementType.I4;
1156 case TypeCode.UInt32:
1157 return ElementType.U4;
1158 case TypeCode.Int64:
1159 return ElementType.I8;
1160 case TypeCode.UInt64:
1161 return ElementType.U8;
1162 case TypeCode.Single:
1163 return ElementType.R4;
1164 case TypeCode.Double:
1165 return ElementType.R8;
1167 throw new NotImplementedException ();
1172 * Implementation of debugger commands
1175 public VersionInfo VM_GetVersion () {
1176 var res = SendReceive (CommandSet.VM, (int)CmdVM.VERSION, null);
1177 VersionInfo info = new VersionInfo ();
1178 info.VMVersion = res.ReadString ();
1179 info.MajorVersion = res.ReadInt ();
1180 info.MinorVersion = res.ReadInt ();
1184 public void VM_SetProtocolVersion (int major, int minor) {
1185 SendReceive (CommandSet.VM, (int)CmdVM.SET_PROTOCOL_VERSION, new PacketWriter ().WriteInt (major).WriteInt (minor));
1188 public long[] VM_GetThreads () {
1189 var res = SendReceive (CommandSet.VM, (int)CmdVM.ALL_THREADS, null);
1190 int len = res.ReadInt ();
1191 long[] arr = new long [len];
1192 for (int i = 0; i < len; ++i)
1193 arr [i] = res.ReadId ();
1197 public void VM_Suspend () {
1198 SendReceive (CommandSet.VM, (int)CmdVM.SUSPEND);
1201 public void VM_Resume () {
1202 SendReceive (CommandSet.VM, (int)CmdVM.RESUME);
1205 public void VM_Exit (int exitCode) {
1206 SendReceive (CommandSet.VM, (int)CmdVM.EXIT, new PacketWriter ().WriteInt (exitCode));
1209 public void VM_Dispose () {
1210 SendReceive (CommandSet.VM, (int)CmdVM.DISPOSE);
1213 public ValueImpl VM_InvokeMethod (long thread, long method, ValueImpl this_arg, ValueImpl[] arguments, InvokeFlags flags, out ValueImpl exc) {
1215 PacketReader r = SendReceive (CommandSet.VM, (int)CmdVM.INVOKE_METHOD, new PacketWriter ().WriteId (thread).WriteInt ((int)flags).WriteId (method).WriteValue (this_arg).WriteInt (arguments.Length).WriteValues (arguments));
1216 if (r.ReadByte () == 0) {
1217 exc = r.ReadValue ();
1220 return r.ReadValue ();
1224 public delegate void InvokeMethodCallback (ValueImpl v, ValueImpl exc, ErrorCode error, object state);
1226 public int VM_BeginInvokeMethod (long thread, long method, ValueImpl this_arg, ValueImpl[] arguments, InvokeFlags flags, InvokeMethodCallback callback, object state) {
1227 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) {
1230 if (r.ErrorCode != 0) {
1231 callback (null, null, (ErrorCode)r.ErrorCode, state);
1233 if (r.ReadByte () == 0) {
1234 exc = r.ReadValue ();
1241 callback (v, exc, 0, state);
1246 public void VM_AbortInvoke (long thread, int id)
1248 SendReceive (CommandSet.VM, (int)CmdVM.ABORT_INVOKE, new PacketWriter ().WriteId (thread).WriteInt (id));
1255 public long RootDomain {
1257 return SendReceive (CommandSet.APPDOMAIN, (int)CmdAppDomain.GET_ROOT_DOMAIN, null).ReadId ();
1261 public string Domain_GetName (long id) {
1262 return SendReceive (CommandSet.APPDOMAIN, (int)CmdAppDomain.GET_FRIENDLY_NAME, new PacketWriter ().WriteId (id)).ReadString ();
1265 public long[] Domain_GetAssemblies (long id) {
1266 var res = SendReceive (CommandSet.APPDOMAIN, (int)CmdAppDomain.GET_ASSEMBLIES, new PacketWriter ().WriteId (id));
1267 int count = res.ReadInt ();
1268 long[] assemblies = new long [count];
1269 for (int i = 0; i < count; ++i)
1270 assemblies [i] = res.ReadId ();
1274 public long Domain_GetEntryAssembly (long id) {
1275 return SendReceive (CommandSet.APPDOMAIN, (int)CmdAppDomain.GET_ENTRY_ASSEMBLY, new PacketWriter ().WriteId (id)).ReadId ();
1278 public long Domain_GetCorlib (long id) {
1279 return SendReceive (CommandSet.APPDOMAIN, (int)CmdAppDomain.GET_CORLIB, new PacketWriter ().WriteId (id)).ReadId ();
1282 public long Domain_CreateString (long id, string s) {
1283 return SendReceive (CommandSet.APPDOMAIN, (int)CmdAppDomain.CREATE_STRING, new PacketWriter ().WriteId (id).WriteString (s)).ReadId ();
1286 public long Domain_CreateBoxedValue (long id, long type_id, ValueImpl v) {
1287 return SendReceive (CommandSet.APPDOMAIN, (int)CmdAppDomain.CREATE_BOXED_VALUE, new PacketWriter ().WriteId (id).WriteId (type_id).WriteValue (v)).ReadId ();
1294 public string Method_GetName (long id) {
1295 return SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_NAME, new PacketWriter ().WriteId (id)).ReadString ();
1298 public long Method_GetDeclaringType (long id) {
1299 return SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_DECLARING_TYPE, new PacketWriter ().WriteId (id)).ReadId ();
1302 public DebugInfo Method_GetDebugInfo (long id) {
1303 var res = SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_DEBUG_INFO, new PacketWriter ().WriteId (id));
1305 DebugInfo info = new DebugInfo ();
1306 info.max_il_offset = res.ReadInt ();
1307 info.filename = res.ReadString ();
1309 int n_il_offsets = res.ReadInt ();
1310 info.il_offsets = new int [n_il_offsets];
1311 info.line_numbers = new int [n_il_offsets];
1312 for (int i = 0; i < n_il_offsets; ++i) {
1313 info.il_offsets [i] = res.ReadInt ();
1314 info.line_numbers [i] = res.ReadInt ();
1320 public ParamInfo Method_GetParamInfo (long id) {
1321 var res = SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_PARAM_INFO, new PacketWriter ().WriteId (id));
1323 ParamInfo info = new ParamInfo ();
1324 info.call_conv = res.ReadInt ();
1325 info.param_count = res.ReadInt ();
1326 info.generic_param_count = res.ReadInt ();
1327 info.ret_type = res.ReadId ();
1328 info.param_types = new long [info.param_count];
1329 for (int i = 0; i < info.param_count; ++i)
1330 info.param_types [i] = res.ReadId ();
1331 info.param_names = new string [info.param_count];
1332 for (int i = 0; i < info.param_count; ++i)
1333 info.param_names [i] = res.ReadString ();
1338 public LocalsInfo Method_GetLocalsInfo (long id) {
1339 var res = SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_LOCALS_INFO, new PacketWriter ().WriteId (id));
1341 LocalsInfo info = new LocalsInfo ();
1342 int nlocals = res.ReadInt ();
1343 info.types = new long [nlocals];
1344 for (int i = 0; i < nlocals; ++i)
1345 info.types [i] = res.ReadId ();
1346 info.names = new string [nlocals];
1347 for (int i = 0; i < nlocals; ++i)
1348 info.names [i] = res.ReadString ();
1349 info.live_range_start = new int [nlocals];
1350 info.live_range_end = new int [nlocals];
1351 for (int i = 0; i < nlocals; ++i) {
1352 info.live_range_start [i] = res.ReadInt ();
1353 info.live_range_end [i] = res.ReadInt ();
1359 public MethodInfo Method_GetInfo (long id) {
1360 var res = SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_INFO, new PacketWriter ().WriteId (id));
1362 MethodInfo info = new MethodInfo ();
1363 info.attributes = res.ReadInt ();
1364 info.iattributes = res.ReadInt ();
1365 info.token = res.ReadInt ();
1370 public MethodBodyInfo Method_GetBody (long id) {
1371 var res = SendReceive (CommandSet.METHOD, (int)CmdMethod.GET_BODY, new PacketWriter ().WriteId (id));
1373 MethodBodyInfo info = new MethodBodyInfo ();
1374 info.il = new byte [res.ReadInt ()];
1375 for (int i = 0; i < info.il.Length; ++i)
1376 info.il [i] = (byte)res.ReadByte ();
1381 public ResolvedToken Method_ResolveToken (long id, int token) {
1382 var res = SendReceive (CommandSet.METHOD, (int)CmdMethod.RESOLVE_TOKEN, new PacketWriter ().WriteId (id).WriteInt (token));
1384 TokenType type = (TokenType)res.ReadByte ();
1386 case TokenType.STRING:
1387 return new ResolvedToken () { Type = type, Str = res.ReadString () };
1388 case TokenType.TYPE:
1389 case TokenType.METHOD:
1390 case TokenType.FIELD:
1391 return new ResolvedToken () { Type = type, Id = res.ReadId () };
1392 case TokenType.UNKNOWN:
1393 return new ResolvedToken () { Type = type };
1395 throw new NotImplementedException ();
1403 public string Thread_GetName (long id) {
1404 return SendReceive (CommandSet.THREAD, (int)CmdThread.GET_NAME, new PacketWriter ().WriteId (id)).ReadString ();
1407 public FrameInfo[] Thread_GetFrameInfo (long id, int start_frame, int length) {
1408 var res = SendReceive (CommandSet.THREAD, (int)CmdThread.GET_FRAME_INFO, new PacketWriter ().WriteId (id).WriteInt (start_frame).WriteInt (length));
1409 int count = res.ReadInt ();
1411 var frames = new FrameInfo [count];
1412 for (int i = 0; i < count; ++i) {
1413 frames [i].id = res.ReadInt ();
1414 frames [i].method = res.ReadId ();
1415 frames [i].il_offset = res.ReadInt ();
1416 frames [i].flags = (StackFrameFlags)res.ReadByte ();
1421 public int Thread_GetState (long id) {
1422 return SendReceive (CommandSet.THREAD, (int)CmdThread.GET_STATE, new PacketWriter ().WriteId (id)).ReadInt ();
1425 public ThreadInfo Thread_GetInfo (long id) {
1426 PacketReader r = SendReceive (CommandSet.THREAD, (int)CmdThread.GET_INFO, new PacketWriter ().WriteId (id));
1428 ThreadInfo res = new ThreadInfo () { is_thread_pool = r.ReadByte () > 0 ? true : false };
1437 public ModuleInfo Module_GetInfo (long id) {
1438 PacketReader r = SendReceive (CommandSet.MODULE, (int)CmdModule.GET_INFO, new PacketWriter ().WriteId (id));
1439 ModuleInfo info = new ModuleInfo { Name = r.ReadString (), ScopeName = r.ReadString (), FQName = r.ReadString (), Guid = r.ReadString (), Assembly = r.ReadId () };
1447 public string Assembly_GetLocation (long id) {
1448 return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_LOCATION, new PacketWriter ().WriteId (id)).ReadString ();
1451 public long Assembly_GetEntryPoint (long id) {
1452 return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_ENTRY_POINT, new PacketWriter ().WriteId (id)).ReadId ();
1455 public long Assembly_GetManifestModule (long id) {
1456 return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_MANIFEST_MODULE, new PacketWriter ().WriteId (id)).ReadId ();
1459 public long Assembly_GetObject (long id) {
1460 return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_OBJECT, new PacketWriter ().WriteId (id)).ReadId ();
1463 public long Assembly_GetType (long id, string name, bool ignoreCase) {
1464 return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_TYPE, new PacketWriter ().WriteId (id).WriteString (name).WriteBool (ignoreCase)).ReadId ();
1467 public string Assembly_GetName (long id) {
1468 return SendReceive (CommandSet.ASSEMBLY, (int)CmdAssembly.GET_NAME, new PacketWriter ().WriteId (id)).ReadString ();
1475 public TypeInfo Type_GetInfo (long id) {
1476 PacketReader r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_INFO, new PacketWriter ().WriteId (id));
1477 TypeInfo res = new TypeInfo ();
1479 res.ns = r.ReadString ();
1480 res.name = r.ReadString ();
1481 res.full_name = r.ReadString ();
1482 res.assembly = r.ReadId ();
1483 res.module = r.ReadId ();
1484 res.base_type = r.ReadId ();
1485 res.element_type = r.ReadId ();
1486 res.token = r.ReadInt ();
1487 res.rank = r.ReadByte ();
1488 res.attributes = r.ReadInt ();
1489 int b = r.ReadByte ();
1490 res.is_byref = (b & 1) != 0;
1491 res.is_pointer = (b & 2) != 0;
1492 res.is_primitive = (b & 4) != 0;
1493 res.is_valuetype = (b & 8) != 0;
1494 res.is_enum = (b & 16) != 0;
1496 int nested_len = r.ReadInt ();
1497 res.nested = new long [nested_len];
1498 for (int i = 0; i < nested_len; ++i)
1499 res.nested [i] = r.ReadId ();
1504 public long[] Type_GetMethods (long id) {
1505 PacketReader r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_METHODS, new PacketWriter ().WriteId (id));
1507 int n = r.ReadInt ();
1508 long[] res = new long [n];
1509 for (int i = 0; i < n; ++i)
1510 res [i] = r.ReadId ();
1514 public long[] Type_GetFields (long id, out string[] names, out long[] types, out int[] attrs) {
1515 PacketReader r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_FIELDS, new PacketWriter ().WriteId (id));
1517 int n = r.ReadInt ();
1518 long[] res = new long [n];
1519 names = new string [n];
1520 types = new long [n];
1521 attrs = new int [n];
1522 for (int i = 0; i < n; ++i) {
1523 res [i] = r.ReadId ();
1524 names [i] = r.ReadString ();
1525 types [i] = r.ReadId ();
1526 attrs [i] = r.ReadInt ();
1531 public PropInfo[] Type_GetProperties (long id) {
1532 PacketReader r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_PROPERTIES, new PacketWriter ().WriteId (id));
1534 int n = r.ReadInt ();
1535 PropInfo[] res = new PropInfo [n];
1536 for (int i = 0; i < n; ++i) {
1537 res [i] = new PropInfo ();
1538 res [i].id = r.ReadId ();
1539 res [i].name = r.ReadString ();
1540 res [i].get_method = r.ReadId ();
1541 res [i].set_method = r.ReadId ();
1542 res [i].attrs = r.ReadInt ();
1548 public long Type_GetObject (long id) {
1549 return SendReceive (CommandSet.TYPE, (int)CmdType.GET_OBJECT, new PacketWriter ().WriteId (id)).ReadId ();
1552 public ValueImpl[] Type_GetValues (long id, long[] fields) {
1553 int len = fields.Length;
1554 PacketReader r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_VALUES, new PacketWriter ().WriteId (id).WriteInt (len).WriteIds (fields));
1556 ValueImpl[] res = new ValueImpl [len];
1557 for (int i = 0; i < len; ++i)
1558 res [i] = r.ReadValue ();
1562 public void Type_SetValues (long id, long[] fields, ValueImpl[] values) {
1563 SendReceive (CommandSet.TYPE, (int)CmdType.SET_VALUES, new PacketWriter ().WriteId (id).WriteInt (fields.Length).WriteIds (fields).WriteValues (values));
1566 public string[] Type_GetSourceFiles (long id) {
1567 var r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_SOURCE_FILES, new PacketWriter ().WriteId (id));
1568 int len = r.ReadInt ();
1569 string[] res = new string [len];
1570 for (int i = 0; i < len; ++i)
1571 res [i] = r.ReadString ();
1575 public bool Type_IsAssignableFrom (long id, long c_id) {
1576 return SendReceive (CommandSet.TYPE, (int)CmdType.IS_ASSIGNABLE_FROM, new PacketWriter ().WriteId (id).WriteId (c_id)).ReadByte () > 0;
1579 public CattrInfo[] Type_GetCustomAttributes (long id, long attr_type_id, bool inherit) {
1580 PacketReader r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_CATTRS, new PacketWriter ().WriteId (id).WriteId (attr_type_id));
1581 return ReadCattrs (r);
1584 public CattrInfo[] Type_GetFieldCustomAttributes (long id, long field_id, long attr_type_id, bool inherit) {
1585 PacketReader r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_FIELD_CATTRS, new PacketWriter ().WriteId (id).WriteId (field_id).WriteId (attr_type_id));
1586 return ReadCattrs (r);
1589 public CattrInfo[] Type_GetPropertyCustomAttributes (long id, long field_id, long attr_type_id, bool inherit) {
1590 PacketReader r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_PROPERTY_CATTRS, new PacketWriter ().WriteId (id).WriteId (field_id).WriteId (attr_type_id));
1591 return ReadCattrs (r);
1598 public int EnableEvent (EventType etype, SuspendPolicy suspend_policy, List<Modifier> mods) {
1599 var w = new PacketWriter ().WriteByte ((byte)etype).WriteByte ((byte)suspend_policy);
1601 if (mods.Count > 255)
1602 throw new NotImplementedException ();
1603 w.WriteByte ((byte)mods.Count);
1604 foreach (Modifier mod in mods) {
1605 if (mod is CountModifier) {
1606 w.WriteByte ((byte)ModifierKind.COUNT);
1607 w.WriteInt ((mod as CountModifier).Count);
1608 } else if (mod is LocationModifier) {
1609 w.WriteByte ((byte)ModifierKind.LOCATION_ONLY);
1610 w.WriteId ((mod as LocationModifier).Method);
1611 w.WriteLong ((mod as LocationModifier).Location);
1612 } else if (mod is StepModifier) {
1613 w.WriteByte ((byte)ModifierKind.STEP);
1614 w.WriteId ((mod as StepModifier).Thread);
1615 w.WriteInt ((mod as StepModifier).Size);
1616 w.WriteInt ((mod as StepModifier).Depth);
1617 } else if (mod is ThreadModifier) {
1618 w.WriteByte ((byte)ModifierKind.THREAD_ONLY);
1619 w.WriteId ((mod as ThreadModifier).Thread);
1620 } else if (mod is ExceptionModifier) {
1621 var em = mod as ExceptionModifier;
1622 w.WriteByte ((byte)ModifierKind.EXCEPTION_ONLY);
1623 w.WriteId (em.Type);
1624 if (Version.MajorVersion > 2 || Version.MinorVersion > 0) {
1625 /* This is only supported in protocol version 2.1 */
1626 w.WriteBool (em.Caught);
1627 w.WriteBool (em.Uncaught);
1628 } else if (!em.Caught || !em.Uncaught) {
1629 throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
1631 } else if (mod is AssemblyModifier) {
1632 w.WriteByte ((byte)ModifierKind.ASSEMBLY_ONLY);
1633 var amod = (mod as AssemblyModifier);
1634 w.WriteInt (amod.Assemblies.Length);
1635 foreach (var id in amod.Assemblies)
1638 throw new NotImplementedException ();
1644 return SendReceive (CommandSet.EVENT_REQUEST, (int)CmdEventRequest.SET, w).ReadInt ();
1647 public void ClearEventRequest (EventType etype, int req_id) {
1648 SendReceive (CommandSet.EVENT_REQUEST, (int)CmdEventRequest.CLEAR, new PacketWriter ().WriteByte ((byte)etype).WriteInt (req_id));
1651 public void ClearAllBreakpoints () {
1652 SendReceive (CommandSet.EVENT_REQUEST, (int)CmdEventRequest.CLEAR_ALL_BREAKPOINTS, new PacketWriter ());
1658 public ValueImpl StackFrame_GetThis (long thread_id, long id) {
1659 PacketReader r = SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.GET_THIS, new PacketWriter ().WriteId (thread_id).WriteId (id));
1660 return r.ReadValue ();
1663 public ValueImpl[] StackFrame_GetValues (long thread_id, long id, int[] pos) {
1664 /* pos < 0 -> argument at pos (-pos) - 1 */
1665 /* pos >= 0 -> local at pos */
1666 int len = pos.Length;
1667 PacketReader r = SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.GET_VALUES, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteInt (len).WriteInts (pos));
1669 ValueImpl[] res = new ValueImpl [len];
1670 for (int i = 0; i < len; ++i)
1671 res [i] = r.ReadValue ();
1675 public void StackFrame_SetValues (long thread_id, long id, int[] pos, ValueImpl[] values) {
1676 /* pos < 0 -> argument at pos (-pos) - 1 */
1677 /* pos >= 0 -> local at pos */
1678 int len = pos.Length;
1679 SendReceive (CommandSet.STACK_FRAME, (int)CmdStackFrame.SET_VALUES, new PacketWriter ().WriteId (thread_id).WriteId (id).WriteInt (len).WriteInts (pos).WriteValues (values));
1685 public int[] Array_GetLength (long id, out int rank, out int[] lower_bounds) {
1686 var r = SendReceive (CommandSet.ARRAY_REF, (int)CmdArrayRef.GET_LENGTH, new PacketWriter ().WriteId (id));
1687 rank = r.ReadInt ();
1688 int[] res = new int [rank];
1689 lower_bounds = new int [rank];
1690 for (int i = 0; i < rank; ++i) {
1691 res [i] = r.ReadInt ();
1692 lower_bounds [i] = r.ReadInt ();
1697 public ValueImpl[] Array_GetValues (long id, int index, int len) {
1698 var r = SendReceive (CommandSet.ARRAY_REF, (int)CmdArrayRef.GET_VALUES, new PacketWriter ().WriteId (id).WriteInt (index).WriteInt (len));
1699 ValueImpl[] res = new ValueImpl [len];
1700 for (int i = 0; i < len; ++i)
1701 res [i] = r.ReadValue ();
1705 public void Array_SetValues (long id, int index, ValueImpl[] values) {
1706 SendReceive (CommandSet.ARRAY_REF, (int)CmdArrayRef.SET_VALUES, new PacketWriter ().WriteId (id).WriteInt (index).WriteInt (values.Length).WriteValues (values));
1712 public string String_GetValue (long id) {
1713 return SendReceive (CommandSet.STRING_REF, (int)CmdStringRef.GET_VALUE, new PacketWriter ().WriteId (id)).ReadString ();
1719 public long Object_GetType (long id) {
1720 return SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.GET_TYPE, new PacketWriter ().WriteId (id)).ReadId ();
1723 public long Object_GetDomain (long id) {
1724 return SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.GET_DOMAIN, new PacketWriter ().WriteId (id)).ReadId ();
1727 public ValueImpl[] Object_GetValues (long id, long[] fields) {
1728 int len = fields.Length;
1729 PacketReader r = SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.GET_VALUES, new PacketWriter ().WriteId (id).WriteInt (len).WriteIds (fields));
1731 ValueImpl[] res = new ValueImpl [len];
1732 for (int i = 0; i < len; ++i)
1733 res [i] = r.ReadValue ();
1737 public void Object_SetValues (long id, long[] fields, ValueImpl[] values) {
1738 SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.SET_VALUES, new PacketWriter ().WriteId (id).WriteInt (fields.Length).WriteIds (fields).WriteValues (values));
1741 public bool Object_IsCollected (long id) {
1742 return SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.IS_COLLECTED, new PacketWriter ().WriteId (id)).ReadInt () == 1;
1745 public long Object_GetAddress (long id) {
1746 return SendReceive (CommandSet.OBJECT_REF, (int)CmdObjectRef.GET_ADDRESS, new PacketWriter ().WriteId (id)).ReadLong ();
1751 /* This is the interface exposed by the debugger towards the debugger agent */
1752 interface IEventHandler
1754 void VMStart (int req_id, long thread_id, string vm_uri);
1756 void VMDeath (int req_id, long thread_id, string vm_uri);
1758 void VMDisconnect (int req_id, long thread_id, string vm_uri);
1760 void ThreadStart (int req_id, long thread_id, long id);
1762 void ThreadDeath (int req_id, long thread_id, long id);
1764 void AssemblyLoad (int req_id, long thread_id, long id);
1766 void AssemblyUnload (int req_id, long thread_id, long id);
1768 void TypeLoad (int req_id, long thread_id, long id);
1770 void MethodEntry (int req_id, long thread_id, long id);
1772 void MethodExit (int req_id, long thread_id, long id);
1774 void Breakpoint (int req_id, long thread_id, long method_id, long loc);
1776 void Step (int req_id, long thread_id, long method_id, long loc);
1778 void Exception (int req_id, long thread_id, long exc_id, long loc);
1780 void AppDomainCreate (int req_id, long thread_id, long id);
1782 void AppDomainUnload (int req_id, long thread_id, long id);