public void VirtualMachineStart(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId)
 {
     ThreadReference thread = VirtualMachine.GetMirrorOf(threadId);
     EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.VirtualMachineStart, requestId);
     ThreadEventArgs e = new ThreadEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread);
     VirtualMachine.EventQueue.OnVirtualMachineStart(e);
 }
            public void Breakpoint(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId, Types.Location location)
            {
                ThreadReference thread = VirtualMachine.GetMirrorOf(threadId);
                EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.Breakpoint, requestId);
                Location loc = VirtualMachine.GetMirrorOf(location);

                ThreadLocationEventArgs e = new ThreadLocationEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread, loc);
                VirtualMachine.EventQueue.OnBreakpoint(e);
            }
            public EventFilter(EventKind internalEventKind, RequestId requestId, SuspendPolicy suspendPolicy, IEnumerable<EventRequestModifier> modifiers)
            {
                Contract.Requires<ArgumentNullException>(modifiers != null, "modifiers");

                _internalEventKind = internalEventKind;
                _requestId = requestId;
                _suspendPolicy = suspendPolicy;
                _modifiers = new ImmutableList<EventRequestModifier>(modifiers);
            }
            public static EventFilter CreateFilter(EventKind internalEventKind, JvmtiEnvironment environment, JniEnvironment nativeEnvironment, RequestId requestId, SuspendPolicy suspendPolicy, ImmutableList<EventRequestModifier> modifiers)
            {
                if (modifiers.Count == 0)
                    return new PassThroughEventFilter(internalEventKind, requestId, suspendPolicy, modifiers);

                EventFilter[] elements = modifiers.Select(modifier => CreateFilter(internalEventKind, environment, nativeEnvironment, requestId, suspendPolicy, modifiers, modifier)).ToArray();
                if (elements.Length == 1)
                    return elements[0];

                return new AggregateEventFilter(internalEventKind, requestId, suspendPolicy, modifiers, elements);
            }
            private static EventFilter CreateFilter(EventKind internalEventKind, JvmtiEnvironment environment, JniEnvironment nativeEnvironment, RequestId requestId, SuspendPolicy suspendPolicy, ImmutableList<EventRequestModifier> modifiers, EventRequestModifier modifier)
            {
                switch (modifier.Kind)
                {
                case ModifierKind.Count:
                    return new CountEventFilter(internalEventKind, requestId, suspendPolicy, modifiers, modifier.Count);

                case ModifierKind.ThreadFilter:
                    return new ThreadEventFilter(internalEventKind, requestId, suspendPolicy, modifiers, modifier.Thread);

                case ModifierKind.ClassTypeFilter:
                    throw new NotImplementedException();

                case ModifierKind.ClassMatchFilter:
                    throw new NotImplementedException();

                case ModifierKind.ClassExcludeFilter:
                    throw new NotImplementedException();

                case ModifierKind.LocationFilter:
                    return new LocationEventFilter(internalEventKind, requestId, suspendPolicy, modifiers, modifier.Location);

                case ModifierKind.ExceptionFilter:
                    return new ExceptionEventFilter(internalEventKind, requestId, suspendPolicy, modifiers, modifier.ExceptionOrNull, modifier.Caught, modifier.Uncaught);

                case ModifierKind.FieldFilter:
                    throw new NotImplementedException();

                case ModifierKind.Step:
                    return new StepEventFilter(internalEventKind, requestId, suspendPolicy, modifiers, modifier.Thread, environment, nativeEnvironment, modifier.StepSize, modifier.StepDepth);

                case ModifierKind.InstanceFilter:
                    throw new NotImplementedException();

                case ModifierKind.SourceNameMatchFilter:
                    throw new NotImplementedException();

                case ModifierKind.Conditional:
                    throw new NotImplementedException();

                case ModifierKind.Invalid:
                default:
                    throw new ArgumentException();
                }
            }
Ejemplo n.º 6
0
 /// <summary>
 ///   A private helper method to make a request
 ///   and put the dialog to sleep at the same time.
 /// </summary>
 /// <remarks>
 ///   It is expected that the process which executes the request 
 ///   (the Idling helper in this particular case) will also
 ///   wake the dialog up after finishing the execution.
 /// </remarks>
 ///
 private void MakeRequest(RequestId request, Tuple<string, double> value)
 {
     //MessageBox.Show("You are in the Control.Request event.");
     handler.Request.Value(value);
     handler.Request.Make(request);
     exEvent.Raise();
     DozeOff();
 }
 public RequestY(RequesterId requesterId, RequestId requestId) : base(requesterId, requestId)
 {
 }
