97 |
97 |
98 return JNI_OK; |
98 return JNI_OK; |
99 } |
99 } |
100 |
100 |
101 // Implementation of "properties" command. |
101 // Implementation of "properties" command. |
|
102 // See also: PrintSystemPropertiesDCmd class |
102 static jint get_system_properties(AttachOperation* op, outputStream* out) { |
103 static jint get_system_properties(AttachOperation* op, outputStream* out) { |
103 return get_properties(op, out, vmSymbols::serializePropertiesToByteArray_name()); |
104 return get_properties(op, out, vmSymbols::serializePropertiesToByteArray_name()); |
104 } |
105 } |
105 |
106 |
106 // Implementation of "agent_properties" command. |
107 // Implementation of "agent_properties" command. |
125 } |
126 } |
126 return JNI_OK; |
127 return JNI_OK; |
127 } |
128 } |
128 |
129 |
129 // Implementation of "threaddump" command - essentially a remote ctrl-break |
130 // Implementation of "threaddump" command - essentially a remote ctrl-break |
|
131 // See also: ThreadDumpDCmd class |
130 // |
132 // |
131 static jint thread_dump(AttachOperation* op, outputStream* out) { |
133 static jint thread_dump(AttachOperation* op, outputStream* out) { |
132 bool print_concurrent_locks = false; |
134 bool print_concurrent_locks = false; |
133 if (op->arg(0) != NULL && strcmp(op->arg(0), "-l") == 0) { |
135 if (op->arg(0) != NULL && strcmp(op->arg(0), "-l") == 0) { |
134 print_concurrent_locks = true; |
136 print_concurrent_locks = true; |
156 // All the supplied jcmd arguments are stored as a single |
158 // All the supplied jcmd arguments are stored as a single |
157 // string (op->arg(0)). This is parsed by the Dcmd framework. |
159 // string (op->arg(0)). This is parsed by the Dcmd framework. |
158 DCmd::parse_and_execute(out, op->arg(0), ' ', THREAD); |
160 DCmd::parse_and_execute(out, op->arg(0), ' ', THREAD); |
159 if (HAS_PENDING_EXCEPTION) { |
161 if (HAS_PENDING_EXCEPTION) { |
160 java_lang_Throwable::print(PENDING_EXCEPTION, out); |
162 java_lang_Throwable::print(PENDING_EXCEPTION, out); |
|
163 out->cr(); |
161 CLEAR_PENDING_EXCEPTION; |
164 CLEAR_PENDING_EXCEPTION; |
162 // The exception has been printed on the output stream |
165 // The exception has been printed on the output stream |
163 // If the JVM returns JNI_ERR, the attachAPI throws a generic I/O |
166 // If the JVM returns JNI_ERR, the attachAPI throws a generic I/O |
164 // exception and the content of the output stream is not processed. |
167 // exception and the content of the output stream is not processed. |
165 // By returning JNI_OK, the exception will be displayed on the client side |
168 // By returning JNI_OK, the exception will be displayed on the client side |
167 return JNI_OK; |
170 return JNI_OK; |
168 } |
171 } |
169 |
172 |
170 #ifndef SERVICES_KERNEL // Heap dumping not supported |
173 #ifndef SERVICES_KERNEL // Heap dumping not supported |
171 // Implementation of "dumpheap" command. |
174 // Implementation of "dumpheap" command. |
|
175 // See also: HeapDumpDCmd class |
172 // |
176 // |
173 // Input arguments :- |
177 // Input arguments :- |
174 // arg0: Name of the dump file |
178 // arg0: Name of the dump file |
175 // arg1: "-live" or "-all" |
179 // arg1: "-live" or "-all" |
176 jint dump_heap(AttachOperation* op, outputStream* out) { |
180 jint dump_heap(AttachOperation* op, outputStream* out) { |
209 return JNI_OK; |
213 return JNI_OK; |
210 } |
214 } |
211 #endif // SERVICES_KERNEL |
215 #endif // SERVICES_KERNEL |
212 |
216 |
213 // Implementation of "inspectheap" command |
217 // Implementation of "inspectheap" command |
|
218 // See also: ClassHistogramDCmd class |
214 // |
219 // |
215 // Input arguments :- |
220 // Input arguments :- |
216 // arg0: "-live" or "-all" |
221 // arg0: "-live" or "-all" |
217 static jint heap_inspection(AttachOperation* op, outputStream* out) { |
222 static jint heap_inspection(AttachOperation* op, outputStream* out) { |
218 bool live_objects_only = true; // default is true to retain the behavior before this change is made |
223 bool live_objects_only = true; // default is true to retain the behavior before this change is made |
352 return AttachListener::pd_set_flag(op, out); |
357 return AttachListener::pd_set_flag(op, out); |
353 } |
358 } |
354 } |
359 } |
355 |
360 |
356 // Implementation of "printflag" command |
361 // Implementation of "printflag" command |
|
362 // See also: PrintVMFlagsDCmd class |
357 static jint print_flag(AttachOperation* op, outputStream* out) { |
363 static jint print_flag(AttachOperation* op, outputStream* out) { |
358 const char* name = NULL; |
364 const char* name = NULL; |
359 if ((name = op->arg(0)) == NULL) { |
365 if ((name = op->arg(0)) == NULL) { |
360 out->print_cr("flag name is missing"); |
366 out->print_cr("flag name is missing"); |
361 return JNI_ERR; |
367 return JNI_ERR; |