/// <summary>
 /// Create a new EventRequest with the data in the Packet
 /// </summary>
 /// <param name="packet">a data packet send from the Java debugger</param>
 /// <returns>a new packet or null if there are some unknown types.</returns>
 internal static EventRequest create(Packet packet)
 {
     byte eventKind = packet.ReadByte(); // class EventKind
     switch (eventKind)
     {
         case ikvm.debugger.EventKind.SINGLE_STEP:
         case ikvm.debugger.EventKind.BREAKPOINT:
         case ikvm.debugger.EventKind.FRAME_POP:
         case ikvm.debugger.EventKind.EXCEPTION:
         case ikvm.debugger.EventKind.USER_DEFINED:
         case ikvm.debugger.EventKind.THREAD_START:
         case ikvm.debugger.EventKind.THREAD_DEATH:
         case ikvm.debugger.EventKind.CLASS_PREPARE:
         case ikvm.debugger.EventKind.CLASS_UNLOAD:
         case ikvm.debugger.EventKind.CLASS_LOAD:
         case ikvm.debugger.EventKind.FIELD_ACCESS:
         case ikvm.debugger.EventKind.FIELD_MODIFICATION:
         case ikvm.debugger.EventKind.EXCEPTION_CATCH:
         case ikvm.debugger.EventKind.METHOD_ENTRY:
         case ikvm.debugger.EventKind.METHOD_EXIT:
         case ikvm.debugger.EventKind.METHOD_EXIT_WITH_RETURN_VALUE:
         case ikvm.debugger.EventKind.MONITOR_CONTENDED_ENTER:
         case ikvm.debugger.EventKind.MONITOR_CONTENDED_ENTERED:
         case ikvm.debugger.EventKind.MONITOR_WAIT:
         case ikvm.debugger.EventKind.MONITOR_WAITED:
         case ikvm.debugger.EventKind.VM_START:
         case ikvm.debugger.EventKind.VM_DEATH:
         case ikvm.debugger.EventKind.VM_DISCONNECTED:
             break;
         default:
             return null; //Invalid or not supported EventKind
     }
     byte suspendPolicy = packet.ReadByte();
     int count = packet.ReadInt();
     Console.Error.WriteLine("Set:" + eventKind + "-" + suspendPolicy + "-" + count);
     List<EventModifier> modifiers = new List<EventModifier>();
     for (int i = 0; i < count; i++)
     {
         byte modKind = packet.ReadByte(); // class EventModifierKind
         Console.Error.WriteLine("EventModifierKind:" + modKind);
         EventModifier modifier;
         switch (modKind)
         {
             case EventModifierKind.Count:
                 modifier = new CountEventModifier(packet);
                 break;
             case EventModifierKind.Conditional:
                 modifier = new ConditionalEventModifier(packet);
                 break;
             case EventModifierKind.ThreadOnly:
                 modifier = new ThreadOnlyEventModifier(packet);
                 break;
             case EventModifierKind.ClassOnly:
                 modifier = new ThreadOnlyEventModifier(packet);
                 break;
             case EventModifierKind.ClassMatch:
                 modifier = new ClassMatchEventModifier(packet);
                 break;
             case EventModifierKind.ClassExclude:
                 modifier = new ClassExcludeEventModifier(packet);
                 break;
             case EventModifierKind.LocationOnly:
                 modifier = new LocationOnlyEventModifier(packet);
                 break;
             case EventModifierKind.ExceptionOnly:
                 modifier = new ExceptionOnlyEventModifier(packet);
                 break;
             case EventModifierKind.FieldOnly:
                 modifier = new FieldOnlyEventModifier(packet);
                 break;
             case EventModifierKind.Step:
                 modifier = new StepEventModifier(packet);
                 break;
             case EventModifierKind.InstanceOnly:
                 modifier = new InstanceOnlyEventModifier(packet);
                 break;
             case EventModifierKind.SourceNameMatch:
                 modifier = new SourceNameMatchEventModifier(packet);
                 break;
             default:
                 return null; //Invalid or not supported EventModifierKind
         }
         modifiers.Add(modifier);
     }
     return new EventRequest(eventKind, suspendPolicy, modifiers);
 }