Ejemplo n.º 8
0
        public Error ClearEvent(EventKind eventKind, RequestId requestId)
        {
            List<RequestId> linkedRequests;
            if (_linkedRequests.TryRemove(requestId, out linkedRequests))
            {
                Suspend();

                foreach (RequestId request in linkedRequests)
                {
                    RequestId ignored;
                    _requestRemap.TryRemove(request, out ignored);

                    ClearEvent(eventKind, request);
                }

                return Resume();
            }

            byte[] packet = new byte[HeaderSize + sizeof(byte) + sizeof(int)];
            int id = GetMessageId();
            SerializeHeader(packet, id, EventRequestCommand.Clear);
            packet[HeaderSize] = (byte)eventKind;
            WriteInt32(packet, HeaderSize + sizeof(byte), requestId.Id);

            byte[] response = SendPacket(id, packet);
            return ReadErrorCode(response);
        }
Ejemplo n.º 9
0
 internal static void WritingMessage(this ILogger logger, RequestId requestId, Type messageType)
 => _writingMessage(logger, requestId, messageType, null);
Ejemplo n.º 10
0
 public PutStuffInInbox(TrustedSystemId id, RequestId requestId, string stuffDescription)
 {
     Id = id;
     RequestId = requestId;
     StuffDescription = stuffDescription;
 }
 public void Exception(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId, Types.Location location, TaggedObjectId exception, Types.Location catchLocation)
 {
     EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.Exception, requestId);
     ThreadReference thread = VirtualMachine.GetMirrorOf(threadId);
     Location loc = VirtualMachine.GetMirrorOf(location);
     ObjectReference exceptionReference = VirtualMachine.GetMirrorOf(exception);
     Location catchLoc = VirtualMachine.GetMirrorOf(catchLocation);
     ExceptionEventArgs e = new ExceptionEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread, loc, exceptionReference, catchLoc);
     VirtualMachine.EventQueue.OnException(e);
 }
Ejemplo n.º 12
0
 public void PutStuffInInbox(RequestId requestId, string stuffDescription, ITimeProvider provider)
 {
     var stuffId = new StuffId(NewGuidIfEmpty(requestId));
     Apply(new StuffPutInInbox(_aggState.Id, stuffId, stuffDescription, provider.GetUtcNow()));
 }
 public void ClassUnload(Types.SuspendPolicy suspendPolicy, RequestId requestId, string signature)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 14
0
 public string GetForCacheKeyValue()
 {
     return(RequestId.ToString());
 }
            public Error ClearEvent(EventKind eventKind, RequestId requestId)
            {
                if (eventKind == EventKind.SingleStep)
                {
                    // this event might also be registered as a frame pop event with the same request ID
                    Error error = ClearEventInternal(EventKind.FramePop, requestId);
                    if (error != Error.None)
                        return error;
                }

                return ClearEventInternal(eventKind, requestId);
            }
 public MessageHistoryUpdated(RequestId requestId, NonNullList <SavedMessageDetails> messages)
 {
     this.CtorSet(_ => _.RequestId, requestId);
     this.CtorSet(_ => _.Messages, messages);
 }
Ejemplo n.º 17
0
 /// <inheritdoc />
 public void SendCommandResponse <TComponent>(RequestId <IncomingCommandRequest <TComponent> > requestId, ICommandResponse <TComponent> response) where TComponent : ICommandMetaclass, new()
 {
     connection.SendCommandResponse(requestId, response);
 }
Ejemplo n.º 18
0
 public RequestHeader(CommandCode code, RequestId requestId)
     : base(code, requestId)
 {
 }
    /// <summary>
    /// Sends exension request to the server
    /// </summary>
    /// <param name="id">ID of request</param>
    /// <param name="dataObject">Data to send</param>
    public void sendClientRequest(RequestId id, SFSObject dataObject)
    {
        string extCmd = id.ToString();

        smartFox.Send(new ExtensionRequest(extCmd, dataObject, smartFox.LastJoinedRoom));
    }
Ejemplo n.º 20
0
 /// <summary>
 ///   Make - The Dialog calls this when the user presses a command button there. 
 /// </summary>
 /// <remarks>
 ///   It replaces any older request previously made.
 /// </remarks>
 /// 
 public void Make(RequestId request)
 {
    Interlocked.Exchange(ref m_request, (int)request);
 }
