1 /*
2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
339 class VM_GetOwnedMonitorInfo : public VM_Operation {
340 private:
341 JvmtiEnv *_env;
342 JavaThread* _calling_thread;
343 JavaThread *_java_thread;
344 jvmtiError _result;
345 GrowableArray<jvmtiMonitorStackDepthInfo*> *_owned_monitors_list;
346
347 public:
348 VM_GetOwnedMonitorInfo(JvmtiEnv* env, JavaThread* calling_thread,
349 JavaThread* java_thread,
350 GrowableArray<jvmtiMonitorStackDepthInfo*>* owned_monitor_list) {
351 _env = env;
352 _calling_thread = calling_thread;
353 _java_thread = java_thread;
354 _owned_monitors_list = owned_monitor_list;
355 _result = JVMTI_ERROR_NONE;
356 }
357 VMOp_Type type() const { return VMOp_GetOwnedMonitorInfo; }
358 void doit() {
359 ((JvmtiEnvBase *)_env)->get_owned_monitors(_calling_thread, _java_thread,
360 _owned_monitors_list);
361 }
362 jvmtiError result() { return _result; }
363 };
364
365
366 // VM operation to get object monitor usage.
367 class VM_GetObjectMonitorUsage : public VM_Operation {
368 private:
369 JvmtiEnv *_env;
370 jobject _object;
371 JavaThread* _calling_thread;
372 jvmtiMonitorUsage* _info_ptr;
373 jvmtiError _result;
374
375 public:
376 VM_GetObjectMonitorUsage(JvmtiEnv *env, JavaThread* calling_thread, jobject object, jvmtiMonitorUsage* info_ptr) {
377 _env = env;
378 _object = object;
379 _calling_thread = calling_thread;
380 _info_ptr = info_ptr;
381 }
422 jint _start_depth;
423 jint _max_count;
424 jvmtiFrameInfo *_frame_buffer;
425 jint *_count_ptr;
426 jvmtiError _result;
427
428 public:
429 VM_GetStackTrace(JvmtiEnv *env, JavaThread *java_thread,
430 jint start_depth, jint max_count,
431 jvmtiFrameInfo* frame_buffer, jint* count_ptr) {
432 _env = env;
433 _java_thread = java_thread;
434 _start_depth = start_depth;
435 _max_count = max_count;
436 _frame_buffer = frame_buffer;
437 _count_ptr = count_ptr;
438 }
439 jvmtiError result() { return _result; }
440 VMOp_Type type() const { return VMOp_GetStackTrace; }
441 void doit() {
442 _result = ((JvmtiEnvBase *)_env)->get_stack_trace(_java_thread,
443 _start_depth, _max_count,
444 _frame_buffer, _count_ptr);
445 }
446 };
447
448 // forward declaration
449 struct StackInfoNode;
450
451 // VM operation to get stack trace at safepoint.
452 class VM_GetMultipleStackTraces : public VM_Operation {
453 private:
454 JvmtiEnv *_env;
455 jint _max_frame_count;
456 jvmtiStackInfo *_stack_info;
457 jvmtiError _result;
458 int _frame_count_total;
459 struct StackInfoNode *_head;
460
461 JvmtiEnvBase *env() { return (JvmtiEnvBase *)_env; }
462 jint max_frame_count() { return _max_frame_count; }
463 struct StackInfoNode *head() { return _head; }
464 void set_head(StackInfoNode *head) { _head = head; }
465
|
1 /*
2 * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
339 class VM_GetOwnedMonitorInfo : public VM_Operation {
340 private:
341 JvmtiEnv *_env;
342 JavaThread* _calling_thread;
343 JavaThread *_java_thread;
344 jvmtiError _result;
345 GrowableArray<jvmtiMonitorStackDepthInfo*> *_owned_monitors_list;
346
347 public:
348 VM_GetOwnedMonitorInfo(JvmtiEnv* env, JavaThread* calling_thread,
349 JavaThread* java_thread,
350 GrowableArray<jvmtiMonitorStackDepthInfo*>* owned_monitor_list) {
351 _env = env;
352 _calling_thread = calling_thread;
353 _java_thread = java_thread;
354 _owned_monitors_list = owned_monitor_list;
355 _result = JVMTI_ERROR_NONE;
356 }
357 VMOp_Type type() const { return VMOp_GetOwnedMonitorInfo; }
358 void doit() {
359 _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
360 if (Threads::includes(_java_thread) && !_java_thread->is_exiting() && _java_thread->threadObj() != NULL) {
361 _result = ((JvmtiEnvBase *)_env)->get_owned_monitors(_calling_thread, _java_thread,
362 _owned_monitors_list);
363 }
364 }
365 jvmtiError result() { return _result; }
366 };
367
368
369 // VM operation to get object monitor usage.
370 class VM_GetObjectMonitorUsage : public VM_Operation {
371 private:
372 JvmtiEnv *_env;
373 jobject _object;
374 JavaThread* _calling_thread;
375 jvmtiMonitorUsage* _info_ptr;
376 jvmtiError _result;
377
378 public:
379 VM_GetObjectMonitorUsage(JvmtiEnv *env, JavaThread* calling_thread, jobject object, jvmtiMonitorUsage* info_ptr) {
380 _env = env;
381 _object = object;
382 _calling_thread = calling_thread;
383 _info_ptr = info_ptr;
384 }
425 jint _start_depth;
426 jint _max_count;
427 jvmtiFrameInfo *_frame_buffer;
428 jint *_count_ptr;
429 jvmtiError _result;
430
431 public:
432 VM_GetStackTrace(JvmtiEnv *env, JavaThread *java_thread,
433 jint start_depth, jint max_count,
434 jvmtiFrameInfo* frame_buffer, jint* count_ptr) {
435 _env = env;
436 _java_thread = java_thread;
437 _start_depth = start_depth;
438 _max_count = max_count;
439 _frame_buffer = frame_buffer;
440 _count_ptr = count_ptr;
441 }
442 jvmtiError result() { return _result; }
443 VMOp_Type type() const { return VMOp_GetStackTrace; }
444 void doit() {
445 _result = JVMTI_ERROR_THREAD_NOT_ALIVE;
446 if (Threads::includes(_java_thread) && !_java_thread->is_exiting() && _java_thread->threadObj() != NULL) {
447 _result = ((JvmtiEnvBase *)_env)->get_stack_trace(_java_thread,
448 _start_depth, _max_count,
449 _frame_buffer, _count_ptr);
450 }
451 }
452 };
453
454 // forward declaration
455 struct StackInfoNode;
456
457 // VM operation to get stack trace at safepoint.
458 class VM_GetMultipleStackTraces : public VM_Operation {
459 private:
460 JvmtiEnv *_env;
461 jint _max_frame_count;
462 jvmtiStackInfo *_stack_info;
463 jvmtiError _result;
464 int _frame_count_total;
465 struct StackInfoNode *_head;
466
467 JvmtiEnvBase *env() { return (JvmtiEnvBase *)_env; }
468 jint max_frame_count() { return _max_frame_count; }
469 struct StackInfoNode *head() { return _head; }
470 void set_head(StackInfoNode *head) { _head = head; }
471
|