JdwpConstants.h revision 375fb116bcb817b37509ab579dbd55cdbb765cbf
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 DALVIK_JDWP_JDWPCONSTANTS_H_
20#define DALVIK_JDWP_JDWPCONSTANTS_H_
21
22/*
23 * Error constants.
24 */
25enum JdwpError {
26    ERR_NONE                                        = 0,
27    ERR_INVALID_THREAD                              = 10,
28    ERR_INVALID_THREAD_GROUP                        = 11,
29    ERR_INVALID_PRIORITY                            = 12,
30    ERR_THREAD_NOT_SUSPENDED                        = 13,
31    ERR_THREAD_SUSPENDED                            = 14,
32    ERR_INVALID_OBJECT                              = 20,
33    ERR_INVALID_CLASS                               = 21,
34    ERR_CLASS_NOT_PREPARED                          = 22,
35    ERR_INVALID_METHODID                            = 23,
36    ERR_INVALID_LOCATION                            = 24,
37    ERR_INVALID_FIELDID                             = 25,
38    ERR_INVALID_FRAMEID                             = 30,
39    ERR_NO_MORE_FRAMES                              = 31,
40    ERR_OPAQUE_FRAME                                = 32,
41    ERR_NOT_CURRENT_FRAME                           = 33,
42    ERR_TYPE_MISMATCH                               = 34,
43    ERR_INVALID_SLOT                                = 35,
44    ERR_DUPLICATE                                   = 40,
45    ERR_NOT_FOUND                                   = 41,
46    ERR_INVALID_MONITOR                             = 50,
47    ERR_NOT_MONITOR_OWNER                           = 51,
48    ERR_INTERRUPT                                   = 52,
49    ERR_INVALID_CLASS_FORMAT                        = 60,
50    ERR_CIRCULAR_CLASS_DEFINITION                   = 61,
51    ERR_FAILS_VERIFICATION                          = 62,
52    ERR_ADD_METHOD_NOT_IMPLEMENTED                  = 63,
53    ERR_SCHEMA_CHANGE_NOT_IMPLEMENTED               = 64,
54    ERR_INVALID_TYPESTATE                           = 65,
55    ERR_HIERARCHY_CHANGE_NOT_IMPLEMENTED            = 66,
56    ERR_DELETE_METHOD_NOT_IMPLEMENTED               = 67,
57    ERR_UNSUPPORTED_VERSION                         = 68,
58    ERR_NAMES_DONT_MATCH                            = 69,
59    ERR_CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED      = 70,
60    ERR_METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED     = 71,
61    ERR_NOT_IMPLEMENTED                             = 99,
62    ERR_NULL_POINTER                                = 100,
63    ERR_ABSENT_INFORMATION                          = 101,
64    ERR_INVALID_EVENT_TYPE                          = 102,
65    ERR_ILLEGAL_ARGUMENT                            = 103,
66    ERR_OUT_OF_MEMORY                               = 110,
67    ERR_ACCESS_DENIED                               = 111,
68    ERR_VM_DEAD                                     = 112,
69    ERR_INTERNAL                                    = 113,
70    ERR_UNATTACHED_THREAD                           = 115,
71    ERR_INVALID_TAG                                 = 500,
72    ERR_ALREADY_INVOKING                            = 502,
73    ERR_INVALID_INDEX                               = 503,
74    ERR_INVALID_LENGTH                              = 504,
75    ERR_INVALID_STRING                              = 506,
76    ERR_INVALID_CLASS_LOADER                        = 507,
77    ERR_INVALID_ARRAY                               = 508,
78    ERR_TRANSPORT_LOAD                              = 509,
79    ERR_TRANSPORT_INIT                              = 510,
80    ERR_NATIVE_METHOD                               = 511,
81    ERR_INVALID_COUNT                               = 512,
82};
83const char* dvmJdwpErrorStr(JdwpError error);
84
85
86/*
87 * ClassStatus constants.  These are bit flags that can be ORed together.
88 */
89enum JdwpClassStatus {
90    CS_VERIFIED             = 0x01,
91    CS_PREPARED             = 0x02,
92    CS_INITIALIZED          = 0x04,
93    CS_ERROR                = 0x08,
94};
95
96/*
97 * EventKind constants.
98 */
99enum JdwpEventKind {
100    EK_SINGLE_STEP          = 1,
101    EK_BREAKPOINT           = 2,
102    EK_FRAME_POP            = 3,
103    EK_EXCEPTION            = 4,
104    EK_USER_DEFINED         = 5,
105    EK_THREAD_START         = 6,
106    EK_THREAD_END           = 7,
107    EK_CLASS_PREPARE        = 8,
108    EK_CLASS_UNLOAD         = 9,
109    EK_CLASS_LOAD           = 10,
110    EK_FIELD_ACCESS         = 20,
111    EK_FIELD_MODIFICATION   = 21,
112    EK_EXCEPTION_CATCH      = 30,
113    EK_METHOD_ENTRY         = 40,
114    EK_METHOD_EXIT          = 41,
115    EK_VM_INIT              = 90,
116    EK_VM_DEATH             = 99,
117    EK_VM_DISCONNECTED      = 100,  /* "Never sent across JDWP */
118    EK_VM_START             = EK_VM_INIT,
119    EK_THREAD_DEATH         = EK_THREAD_END,
120};
121const char* dvmJdwpEventKindStr(JdwpEventKind kind);
122
123/*
124 * Values for "modKind" in EventRequest.Set.
125 */
126enum JdwpModKind {
127    MK_COUNT                = 1,
128    MK_CONDITIONAL          = 2,
129    MK_THREAD_ONLY          = 3,
130    MK_CLASS_ONLY           = 4,
131    MK_CLASS_MATCH          = 5,
132    MK_CLASS_EXCLUDE        = 6,
133    MK_LOCATION_ONLY        = 7,
134    MK_EXCEPTION_ONLY       = 8,
135    MK_FIELD_ONLY           = 9,
136    MK_STEP                 = 10,
137    MK_INSTANCE_ONLY        = 11,
138};
139const char* dvmJdwpModKindStr(JdwpModKind kind);
140
141/*
142 * InvokeOptions constants (bit flags).
143 */
144enum JdwpInvokeOptions {
145    INVOKE_SINGLE_THREADED  = 0x01,
146    INVOKE_NONVIRTUAL       = 0x02,
147};
148
149/*
150 * StepDepth constants.
151 */
152enum JdwpStepDepth {
153    SD_INTO                 = 0,    /* step into method calls */
154    SD_OVER                 = 1,    /* step over method calls */
155    SD_OUT                  = 2,    /* step out of current method */
156};
157const char* dvmJdwpStepDepthStr(JdwpStepDepth depth);
158
159/*
160 * StepSize constants.
161 */
162enum JdwpStepSize {
163    SS_MIN                  = 0,    /* step by minimum (e.g. 1 bytecode inst) */
164    SS_LINE                 = 1,    /* if possible, step to next line */
165};
166const char* dvmJdwpStepSizeStr(JdwpStepSize size);
167
168/*
169 * SuspendPolicy constants.
170 */
171enum JdwpSuspendPolicy {
172    SP_NONE                 = 0,    /* suspend no threads */
173    SP_EVENT_THREAD         = 1,    /* suspend event thread */
174    SP_ALL                  = 2,    /* suspend all threads */
175};
176const char* dvmJdwpSuspendPolicyStr(JdwpSuspendPolicy policy);
177
178/*
179 * SuspendStatus constants.
180 */
181enum JdwpSuspendStatus {
182    SUSPEND_STATUS_SUSPENDED = 1,
183};
184const char* dvmJdwpSuspendStatusStr(JdwpSuspendStatus status);
185
186/*
187 * ThreadStatus constants.
188 */
189enum JdwpThreadStatus {
190    TS_ZOMBIE               = 0,
191    TS_RUNNING              = 1,        // RUNNING
192    TS_SLEEPING             = 2,        // (in Thread.sleep())
193    TS_MONITOR              = 3,        // WAITING (monitor wait)
194    TS_WAIT                 = 4,        // (in Object.wait())
195};
196const char* dvmJdwpThreadStatusStr(JdwpThreadStatus status);
197
198/*
199 * TypeTag constants.
200 */
201enum JdwpTypeTag {
202    TT_CLASS                = 1,
203    TT_INTERFACE            = 2,
204    TT_ARRAY                = 3,
205};
206
207/*
208 * Tag constants.
209 */
210enum JdwpType {
211    JT_ARRAY                 = '[',
212    JT_BYTE                  = 'B',
213    JT_CHAR                  = 'C',
214    JT_OBJECT                = 'L',
215    JT_FLOAT                 = 'F',
216    JT_DOUBLE                = 'D',
217    JT_INT                   = 'I',
218    JT_LONG                  = 'J',
219    JT_SHORT                 = 'S',
220    JT_VOID                  = 'V',
221    JT_BOOLEAN               = 'Z',
222    JT_STRING                = 's',
223    JT_THREAD                = 't',
224    JT_THREAD_GROUP          = 'g',
225    JT_CLASS_LOADER          = 'l',
226    JT_CLASS_OBJECT          = 'c',
227};
228
229#endif  // DALVIK_JDWP_JDWPCONSTANTS_H_
230