Ejemplo n.º 21
0
 public override int GetHashCode()
 {
     return(RequestId.GetHashCode() ^ WorkflowDefinitionId.GetHashCode());
 }
 public void VirtualMachineDeath(Types.SuspendPolicy suspendPolicy, RequestId requestId)
 {
     EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.ClassPrepare, requestId);
     VirtualMachineEventArgs e = new VirtualMachineEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request);
     VirtualMachine.EventQueue.OnVirtualMachineDeath(e);
 }
Ejemplo n.º 23
0
 /// <summary>
 ///   A private helper method to make a request
 ///   and put the dialog to sleep at the same time.
 /// </summary>
 /// <remarks>
 ///   It is expected that the process which executes the request
 ///   (the Idling helper in this particular case) will also
 ///   wake the dialog up after finishing the execution.
 /// </remarks>
 ///
 private void MakeRequest(RequestId request)
 {
     Request.Make(request);
     DozeOff();
 }
 public void MethodExit(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId thread, Types.Location location, Types.Value returnValue)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 25
0
 public MessageSaveSucceeded(RequestId requestId)
 {
     this.CtorSet(_ => _.RequestId, requestId);
 }
Ejemplo n.º 26
0
        // This Event happens when Stuff is moved from the Inbox to another part of the system
        // TODO: Not sure if I need a method for a Command to call because StuffArchived Event is system generated.
        //public void ArchiveStuff(StuffId stuffId, ITimeProvider provider)
        //{
        //    if (!_aggState.Inbox.Contains(stuffId))
        //        throw DomainError.Named("no stuff", "Stuff with Id {0} not found", stuffId);
        //    Apply(new StuffArchived(_aggState.Id, stuffId, provider.GetUtcNow()));
        //}
        public void DefineProject(RequestId requestId, string name, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var projectId = new ProjectId(NewGuidIfEmpty(requestId));

            const ProjectType defaultProjectType = ProjectType.List;
            Apply(new ProjectDefined(_aggState.Id, projectId, name, defaultProjectType, time));
        }
 public Request(RequesterId requesterId, RequestId requestId)
 {
     RequestId   = requestId;
     RequesterId = requesterId;
 }
 /// <summary>
 ///   A private helper method to make a request
 ///   and put the dialog to sleep at the same time.
 /// </summary>
 /// <remarks>
 ///   It is expected that the process which executes the request
 ///   (the Idling helper in this particular case) will also
 ///   wake the dialog up after finishing the execution.
 /// </remarks>
 ///
 public void MakeRequest(RequestId request)
 {
     Request.Make(request);
     DozeOff();
 }
Ejemplo n.º 29
0
    public override string ToString()
    {
        var  sb      = new StringBuilder("SetBuddyOnAirResult(");
        bool __first = true;

        if (RequestId != null && __isset.requestId)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("RequestId: ");
            RequestId.ToString(sb);
        }
        if (__isset.state)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("State: ");
            State.ToString(sb);
        }
        if (__isset.eventNo)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("EventNo: ");
            EventNo.ToString(sb);
        }
        if (__isset.receiverCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("ReceiverCount: ");
            ReceiverCount.ToString(sb);
        }
        if (__isset.successCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("SuccessCount: ");
            SuccessCount.ToString(sb);
        }
        if (__isset.failCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("FailCount: ");
            FailCount.ToString(sb);
        }
        if (__isset.cancelCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("CancelCount: ");
            CancelCount.ToString(sb);
        }
        if (__isset.unregisterCount)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("UnregisterCount: ");
            UnregisterCount.ToString(sb);
        }
        if (__isset.timestamp)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Timestamp: ");
            Timestamp.ToString(sb);
        }
        if (Message != null && __isset.message)
        {
            if (!__first)
            {
                sb.Append(", ");
            }
            __first = false;
            sb.Append("Message: ");
            Message.ToString(sb);
        }
        sb.Append(")");
        return(sb.ToString());
    }
Ejemplo n.º 30
0
 public DefineSingleActionProject(TrustedSystemId id, RequestId requestId, StuffId stuffId)
 {
     Id = id;
     RequestId = requestId;
     StuffId = stuffId;
 }
