1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /*
17  * These come out of the JDWP documentation.
18  */
19 #ifndef ART_RUNTIME_JDWP_JDWP_CONSTANTS_H_
20 #define ART_RUNTIME_JDWP_JDWP_CONSTANTS_H_
21 
22 #include <iosfwd>
23 
24 namespace art {
25 
26 namespace JDWP {
27 
28 /*
29  * Error constants.
30  */
31 enum JdwpError {
32   ERR_NONE                                        = 0,
33   ERR_INVALID_THREAD                              = 10,
34   ERR_INVALID_THREAD_GROUP                        = 11,
35   ERR_INVALID_PRIORITY                            = 12,
36   ERR_THREAD_NOT_SUSPENDED                        = 13,
37   ERR_THREAD_SUSPENDED                            = 14,
38   ERR_THREAD_NOT_ALIVE                            = 15,
39   ERR_INVALID_OBJECT                              = 20,
40   ERR_INVALID_CLASS                               = 21,
41   ERR_CLASS_NOT_PREPARED                          = 22,
42   ERR_INVALID_METHODID                            = 23,
43   ERR_INVALID_LOCATION                            = 24,
44   ERR_INVALID_FIELDID                             = 25,
45   ERR_INVALID_FRAMEID                             = 30,
46   ERR_NO_MORE_FRAMES                              = 31,
47   ERR_OPAQUE_FRAME                                = 32,
48   ERR_NOT_CURRENT_FRAME                           = 33,
49   ERR_TYPE_MISMATCH                               = 34,
50   ERR_INVALID_SLOT                                = 35,
51   ERR_DUPLICATE                                   = 40,
52   ERR_NOT_FOUND                                   = 41,
53   ERR_INVALID_MONITOR                             = 50,
54   ERR_NOT_MONITOR_OWNER                           = 51,
55   ERR_INTERRUPT                                   = 52,
56   ERR_INVALID_CLASS_FORMAT                        = 60,
57   ERR_CIRCULAR_CLASS_DEFINITION                   = 61,
58   ERR_FAILS_VERIFICATION                          = 62,
59   ERR_ADD_METHOD_NOT_IMPLEMENTED                  = 63,
60   ERR_SCHEMA_CHANGE_NOT_IMPLEMENTED               = 64,
61   ERR_INVALID_TYPESTATE                           = 65,
62   ERR_HIERARCHY_CHANGE_NOT_IMPLEMENTED            = 66,
63   ERR_DELETE_METHOD_NOT_IMPLEMENTED               = 67,
64   ERR_UNSUPPORTED_VERSION                         = 68,
65   ERR_NAMES_DONT_MATCH                            = 69,
66   ERR_CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED      = 70,
67   ERR_METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED     = 71,
68   ERR_NOT_IMPLEMENTED                             = 99,
69   ERR_NULL_POINTER                                = 100,
70   ERR_ABSENT_INFORMATION                          = 101,
71   ERR_INVALID_EVENT_TYPE                          = 102,
72   ERR_ILLEGAL_ARGUMENT                            = 103,
73   ERR_OUT_OF_MEMORY                               = 110,
74   ERR_ACCESS_DENIED                               = 111,
75   ERR_VM_DEAD                                     = 112,
76   ERR_INTERNAL                                    = 113,
77   ERR_UNATTACHED_THREAD                           = 115,
78   ERR_INVALID_TAG                                 = 500,
79   ERR_ALREADY_INVOKING                            = 502,
80   ERR_INVALID_INDEX                               = 503,
81   ERR_INVALID_LENGTH                              = 504,
82   ERR_INVALID_STRING                              = 506,
83   ERR_INVALID_CLASS_LOADER                        = 507,
84   ERR_INVALID_ARRAY                               = 508,
85   ERR_TRANSPORT_LOAD                              = 509,
86   ERR_TRANSPORT_INIT                              = 510,
87   ERR_NATIVE_METHOD                               = 511,
88   ERR_INVALID_COUNT                               = 512,
89 };
90 std::ostream& operator<<(std::ostream& os, const JdwpError& value);
91 
92 
93 /*
94  * ClassStatus constants.  These are bit flags that can be ORed together.
95  */
96 enum JdwpClassStatus {
97   CS_VERIFIED             = 0x01,
98   CS_PREPARED             = 0x02,
99   CS_INITIALIZED          = 0x04,
100   CS_ERROR                = 0x08,
101 };
102 std::ostream& operator<<(std::ostream& os, const JdwpClassStatus& value);
103 
104 /*
105  * EventKind constants.
106  */
107 enum JdwpEventKind {
108   EK_SINGLE_STEP          = 1,
109   EK_BREAKPOINT           = 2,
110   EK_FRAME_POP            = 3,
111   EK_EXCEPTION            = 4,
112   EK_USER_DEFINED         = 5,
113   EK_THREAD_START         = 6,
114   EK_THREAD_DEATH         = 7,  // Formerly known as THREAD_END.
115   EK_CLASS_PREPARE        = 8,
116   EK_CLASS_UNLOAD         = 9,
117   EK_CLASS_LOAD           = 10,
118   EK_FIELD_ACCESS         = 20,
119   EK_FIELD_MODIFICATION   = 21,
120   EK_EXCEPTION_CATCH      = 30,
121   EK_METHOD_ENTRY         = 40,
122   EK_METHOD_EXIT          = 41,
123   EK_METHOD_EXIT_WITH_RETURN_VALUE = 42,
124   EK_MONITOR_CONTENDED_ENTER       = 43,
125   EK_MONITOR_CONTENDED_ENTERED     = 44,
126   EK_MONITOR_WAIT         = 45,
127   EK_MONITOR_WAITED       = 46,
128   EK_VM_START             = 90,  // Formerly known as VM_INIT.
129   EK_VM_DEATH             = 99,
130   EK_VM_DISCONNECTED      = 100,  // "Never sent across JDWP".
131 };
132 std::ostream& operator<<(std::ostream& os, const JdwpEventKind& value);
133 
134 /*
135  * Values for "modKind" in EventRequest.Set.
136  */
137 enum JdwpModKind {
138   MK_COUNT                = 1,
139   MK_CONDITIONAL          = 2,
140   MK_THREAD_ONLY          = 3,
141   MK_CLASS_ONLY           = 4,
142   MK_CLASS_MATCH          = 5,
143   MK_CLASS_EXCLUDE        = 6,
144   MK_LOCATION_ONLY        = 7,
145   MK_EXCEPTION_ONLY       = 8,
146   MK_FIELD_ONLY           = 9,
147   MK_STEP                 = 10,
148   MK_INSTANCE_ONLY        = 11,
149   MK_SOURCE_NAME_MATCH    = 12,  // Since Java 6.
150 };
151 std::ostream& operator<<(std::ostream& os, const JdwpModKind& value);
152 
153 /*
154  * InvokeOptions constants (bit flags).
155  */
156 enum JdwpInvokeOptions {
157   INVOKE_SINGLE_THREADED  = 0x01,
158   INVOKE_NONVIRTUAL       = 0x02,
159 };
160 std::ostream& operator<<(std::ostream& os, const JdwpInvokeOptions& value);
161 
162 /*
163  * StepDepth constants.
164  */
165 enum JdwpStepDepth {
166   SD_INTO                 = 0,    // Step into method calls.
167   SD_OVER                 = 1,    // Step over method calls.
168   SD_OUT                  = 2,    // Step out of current method.
169 };
170 std::ostream& operator<<(std::ostream& os, const JdwpStepDepth& value);
171 
172 /*
173  * StepSize constants.
174  */
175 enum JdwpStepSize {
176   SS_MIN                  = 0,    // Step by minimum (for example, one bytecode).
177   SS_LINE                 = 1,    // If possible, step to next line.
178 };
179 std::ostream& operator<<(std::ostream& os, const JdwpStepSize& value);
180 
181 /*
182  * SuspendPolicy constants.
183  */
184 enum JdwpSuspendPolicy {
185   SP_NONE                 = 0,    // Suspend no threads.
186   SP_EVENT_THREAD         = 1,    // Suspend event thread.
187   SP_ALL                  = 2,    // Suspend all threads.
188 };
189 std::ostream& operator<<(std::ostream& os, const JdwpSuspendPolicy& value);
190 
191 /*
192  * SuspendStatus constants.
193  */
194 enum JdwpSuspendStatus {
195   SUSPEND_STATUS_NOT_SUSPENDED = 0,
196   SUSPEND_STATUS_SUSPENDED     = 1,
197 };
198 std::ostream& operator<<(std::ostream& os, const JdwpSuspendStatus& value);
199 
200 /*
201  * ThreadStatus constants.
202  */
203 enum JdwpThreadStatus {
204   TS_ZOMBIE               = 0,
205   TS_RUNNING              = 1,        // RUNNING
206   TS_SLEEPING             = 2,        // (in Thread.sleep())
207   TS_MONITOR              = 3,        // WAITING (monitor wait)
208   TS_WAIT                 = 4,        // (in Object.wait())
209 };
210 std::ostream& operator<<(std::ostream& os, const JdwpThreadStatus& value);
211 
212 /*
213  * TypeTag constants.
214  */
215 enum JdwpTypeTag {
216   TT_CLASS                = 1,
217   TT_INTERFACE            = 2,
218   TT_ARRAY                = 3,
219 };
220 std::ostream& operator<<(std::ostream& os, const JdwpTypeTag& value);
221 
222 /*
223  * Tag constants.
224  */
225 enum JdwpTag {
226   JT_ARRAY                 = '[',
227   JT_BYTE                  = 'B',
228   JT_CHAR                  = 'C',
229   JT_OBJECT                = 'L',
230   JT_FLOAT                 = 'F',
231   JT_DOUBLE                = 'D',
232   JT_INT                   = 'I',
233   JT_LONG                  = 'J',
234   JT_SHORT                 = 'S',
235   JT_VOID                  = 'V',
236   JT_BOOLEAN               = 'Z',
237   JT_STRING                = 's',
238   JT_THREAD                = 't',
239   JT_THREAD_GROUP          = 'g',
240   JT_CLASS_LOADER          = 'l',
241   JT_CLASS_OBJECT          = 'c',
242 };
243 std::ostream& operator<<(std::ostream& os, const JdwpTag& value);
244 
245 }  // namespace JDWP
246 
247 }  // namespace art
248 
249 #endif  // ART_RUNTIME_JDWP_JDWP_CONSTANTS_H_
250