1 /* JdwpConstants.java -- Constants defined by JDWP 1.4 specification
2    Copyright (C) 2005 Free Software Foundation
3 
4 This file is part of GNU Classpath.
5 
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10 
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15 
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 02110-1301 USA.
20 
21 Linking this library statically or dynamically with other modules is
22 making a combined work based on this library.  Thus, the terms and
23 conditions of the GNU General Public License cover the whole
24 combination.
25 
26 As a special exception, the copyright holders of this library give you
27 permission to link this library with independent modules to produce an
28 executable, regardless of the license terms of these independent
29 modules, and to copy and distribute the resulting executable under
30 terms of your choice, provided that you also meet, for each linked
31 terms of your choice, provided that you also meet, for each linked
32 independent module, the terms and conditions of the license of that
33 module.  An independent module is a module which is not derived from
34 or based on this library.  If you modify this library, you may extend
35 this exception to your version of the library, but you are not
36 obligated to do so.  If you do not wish to do so, delete this
37 exception statement from your version. */
38 
39 
40 package gnu.classpath.jdwp;
41 
42 /**
43  * Constants defined by JDWP specification.
44  *
45  * @author Keith Seitz  (keiths@redhat.com)
46  */
47 public class JdwpConstants
48 {
49   public static final class Version
50   {
51     public static final int MAJOR = 1;
52     public static final int MINOR = 4;
53   }
54 
55   ////////////////////////////////////////
56   //           Commands/Sets            //
57   ////////////////////////////////////////
58 
59   public static final class CommandSet
60   {
61     public static final class VirtualMachine
62     {
63       public static final byte CS_VALUE = 1;
64 
65       // commands
66       public static final byte VERSION = 1;
67       public static final byte CLASSES_BY_SIGNATURE = 2;
68       public static final byte ALL_CLASSES = 3;
69       public static final byte ALL_THREADS = 4;
70       public static final byte TOP_LEVEL_THREAD_GROUPS = 5;
71       public static final byte DISPOSE = 6;
72       public static final byte IDSIZES = 7;
73       public static final byte SUSPEND = 8;
74       public static final byte RESUME = 9;
75       public static final byte EXIT = 10;
76       public static final byte CREATE_STRING = 11;
77       public static final byte CAPABILITIES = 12;
78       public static final byte CLASS_PATHS = 13;
79       public static final byte DISPOSE_OBJECTS = 14;
80       public static final byte HOLD_EVENTS = 15;
81       public static final byte RELEASE_EVENTS = 16;
82       public static final byte CAPABILITIES_NEW = 17;
83       public static final byte REDEFINE_CLASSES = 18;
84       public static final byte SET_DEFAULT_STRATUM = 19;
85       public static final byte ALL_CLASSES_WITH_GENERIC = 20;
86     }
87 
88     public static final class ReferenceType
89     {
90       public static final byte CS_VALUE = 2;
91 
92       // commands
93       public static final byte SIGNATURE= 1;
94       public static final byte CLASS_LOADER= 2;
95       public static final byte MODIFIERS = 3;
96       public static final byte FIELDS = 4;
97       public static final byte METHODS = 5;
98       public static final byte GET_VALUES = 6;
99       public static final byte SOURCE_FILE = 7;
100       public static final byte NESTED_TYPES = 8;
101       public static final byte STATUS = 9;
102       public static final byte INTERFACES= 10;
103       public static final byte CLASS_OBJECT = 11;
104       public static final byte SOURCE_DEBUG_EXTENSION = 12;
105       public static final byte SIGNATURE_WITH_GENERIC = 13;
106       public static final byte FIELDS_WITH_GENERIC = 14;
107       public static final byte METHODS_WITH_GENERIC = 15;
108     }
109 
110     public static final class ClassType
111     {
112       public static final byte CS_VALUE = 3;
113 
114       // commands
115       public static final byte SUPERCLASS = 1;
116       public static final byte SET_VALUES = 2;
117       public static final byte INVOKE_METHOD = 3;
118       public static final byte NEW_INSTANCE = 4;
119     }
120 
121     public static final class ArrayType
122     {
123       public static final byte CS_VALUE = 4;
124 
125       // commands
126       public static final byte NEW_INSTANCE = 1;
127     }
128 
129     public static final class InterfaceType
130     {
131       public static final byte CS_VALUE = 5;
132 
133       // commands
134     }
135 
136     public static final class Method
137     {
138       public static final byte CS_VALUE = 6;
139 
140       // commands
141       public static final byte LINE_TABLE = 1;
142       public static final byte VARIABLE_TABLE = 2;
143       public static final byte BYTE_CODES = 3;
144       public static final byte IS_OBSOLETE = 4;
145       public static final byte VARIABLE_TABLE_WITH_GENERIC = 5;
146     }
147 
148     public static final class Field
149     {
150       public static final byte CS_VALUE = 8;
151 
152       // commands
153     }
154 
155     public static final class ObjectReference
156     {
157       public static final byte CS_VALUE = 9;
158 
159       // commands
160       public static final byte REFERENCE_TYPE = 1;
161       public static final byte GET_VALUES = 2;
162       public static final byte SET_VALUES = 3;
163       public static final byte MONITOR_INFO = 5;
164       public static final byte INVOKE_METHOD = 6;
165       public static final byte DISABLE_COLLECTION = 7;
166       public static final byte ENABLE_COLLECTION = 8;
167       public static final byte IS_COLLECTED = 9;
168     }
169 
170     public static final class StringReference
171     {
172       public static final byte CS_VALUE = 10;
173 
174       // commands
175       public static final byte VALUE = 1;
176     }
177 
178     public static final class ThreadReference
179     {
180       public static final byte CS_VALUE = 11;
181 
182       // commands
183       public static final byte NAME = 1;
184       public static final byte SUSPEND = 2;
185       public static final byte RESUME = 3;
186       public static final byte STATUS = 4;
187       public static final byte THREAD_GROUP = 5;
188       public static final byte FRAMES = 6;
189       public static final byte FRAME_COUNT = 7;
190       public static final byte OWNED_MONITORS = 8;
191       public static final byte CURRENT_CONTENDED_MONITOR = 9;
192       public static final byte STOP = 10;
193       public static final byte INTERRUPT = 11;
194       public static final byte SUSPEND_COUNT = 12;
195     }
196 
197     public static final class ThreadGroupReference
198     {
199       public static final byte CS_VALUE = 12;
200 
201       // commands
202       public static final byte NAME = 1;
203       public static final byte PARENT = 2;
204       public static final byte CHILDREN = 3;
205     }
206 
207     public static final class ArrayReference
208     {
209       public static final byte CS_VALUE = 13;
210 
211       // commands
212       public static final byte LENGTH = 1;
213       public static final byte GET_VALUES = 2;
214       public static final byte SET_VALUES = 3;
215     }
216 
217     public static final class ClassLoaderReference
218     {
219       public static final byte CS_VALUE = 14;
220 
221       // commands
222       public static final byte VISIBLE_CLASSES = 1;
223     }
224 
225     public static final class EventRequest
226     {
227       public static final byte CS_VALUE = 15;
228 
229       // commands
230       public static final byte SET = 1;
231       public static final byte CLEAR = 2;
232       public static final byte CLEAR_ALL_BREAKPOINTS = 3;
233     }
234 
235     public static final class StackFrame
236     {
237       public static final byte CS_VALUE = 16;
238 
239       // commands
240       public static final byte GET_VALUES = 1;
241       public static final byte SET_VALUES = 2;
242       public static final byte THIS_OBJECT = 3;
243       public static final byte POP_FRAMES = 4;
244     }
245 
246     public static final class ClassObjectReference
247     {
248       public static final byte CS_VALUE = 17;
249 
250       // commands
251       public static final byte REFLECTED_TYPE = 1;
252     }
253 
254     public static final int MAXIMUM = ClassObjectReference.CS_VALUE;
255 
256     public static final class Event
257     {
258       public static final byte CS_VALUE = 64;
259 
260       // commands
261       public static final byte COMPOSITE = 100;
262     }
263   }
264 
265   ////////////////////////////////////////
266   //             Constants              //
267   ////////////////////////////////////////
268 
269   /*
270    * Error constants
271    */
272   public static final class Error
273   {
274     /**
275      * No error has occurred
276      */
277     public static final short NONE = 0;
278 
279     /**
280      * Passed thread is null, is not a valid thread or has exited
281      */
282     public static final short INVALID_THREAD = 10;
283 
284     /**
285      * Thread group invalid
286      */
287     public static final short INVALID_THREAD_GROUP = 11;
288 
289     /**
290      * Invalid priority
291      */
292     public static final short INVALID_PRIORITY = 12;
293 
294     /**
295      * Specified thread has not been suspended by an event
296      */
297     public static final short THREAD_NOT_SUSPENDED = 13;
298 
299     /**
300      * Thread already suspended
301      */
302     public static final short THREAD_SUSPENDED = 14;
303 
304     /**
305      * Reference type has been unloaded and garbage collected
306      */
307     public static final short INVALID_OBJECT = 20;
308 
309     /**
310      * Invalid class
311      */
312     public static final short INVALID_CLASS = 21;
313 
314     /**
315      * Class has been loaded but not yet prepared
316      */
317     public static final short CLASS_NOT_PREPARED = 22;
318 
319     /**
320      * Invalid method
321      */
322     public static final short INVALID_METHODID = 23;
323 
324     /**
325      * Invalid location
326      */
327     public static final short INVALID_LOCATION = 24;
328 
329     /**
330      * Invalid field
331      */
332     public static final short INVALID_FIELDID = 25;
333 
334     /**
335      * Invaliid frame
336      */
337     public static final short INVALID_FRAMEID = 30;
338 
339     /**
340      * There are no more Java or JNI frames on the call stack
341      */
342     public static final short NO_MORE_FRAMES = 31;
343 
344     /**
345      * Information about the frame is not available
346      */
347     public static final short OPAQUE_FRAME = 32;
348 
349     /**
350      * Operation can only be performed on current frame
351      */
352     public static final short NOT_CURRENT_FRAME = 33;
353 
354     /**
355      * Variable is not an appropriate type for the function used
356      */
357     public static final short TYPE_MISMATCH = 34;
358 
359     /**
360      * Invalid slot
361      */
362     public static final short INVALID_SLOT = 35;
363 
364     /**
365      * Item already set
366      */
367     public static final short DUPLICATE = 40;
368 
369     /**
370      * Desired element not found
371      */
372     public static final short NOT_FOUND = 41;
373 
374     /**
375      * Invalid monitor
376      */
377     public static final short INVALID_MONITOR = 50;
378 
379     /**
380      * Thread doesn't own the monitor
381      */
382     public static final short NOT_MONITOR_OWNER = 51;
383 
384     /**
385      * Call has been interrupted before completion
386      */
387     public static final short INTERRUPT = 52;
388 
389     /**
390      * Virtual machine attempted to read a class file and determined that
391      * the file is malformed or otherwise cannot be interpreted as a class
392      * file
393      */
394     public static final short INVALID_CLASS_FORMAT = 60;
395 
396     /**
397      * Circularity has been detected while initializing a class
398      */
399     public static final short CIRCULAR_CLASS_DEFINITION = 61;
400 
401     /**
402      * Verifier detected that a class file, though well formed, contained
403      * some sort of internal inconsistency or security problem
404      */
405     public static final short FAILS_VERIFICATION = 62;
406 
407     /**
408      * Adding methods has not been implemented
409      */
410     public static final short ADD_METHOD_NOT_IMPLEMENTED = 63;
411 
412     /**
413      * Schema change has not been implemented
414      */
415     public static final short SCHEMA_CHANGE_NOT_IMPLEMENTED = 64;
416 
417     /**
418      * State of the thread has been modified and is now inconsistent
419      */
420     public static final short INVALID_TYPESTATE = 65;
421 
422     /**
423      * A direct superclass is different for the new class version, or the set
424      * of directly implemented interfaces is different and
425      * <code>canUnrestrictedlyRedefineClasses</code> is false
426      */
427     public static final short HIERARCHY_CHANGE_NOT_IMPLEMENTED = 66;
428 
429     /**
430      * New class version does not declare a method declared in the old
431      * class version and <code>canUnrestrictedlyRedefineClasses</code>
432      * is false
433      */
434     public static final short DELETE_METHOD_NOT_IMPLEMENTED = 67;
435 
436     /**
437      * Class file has a version number not supported by this VM
438      */
439     public static final short UNSUPPORTED_VERSION = 68;
440 
441     /**
442      * Class name defined in the new class file is different from the name
443      * in the old class object
444      */
445     public static final short NAMES_DONT_MATCH = 69;
446 
447     /**
448      * New class version has different modifiers and
449      * <code>canUnrestrictedlyRedefineClasses</code> is false
450      */
451     public static final short CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED = 70;
452 
453     /**
454      * A method in the new class version has different modifiers than its
455      * counterpart in the old class version and
456      * <code>canUnrestrictedlyRedefineClasses</code> is false.
457      */
458     public static final short METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED = 71;
459 
460     /**
461      * Functionality is not implemented in this virtual machine
462      */
463     public static final short NOT_IMPLEMENTED = 99;
464 
465     /**
466      * Invalid pointer
467      */
468     public static final short NULL_POINTER = 100;
469 
470     /**
471      * Desired information is not available
472      */
473     public static final short ABSENT_INFORMATION = 101;
474 
475     /**
476      * Specified event type id is not recognized
477      */
478     public static final short INVALID_EVENT_TYPE = 102;
479 
480     /**
481      * Illegal argument
482      */
483     public static final short ILLEGAL_ARGUMENT = 103;
484 
485     /**
486      * The function needed to allocate memory and no more memory was
487      * available for allocation
488      */
489     public static final short OUT_OF_MEMORY = 110;
490 
491     /**
492      * Debugging has not been enabled in this virtual machine. JVMDI cannot
493      * be used
494      */
495     public static final short ACCESS_DENIED = 111;
496 
497     /**
498      * The virtual machine is not running
499      */
500     public static final short VM_DEAD = 112;
501 
502     /**
503      * An unexpected internal error has occurred
504      */
505     public static final short INTERNAL = 113;
506 
507     /**
508      * The thread being used to call this function is not attached to the
509      * virtual machine. Calls must be made from attached threads.
510      */
511     public static final short UNATTACHED_THREAD = 115;
512 
513     /**
514      * Invalid object type id or class tag
515      */
516     public static final short INVALID_TAG = 500;
517 
518     /**
519      * Previous invoke not complete
520      */
521     public static final short ALREADY_INVOKING = 502;
522 
523     /**
524      * Invalid index
525      */
526     public static final short INVALID_INDEX = 503;
527 
528     /**
529      * Invalid length
530      */
531     public static final short INVALID_LENGTH = 504;
532 
533     /**
534      * Invalid string
535      */
536     public static final short INVALID_STRING = 506;
537 
538     /**
539      * Invalid class loader
540      */
541     public static final short INVALID_CLASS_LOADER = 507;
542 
543     /**
544      * Invalid array
545      */
546     public static final short INVALID_ARRAY = 508;
547 
548     /**
549      * Unable to load the transport
550      */
551     public static final short TRANSPORT_LOAD = 509;
552 
553     /**
554      * Unablie to initialize the transport
555      */
556     public static final short TRANSPORT_INIT = 510;
557 
558     /**
559      * Method is native
560      */
561     public static final short NATIVE_METHOD = 511;
562 
563     /**
564      * Invalid count
565      */
566     public static final short INVALID_COUNT = 512;
567   }
568 
569   /*
570    * EventKind constants
571    */
572   public static final class EventKind
573   {
574     public static final byte SINGLE_STEP = 1;
575     public static final byte BREAKPOINT = 2;
576     public static final byte FRAME_POP = 3;
577     public static final byte EXCEPTION = 4;
578     public static final byte USER_DEFINED = 5;
579     public static final byte THREAD_START = 6;
580     public static final byte THREAD_END = 7;
581     public static final byte CLASS_PREPARE = 8;
582     public static final byte CLASS_UNLOAD = 9;
583     public static final byte CLASS_LOAD = 10;
584     public static final byte FIELD_ACCESS = 20;
585     public static final byte FIELD_MODIFICATION = 21;
586     public static final byte EXCEPTION_CATCH = 30;
587     public static final byte METHOD_ENTRY = 40;
588     public static final byte METHOD_EXIT = 41;
589     public static final byte VM_INIT = 90;
590     public static final byte VM_DEATH = 99;
591     public static final byte VM_DISCONNECTED = 100;
592 
593     public static final byte VM_START = VM_INIT;
594     public static final byte THREAD_DEATH = THREAD_END;
595   }
596 
597   /*
598    * ModKind constants (event filters)
599    */
600   public static final class ModKind
601   {
602     /**
603      * Limit the requested event to be reported at most once after a
604      * given number of occurrences. May be used with any event.
605      */
606     public static final byte COUNT = 1;
607 
608     /**
609      * Conditional on expression
610      */
611     public static final byte CONDITIONAL = 2;
612 
613     /**
614      * Restricts reported events to those in the given thread.
615      * May be used with any event except for class unload.
616      */
617     public static final byte THREAD_ONLY = 3;
618 
619     /**
620      * For class prepare events, restricts generated events
621      * to be the preparation of the given reference type and any
622      * subtypes.
623      *
624      * For other events, restricts the generated events to those where
625      * location is in the given reference type or any of its subtypes.
626      *
627      * An event will be generated for any location in a reference type
628      * that can be safely cast to the given reference type.
629      *
630      * May be used with any event except class unload, thread start,
631      * and thread end.
632      */
633     public static final byte CLASS_ONLY = 4;
634 
635     /**
636      * Restricts reported events to those for classes whose name matches
637      * the given restricted regular expression.
638      *
639      * For class prepare events, the prepared class name is matched.
640      * For class unload events, the unloaded class name is matched.
641      * For other events, the class name of the event's location is matched.
642      *
643      * May be used with any event except thread start and thread end.
644      */
645     public static final byte CLASS_MATCH = 5;
646 
647     /**
648      * Restricts reported events to those for classes whose name does not
649      * match the given restricted regular expression.
650      *
651      * For class prepare events, the prepared class name is matched.
652      * For class unload events, the unloaded class name is matched.
653      * For other events, the class name of the event's location is matched.
654      *
655      * May be used with any event except thread start and thread end.
656      */
657     public static final byte CLASS_EXCLUDE = 6;
658 
659     /**
660      * Restricts reported events to those that occur at the given location.
661      *
662      * May be used with breakpoint, field access, field modification, step,
663      * and exception event kinds.
664      */
665     public static final byte LOCATION_ONLY = 7;
666 
667     /**
668      * Restricts reported exceptions by their class and whether they are
669      * caught or uncaught.
670      *
671      * May be used with exception event kinds only.
672      */
673     public static final byte EXCEPTION_ONLY = 8;
674 
675     /**
676      * Restricts reported events to those that occur for a given field.
677      *
678      * May be used with field access and field modification event kinds only.
679      */
680     public static final byte FIELD_ONLY = 9;
681 
682     /**
683      * Restricts reported step events to those which satisfy depth and
684      * size constraints.
685      *
686      * May be used with step event kinds only.
687      */
688     public static final byte STEP = 10;
689 
690     /**
691      * Restricts reported events to those whose active 'this' object is
692      * the given object. Match value is the null object for static methods.
693      *
694      * May be used with any event except class prepare, class unload,
695      * thread start, and thread end.
696      */
697     public static final byte INSTANCE_ONLY = 11;
698   }
699 
700   /*
701    * ThreadStatus constants
702    */
703   public static final class ThreadStatus
704   {
705     public static final int ZOMBIE = 0;
706     public static final int RUNNING = 1;
707     public static final int SLEEPING = 2;
708     public static final int MONITOR = 3;
709     public static final int WAIT = 4;
710   }
711 
712   /*
713    * SuspendStatus constants
714    */
715   public static final class SuspendStatus
716   {
717     public static final byte SUSPENDED = 1;
718   }
719 
720   /*
721    * ClassStatus constants
722    */
723   public static final class ClassStatus
724   {
725     public static final int VERIFIED = 1;
726     public static final int PREPARED = 2;
727     public static final int INITIALIZED = 4;
728     public static final int ERROR = 8;
729   }
730 
731   /*
732    * TypeTag constants
733    */
734   public static final class TypeTag
735   {
736     public static final byte CLASS = 1;
737     public static final byte INTERFACE = 2;
738     public static final byte ARRAY = 3;
739   }
740 
741   /*
742    * Tag constants
743    */
744   public static final class Tag
745   {
746     /**
747      * Array object (objectID size)
748      */
749     public static final byte ARRAY = '[';
750 
751     /**
752      * Byte value (1 byte)
753      */
754     public static final byte BYTE = 'B';
755 
756     /**
757      * Character value (2 bytes)
758      */
759     public static final byte CHAR = 'C';
760 
761     /**
762      * Object (objectID size)
763      */
764     public static final byte OBJECT = 'L';
765 
766     /**
767      * Float value (4 bytes)
768      */
769     public static final byte FLOAT = 'F';
770 
771     /**
772      * Double value (8 bytes)
773      */
774     public static final byte DOUBLE = 'D';
775 
776     /**
777      * Int value (4 bytes)
778      */
779     public static final byte INT = 'I';
780 
781     /**
782      * Long value (8 bytes)
783      */
784     public static final byte LONG = 'J';
785 
786     /**
787      * Short value (2 bytes)
788      */
789     public static final byte SHORT = 'S';
790 
791     /**
792      * Void value (no bytes)
793      */
794     public static final byte  VOID = 'V';
795 
796     /**
797      * Boolean value (1 byte)
798      */
799     public static final byte BOOLEAN = 'Z';
800 
801     /**
802      * String object (objectID size)
803      */
804     public static final byte STRING = 's';
805 
806     /**
807      * Thread object (objectID size)
808      */
809     public static final byte THREAD = 't';
810 
811     /**
812      * ThreadGroup object (objectID size)
813      */
814     public static final byte THREAD_GROUP = 'g';
815 
816     /**
817      * ClassLoader object (objectID size)
818      */
819     public static final byte CLASS_LOADER = 'l';
820 
821     /**
822      * Class object object (objectID size)
823      */
824     public static final byte CLASS_OBJECT = 'c';
825   }
826 
827   /*
828    * StepDepth constants
829    */
830   public static final class StepDepth
831   {
832     /**
833      * Step into any method calls that occur before the end of the step
834      */
835     public static final int INTO = 0;
836 
837     /**
838      * Step over any method calls that occur before the end of the step
839      */
840     public static final int OVER = 1;
841 
842     /**
843      * Step out of the current method
844      */
845     public static final int OUT = 2;
846   }
847 
848   /*
849    * StepSize constants
850    */
851   public static final class StepSize
852   {
853     /**
854      * Step by the minimum possible amount (often a bytecode instruction)
855      */
856     public static final int MIN = 0;
857 
858     /**
859      * Step to the next source line unless there is no line number information,
860      * in which case MIN step is done instead
861      */
862     public static final int LINE = 1;
863   }
864 
865   /*
866    * SuspendPolicy constants
867    */
868   public static final class SuspendPolicy
869   {
870     /**
871      * Suspend no threads when this event is encountered
872      */
873     public static final byte NONE = 0;
874 
875     /**
876      * Suspend the event thread when this event is encountered
877      */
878     public static final byte EVENT_THREAD = 1;
879 
880     /**
881      * Suspend all threads when this event is encountered
882      */
883     public static final byte ALL = 2;
884   }
885 
886   /*
887    * InvokeOptions flag constants
888    */
889   public static final class InvokeOptions
890   {
891     /**
892      * otherwise, all threads started
893      */
894     public static final int INVOKE_SINGLE_THREADED = 0x1;
895 
896     /**
897      * otherwise, normal virtual invoke (instance methods only)
898      */
899     public static final int INVOKE_NONVIRTUAL = 0x2;
900   }
901 }
902