Ejemplo n.º 31
0
        /// <summary>
        ///   The top function that distributes requests to individual methods.
        /// </summary>
        ///
        public static void Execute(UIApplication uiapp, RequestId reqest)
        {
            switch (reqest)
            {
            case RequestId.None:
            {
                return;          // no request at this time -> we can leave immediately
            }

            case RequestId.Delete:
            {
                ModifySelectedDoors(uiapp, "Delete doors", e => e.Document.Delete(e.Id));
                break;
            }

            case RequestId.FlipLeftRight:
            {
                ModifySelectedDoors(uiapp, "Flip door Hand", e => e.flipHand());
                break;
            }

            case RequestId.FlipInOut:
            {
                ModifySelectedDoors(uiapp, "Flip door Facing", e => e.flipFacing());
                break;
            }

            case RequestId.MakeLeft:
            {
                ModifySelectedDoors(uiapp, "Make door Left", MakeLeft);
                break;
            }

            case RequestId.MakeRight:
            {
                ModifySelectedDoors(uiapp, "Make door Right", MakeRight);
                break;
            }

            case RequestId.TurnOut:
            {
                ModifySelectedDoors(uiapp, "Place door Out", TurnOut);
                break;
            }

            case RequestId.TurnIn:
            {
                ModifySelectedDoors(uiapp, "Place door In", TurnIn);
                break;
            }

            case RequestId.Rotate:
            {
                ModifySelectedDoors(uiapp, "Rotate door", FlipHandAndFace);
                break;
            }

            default:
            {
                // some kind of a warning here should
                // notify us about an unexpected request
                break;
            }
            }

            return;
        }
Ejemplo n.º 32
0
 public DefineAction(TrustedSystemId id, RequestId requestId, ProjectId projectId, string outcome)
 {
     Id = id;
     RequestId = requestId;
     ProjectId = projectId;
     Outcome = outcome;
 }
Ejemplo n.º 33
0
 /// <summary>
 ///   A private helper method to make a request
 ///   and put the dialog to sleep at the same time.
 /// </summary>
 /// <remarks>
 ///   It is expected that the process which executes the request
 ///   (the Idling helper in this particular case) will also
 ///   wake the dialog up after finishing the execution.
 /// </remarks>
 ///
 private void MakeRequest(RequestId request)
 {
     m_Handler.Request.Make(request);
     m_ExEvent.Raise();
     DozeOff();
 }
