public RuntimeValue[] GetStackFrameValueAll(uint pid, uint depth, uint cValues, StackValueKind kind)
        {
            WireProtocol.OutgoingMessage[] cmds = new WireProtocol.OutgoingMessage[cValues];
            RuntimeValue[] vals = null;
            uint i;

            for (i = 0; i < cValues; i++)
            {
                cmds[i] = CreateMessage_GetValue_Stack(pid, depth, kind, i);
            }

            WireProtocol.IncomingMessage[] replies = SyncMessages(cmds);
            if (replies != null)
            {
                vals = new RuntimeValue[cValues];

                for (i = 0; i < cValues; i++)
                {
                    WireProtocol.Commands.Debugging_Value_Reply reply = replies[i].Payload as WireProtocol.Commands.Debugging_Value_Reply;
                    if (reply != null)
                    {
                        vals[i] = RuntimeValue.Convert(this, reply.m_values);
                    }
                }
            }

            return vals;
        }
            internal Request(Engine parent, WireProtocol.OutgoingMessage req, int retries, int timeout, CommandEventHandler callback)
            {
                if (retries < 0)
                {
                    throw new ArgumentException("Value cannot be negative", "retries");
                }

                if (timeout < 1 || timeout > 60 * 60 * 1000)
                {
                    throw new ArgumentException(String.Format("Value out of bounds: {0}", timeout), "timeout");
                }

                m_parent = parent;
                m_req = req;
                m_retries = retries;
                m_timeoutRetry = new TimeSpan(timeout * TimeSpan.TicksPerMillisecond);
                m_timeoutWait = new TimeSpan((retries == 0 ? 1 : 2 * retries) * timeout * TimeSpan.TicksPerMillisecond);
                m_callback = callback;

                if (callback == null)
                {
                    m_event = new ManualResetEvent(false);
                }
            }
Ejemplo n.º 3
0
        public bool Reply(Converter converter, uint flags, object payload)
        {
            OutgoingMessage msgReply = new OutgoingMessage(this, converter, flags, payload);

            return(msgReply.Send());
        }
        public WireProtocol.Commands.Debugging_Resolve_Assembly[] ResolveAllAssemblies()
        {
            WireProtocol.Commands.Debugging_TypeSys_Assemblies.Reply assemblies = GetAssemblies();
            WireProtocol.Commands.Debugging_Resolve_Assembly[] resolveAssemblies = null;

            if (assemblies == null || assemblies.m_data == null)
            {
                resolveAssemblies = new WireProtocol.Commands.Debugging_Resolve_Assembly[0];
            }
            else
            {
                int cAssembly = assemblies.m_data.Length;
                WireProtocol.OutgoingMessage[] requests = new WireProtocol.OutgoingMessage[cAssembly];
                int iAssembly;

                for (iAssembly = 0; iAssembly < cAssembly; iAssembly++)
                {
                    WireProtocol.Commands.Debugging_Resolve_Assembly cmd = new WireProtocol.Commands.Debugging_Resolve_Assembly();

                    cmd.m_idx = assemblies.m_data[iAssembly];

                    requests[iAssembly] = CreateMessage(WireProtocol.Commands.c_Debugging_Resolve_Assembly, 0, cmd);
                }

                WireProtocol.IncomingMessage[] replies = SyncMessages(requests);

                resolveAssemblies = new WireProtocol.Commands.Debugging_Resolve_Assembly[cAssembly];

                for (iAssembly = 0; iAssembly < cAssembly; iAssembly++)
                {
                    resolveAssemblies[iAssembly] = requests[iAssembly].Payload as WireProtocol.Commands.Debugging_Resolve_Assembly;
                    resolveAssemblies[iAssembly].m_reply = replies[iAssembly].Payload as WireProtocol.Commands.Debugging_Resolve_Assembly.Reply;
                }
            }

            return resolveAssemblies;
        }
Ejemplo n.º 5
0
        static public bool ReplyBadPacket( IController ctrl, uint flags )
        {
            //What is this for? Nack + Ping?  What can the TinyCLR possibly do with this information?
            OutgoingMessage msg = new OutgoingMessage( ctrl, null, Commands.c_Monitor_Ping, Flags.c_NonCritical | Flags.c_NACK | flags, null );

            return msg.Send();
        }
Ejemplo n.º 6
0
        public bool Reply( Converter converter, uint flags, object payload )
        {
            
            OutgoingMessage msgReply = new OutgoingMessage( this, converter, flags, payload );

            return msgReply.Send();
        }
Ejemplo n.º 7
0
        public async Task <bool> ReplyAsync(Converter converter, uint flags, object payload)
        {
            OutgoingMessage msgReply = new OutgoingMessage(this, converter, flags, payload);

            return(await msgReply.SendAsync().ConfigureAwait(false));
        }
Ejemplo n.º 8
0
 private IncomingMessage[ ] SyncMessages( OutgoingMessage[ ] messages )
 {
     return SyncMessages( messages, 2, 1000 );
 }
Ejemplo n.º 9
0
        private IncomingMessage[ ] SyncMessages( OutgoingMessage[ ] messages, int retries, int timeout )
        {
            int cMessage = messages.Length;
            IncomingMessage[ ] replies = new IncomingMessage[ cMessage ];
            Request[ ] requests = new Request[ cMessage ];

            for( int iMessage = 0; iMessage < cMessage; iMessage++ )
            {
                replies[ iMessage ] = SyncRequest( messages[ iMessage ], retries, timeout );
            }

            return replies;
        }
Ejemplo n.º 10
0
        internal IncomingMessage SyncRequest( OutgoingMessage msg, int retries, int timeout )
        {
            // Lock on m_ReqSyncLock object, so only one thread is active inside the block.
            lock( m_ReqSyncLock )
            {
                Request req = AsyncRequest( msg, retries, timeout );

                return req != null ? req.Wait( ) : null;
            }
        }
Ejemplo n.º 11
0
        internal Request AsyncRequest( OutgoingMessage msg, int retries, int timeout )
        {
            Request req = new Request( this, msg, retries, timeout, null );

            lock( m_state.SyncObject )
            {

                //Checking whether IsRunning and adding the request to m_requests
                //needs to be atomic to avoid adding a request after the Engine
                //has been stopped.

                if( !IsRunning )
                {
                    throw new ApplicationException( "Engine is not running or process has exited." );
                }

                m_requests.Add( req );

                req.SendAsync( );
            }

            return req;
        }