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 * String constants to go along with enumerated values. (Pity we don't 18 * have enumerated constant reflection in C.) These are only needed for 19 * making the output human-readable. 20 */ 21 #include "jdwp/JdwpConstants.h" 22 23 /* 24 * Return a string for the error code. 25 */ dvmJdwpErrorStr(JdwpError error)26const char* dvmJdwpErrorStr(JdwpError error) 27 { 28 switch (error) { 29 case ERR_NONE: 30 return "NONE"; 31 case ERR_INVALID_THREAD: 32 return "INVALID_THREAD"; 33 case ERR_INVALID_THREAD_GROUP: 34 return "INVALID_THREAD_GROUP"; 35 case ERR_INVALID_PRIORITY: 36 return "INVALID_PRIORITY"; 37 case ERR_THREAD_NOT_SUSPENDED: 38 return "THREAD_NOT_SUSPENDED"; 39 case ERR_THREAD_SUSPENDED: 40 return "THREAD_SUSPENDED"; 41 case ERR_INVALID_OBJECT: 42 return "INVALID_OBJEC"; 43 case ERR_INVALID_CLASS: 44 return "INVALID_CLASS"; 45 case ERR_CLASS_NOT_PREPARED: 46 return "CLASS_NOT_PREPARED"; 47 case ERR_INVALID_METHODID: 48 return "INVALID_METHODID"; 49 case ERR_INVALID_LOCATION: 50 return "INVALID_LOCATION"; 51 case ERR_INVALID_FIELDID: 52 return "INVALID_FIELDID"; 53 case ERR_INVALID_FRAMEID: 54 return "INVALID_FRAMEID"; 55 case ERR_NO_MORE_FRAMES: 56 return "NO_MORE_FRAMES"; 57 case ERR_OPAQUE_FRAME: 58 return "OPAQUE_FRAME"; 59 case ERR_NOT_CURRENT_FRAME: 60 return "NOT_CURRENT_FRAME"; 61 case ERR_TYPE_MISMATCH: 62 return "TYPE_MISMATCH"; 63 case ERR_INVALID_SLOT: 64 return "INVALID_SLOT"; 65 case ERR_DUPLICATE: 66 return "DUPLICATE"; 67 case ERR_NOT_FOUND: 68 return "NOT_FOUND"; 69 case ERR_INVALID_MONITOR: 70 return "INVALID_MONITOR"; 71 case ERR_NOT_MONITOR_OWNER: 72 return "NOT_MONITOR_OWNER"; 73 case ERR_INTERRUPT: 74 return "INTERRUPT"; 75 case ERR_INVALID_CLASS_FORMAT: 76 return "INVALID_CLASS_FORMAT"; 77 case ERR_CIRCULAR_CLASS_DEFINITION: 78 return "CIRCULAR_CLASS_DEFINITION"; 79 case ERR_FAILS_VERIFICATION: 80 return "FAILS_VERIFICATION"; 81 case ERR_ADD_METHOD_NOT_IMPLEMENTED: 82 return "ADD_METHOD_NOT_IMPLEMENTED"; 83 case ERR_SCHEMA_CHANGE_NOT_IMPLEMENTED: 84 return "SCHEMA_CHANGE_NOT_IMPLEMENTED"; 85 case ERR_INVALID_TYPESTATE: 86 return "INVALID_TYPESTATE"; 87 case ERR_HIERARCHY_CHANGE_NOT_IMPLEMENTED: 88 return "HIERARCHY_CHANGE_NOT_IMPLEMENTED"; 89 case ERR_DELETE_METHOD_NOT_IMPLEMENTED: 90 return "DELETE_METHOD_NOT_IMPLEMENTED"; 91 case ERR_UNSUPPORTED_VERSION: 92 return "UNSUPPORTED_VERSION"; 93 case ERR_NAMES_DONT_MATCH: 94 return "NAMES_DONT_MATCH"; 95 case ERR_CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED: 96 return "CLASS_MODIFIERS_CHANGE_NOT_IMPLEMENTED"; 97 case ERR_METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED: 98 return "METHOD_MODIFIERS_CHANGE_NOT_IMPLEMENTED"; 99 case ERR_NOT_IMPLEMENTED: 100 return "NOT_IMPLEMENTED"; 101 case ERR_NULL_POINTER: 102 return "NULL_POINTER"; 103 case ERR_ABSENT_INFORMATION: 104 return "ABSENT_INFORMATION"; 105 case ERR_INVALID_EVENT_TYPE: 106 return "INVALID_EVENT_TYPE"; 107 case ERR_ILLEGAL_ARGUMENT: 108 return "ILLEGAL_ARGUMENT"; 109 case ERR_OUT_OF_MEMORY: 110 return "OUT_OF_MEMORY"; 111 case ERR_ACCESS_DENIED: 112 return "ACCESS_DENIED"; 113 case ERR_VM_DEAD: 114 return "VM_DEAD"; 115 case ERR_INTERNAL: 116 return "INTERNAL"; 117 case ERR_UNATTACHED_THREAD: 118 return "UNATTACHED_THREAD"; 119 case ERR_INVALID_TAG: 120 return "INVALID_TAG"; 121 case ERR_ALREADY_INVOKING: 122 return "ALREADY_INVOKING"; 123 case ERR_INVALID_INDEX: 124 return "INVALID_INDEX"; 125 case ERR_INVALID_LENGTH: 126 return "INVALID_LENGTH"; 127 case ERR_INVALID_STRING: 128 return "INVALID_STRING"; 129 case ERR_INVALID_CLASS_LOADER: 130 return "INVALID_CLASS_LOADER"; 131 case ERR_INVALID_ARRAY: 132 return "INVALID_ARRAY"; 133 case ERR_TRANSPORT_LOAD: 134 return "TRANSPORT_LOAD"; 135 case ERR_TRANSPORT_INIT: 136 return "TRANSPORT_INIT"; 137 case ERR_NATIVE_METHOD: 138 return "NATIVE_METHOD"; 139 case ERR_INVALID_COUNT: 140 return "INVALID_COUNT"; 141 default: 142 return "?UNKNOWN?"; 143 } 144 } 145 146 /* 147 * Return a string for the EventKind. 148 */ dvmJdwpEventKindStr(JdwpEventKind kind)149const char* dvmJdwpEventKindStr(JdwpEventKind kind) 150 { 151 switch (kind) { 152 case EK_SINGLE_STEP: return "SINGLE_STEP"; 153 case EK_BREAKPOINT: return "BREAKPOINT"; 154 case EK_FRAME_POP: return "FRAME_POP"; 155 case EK_EXCEPTION: return "EXCEPTION"; 156 case EK_USER_DEFINED: return "USER_DEFINED"; 157 case EK_THREAD_START: return "THREAD_START"; 158 /*case EK_THREAD_END: return "THREAD_END";*/ 159 case EK_CLASS_PREPARE: return "CLASS_PREPARE"; 160 case EK_CLASS_UNLOAD: return "CLASS_UNLOAD"; 161 case EK_CLASS_LOAD: return "CLASS_LOAD"; 162 case EK_FIELD_ACCESS: return "FIELD_ACCESS"; 163 case EK_FIELD_MODIFICATION: return "FIELD_MODIFICATION"; 164 case EK_EXCEPTION_CATCH: return "EXCEPTION_CATCH"; 165 case EK_METHOD_ENTRY: return "METHOD_ENTRY"; 166 case EK_METHOD_EXIT: return "METHOD_EXIT"; 167 case EK_VM_INIT: return "VM_INIT"; 168 case EK_VM_DEATH: return "VM_DEATH"; 169 case EK_VM_DISCONNECTED: return "VM_DISCONNECTED"; 170 /*case EK_VM_START: return "VM_START";*/ 171 case EK_THREAD_DEATH: return "THREAD_DEATH"; 172 default: return "?UNKNOWN?"; 173 } 174 } 175 176 /* 177 * Return a string for the ModKind. 178 */ dvmJdwpModKindStr(JdwpModKind kind)179const char* dvmJdwpModKindStr(JdwpModKind kind) 180 { 181 switch (kind) { 182 case MK_COUNT: return "COUNT"; 183 case MK_CONDITIONAL: return "CONDITIONAL"; 184 case MK_THREAD_ONLY: return "THREAD_ONLY"; 185 case MK_CLASS_ONLY: return "CLASS_ONLY"; 186 case MK_CLASS_MATCH: return "CLASS_MATCH"; 187 case MK_CLASS_EXCLUDE: return "CLASS_EXCLUDE"; 188 case MK_LOCATION_ONLY: return "LOCATION_ONLY"; 189 case MK_EXCEPTION_ONLY: return "EXCEPTION_ONLY"; 190 case MK_FIELD_ONLY: return "FIELD_ONLY"; 191 case MK_STEP: return "STEP"; 192 case MK_INSTANCE_ONLY: return "INSTANCE_ONLY"; 193 default: return "?UNKNOWN?"; 194 } 195 } 196 197 /* 198 * Return a string for the StepDepth. 199 */ dvmJdwpStepDepthStr(JdwpStepDepth depth)200const char* dvmJdwpStepDepthStr(JdwpStepDepth depth) 201 { 202 switch (depth) { 203 case SD_INTO: return "INTO"; 204 case SD_OVER: return "OVER"; 205 case SD_OUT: return "OUT"; 206 default: return "?UNKNOWN?"; 207 } 208 } 209 210 /* 211 * Return a string for the StepSize. 212 */ dvmJdwpStepSizeStr(JdwpStepSize size)213const char* dvmJdwpStepSizeStr(JdwpStepSize size) 214 { 215 switch (size) { 216 case SS_MIN: return "MIN"; 217 case SS_LINE: return "LINE"; 218 default: return "?UNKNOWN?"; 219 } 220 } 221 222 /* 223 * Return a string for the SuspendPolicy. 224 */ dvmJdwpSuspendPolicyStr(JdwpSuspendPolicy policy)225const char* dvmJdwpSuspendPolicyStr(JdwpSuspendPolicy policy) 226 { 227 switch (policy) { 228 case SP_NONE: return "NONE"; 229 case SP_EVENT_THREAD: return "EVENT_THREAD"; 230 case SP_ALL: return "ALL"; 231 default: return "?UNKNOWN?"; 232 } 233 } 234 235 /* 236 * Return a string for the SuspendStatus. 237 */ dvmJdwpSuspendStatusStr(JdwpSuspendStatus status)238const char* dvmJdwpSuspendStatusStr(JdwpSuspendStatus status) 239 { 240 switch (status) { 241 case SUSPEND_STATUS_NOT_SUSPENDED: return "Not SUSPENDED"; 242 case SUSPEND_STATUS_SUSPENDED: return "SUSPENDED"; 243 default: return "?UNKNOWN?"; 244 } 245 } 246 247 /* 248 * Return a string for the ThreadStatus. 249 */ dvmJdwpThreadStatusStr(JdwpThreadStatus status)250const char* dvmJdwpThreadStatusStr(JdwpThreadStatus status) 251 { 252 switch (status) { 253 case TS_ZOMBIE: return "ZOMBIE"; 254 case TS_RUNNING: return "RUNNING"; 255 case TS_SLEEPING: return "SLEEPING"; 256 case TS_MONITOR: return "MONITOR"; 257 case TS_WAIT: return "WAIT"; 258 default: return "?UNKNOWN?"; 259 } 260 }; 261