Ejemplo n.º 34
0
        public Error SetEvent(out RequestId requestId, EventKind eventKind, SuspendPolicy suspendPolicy, EventRequestModifier[] modifiers)
        {
            if (eventKind == EventKind.SingleStep && modifiers.Length == 1 && modifiers[0].Thread == default(ThreadId))
            {
                ThreadId[] threads;
                Error threadsErrorCode = GetAllThreads(out threads);
                if (threadsErrorCode != Error.None)
                {
                    requestId = default(RequestId);
                    return threadsErrorCode;
                }

                requestId = default(RequestId);

                threadsErrorCode = Suspend();
                if (threadsErrorCode != Error.None)
                    return threadsErrorCode;

                List<RequestId> requests = new List<RequestId>();
                foreach (var thread in threads)
                {
                    EventRequestModifier modifier = modifiers[0];
                    modifier.Thread = thread;
                    threadsErrorCode = SetEvent(out requestId, eventKind, suspendPolicy, new[] { modifier });
                    if (threadsErrorCode != Error.None)
                        return threadsErrorCode;

                    requests.Add(requestId);
                }

                _linkedRequests[requestId] = requests;
                foreach (var request in requests)
                    _requestRemap[request] = requestId;

                threadsErrorCode = Resume();
                if (threadsErrorCode != Error.None)
                    return threadsErrorCode;

                return Error.None;
            }

            byte[] packet = new byte[HeaderSize + 6];
            packet[HeaderSize] = (byte)eventKind;
            packet[HeaderSize + 1] = (byte)suspendPolicy;
            WriteInt32(packet, HeaderSize + 2, modifiers.Length);

            List<byte> packetData = new List<byte>(packet);
            foreach (EventRequestModifier modifier in modifiers)
            {
                packetData.Add((byte)modifier.Kind);

                switch (modifier.Kind)
                {
                case ModifierKind.Count:
                    {
                        byte[] additionalData = new byte[sizeof(int)];
                        WriteInt32(additionalData, 0, modifier.Count);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.Conditional:
                    {
                        byte[] additionalData = new byte[sizeof(int)];
                        WriteInt32(additionalData, 0, modifier.ExpressionId);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.ThreadFilter:
                    {
                        byte[] additionalData = new byte[ThreadIdSize];
                        WriteObjectId(additionalData, 0, modifier.Thread);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.ClassTypeFilter:
                    {
                        byte[] additionalData = new byte[ReferenceTypeIdSize];
                        WriteReferenceTypeId(additionalData, 0, modifier.Class);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.ClassMatchFilter:
                case ModifierKind.ClassExcludeFilter:
                    {
                        byte[] stringData = Encoding.UTF8.GetBytes(modifier.ClassPattern);
                        byte[] sizeData = new byte[sizeof(int)];
                        WriteInt32(sizeData, 0, stringData.Length);
                        packetData.AddRange(sizeData);
                        packetData.AddRange(stringData);
                    }
                    continue;

                case ModifierKind.LocationFilter:
                    {
                        byte[] additionalData = new byte[LocationSize];
                        WriteLocation(additionalData, 0, modifier.Location);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.ExceptionFilter:
                    {
                        byte[] additionalData = new byte[_referenceTypeIdSize.Value + 2];
                        WriteReferenceTypeId(additionalData, 0, modifier.ExceptionOrNull);
                        additionalData[_referenceTypeIdSize.Value] = (byte)(modifier.Caught ? 1 : 0);
                        additionalData[_referenceTypeIdSize.Value + 1] = (byte)(modifier.Uncaught ? 1 : 0);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.FieldFilter:
                    {
                        byte[] additionalData = new byte[ReferenceTypeIdSize + FieldIdSize];
                        WriteReferenceTypeId(additionalData, 0, modifier.Class);
                        WriteFieldId(additionalData, ReferenceTypeIdSize, modifier.Field);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.Step:
                    {
                        if (modifier.StepSize == StepSize.Statement)
                            throw new NotSupportedException();

                        byte[] additionalData = new byte[ThreadIdSize + (2 * sizeof(int))];
                        WriteObjectId(additionalData, 0, modifier.Thread);
                        WriteInt32(additionalData, ThreadIdSize, (int)modifier.StepSize);
                        WriteInt32(additionalData, ThreadIdSize + sizeof(int), (int)modifier.StepDepth);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.InstanceFilter:
                    {
                        byte[] additionalData = new byte[ObjectIdSize];
                        WriteObjectId(additionalData, 0, modifier.Instance);
                        packetData.AddRange(additionalData);
                    }
                    continue;

                case ModifierKind.SourceNameMatchFilter:
                    {
                        byte[] stringData = Encoding.UTF8.GetBytes(modifier.SourceNamePattern);
                        byte[] sizeData = new byte[sizeof(int)];
                        WriteInt32(sizeData, 0, stringData.Length);
                        packetData.AddRange(sizeData);
                        packetData.AddRange(stringData);
                    }
                    continue;

                case ModifierKind.Invalid:
                default:
                    throw new InvalidOperationException();
                }
            }

            packet = packetData.ToArray();
            int id = GetMessageId();
            SerializeHeader(packet, id, EventRequestCommand.Set);

            byte[] response = SendPacket(id, packet);
            Error errorCode = ReadErrorCode(response);
            if (errorCode != Error.None)
            {
                requestId = default(RequestId);
                return errorCode;
            }

            int offset = HeaderSize;
            requestId = new RequestId(ReadInt32(response, ref offset));
            return Error.None;
        }
Ejemplo n.º 35
0
 // Change all values
 public static void MakeRequest(RequestId request, List <Tuple <string, string, double> > value)
 {
     Application.handler.Request.AllValues(value);
     Application.handler.Request.Make(request);
     Application.exEvent.Raise();
 }
Ejemplo n.º 36
0
        private void ProcessEventPacket(byte[] packet)
        {
            if (!_objectIdSize.HasValue)
            {
                RequestIdSizes();
            }

            int offset = HeaderSize;
            SuspendPolicy suspendPolicy = (SuspendPolicy)ReadByte(packet, ref offset);
            int eventCount = ReadInt32(packet, ref offset);
            for (int i = 0; i < eventCount; i++)
            {
                EventKind eventKind = (EventKind)ReadByte(packet, ref offset);
                switch (eventKind)
                {
                case EventKind.SingleStep:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        RequestId mappedRequestId;
                        if (_requestRemap.TryGetValue(requestId, out mappedRequestId))
                            requestId = mappedRequestId;

                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        Location location = ReadLocation(packet, ref offset);
                        _callback.SingleStep(suspendPolicy, requestId, threadId, location);
                    }
                    continue;

                case EventKind.Breakpoint:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        Location location = ReadLocation(packet, ref offset);
                        _callback.Breakpoint(suspendPolicy, requestId, threadId, location);
                    }
                    continue;

                case EventKind.FramePop:
                    throw new NotImplementedException();

                case EventKind.Exception:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        Location location = ReadLocation(packet, ref offset);
                        TaggedObjectId exception = ReadTaggedObjectId(packet, ref offset);
                        Location catchLocation = ReadLocation(packet, ref offset);
                        _callback.Exception(suspendPolicy, requestId, threadId, location, exception, catchLocation);
                    }
                    continue;

                case EventKind.UserDefined:
                    throw new NotImplementedException();

                case EventKind.ThreadStart:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        _callback.ThreadStart(suspendPolicy, requestId, threadId);
                    }
                    continue;

                case EventKind.ThreadDeath:
                //case EventKind.ThreadEnd:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        _callback.ThreadDeath(suspendPolicy, requestId, threadId);
                    }
                    continue;

                case EventKind.ClassPrepare:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        TypeTag typeTag = (TypeTag)ReadByte(packet, ref offset);
                        ReferenceTypeId typeId = ReadReferenceTypeId(packet, ref offset);
                        string signature = ReadString(packet, ref offset);
                        ClassStatus status = (ClassStatus)ReadInt32(packet, ref offset);
                        _callback.ClassPrepare(suspendPolicy, requestId, threadId, typeTag, typeId, signature, status);
                    }
                    continue;

                case EventKind.ClassUnload:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        string signature = ReadString(packet, ref offset);
                        _callback.ClassUnload(suspendPolicy, requestId, signature);
                    }
                    continue;

                case EventKind.ClassLoad:
                    throw new NotImplementedException();

                case EventKind.FieldAccess:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        Location location = ReadLocation(packet, ref offset);
                        TypeTag typeTag = (TypeTag)ReadByte(packet, ref offset);
                        ReferenceTypeId typeId = ReadReferenceTypeId(packet, ref offset);
                        FieldId fieldId = ReadFieldId(packet, ref offset);
                        TaggedObjectId objectId = ReadTaggedObjectId(packet, ref offset);
                        _callback.FieldAccess(suspendPolicy, requestId, threadId, location, typeTag, typeId, fieldId, objectId);
                    }
                    continue;

                case EventKind.FieldModification:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        Location location = ReadLocation(packet, ref offset);
                        TypeTag typeTag = (TypeTag)ReadByte(packet, ref offset);
                        ReferenceTypeId typeId = ReadReferenceTypeId(packet, ref offset);
                        FieldId fieldId = ReadFieldId(packet, ref offset);
                        TaggedObjectId objectId = ReadTaggedObjectId(packet, ref offset);
                        Value newValue = ReadValue(packet, ref offset);
                        _callback.FieldModification(suspendPolicy, requestId, threadId, location, typeTag, typeId, fieldId, objectId, newValue);
                    }
                    continue;

                case EventKind.ExceptionCatch:
                    throw new NotImplementedException();

                case EventKind.MethodEntry:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        Location location = ReadLocation(packet, ref offset);
                        _callback.MethodEntry(suspendPolicy, requestId, threadId, location);
                    }
                    continue;

                case EventKind.MethodExit:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        Location location = ReadLocation(packet, ref offset);
                        _callback.MethodExit(suspendPolicy, requestId, threadId, location, default(Value));
                    }
                    continue;

                case EventKind.MethodExitWithReturnValue:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        Location location = ReadLocation(packet, ref offset);
                        Value returnValue = ReadValue(packet, ref offset);
                        _callback.MethodExit(suspendPolicy, requestId, threadId, location, returnValue);
                    }
                    continue;

                case EventKind.VirtualMachineStart:
                //case EventKind.VirtualMachineInit:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        ThreadId threadId = (ThreadId)ReadObjectId(packet, ref offset);
                        _callback.VirtualMachineStart(suspendPolicy, requestId, threadId);
                    }
                    continue;

                case EventKind.VirtualMachineDeath:
                    {
                        RequestId requestId = new RequestId(ReadInt32(packet, ref offset));
                        _callback.VirtualMachineDeath(suspendPolicy, requestId);
                    }
                    continue;

                case EventKind.VirtualMachineDisconnected:
                    throw new NotImplementedException();

                case EventKind.Invalid:
                default:
                    throw new NotImplementedException();
                }
            }
        }
