001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdi.internal.jdwp;
011:
012: import java.io.IOException;
013: import java.lang.reflect.Field;
014: import java.lang.reflect.Modifier;
015: import java.util.HashMap;
016: import java.util.Map;
017:
018: /**
019: * This class implements the corresponding Java Debug Wire Protocol (JDWP) packet
020: * declared by the JDWP specification.
021: *
022: */
023: public class JdwpCommandPacket extends JdwpPacket {
024: /** Command Sets. */
025: public static final int CSET_VIRTUAL_MACHINE = 1;
026: public static final int CSET_REFERENCE_TYPE = 2;
027: public static final int CSET_CLASS_TYPE = 3;
028: public static final int CSET_ARRAY_TYPE = 4;
029: public static final int CSET_INTERFACE_TYPE = 5;
030: public static final int CSET_METHOD = 6;
031: public static final int CSET_FIELD = 8;
032: public static final int CSET_OBJECT_REFERENCE = 9;
033: public static final int CSET_STRING_REFERENCE = 10;
034: public static final int CSET_THREAD_REFERENCE = 11;
035: public static final int CSET_THREAD_GROUP_REFERENCE = 12;
036: public static final int CSET_ARRAY_REFERENCE = 13;
037: public static final int CSET_CLASS_LOADER_REFERENCE = 14;
038: public static final int CSET_EVENT_REQUEST = 15;
039: public static final int CSET_STACK_FRAME = 16;
040: public static final int CSET_CLASS_OBJECT_REFERENCE = 17;
041: public static final int CSET_EVENT = 64;
042: public static final int CSET_HOT_CODE_REPLACEMENT = 128;
043:
044: /** Commands VirtualMachine. */
045: public static final int VM_VERSION = 1 + (CSET_VIRTUAL_MACHINE << 8);
046: public static final int VM_CLASSES_BY_SIGNATURE = 2 + (CSET_VIRTUAL_MACHINE << 8);
047: public static final int VM_ALL_CLASSES = 3 + (CSET_VIRTUAL_MACHINE << 8);
048: public static final int VM_ALL_THREADS = 4 + (CSET_VIRTUAL_MACHINE << 8);
049: public static final int VM_TOP_LEVEL_THREAD_GROUPS = 5 + (CSET_VIRTUAL_MACHINE << 8);
050: public static final int VM_DISPOSE = 6 + (CSET_VIRTUAL_MACHINE << 8);
051: public static final int VM_ID_SIZES = 7 + (CSET_VIRTUAL_MACHINE << 8);
052: public static final int VM_SUSPEND = 8 + (CSET_VIRTUAL_MACHINE << 8);
053: public static final int VM_RESUME = 9 + (CSET_VIRTUAL_MACHINE << 8);
054: public static final int VM_EXIT = 10 + (CSET_VIRTUAL_MACHINE << 8);
055: public static final int VM_CREATE_STRING = 11 + (CSET_VIRTUAL_MACHINE << 8);
056: public static final int VM_CAPABILITIES = 12 + (CSET_VIRTUAL_MACHINE << 8);
057: public static final int VM_CLASS_PATHS = 13 + (CSET_VIRTUAL_MACHINE << 8);
058: public static final int VM_DISPOSE_OBJECTS = 14 + (CSET_VIRTUAL_MACHINE << 8);
059: public static final int VM_HOLD_EVENTS = 15 + (CSET_VIRTUAL_MACHINE << 8);
060: public static final int VM_RELEASE_EVENTS = 16 + (CSET_VIRTUAL_MACHINE << 8);
061: public static final int VM_CAPABILITIES_NEW = 17 + (CSET_VIRTUAL_MACHINE << 8);
062: public static final int VM_REDEFINE_CLASSES = 18 + (CSET_VIRTUAL_MACHINE << 8);
063: public static final int VM_SET_DEFAULT_STRATUM = 19 + (CSET_VIRTUAL_MACHINE << 8);
064: public static final int VM_ALL_CLASSES_WITH_GENERIC = 20 + (CSET_VIRTUAL_MACHINE << 8);
065: public static final int VM_INSTANCE_COUNTS = 21 + (CSET_VIRTUAL_MACHINE << 8);
066:
067: /** Commands ReferenceType. */
068: public static final int RT_SIGNATURE = 1 + (CSET_REFERENCE_TYPE << 8);
069: public static final int RT_CLASS_LOADER = 2 + (CSET_REFERENCE_TYPE << 8);
070: public static final int RT_MODIFIERS = 3 + (CSET_REFERENCE_TYPE << 8);
071: public static final int RT_FIELDS = 4 + (CSET_REFERENCE_TYPE << 8);
072: public static final int RT_METHODS = 5 + (CSET_REFERENCE_TYPE << 8);
073: public static final int RT_GET_VALUES = 6 + (CSET_REFERENCE_TYPE << 8);
074: public static final int RT_SOURCE_FILE = 7 + (CSET_REFERENCE_TYPE << 8);
075: public static final int RT_NESTED_TYPES = 8 + (CSET_REFERENCE_TYPE << 8);
076: public static final int RT_STATUS = 9 + (CSET_REFERENCE_TYPE << 8);
077: public static final int RT_INTERFACES = 10 + (CSET_REFERENCE_TYPE << 8);
078: public static final int RT_CLASS_OBJECT = 11 + (CSET_REFERENCE_TYPE << 8);
079: public static final int RT_SOURCE_DEBUG_EXTENSION = 12 + (CSET_REFERENCE_TYPE << 8);
080: public static final int RT_SIGNATURE_WITH_GENERIC = 13 + (CSET_REFERENCE_TYPE << 8);
081: public static final int RT_FIELDS_WITH_GENERIC = 14 + (CSET_REFERENCE_TYPE << 8);
082: public static final int RT_METHODS_WITH_GENERIC = 15 + (CSET_REFERENCE_TYPE << 8);
083: public static final int RT_INSTANCES = 16 + (CSET_REFERENCE_TYPE << 8);
084: public static final int RT_CLASS_VERSION = 17 + (CSET_REFERENCE_TYPE << 8);
085: public static final int RT_CONSTANT_POOL = 18 + (CSET_REFERENCE_TYPE << 8);
086:
087: /** Commands ClassType. */
088: public static final int CT_SUPERCLASS = 1 + (CSET_CLASS_TYPE << 8);
089: public static final int CT_SET_VALUES = 2 + (CSET_CLASS_TYPE << 8);
090: public static final int CT_INVOKE_METHOD = 3 + (CSET_CLASS_TYPE << 8);
091: public static final int CT_NEW_INSTANCE = 4 + (CSET_CLASS_TYPE << 8);
092:
093: /** Commands ArrayType. */
094: public static final int AT_NEW_INSTANCE = 1 + (CSET_ARRAY_TYPE << 8);
095:
096: /** Commands Method. */
097: public static final int M_LINE_TABLE = 1 + (CSET_METHOD << 8);
098: public static final int M_VARIABLE_TABLE = 2 + (CSET_METHOD << 8);
099: public static final int M_BYTECODES = 3 + (CSET_METHOD << 8);
100: public static final int M_OBSOLETE = 4 + (CSET_METHOD << 8);
101: public static final int M_VARIABLE_TABLE_WITH_GENERIC = 5 + (CSET_METHOD << 8);
102:
103: /** Commands ObjectReference. */
104: public static final int OR_REFERENCE_TYPE = 1 + (CSET_OBJECT_REFERENCE << 8);
105: public static final int OR_GET_VALUES = 2 + (CSET_OBJECT_REFERENCE << 8);
106: public static final int OR_SET_VALUES = 3 + (CSET_OBJECT_REFERENCE << 8);
107: public static final int OR_MONITOR_INFO = 5 + (CSET_OBJECT_REFERENCE << 8);
108: public static final int OR_INVOKE_METHOD = 6 + (CSET_OBJECT_REFERENCE << 8);
109: public static final int OR_DISABLE_COLLECTION = 7 + (CSET_OBJECT_REFERENCE << 8);
110: public static final int OR_ENABLE_COLLECTION = 8 + (CSET_OBJECT_REFERENCE << 8);
111: public static final int OR_IS_COLLECTED = 9 + (CSET_OBJECT_REFERENCE << 8);
112: public static final int OR_REFERRING_OBJECTS = 10 + (CSET_OBJECT_REFERENCE << 8);
113:
114: /** Commands StringReference. */
115: public static final int SR_VALUE = 1 + (CSET_STRING_REFERENCE << 8);
116:
117: /** Commands ThreadReference. */
118: public static final int TR_NAME = 1 + (CSET_THREAD_REFERENCE << 8);
119: public static final int TR_SUSPEND = 2 + (CSET_THREAD_REFERENCE << 8);
120: public static final int TR_RESUME = 3 + (CSET_THREAD_REFERENCE << 8);
121: public static final int TR_STATUS = 4 + (CSET_THREAD_REFERENCE << 8);
122: public static final int TR_THREAD_GROUP = 5 + (CSET_THREAD_REFERENCE << 8);
123: public static final int TR_FRAMES = 6 + (CSET_THREAD_REFERENCE << 8);
124: public static final int TR_FRAME_COUNT = 7 + (CSET_THREAD_REFERENCE << 8);
125: public static final int TR_OWNED_MONITORS = 8 + (CSET_THREAD_REFERENCE << 8);
126: public static final int TR_CURRENT_CONTENDED_MONITOR = 9 + (CSET_THREAD_REFERENCE << 8);
127: public static final int TR_STOP = 10 + (CSET_THREAD_REFERENCE << 8);
128: public static final int TR_INTERRUPT = 11 + (CSET_THREAD_REFERENCE << 8);
129: public static final int TR_SUSPEND_COUNT = 12 + (CSET_THREAD_REFERENCE << 8);
130: public static final int TR_OWNED_MONITOR_STACK_DEPTH = 13 + (CSET_THREAD_REFERENCE << 8);
131: public static final int TR_FORCE_EARLY_RETURN = 14 + (CSET_THREAD_REFERENCE << 8);
132:
133: /** Commands ThreadGroupReference. */
134: public static final int TGR_NAME = 1 + (CSET_THREAD_GROUP_REFERENCE << 8);
135: public static final int TGR_PARENT = 2 + (CSET_THREAD_GROUP_REFERENCE << 8);
136: public static final int TGR_CHILDREN = 3 + (CSET_THREAD_GROUP_REFERENCE << 8);
137:
138: /** Commands ArrayReference. */
139: public static final int AR_LENGTH = 1 + (CSET_ARRAY_REFERENCE << 8);
140: public static final int AR_GET_VALUES = 2 + (CSET_ARRAY_REFERENCE << 8);
141: public static final int AR_SET_VALUES = 3 + (CSET_ARRAY_REFERENCE << 8);
142:
143: /** Commands ClassLoaderReference. */
144: public static final int CLR_VISIBLE_CLASSES = 1 + (CSET_CLASS_LOADER_REFERENCE << 8);
145:
146: /** Commands EventRequest. */
147: public static final int ER_SET = 1 + (CSET_EVENT_REQUEST << 8);
148: public static final int ER_CLEAR = 2 + (CSET_EVENT_REQUEST << 8);
149: public static final int ER_CLEAR_ALL_BREAKPOINTS = 3 + (CSET_EVENT_REQUEST << 8);
150:
151: /** Commands StackFrame. */
152: public static final int SF_GET_VALUES = 1 + (CSET_STACK_FRAME << 8);
153: public static final int SF_SET_VALUES = 2 + (CSET_STACK_FRAME << 8);
154: public static final int SF_THIS_OBJECT = 3 + (CSET_STACK_FRAME << 8);
155: public static final int SF_POP_FRAME = 4 + (CSET_STACK_FRAME << 8);
156:
157: /** Commands ClassObjectReference. */
158: public static final int COR_REFLECTED_TYPE = 1 + (CSET_CLASS_OBJECT_REFERENCE << 8);
159:
160: /** Commands Event. */
161: public static final int E_COMPOSITE = 100 + (CSET_EVENT << 8);
162:
163: /** Commands Hot Code Replacement (OTI specific). */
164: public static final int HCR_CLASSES_HAVE_CHANGED = 1 + (CSET_HOT_CODE_REPLACEMENT << 8);
165: public static final int HCR_GET_CLASS_VERSION = 2 + (CSET_HOT_CODE_REPLACEMENT << 8);
166: public static final int HCR_DO_RETURN = 3 + (CSET_HOT_CODE_REPLACEMENT << 8);
167: public static final int HCR_REENTER_ON_EXIT = 4 + (CSET_HOT_CODE_REPLACEMENT << 8);
168: public static final int HCR_CAPABILITIES = 5 + (CSET_HOT_CODE_REPLACEMENT << 8);
169:
170: /** Mapping of command codes to strings. */
171: private static Map fgCommandMap = null;
172:
173: /** Next id to be assigned. */
174: private static int fgNextId = 1;
175: /** Command, note that this field is 256 * JDWP CommandSet (unsigned) + JDWP Command. */
176: private int fCommand;
177:
178: /**
179: * Creates new JdwpCommandPacket.
180: */
181: protected JdwpCommandPacket() {
182: }
183:
184: /**
185: * Creates new JdwpCommandPacket.
186: */
187: public JdwpCommandPacket(int command) {
188: setCommand(command);
189: setId(getNewId());
190: }
191:
192: /**
193: * @return Returns unique id for command packet.
194: */
195: public static synchronized int getNewId() {
196: return fgNextId++;
197: }
198:
199: /**
200: * @return Returns JDWP command set of packet.
201: */
202: public byte getCommandSet() {
203: return (byte) (fCommand >>> 8);
204: }
205:
206: /**
207: * @return Returns 256 * JDWP CommandSet (unsigned) + JDWP Command.
208: */
209: public int getCommand() {
210: return fCommand;
211: }
212:
213: /**
214: * Assigns command (256 * JDWP CommandSet (unsigned) + JDWP Command)
215: */
216: public void setCommand(int command) {
217: fCommand = command;
218: }
219:
220: /**
221: * Reads header fields that are specific for this type of packet.
222: */
223: protected int readSpecificHeaderFields(byte[] bytes, int index) {
224: byte commandSet = bytes[index];
225: fCommand = bytes[index + 1] + (commandSet << 8);
226: return 2;
227: }
228:
229: /**
230: * Writes header fields that are specific for this type of packet.
231: */
232: protected int writeSpecificHeaderFields(byte[] bytes, int index)
233: throws IOException {
234: bytes[index] = getCommandSet();
235: bytes[index + 1] = (byte) fCommand;
236: return 2;
237: }
238:
239: /**
240: * Retrieves constant mappings.
241: */
242: public static void getConstantMaps() {
243: if (fgCommandMap != null) {
244: return;
245: }
246:
247: Field[] fields = JdwpCommandPacket.class.getDeclaredFields();
248:
249: // First get the set names.
250: Map setNames = new HashMap(fields.length);
251: for (int i = 0; i < fields.length; i++) {
252: Field field = fields[i];
253: if ((field.getModifiers() & Modifier.PUBLIC) == 0
254: || (field.getModifiers() & Modifier.STATIC) == 0
255: || (field.getModifiers() & Modifier.FINAL) == 0)
256: continue;
257:
258: try {
259: String name = field.getName();
260: // If it is not a set, continue.
261: if (!name.startsWith("CSET_")) {//$NON-NLS-1$
262: continue;
263: }
264: int value = field.getInt(null);
265: setNames.put(new Integer(value), removePrefix(name));
266: } catch (IllegalAccessException e) {
267: // Will not occur for own class.
268: } catch (IllegalArgumentException e) {
269: // Should not occur.
270: // We should take care that all public static final constants
271: // in this class are numbers that are convertible to int.
272: }
273: }
274:
275: // Get the commands.
276: fgCommandMap = new HashMap();
277: for (int i = 0; i < fields.length; i++) {
278: Field field = fields[i];
279: if ((field.getModifiers() & Modifier.PUBLIC) == 0
280: || (field.getModifiers() & Modifier.STATIC) == 0
281: || (field.getModifiers() & Modifier.FINAL) == 0) {
282: continue;
283: }
284:
285: try {
286: String name = field.getName();
287:
288: // If it is a set, continue.
289: if (name.startsWith("CSET_")) { //$NON-NLS-1$
290: continue;
291: }
292: Integer val = (Integer) field.get(null);
293: int value = val.intValue();
294: int set = value >>> 8;
295: String setName = (String) setNames
296: .get(new Integer(set));
297: String entryName = setName + " - " + removePrefix(name); //$NON-NLS-1$
298:
299: fgCommandMap.put(val, entryName);
300:
301: } catch (IllegalAccessException e) {
302: // Will not occur for own class.
303: }
304: }
305: }
306:
307: /**
308: * @return Returns a map with string representations of error codes.
309: */
310: public static Map commandMap() {
311: getConstantMaps();
312: return fgCommandMap;
313: }
314:
315: /**
316: * @return Returns string without XXX_ prefix.
317: */
318: public static String removePrefix(String str) {
319: int i = str.indexOf('_');
320: if (i < 0) {
321: return str;
322: }
323: return str.substring(i + 1);
324: }
325:
326: /* (non-Javadoc)
327: * @see java.lang.Object#toString()
328: */
329: public String toString() {
330: StringBuffer buffer = new StringBuffer();
331: buffer.append('[');
332: buffer.append(getId());
333: buffer.append("] "); //$NON-NLS-1$
334: switch (getCommand()) {
335:
336: /** Commands VirtualMachine. */
337: case VM_VERSION:
338: buffer.append("VM_VERSION"); //$NON-NLS-1$
339: break;
340: case VM_CLASSES_BY_SIGNATURE:
341: buffer.append("VM_CLASSES_BY_SIGNATURE"); //$NON-NLS-1$
342: break;
343: case VM_ALL_CLASSES:
344: buffer.append("VM_ALL_CLASSES"); //$NON-NLS-1$
345: break;
346: case VM_ALL_THREADS:
347: buffer.append("VM_ALL_THREADS"); //$NON-NLS-1$
348: break;
349: case VM_TOP_LEVEL_THREAD_GROUPS:
350: buffer.append("VM_TOP_LEVEL_THREAD_GROUPS"); //$NON-NLS-1$
351: break;
352: case VM_DISPOSE:
353: buffer.append("VM_DISPOSE"); //$NON-NLS-1$
354: break;
355: case VM_ID_SIZES:
356: buffer.append("VM_ID_SIZES"); //$NON-NLS-1$
357: break;
358: case VM_SUSPEND:
359: buffer.append("VM_SUSPEND"); //$NON-NLS-1$
360: break;
361: case VM_RESUME:
362: buffer.append("VM_RESUME"); //$NON-NLS-1$
363: break;
364: case VM_EXIT:
365: buffer.append("VM_EXIT"); //$NON-NLS-1$
366: break;
367: case VM_CREATE_STRING:
368: buffer.append("VM_CREATE_STRING"); //$NON-NLS-1$
369: break;
370: case VM_CAPABILITIES:
371: buffer.append("VM_CAPABILITIES"); //$NON-NLS-1$
372: break;
373: case VM_CLASS_PATHS:
374: buffer.append("VM_CLASS_PATHS"); //$NON-NLS-1$
375: break;
376: case VM_DISPOSE_OBJECTS:
377: buffer.append("VM_DISPOSE_OBJECTS"); //$NON-NLS-1$
378: break;
379: case VM_HOLD_EVENTS:
380: buffer.append("VM_HOLD_EVENTS"); //$NON-NLS-1$
381: break;
382: case VM_RELEASE_EVENTS:
383: buffer.append("VM_RELEASE_EVENTS"); //$NON-NLS-1$
384: break;
385: case VM_CAPABILITIES_NEW:
386: buffer.append("VM_CAPABILITIES_NEW"); //$NON-NLS-1$
387: break;
388: case VM_REDEFINE_CLASSES:
389: buffer.append("VM_REDEFINE_CLASSES"); //$NON-NLS-1$
390: break;
391: case VM_SET_DEFAULT_STRATUM:
392: buffer.append("VM_SET_DEFAULT_STRATUM"); //$NON-NLS-1$
393: break;
394: case VM_ALL_CLASSES_WITH_GENERIC:
395: buffer.append("VM_ALL_CLASSES_WITH_GENERIC"); //$NON-NLS-1$
396: break;
397:
398: /** Commands ReferenceType. */
399: case RT_SIGNATURE:
400: buffer.append("RT_SIGNATURE"); //$NON-NLS-1$
401: break;
402: case RT_CLASS_LOADER:
403: buffer.append("RT_CLASS_LOADER"); //$NON-NLS-1$
404: break;
405: case RT_MODIFIERS:
406: buffer.append("RT_MODIFIERS"); //$NON-NLS-1$
407: break;
408: case RT_FIELDS:
409: buffer.append("RT_FIELDS"); //$NON-NLS-1$
410: break;
411: case RT_METHODS:
412: buffer.append("RT_METHODS"); //$NON-NLS-1$
413: break;
414: case RT_GET_VALUES:
415: buffer.append("RT_GET_VALUES"); //$NON-NLS-1$
416: break;
417: case RT_SOURCE_FILE:
418: buffer.append("RT_SOURCE_FILE"); //$NON-NLS-1$
419: break;
420: case RT_NESTED_TYPES:
421: buffer.append("RT_NESTED_TYPES"); //$NON-NLS-1$
422: break;
423: case RT_STATUS:
424: buffer.append("RT_STATUS"); //$NON-NLS-1$
425: break;
426: case RT_INTERFACES:
427: buffer.append("RT_INTERFACES"); //$NON-NLS-1$
428: break;
429: case RT_CLASS_OBJECT:
430: buffer.append("RT_CLASS_OBJECT"); //$NON-NLS-1$
431: break;
432: case RT_SOURCE_DEBUG_EXTENSION:
433: buffer.append("RT_SOURCE_DEBUG_EXTENSION"); //$NON-NLS-1$
434: break;
435: case RT_SIGNATURE_WITH_GENERIC:
436: buffer.append("RT_SIGNATURE_WITH_GENERIC"); //$NON-NLS-1$
437: break;
438: case RT_FIELDS_WITH_GENERIC:
439: buffer.append("RT_FIELDS_WITH_GENERIC"); //$NON-NLS-1$
440: break;
441: case RT_METHODS_WITH_GENERIC:
442: buffer.append("RT_METHODS_WITH_GENERIC"); //$NON-NLS-1$
443: break;
444:
445: /** Commands ClassType. */
446: case CT_SUPERCLASS:
447: buffer.append("CT_SUPERCLASS"); //$NON-NLS-1$
448: break;
449: case CT_SET_VALUES:
450: buffer.append("CT_SET_VALUES"); //$NON-NLS-1$
451: break;
452: case CT_INVOKE_METHOD:
453: buffer.append("CT_INVOKE_METHOD"); //$NON-NLS-1$
454: break;
455: case CT_NEW_INSTANCE:
456: buffer.append("CT_NEW_INSTANCE"); //$NON-NLS-1$
457: break;
458:
459: /** Commands ArrayType. */
460: case AT_NEW_INSTANCE:
461: buffer.append("AT_NEW_INSTANCE"); //$NON-NLS-1$
462: break;
463:
464: /** Commands Method. */
465: case M_LINE_TABLE:
466: buffer.append("M_LINE_TABLE"); //$NON-NLS-1$
467: break;
468: case M_VARIABLE_TABLE:
469: buffer.append("M_VARIABLE_TABLE"); //$NON-NLS-1$
470: break;
471: case M_BYTECODES:
472: buffer.append("M_BYTECODES"); //$NON-NLS-1$
473: break;
474: case M_OBSOLETE:
475: buffer.append("M_OBSOLETE"); //$NON-NLS-1$
476: break;
477: case M_VARIABLE_TABLE_WITH_GENERIC:
478: buffer.append("M_VARIABLE_TABLE_WITH_GENERIC"); //$NON-NLS-1$
479: break;
480:
481: /** Commands ObjectReference. */
482: case OR_REFERENCE_TYPE:
483: buffer.append("OR_REFERENCE_TYPE"); //$NON-NLS-1$
484: break;
485: case OR_GET_VALUES:
486: buffer.append("OR_GET_VALUES"); //$NON-NLS-1$
487: break;
488: case OR_SET_VALUES:
489: buffer.append("OR_SET_VALUES"); //$NON-NLS-1$
490: break;
491: case OR_MONITOR_INFO:
492: buffer.append("OR_MONITOR_INFO"); //$NON-NLS-1$
493: break;
494: case OR_INVOKE_METHOD:
495: buffer.append("OR_INVOKE_METHOD"); //$NON-NLS-1$
496: break;
497: case OR_DISABLE_COLLECTION:
498: buffer.append("OR_DISABLE_COLLECTION"); //$NON-NLS-1$
499: break;
500: case OR_ENABLE_COLLECTION:
501: buffer.append("OR_ENABLE_COLLECTION"); //$NON-NLS-1$
502: break;
503: case OR_IS_COLLECTED:
504: buffer.append("OR_IS_COLLECTED"); //$NON-NLS-1$
505: break;
506:
507: /** Commands StringReference. */
508: case SR_VALUE:
509: buffer.append("SR_VALUE"); //$NON-NLS-1$
510: break;
511:
512: /** Commands ThreadReference. */
513: case TR_NAME:
514: buffer.append("TR_NAME"); //$NON-NLS-1$
515: break;
516: case TR_SUSPEND:
517: buffer.append("TR_SUSPEND"); //$NON-NLS-1$
518: break;
519: case TR_RESUME:
520: buffer.append("TR_RESUME"); //$NON-NLS-1$
521: break;
522: case TR_STATUS:
523: buffer.append("TR_STATUS"); //$NON-NLS-1$
524: break;
525: case TR_THREAD_GROUP:
526: buffer.append("TR_THREAD_GROUP"); //$NON-NLS-1$
527: break;
528: case TR_FRAMES:
529: buffer.append("TR_FRAMES"); //$NON-NLS-1$
530: break;
531: case TR_FRAME_COUNT:
532: buffer.append("TR_FRAME_COUNT"); //$NON-NLS-1$
533: break;
534: case TR_OWNED_MONITORS:
535: buffer.append("TR_OWNED_MONITORS"); //$NON-NLS-1$
536: break;
537: case TR_CURRENT_CONTENDED_MONITOR:
538: buffer.append("TR_CURRENT_CONTENDED_MONITOR"); //$NON-NLS-1$
539: break;
540: case TR_STOP:
541: buffer.append("TR_STOP"); //$NON-NLS-1$
542: break;
543: case TR_INTERRUPT:
544: buffer.append("TR_INTERRUPT"); //$NON-NLS-1$
545: break;
546: case TR_SUSPEND_COUNT:
547: buffer.append("TR_SUSPEND_COUNT"); //$NON-NLS-1$
548: break;
549:
550: /** Commands ThreadGroupReference. */
551: case TGR_NAME:
552: buffer.append("TGR_NAME"); //$NON-NLS-1$
553: break;
554: case TGR_PARENT:
555: buffer.append("TGR_PARENT"); //$NON-NLS-1$
556: break;
557: case TGR_CHILDREN:
558: buffer.append("TGR_CHILDREN"); //$NON-NLS-1$
559: break;
560:
561: /** Commands ArrayReference. */
562: case AR_LENGTH:
563: buffer.append("AR_LENGTH"); //$NON-NLS-1$
564: break;
565: case AR_GET_VALUES:
566: buffer.append("AR_GET_VALUES"); //$NON-NLS-1$
567: break;
568: case AR_SET_VALUES:
569: buffer.append("AR_SET_VALUES"); //$NON-NLS-1$
570: break;
571:
572: /** Commands ClassLoaderReference. */
573: case CLR_VISIBLE_CLASSES:
574: buffer.append("CLR_VISIBLE_CLASSES"); //$NON-NLS-1$
575: break;
576:
577: /** Commands EventRequest. */
578: case ER_SET:
579: buffer.append("ER_SET"); //$NON-NLS-1$
580: break;
581: case ER_CLEAR:
582: buffer.append("ER_CLEAR"); //$NON-NLS-1$
583: break;
584: case ER_CLEAR_ALL_BREAKPOINTS:
585: buffer.append("ER_CLEAR_ALL_BREAKPOINTS"); //$NON-NLS-1$
586: break;
587:
588: /** Commands StackFrame. */
589: case SF_GET_VALUES:
590: buffer.append("SF_GET_VALUES"); //$NON-NLS-1$
591: break;
592: case SF_SET_VALUES:
593: buffer.append("SF_SET_VALUES"); //$NON-NLS-1$
594: break;
595: case SF_THIS_OBJECT:
596: buffer.append("SF_THIS_OBJECT"); //$NON-NLS-1$
597: break;
598: case SF_POP_FRAME:
599: buffer.append("SF_POP_FRAME"); //$NON-NLS-1$
600: break;
601:
602: /** Commands ClassObjectReference. */
603: case COR_REFLECTED_TYPE:
604: buffer.append("COR_REFLECTED_TYPE"); //$NON-NLS-1$
605: break;
606:
607: /** Commands Event. */
608: case E_COMPOSITE:
609: buffer.append("E_COMPOSITE"); //$NON-NLS-1$
610: break;
611:
612: default:
613: buffer.append("UNKNOWN COMMAND: "); //$NON-NLS-1$
614: buffer.append(getCommand());
615: break;
616: }
617: return buffer.toString();
618: }
619: }
|