예제 #2
0
        /// <summary>
        /// Create a new EventRequest with the data in the Packet
        /// </summary>
        /// <param name="packet">a data packet send from the Java debugger</param>
        /// <returns>a new packet or null if there are some unknown types.</returns>
        internal static EventRequest create(Packet packet)
        {
            byte eventKind = packet.ReadByte(); // class EventKind

            switch (eventKind)
            {
            case ikvm.debugger.EventKind.SINGLE_STEP:
            case ikvm.debugger.EventKind.BREAKPOINT:
            case ikvm.debugger.EventKind.FRAME_POP:
            case ikvm.debugger.EventKind.EXCEPTION:
            case ikvm.debugger.EventKind.USER_DEFINED:
            case ikvm.debugger.EventKind.THREAD_START:
            case ikvm.debugger.EventKind.THREAD_DEATH:
            case ikvm.debugger.EventKind.CLASS_PREPARE:
            case ikvm.debugger.EventKind.CLASS_UNLOAD:
            case ikvm.debugger.EventKind.CLASS_LOAD:
            case ikvm.debugger.EventKind.FIELD_ACCESS:
            case ikvm.debugger.EventKind.FIELD_MODIFICATION:
            case ikvm.debugger.EventKind.EXCEPTION_CATCH:
            case ikvm.debugger.EventKind.METHOD_ENTRY:
            case ikvm.debugger.EventKind.METHOD_EXIT:
            case ikvm.debugger.EventKind.METHOD_EXIT_WITH_RETURN_VALUE:
            case ikvm.debugger.EventKind.MONITOR_CONTENDED_ENTER:
            case ikvm.debugger.EventKind.MONITOR_CONTENDED_ENTERED:
            case ikvm.debugger.EventKind.MONITOR_WAIT:
            case ikvm.debugger.EventKind.MONITOR_WAITED:
            case ikvm.debugger.EventKind.VM_START:
            case ikvm.debugger.EventKind.VM_DEATH:
            case ikvm.debugger.EventKind.VM_DISCONNECTED:
                break;

            default:
                return(null);    //Invalid or not supported EventKind
            }
            byte suspendPolicy = packet.ReadByte();
            int  count         = packet.ReadInt();

            Console.Error.WriteLine("Set:" + eventKind + "-" + suspendPolicy + "-" + count);
            List <EventModifier> modifiers = new List <EventModifier>();

            for (int i = 0; i < count; i++)
            {
                byte modKind = packet.ReadByte(); // class EventModifierKind
                Console.Error.WriteLine("EventModifierKind:" + modKind);
                EventModifier modifier;
                switch (modKind)
                {
                case EventModifierKind.Count:
                    modifier = new CountEventModifier(packet);
                    break;

                case EventModifierKind.Conditional:
                    modifier = new ConditionalEventModifier(packet);
                    break;

                case EventModifierKind.ThreadOnly:
                    modifier = new ThreadOnlyEventModifier(packet);
                    break;

                case EventModifierKind.ClassOnly:
                    modifier = new ThreadOnlyEventModifier(packet);
                    break;

                case EventModifierKind.ClassMatch:
                    modifier = new ClassMatchEventModifier(packet);
                    break;

                case EventModifierKind.ClassExclude:
                    modifier = new ClassExcludeEventModifier(packet);
                    break;

                case EventModifierKind.LocationOnly:
                    modifier = new LocationOnlyEventModifier(packet);
                    break;

                case EventModifierKind.ExceptionOnly:
                    modifier = new ExceptionOnlyEventModifier(packet);
                    break;

                case EventModifierKind.FieldOnly:
                    modifier = new FieldOnlyEventModifier(packet);
                    break;

                case EventModifierKind.Step:
                    modifier = new StepEventModifier(packet);
                    break;

                case EventModifierKind.InstanceOnly:
                    modifier = new InstanceOnlyEventModifier(packet);
                    break;

                case EventModifierKind.SourceNameMatch:
                    modifier = new SourceNameMatchEventModifier(packet);
                    break;

                default:
                    return(null);    //Invalid or not supported EventModifierKind
                }
                modifiers.Add(modifier);
            }
            return(new EventRequest(eventKind, suspendPolicy, modifiers));
        }