Ejemplo n.º 37
0
 private bool ShouldAddRequestId(RequestId requestId, HttpRequestHeaders headers)
 {
     return(!string.IsNullOrEmpty(requestId?.RequestIdKey) &&
            !string.IsNullOrEmpty(requestId.RequestIdValue) &&
            !RequestIdInHeaders(requestId, headers));
 }
            public Error SetEvent(JvmtiEnvironment environment, JniEnvironment nativeEnvironment, EventKind eventKind, SuspendPolicy suspendPolicy, ImmutableList<EventRequestModifier> modifiers, bool internalRequest, out RequestId requestId)
            {
                Contract.Requires<ArgumentNullException>(modifiers != null, "modifiers");

                requestId = default(RequestId);

                EventKind internalEventKind = eventKind;

                EventRequestModifier locationModifier = default(EventRequestModifier);
                EventRequestModifier stepModifier = default(EventRequestModifier);

                switch (eventKind)
                {
                case EventKind.Breakpoint:
                    // we're going to need the location modifier to set the breakpoint
                    if (modifiers.Count == 0 || modifiers[0].Kind != ModifierKind.LocationFilter)
                        return Error.IllegalArgument;

                    locationModifier = modifiers[0];
                    break;

                case EventKind.SingleStep:
                    // the first modifier contains the step properties
                    if (modifiers.Count == 0 || modifiers[0].Kind != ModifierKind.Step)
                        return Error.IllegalArgument;

                    stepModifier = modifiers[0];
                    if (stepModifier.StepDepth == StepDepth.Out)
                    {
                        // we want to attach the filter as a frame pop request instead of a step request
                        eventKind = EventKind.FramePop;
                        internalEventKind = EventKind.SingleStep;
                    }

                    break;

                default:
                    break;
                }

                requestId = new RequestId(Interlocked.Increment(ref _nextRequestId));
                if (internalRequest)
                    requestId = new RequestId(-requestId.Id);

                EventFilter filter = EventFilter.CreateFilter(internalEventKind, environment, nativeEnvironment, requestId, suspendPolicy, modifiers);
                return SetEventInternal(environment, nativeEnvironment, eventKind, filter);
            }
