Esempio n. 1
0
        public override void Serialize(PacketWriter writer, bool prefix)
        {
            PacketWriter pw = new PacketWriter();

            base.Serialize(pw, prefix);

            int lengthPosition = pw.Position;
            pw.WriteInt(0); // length

            pw.WriteInt(RequestId);
            pw.WriteInt(Header);
            pw.WriteStringNoZero(RconData);

            pw.Position = lengthPosition;

            pw.WriteInt(pw.Length);
        }
Esempio n. 2
0
        internal int VM_BeginInvokeMethods(long thread, long[] methods, ValueImpl this_arg, List<ValueImpl[]> arguments, InvokeFlags flags, InvokeMethodCallback callback, object state)
        {
            // FIXME: Merge this with INVOKE_METHOD
            var w = new PacketWriter ();
            w.WriteId (thread);
            w.WriteInt ((int)flags);
            w.WriteInt (methods.Length);
            for (int i = 0; i < methods.Length; ++i) {
                w.WriteId (methods [i]);
                w.WriteValue (this_arg);
                w.WriteInt (arguments [i].Length);
                w.WriteValues (arguments [i]);
            }
            return Send (CommandSet.VM, (int)CmdVM.INVOKE_METHODS, w, delegate (PacketReader r) {
                    ValueImpl v, exc, out_this = null;
                    ValueImpl[] out_args = null;

                    if (r.ErrorCode != 0) {
                        callback (null, null, null, null, (ErrorCode)r.ErrorCode, state);
                    } else {
                        read_invoke_res (r, out v, out exc, out out_this, out out_args);
                        callback (v, exc, out_this, out_args, 0, state);
                    }
                }, methods.Length);
        }
Esempio n. 3
0
 /*
  * EVENTS
  */
 internal int EnableEvent(EventType etype, SuspendPolicy suspend_policy, List<Modifier> mods)
 {
     var w = new PacketWriter ().WriteByte ((byte)etype).WriteByte ((byte)suspend_policy);
     if (mods != null) {
         if (mods.Count > 255)
             throw new NotImplementedException ();
         w.WriteByte ((byte)mods.Count);
         foreach (Modifier mod in mods) {
             if (mod is CountModifier) {
                 w.WriteByte ((byte)ModifierKind.COUNT);
                 w.WriteInt ((mod as CountModifier).Count);
             } else if (mod is LocationModifier) {
                 w.WriteByte ((byte)ModifierKind.LOCATION_ONLY);
                 w.WriteId ((mod as LocationModifier).Method);
                 w.WriteLong ((mod as LocationModifier).Location);
             } else if (mod is StepModifier) {
                 w.WriteByte ((byte)ModifierKind.STEP);
                 w.WriteId ((mod as StepModifier).Thread);
                 w.WriteInt ((mod as StepModifier).Size);
                 w.WriteInt ((mod as StepModifier).Depth);
                 if (Version.AtLeast (2, 16))
                     w.WriteInt ((mod as StepModifier).Filter);
             } else if (mod is ThreadModifier) {
                 w.WriteByte ((byte)ModifierKind.THREAD_ONLY);
                 w.WriteId ((mod as ThreadModifier).Thread);
             } else if (mod is ExceptionModifier) {
                 var em = mod as ExceptionModifier;
                 w.WriteByte ((byte)ModifierKind.EXCEPTION_ONLY);
                 w.WriteId (em.Type);
                 if (Version.MajorVersion > 2 || Version.MinorVersion > 0) {
                     /* This is only supported in protocol version 2.1 */
                     w.WriteBool (em.Caught);
                     w.WriteBool (em.Uncaught);
                 } else if (!em.Caught || !em.Uncaught) {
                     throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
                 }
                 if (Version.MajorVersion > 2 || Version.MinorVersion > 24) {
                     w.WriteBool (em.Subclasses);
                 } else if (!em.Subclasses) {
                     throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
                 }
             } else if (mod is AssemblyModifier) {
                 w.WriteByte ((byte)ModifierKind.ASSEMBLY_ONLY);
                 var amod = (mod as AssemblyModifier);
                 w.WriteInt (amod.Assemblies.Length);
                 foreach (var id in amod.Assemblies)
                     w.WriteId (id);
             } else if (mod is SourceFileModifier) {
                 w.WriteByte ((byte)ModifierKind.SOURCE_FILE_ONLY);
                 var smod = (mod as SourceFileModifier);
                 w.WriteInt (smod.SourceFiles.Length);
                 foreach (var s in smod.SourceFiles)
                     w.WriteString (s);
             } else if (mod is TypeNameModifier) {
                 w.WriteByte ((byte)ModifierKind.TYPE_NAME_ONLY);
                 var tmod = (mod as TypeNameModifier);
                 w.WriteInt (tmod.TypeNames.Length);
                 foreach (var s in tmod.TypeNames)
                     w.WriteString (s);
             } else {
                 throw new NotImplementedException ();
             }
         }
     } else {
         w.WriteByte (0);
     }
     return SendReceive (CommandSet.EVENT_REQUEST, (int)CmdEventRequest.SET, w).ReadInt ();
 }
        public override void Serialize(PacketWriter writer, bool prefix)
        {
            base.Serialize(writer, prefix);

            writer.WriteInt(ChallengeID);
        }