Home | History | Annotate | Download | only in jdwp
      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  */
     26 const char* dvmJdwpErrorStr(enum 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  */
    149 const char* dvmJdwpEventKindStr(enum 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 StepDepth.
    178  */
    179 const char* dvmJdwpStepDepthStr(enum JdwpStepDepth depth)
    180 {
    181     switch (depth) {
    182     case SD_INTO:               return "INTO";
    183     case SD_OVER:               return "OVER";
    184     case SD_OUT:                return "OUT";
    185     default:                    return "?UNKNOWN?";
    186     }
    187 }
    188 
    189 /*
    190  * Return a string for the StepSize.
    191  */
    192 const char* dvmJdwpStepSizeStr(enum JdwpStepSize size)
    193 {
    194     switch (size) {
    195     case SS_MIN:                return "MIN";
    196     case SS_LINE:               return "LINE";
    197     default:                    return "?UNKNOWN?";
    198     }
    199 }
    200 
    201 /*
    202  * Return a string for the SuspendPolicy.
    203  */
    204 const char* dvmJdwpSuspendPolicyStr(enum JdwpSuspendPolicy policy)
    205 {
    206     switch (policy) {
    207     case SP_NONE:               return "NONE";
    208     case SP_EVENT_THREAD:       return "EVENT_THREAD";
    209     case SP_ALL:                return "ALL";
    210     default:                    return "?UNKNOWN?";
    211     }
    212 }
    213 
    214 /*
    215  * Return a string for the SuspendStatus.
    216  */
    217 const char* dvmJdwpSuspendStatusStr(enum JdwpSuspendStatus status)
    218 {
    219     switch (status) {
    220     case 0:                         return "Not SUSPENDED";
    221     case SUSPEND_STATUS_SUSPENDED:  return "SUSPENDED";
    222     default:                        return "?UNKNOWN?";
    223     }
    224 }
    225 
    226 /*
    227  * Return a string for the ThreadStatus.
    228  */
    229 const char* dvmJdwpThreadStatusStr(enum JdwpThreadStatus status)
    230 {
    231     switch (status) {
    232     case TS_ZOMBIE:             return "ZOMBIE";
    233     case TS_RUNNING:            return "RUNNING";
    234     case TS_SLEEPING:           return "SLEEPING";
    235     case TS_MONITOR:            return "MONITOR";
    236     case TS_WAIT:               return "WAIT";
    237     default:                    return "?UNKNOWN?";
    238     }
    239 };
    240 
    241