Ejemplo n.º 39
0
        private bool RequestIdInHeaders(RequestId requestId, HttpRequestHeaders headers)
        {
            IEnumerable <string> value;

            return(headers.TryGetValues(requestId.RequestIdKey, out value));
        }
            public Error ClearEventInternal(EventKind eventKind, RequestId requestId)
            {
                lock (_eventRequests)
                {
                    Dictionary<RequestId, EventFilter> requests;
                    if (!_eventRequests.TryGetValue(eventKind, out requests))
                        return Error.None;

                    EventFilter eventFilter;
                    if (!requests.TryGetValue(requestId, out eventFilter))
                        return Error.None;

                    requests.Remove(requestId);
                    if (requests.Count == 0)
                    {
                        JvmEventType? eventToDisable = GetJvmEventType(eventKind);
                        if (eventToDisable != null)
                        {
                            jvmtiError error = Environment.SetEventNotificationMode(JvmEventMode.Disable, eventToDisable.Value);
                            if (error != jvmtiError.None)
                                return GetStandardError(error);
                        }
                    }

                    if (eventKind == EventKind.Breakpoint)
                    {
                        LocationEventFilter locationFilter = eventFilter as LocationEventFilter;
                        if (locationFilter == null)
                        {
                            AggregateEventFilter aggregateFilter = eventFilter as AggregateEventFilter;
                            Contract.Assert(aggregateFilter != null);
                            locationFilter = aggregateFilter.Filters.OfType<LocationEventFilter>().FirstOrDefault();
                        }

                        Contract.Assert(locationFilter != null);
                        jmethodID methodId = locationFilter.Location.Method;
                        jlocation location = new jlocation((long)locationFilter.Location.Index);
                        jvmtiError error = Environment.ClearBreakpoint(methodId, location);
                        if (error != jvmtiError.None)
                            return GetStandardError(error);
                    }

                    return Error.None;
                }
            }
Ejemplo n.º 41
0
 private void AddRequestIdHeader(RequestId requestId, DownstreamRequest httpRequestMessage)
 {
     httpRequestMessage.Headers.Add(requestId.RequestIdKey, requestId.RequestIdValue);
 }
 public void ClassPrepare(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId, TypeTag typeTag, ReferenceTypeId typeId, string signature, ClassStatus status)
 {
     ThreadReference thread = VirtualMachine.GetMirrorOf(threadId);
     EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.ClassPrepare, requestId);
     ReferenceType type = VirtualMachine.GetMirrorOf(typeTag, typeId);
     ClassPrepareEventArgs e = new ClassPrepareEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread, signature, type);
     VirtualMachine.EventQueue.OnClassPrepare(e);
 }
Ejemplo n.º 43
0
 public void Make(RequestId request)
 {
     Interlocked.Exchange(ref m_request, (int)request);
 }
 public void FieldModification(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId thread, Types.Location location, TypeTag typeTag, ReferenceTypeId typeId, FieldId field, TaggedObjectId @object, Types.Value newValue)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 45
0
 public override int GetHashCode()
 {
     return(ServiceId.GetHashCode() ^ Path.GetHashCode() ^ HttpMethod.GetHashCode() ^ RequestId.GetHashCode() ^ Identity.GetHashCode() ^ SourceIp.GetHashCode() ^ Stage.GetHashCode());
 }
Ejemplo n.º 46
0
 internal static void NoMoreMessagesToRead(this ILogger logger, RequestId requestId)
 => _noMoreMessagesToRead(logger, requestId, null);
Ejemplo n.º 47
0
 internal static void ReverseCallArgumentsNotReceivedBecauseNoFirstMessage(this ILogger logger, RequestId requestId)
 => _reverseCallArgumentsNotReceivedBecauseNoFirstMessage(logger, requestId, null);
 public void MethodEntry(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId thread, Types.Location location)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 49
0
 internal static void ReverseCallArgumentsNotReceivedBecauseNoContextOnConnectArguments(this ILogger logger, RequestId requestId)
 => _reverseCallArgumentsNotReceivedBecauseNoContextOnConnectArguments(logger, requestId, null);
 public void MonitorContendedWaited(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId thread, TaggedObjectId @object, Types.Location location, bool timedOut)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 51
0
 internal static void WaitingForReverseCallContext(this ILogger logger, RequestId requestId)
 => _waitingForReverseCallContext(logger, requestId, null);
Ejemplo n.º 52
0
        public void DefineAction(RequestId requestId, ProjectId projectId, string outcome, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();

            ProjectInfo projectInfo;
            if (!_aggState.Projects.TryGetValue(projectId, out projectInfo))
            {
                throw DomainError.Named("unknown-project", "Unknown project {0}", projectId);
            }

            var actionId = new ActionId(NewGuidIfEmpty(requestId));
            Apply(new ActionDefined(_aggState.Id, actionId, projectId, outcome , time));
        }
Ejemplo n.º 53
0
 internal static void ReceivedReverseCallContext(this ILogger logger, RequestId requestId, TimeSpan waitTime)
 => _receivedReverseCallContext(logger, requestId, waitTime, null);
Ejemplo n.º 54
0
        public void DefineSingleActionProject(RequestId requestId, StuffId stuffId, ITimeProvider provider)
        {
            // filter request IDs
            var time = provider.GetUtcNow();
            var projectId = new ProjectId(NewGuidIfEmpty(requestId));

            // generate actionId
            var actionId = new ActionId(Guid.NewGuid());

            // make sure Stuff exists in the Inbox
            StuffInfo stuffInfo;
            if (!_aggState.StuffInInbox.TryGetValue(stuffId, out stuffInfo))
            {
                throw DomainError.Named("unknown stuff", "Unknown stuff {0}", stuffId);
            }
            // TODO: May be able to use this to change the stuff description and then let that cascade down
            // as both the Project AND Action Outcome in case you wanted to use a different name than from original desc
            // With current design it may be better to kick off a "RENAME" command or Apply Renamed event for that purpose though.
            //if (stuffInfo.Description != stuffDescription)
            //{
            //    Apply(new StuffDescriptionChanged(_aggState.Id, stuffId, newDescriptionOfStuff, time.GetUtcNow()));
            //}

            // TODO: Not sure if it best to just reuse existing Events and projections (probably)
            // or if I should create a new composite event for this new command msg.
            // Thinking the former, not latter is way to go.
            Apply(new ProjectDefined(_aggState.Id, projectId, stuffInfo.Description, ProjectType.List, time));
            Apply(new ActionDefined(_aggState.Id, actionId, projectId, stuffInfo.Description, time));
            //Apply(new SingleActionProjectDefined(_aggState.Id, etc.)

            // Archive the Stuff from the Inbox now that is has transitioned from "Stuff" to a defined "Action"
            Apply(new StuffArchived(_aggState.Id, stuffId, time));
        }
Ejemplo n.º 55
0
 internal static void StartPings(this ILogger logger, RequestId requestId, TimeSpan pingInterval)
 => _startPings(logger, requestId, pingInterval, null);
Ejemplo n.º 56
0
 static Guid NewGuidIfEmpty(RequestId requestId)
 {
     return requestId.IsEmpty ? new RequestId(Guid.NewGuid()).Id : requestId.Id;
 }
Ejemplo n.º 57
0
 private void makeRequest(RequestId request)
 {
     m_Handler.Request.Make(request);
     m_ExEvent.Raise();
     this.dozeOff();//操作进行中,可以是命令窗口灰屏
 }