1 /* src/native/jvmti.c - implementation of the Java Virtual Machine Tool
4 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
5 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
6 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
7 J. Wenninger, Institut f. Computersprachen - TU Wien
9 This file is part of CACAO.
11 This program is free software; you can redistribute it and/or
12 modify it under the terms of the GNU General Public License as
13 published by the Free Software Foundation; either version 2, or (at
14 your option) any later version.
16 This program is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
26 Contact: cacao@cacaojvm.org
28 Author: Martin Platter
33 $Id: jvmti.h 4357 2006-01-22 23:33:38Z twisti $
39 #include "native/jni.h"
40 #include "native/include/java_lang_String.h"
41 #include <sys/types.h>
43 #define JVMTI_VERSION_1_0 0x30010000
45 typedef jobject jthread;
46 typedef jobject jthreadGroup;
47 typedef jlong jlocation;
48 struct _jrawMonitorID;
49 typedef struct _jrawMonitorID *jrawMonitorID;
50 typedef struct jvmtiEnv_struct jvmtiEnv;
53 JVMTI_ERROR_NONE = 0, /* No error has occurred. This is the error code that is
54 returned on successful completion of the function. */
55 JVMTI_ERROR_NULL_POINTER = 100, /* Pointer is unexpectedly NULL. */
56 JVMTI_ERROR_OUT_OF_MEMORY = 110, /* The function attempted to allocate memory
57 and no more memory was available for
59 JVMTI_ERROR_ACCESS_DENIED = 111, /* The desired functionality has not been
60 enabled in this virtual machine. */
61 JVMTI_ERROR_UNATTACHED_THREAD = 115, /* The thread being used to call this
62 function is not attached to the virtual
63 machine. Calls must be made from attached threads.
64 See AttachCurrentThread in the JNI invocation API. */
65 JVMTI_ERROR_INVALID_ENVIRONMENT = 116, /*
66 The JVM TI environment provided is no longer connected or is not an environment. */
67 JVMTI_ERROR_WRONG_PHASE = 112, /*
68 The desired functionality is not available in the current phase. Always returned if the virtual machine has completed running. */
69 JVMTI_ERROR_INTERNAL = 113, /*
70 An unexpected internal error has occurred. */
72 /* ****** Function Specific Required Errors ********** */
73 JVMTI_ERROR_INVALID_PRIORITY = 12, /*
75 JVMTI_ERROR_THREAD_NOT_SUSPENDED = 13, /*
76 Thread was not suspended. */
77 JVMTI_ERROR_THREAD_SUSPENDED = 14, /*
78 Thread already suspended. */
79 JVMTI_ERROR_THREAD_NOT_ALIVE = 15, /*
80 This operation requires the thread to be alive--that is, it must be started and not yet have died. */
81 JVMTI_ERROR_CLASS_NOT_PREPARED = 22, /*
82 The class has been loaded but not yet prepared. */
83 JVMTI_ERROR_NO_MORE_FRAMES = 31, /*
84 There are no Java programming language or JNI stack frames at the specified depth. */
85 JVMTI_ERROR_OPAQUE_FRAME = 32, /*
86 Information about the frame is not available = e.g. for native frames, */
87 JVMTI_ERROR_DUPLICATE = 40, /*
89 JVMTI_ERROR_NOT_FOUND = 41, /*
90 Desired element = e.g. field or breakpoint, not found */
91 JVMTI_ERROR_NOT_MONITOR_OWNER = 51, /*
92 This thread doesn't own the raw monitor. */
93 JVMTI_ERROR_INTERRUPT = 52, /*
94 The call has been interrupted before completion. */
95 JVMTI_ERROR_UNMODIFIABLE_CLASS = 79, /*
96 The class cannot be modified. */
97 JVMTI_ERROR_NOT_AVAILABLE = 98, /*
98 The functionality is not available in this virtual machine. */
99 JVMTI_ERROR_ABSENT_INFORMATION = 101, /*
100 The requested information is not available. */
101 JVMTI_ERROR_INVALID_EVENT_TYPE = 102, /*
102 The specified event type ID is not recognized. */
103 JVMTI_ERROR_NATIVE_METHOD = 104, /*
104 The requested information is not available for native method.
105 Function Specific Agent Errors
106 The following errors are returned by some JVM TI functions. They are returned in the event of invalid parameters passed by the agent or usage in an invalid context. An implementation is not required to detect these errors. */
107 JVMTI_ERROR_INVALID_THREAD = 10, /*
108 The passed thread is not a valid thread.*/
109 JVMTI_ERROR_INVALID_FIELDID = 25, /*
111 JVMTI_ERROR_INVALID_METHODID = 23, /*
113 JVMTI_ERROR_INVALID_LOCATION = 24, /*
115 JVMTI_ERROR_INVALID_OBJECT = 20, /*
117 JVMTI_ERROR_INVALID_CLASS = 21, /*
119 JVMTI_ERROR_TYPE_MISMATCH = 34, /*
120 The variable is not an appropriate type for the function used. */
121 JVMTI_ERROR_INVALID_SLOT = 35, /*
123 JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99, /*
124 The capability being used is false in this environment. */
125 JVMTI_ERROR_INVALID_THREAD_GROUP = 11, /*
126 Thread group invalid. */
127 JVMTI_ERROR_INVALID_MONITOR = 50, /*
128 Invalid raw monitor. */
129 JVMTI_ERROR_ILLEGAL_ARGUMENT = 103, /*
131 JVMTI_ERROR_INVALID_TYPESTATE = 65, /*
132 The state of the thread has been modified, and is now inconsistent. */
133 JVMTI_ERROR_UNSUPPORTED_VERSION = 68, /*
134 A new class file has a version number not supported by this VM. */
135 JVMTI_ERROR_INVALID_CLASS_FORMAT = 60, /*
136 A new class file is malformed = the VM would return a ClassFormatError, */
137 JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION = 61, /*
138 The new class file definitions would lead to a circular definition = the VM would return a ClassCircularityError, */
139 JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED = 63, /*
140 A new class file would require adding a method. */
141 JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED = 64, /*
142 A new class version changes a field. */
143 JVMTI_ERROR_FAILS_VERIFICATION = 62, /*
144 The class bytes fail verification. */
145 JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED = 66, /*
146 A direct superclass is different for the new class version, or the set of directly implemented interfaces is different. */
147 JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED = 67, /*
148 A new class version does not declare a method declared in the old class version. */
149 JVMTI_ERROR_NAMES_DONT_MATCH = 69, /*
150 The class name defined in the new class file is different from the name in the old class object. */
151 JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70, /*
152 A new class version has different modifiers. */
153 JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71 /*
154 A method in the new class version has different modifiers than its counterpart in the old class version.*/
160 JVMTI_PHASE_ONLOAD = 1,
161 JVMTI_PHASE_PRIMORDIAL = 2,
162 JVMTI_PHASE_START = 6,
163 JVMTI_PHASE_LIVE = 4,
169 JVMTI_JLOCATION_JVMBCI = 1,
170 JVMTI_JLOCATION_MACHINEPC = 2,
171 JVMTI_JLOCATION_OTHER = 0
172 } jvmtiJlocationFormat;
175 jlocation start_location;
177 } jvmtiLineNumberEntry;
183 jthreadGroup thread_group;
184 jobject context_class_loader;
188 JVMTI_VERBOSE_OTHER = 0,
189 JVMTI_VERBOSE_GC = 1,
190 JVMTI_VERBOSE_CLASS = 2,
191 JVMTI_VERBOSE_JNI = 4
196 jint class_byte_count;
197 const unsigned char* class_bytes;
198 } jvmtiClassDefinition;
200 typedef struct JNINativeInterface jniNativeInterface;
203 const void* start_address;
205 } jvmtiAddrLocationMap;
208 typedef void (JNICALL *jvmtiEventSingleStep)
209 (jvmtiEnv *jvmti_env,
215 typedef void (JNICALL *jvmtiEventBreakpoint)
216 (jvmtiEnv *jvmti_env,
222 typedef void (JNICALL *jvmtiEventFieldAccess)
223 (jvmtiEnv *jvmti_env,
232 typedef void (JNICALL *jvmtiEventFieldModification)
233 (jvmtiEnv *jvmti_env,
244 typedef void (JNICALL *jvmtiEventFramePop)
245 (jvmtiEnv *jvmti_env,
249 jboolean was_popped_by_exception);
251 typedef void (JNICALL *jvmtiEventMethodEntry)
252 (jvmtiEnv *jvmti_env,
257 typedef void (JNICALL *jvmtiEventMethodExit)
258 (jvmtiEnv *jvmti_env,
262 jboolean was_popped_by_exception,
263 jvalue return_value);
265 typedef void (JNICALL *jvmtiEventNativeMethodBind)
266 (jvmtiEnv *jvmti_env,
271 void** new_address_ptr);
273 typedef void (JNICALL *jvmtiEventException)
274 (jvmtiEnv *jvmti_env,
280 jmethodID catch_method,
281 jlocation catch_location);
283 typedef void (JNICALL *jvmtiEventExceptionCatch)
284 (jvmtiEnv *jvmti_env,
291 typedef void (JNICALL *jvmtiEventThreadStart)
292 (jvmtiEnv *jvmti_env,
296 typedef void (JNICALL *jvmtiEventThreadEnd)
297 (jvmtiEnv *jvmti_env,
301 typedef void (JNICALL *jvmtiEventClassLoad)
302 (jvmtiEnv *jvmti_env,
307 typedef void (JNICALL *jvmtiEventClassPrepare)
308 (jvmtiEnv *jvmti_env,
313 typedef void (JNICALL *jvmtiEventClassFileLoadHook)
314 (jvmtiEnv *jvmti_env,
316 jclass class_being_redefined,
319 jobject protection_domain,
321 const unsigned char* class_data,
322 jint* new_class_data_len,
323 unsigned char** new_class_data);
325 typedef void (JNICALL *jvmtiEventVMStart)
326 (jvmtiEnv *jvmti_env,
329 typedef void (JNICALL *jvmtiEventVMInit)
330 (jvmtiEnv *jvmti_env,
334 typedef void (JNICALL *jvmtiEventVMDeath)
335 (jvmtiEnv *jvmti_env,
339 typedef void (JNICALL *jvmtiEventCompiledMethodLoad)
340 (jvmtiEnv *jvmti_env,
343 const void* code_addr,
345 const jvmtiAddrLocationMap* map,
346 const void* compile_info);
348 typedef void (JNICALL *jvmtiEventCompiledMethodUnload)
349 (jvmtiEnv *jvmti_env,
351 const void* code_addr);
353 typedef void (JNICALL *jvmtiEventDynamicCodeGenerated)
354 (jvmtiEnv *jvmti_env,
359 typedef void (JNICALL *jvmtiEventDataDumpRequest)
360 (jvmtiEnv *jvmti_env);
362 typedef void (JNICALL *jvmtiEventMonitorContendedEnter)
363 (jvmtiEnv *jvmti_env,
368 typedef void (JNICALL *jvmtiEventMonitorContendedEntered)
369 (jvmtiEnv *jvmti_env,
374 typedef void (JNICALL *jvmtiEventMonitorWait)
375 (jvmtiEnv *jvmti_env,
381 typedef void (JNICALL *jvmtiEventMonitorWaited)
382 (jvmtiEnv *jvmti_env,
388 typedef void (JNICALL *jvmtiEventVMObjectAlloc)
389 (jvmtiEnv *jvmti_env,
396 typedef void (JNICALL *jvmtiEventObjectFree)
397 (jvmtiEnv *jvmti_env,
400 typedef void (JNICALL *jvmtiEventGarbageCollectionStart)
401 (jvmtiEnv *jvmti_env);
403 typedef void (JNICALL *jvmtiEventGarbageCollectionFinish)
404 (jvmtiEnv *jvmti_env);
406 typedef void (JNICALL *jvmtiStartFunction)
407 (jvmtiEnv* jvmti_env,
416 } jvmtiThreadGroupInfo;
423 jint notify_waiter_count;
424 jthread* notify_waiters;
428 jlocation start_location;
432 char* generic_signature;
434 } jvmtiLocalVariableEntry;
444 jvmtiFrameInfo* frame_buffer;
449 JVMTI_HEAP_OBJECT_TAGGED = 1,
450 JVMTI_HEAP_OBJECT_UNTAGGED = 2,
451 JVMTI_HEAP_OBJECT_EITHER = 3
452 } jvmtiHeapObjectFilter;
455 JVMTI_REFERENCE_CLASS = 1,
456 JVMTI_REFERENCE_FIELD = 2,
457 JVMTI_REFERENCE_ARRAY_ELEMENT = 3,
458 JVMTI_REFERENCE_CLASS_LOADER = 4,
459 JVMTI_REFERENCE_SIGNERS = 5,
460 JVMTI_REFERENCE_PROTECTION_DOMAIN = 6,
461 JVMTI_REFERENCE_INTERFACE = 7,
462 JVMTI_REFERENCE_STATIC_FIELD = 8,
463 JVMTI_REFERENCE_CONSTANT_POOL = 9
464 } jvmtiObjectReferenceKind;
467 JVMTI_ITERATION_CONTINUE = 1,
468 JVMTI_ITERATION_IGNORE = 2,
469 JVMTI_ITERATION_ABORT = 0
470 } jvmtiIterationControl;
473 JVMTI_HEAP_ROOT_JNI_GLOBAL = 1,
474 JVMTI_HEAP_ROOT_SYSTEM_CLASS = 2,
475 JVMTI_HEAP_ROOT_MONITOR = 3,
476 JVMTI_HEAP_ROOT_STACK_LOCAL = 4,
477 JVMTI_HEAP_ROOT_JNI_LOCAL = 5,
478 JVMTI_HEAP_ROOT_THREAD = 6,
479 JVMTI_HEAP_ROOT_OTHER = 7
482 typedef jvmtiIterationControl (JNICALL *jvmtiObjectReferenceCallback)
483 (jvmtiObjectReferenceKind reference_kind,
491 typedef jvmtiIterationControl (JNICALL *jvmtiHeapRootCallback)
492 (jvmtiHeapRootKind root_kind,
498 typedef jvmtiIterationControl (JNICALL *jvmtiStackReferenceCallback)
499 (jvmtiHeapRootKind root_kind,
509 typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback)
515 typedef jvmtiError (JNICALL *jvmtiExtensionFunction)
516 (jvmtiEnv* jvmti_env,
521 JVMTI_KIND_IN_PTR = 92,
522 JVMTI_KIND_IN_BUF = 93,
523 JVMTI_KIND_ALLOC_BUF = 94,
524 JVMTI_KIND_ALLOC_ALLOC_BUF = 95,
526 JVMTI_KIND_OUT_BUF = 97
530 JVMTI_TYPE_JBYTE = 101,
531 JVMTI_TYPE_JCHAR = 102,
532 JVMTI_TYPE_JSHORT = 103,
533 JVMTI_TYPE_JINT = 104,
534 JVMTI_TYPE_JLONG = 105,
535 JVMTI_TYPE_JFLOAT = 106,
536 JVMTI_TYPE_JDOUBLE = 107,
537 JVMTI_TYPE_JBOOLEAN = 108,
538 JVMTI_TYPE_JOBJECT = 109,
539 JVMTI_TYPE_JTHREAD = 110,
540 JVMTI_TYPE_JCLASS = 111,
541 JVMTI_TYPE_JVALUE = 112,
542 JVMTI_TYPE_JFIELDID = 113,
543 JVMTI_TYPE_JMETHODID = 114,
544 JVMTI_TYPE_CCHAR = 115,
545 JVMTI_TYPE_CVOID = 116,
546 JVMTI_TYPE_JNIENV = 117
552 jvmtiParamTypes base_type;
557 jint extension_event_index;
559 char* short_description;
561 jvmtiParamInfo* params;
562 } jvmtiExtensionEventInfo;
564 typedef void (JNICALL *jvmtiExtensionEvent)
565 (jvmtiEnv* jvmti_env,
569 JVMTI_TIMER_USER_CPU = 30,
570 JVMTI_TIMER_TOTAL_CPU = 31,
571 JVMTI_TIMER_ELAPSED = 32
576 jboolean may_skip_forward;
577 jboolean may_skip_backward;
584 jvmtiExtensionFunction func;
586 char* short_description;
588 jvmtiParamInfo* params;
591 } jvmtiExtensionFunctionInfo;
593 typedef void* jvmtiEventReserved;
596 jvmtiEventVMInit VMInit;
597 jvmtiEventVMDeath VMDeath;
598 jvmtiEventThreadStart ThreadStart;
599 jvmtiEventThreadEnd ThreadEnd;
600 jvmtiEventClassFileLoadHook ClassFileLoadHook;
601 jvmtiEventClassLoad ClassLoad;
602 jvmtiEventClassPrepare ClassPrepare;
603 jvmtiEventVMStart VMStart;
604 jvmtiEventException Exception;
605 jvmtiEventExceptionCatch ExceptionCatch;
606 jvmtiEventSingleStep SingleStep;
607 jvmtiEventFramePop FramePop;
608 jvmtiEventBreakpoint Breakpoint;
609 jvmtiEventFieldAccess FieldAccess;
610 jvmtiEventFieldModification FieldModification;
611 jvmtiEventMethodEntry MethodEntry;
612 jvmtiEventMethodExit MethodExit;
613 jvmtiEventNativeMethodBind NativeMethodBind;
614 jvmtiEventCompiledMethodLoad CompiledMethodLoad;
615 jvmtiEventCompiledMethodUnload CompiledMethodUnload;
616 jvmtiEventDynamicCodeGenerated DynamicCodeGenerated;
617 jvmtiEventDataDumpRequest DataDumpRequest;
618 jvmtiEventReserved reserved72;
619 jvmtiEventMonitorWait MonitorWait;
620 jvmtiEventMonitorWaited MonitorWaited;
621 jvmtiEventMonitorContendedEnter MonitorContendedEnter;
622 jvmtiEventMonitorContendedEntered MonitorContendedEntered;
623 jvmtiEventReserved reserved77;
624 jvmtiEventReserved reserved78;
625 jvmtiEventReserved reserved79;
626 jvmtiEventReserved reserved80;
627 jvmtiEventGarbageCollectionStart GarbageCollectionStart;
628 jvmtiEventGarbageCollectionFinish GarbageCollectionFinish;
629 jvmtiEventObjectFree ObjectFree;
630 jvmtiEventVMObjectAlloc VMObjectAlloc;
631 } jvmtiEventCallbacks;
639 JVMTI_EVENT_START_ENUM = 50,
640 JVMTI_EVENT_VM_INIT = 50,
641 JVMTI_EVENT_VM_DEATH = 51,
642 JVMTI_EVENT_THREAD_START = 52,
643 JVMTI_EVENT_THREAD_END = 53,
644 JVMTI_EVENT_CLASS_FILE_LOAD_HOOK = 54,
645 JVMTI_EVENT_CLASS_LOAD = 55,
646 JVMTI_EVENT_CLASS_PREPARE = 56,
647 JVMTI_EVENT_VM_START = 57,
648 JVMTI_EVENT_EXCEPTION = 58,
649 JVMTI_EVENT_EXCEPTION_CATCH = 59,
650 JVMTI_EVENT_SINGLE_STEP = 60,
651 JVMTI_EVENT_FRAME_POP = 61,
652 JVMTI_EVENT_BREAKPOINT = 62,
653 JVMTI_EVENT_FIELD_ACCESS = 63,
654 JVMTI_EVENT_FIELD_MODIFICATION = 64,
655 JVMTI_EVENT_METHOD_ENTRY = 65,
656 JVMTI_EVENT_METHOD_EXIT = 66,
657 JVMTI_EVENT_NATIVE_METHOD_BIND = 67,
658 JVMTI_EVENT_COMPILED_METHOD_LOAD = 68,
659 JVMTI_EVENT_COMPILED_METHOD_UNLOAD = 69,
660 JVMTI_EVENT_DYNAMIC_CODE_GENERATED = 70,
661 JVMTI_EVENT_DATA_DUMP_REQUEST = 71,
662 JVMTI_EVENT_MONITOR_WAIT = 73,
663 JVMTI_EVENT_MONITOR_WAITED = 74,
664 JVMTI_EVENT_MONITOR_CONTENDED_ENTER = 75,
665 JVMTI_EVENT_MONITOR_CONTENDED_ENTERED = 76,
666 JVMTI_EVENT_GARBAGE_COLLECTION_START = 81,
667 JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82,
668 JVMTI_EVENT_OBJECT_FREE = 83,
669 JVMTI_EVENT_VM_OBJECT_ALLOC = 84,
670 JVMTI_EVENT_END_ENUM = 84
675 unsigned int can_tag_objects : 1;
676 unsigned int can_generate_field_modification_events : 1;
677 unsigned int can_generate_field_access_events : 1;
678 unsigned int can_get_bytecodes : 1;
679 unsigned int can_get_synthetic_attribute : 1;
680 unsigned int can_get_owned_monitor_info : 1;
681 unsigned int can_get_current_contended_monitor : 1;
682 unsigned int can_get_monitor_info : 1;
683 unsigned int can_pop_frame : 1;
684 unsigned int can_redefine_classes : 1;
685 unsigned int can_signal_thread : 1;
686 unsigned int can_get_source_file_name : 1;
687 unsigned int can_get_line_numbers : 1;
688 unsigned int can_get_source_debug_extension : 1;
689 unsigned int can_access_local_variables : 1;
690 unsigned int can_maintain_original_method_order : 1;
691 unsigned int can_generate_single_step_events : 1;
692 unsigned int can_generate_exception_events : 1;
693 unsigned int can_generate_frame_pop_events : 1;
694 unsigned int can_generate_breakpoint_events : 1;
695 unsigned int can_suspend : 1;
696 unsigned int can_redefine_any_class : 1;
697 unsigned int can_get_current_thread_cpu_time : 1;
698 unsigned int can_get_thread_cpu_time : 1;
699 unsigned int can_generate_method_entry_events : 1;
700 unsigned int can_generate_method_exit_events : 1;
701 unsigned int can_generate_all_class_hook_events : 1;
702 unsigned int can_generate_compiled_method_load_events : 1;
703 unsigned int can_generate_monitor_events : 1;
704 unsigned int can_generate_vm_object_alloc_events : 1;
705 unsigned int can_generate_native_method_bind_events : 1;
706 unsigned int can_generate_garbage_collection_events : 1;
707 unsigned int can_generate_object_free_events : 1;
720 /* Function Interface */
721 struct jvmtiEnv_struct {
723 jvmtiError (JNICALL *SetEventNotificationMode) (jvmtiEnv* env,
725 jvmtiEvent event_type,
726 jthread event_thread,
729 jvmtiError (JNICALL *GetAllThreads) (jvmtiEnv* env,
730 jint* threads_count_ptr,
731 jthread** threads_ptr);
732 jvmtiError (JNICALL *SuspendThread) (jvmtiEnv* env,
734 jvmtiError (JNICALL *ResumeThread) (jvmtiEnv* env,
736 jvmtiError (JNICALL *StopThread) (jvmtiEnv* env,
739 jvmtiError (JNICALL *InterruptThread) (jvmtiEnv* env,
741 jvmtiError (JNICALL *GetThreadInfo) (jvmtiEnv* env,
743 jvmtiThreadInfo* info_ptr);
744 jvmtiError (JNICALL *GetOwnedMonitorInfo) (jvmtiEnv* env,
746 jint* owned_monitor_count_ptr,
747 jobject** owned_monitors_ptr);
748 jvmtiError (JNICALL *GetCurrentContendedMonitor) (jvmtiEnv* env,
750 jobject* monitor_ptr);
751 jvmtiError (JNICALL *RunAgentThread) (jvmtiEnv* env,
753 jvmtiStartFunction proc,
756 jvmtiError (JNICALL *GetTopThreadGroups) (jvmtiEnv* env,
757 jint* group_count_ptr,
758 jthreadGroup** groups_ptr);
759 jvmtiError (JNICALL *GetThreadGroupInfo) (jvmtiEnv* env,
761 jvmtiThreadGroupInfo* info_ptr);
762 jvmtiError (JNICALL *GetThreadGroupChildren) (jvmtiEnv* env,
764 jint* thread_count_ptr,
765 jthread** threads_ptr,
766 jint* group_count_ptr,
767 jthreadGroup** groups_ptr);
768 jvmtiError (JNICALL *GetFrameCount) (jvmtiEnv* env,
771 jvmtiError (JNICALL *GetThreadState) (jvmtiEnv* env,
773 jint* thread_state_ptr);
775 jvmtiError (JNICALL *GetFrameLocation) (jvmtiEnv* env,
778 jmethodID* method_ptr,
779 jlocation* location_ptr);
780 jvmtiError (JNICALL *NotifyFramePop) (jvmtiEnv* env,
783 jvmtiError (JNICALL *GetLocalObject) (jvmtiEnv* env,
788 jvmtiError (JNICALL *GetLocalInt) (jvmtiEnv* env,
793 jvmtiError (JNICALL *GetLocalLong) (jvmtiEnv* env,
798 jvmtiError (JNICALL *GetLocalFloat) (jvmtiEnv* env,
803 jvmtiError (JNICALL *GetLocalDouble) (jvmtiEnv* env,
808 jvmtiError (JNICALL *SetLocalObject) (jvmtiEnv* env,
813 jvmtiError (JNICALL *SetLocalInt) (jvmtiEnv* env,
818 jvmtiError (JNICALL *SetLocalLong) (jvmtiEnv* env,
823 jvmtiError (JNICALL *SetLocalFloat) (jvmtiEnv* env,
828 jvmtiError (JNICALL *SetLocalDouble) (jvmtiEnv* env,
833 jvmtiError (JNICALL *CreateRawMonitor) (jvmtiEnv* env,
835 jrawMonitorID* monitor_ptr);
836 jvmtiError (JNICALL *DestroyRawMonitor) (jvmtiEnv* env,
837 jrawMonitorID monitor);
838 jvmtiError (JNICALL *RawMonitorEnter) (jvmtiEnv* env,
839 jrawMonitorID monitor);
840 jvmtiError (JNICALL *RawMonitorExit) (jvmtiEnv* env,
841 jrawMonitorID monitor);
842 jvmtiError (JNICALL *RawMonitorWait) (jvmtiEnv* env,
843 jrawMonitorID monitor,
845 jvmtiError (JNICALL *RawMonitorNotify) (jvmtiEnv* env,
846 jrawMonitorID monitor);
847 jvmtiError (JNICALL *RawMonitorNotifyAll) (jvmtiEnv* env,
848 jrawMonitorID monitor);
849 jvmtiError (JNICALL *SetBreakpoint) (jvmtiEnv* env,
852 jvmtiError (JNICALL *ClearBreakpoint) (jvmtiEnv* env,
856 jvmtiError (JNICALL *SetFieldAccessWatch) (jvmtiEnv* env,
859 jvmtiError (JNICALL *ClearFieldAccessWatch) (jvmtiEnv* env,
862 jvmtiError (JNICALL *SetFieldModificationWatch) (jvmtiEnv* env,
865 jvmtiError (JNICALL *ClearFieldModificationWatch) (jvmtiEnv* env,
869 jvmtiError (JNICALL *Allocate) (jvmtiEnv* env,
871 unsigned char** mem_ptr);
872 jvmtiError (JNICALL *Deallocate) (jvmtiEnv* env,
874 jvmtiError (JNICALL *GetClassSignature) (jvmtiEnv* env,
876 char** signature_ptr,
878 jvmtiError (JNICALL *GetClassStatus) (jvmtiEnv* env,
881 jvmtiError (JNICALL *GetSourceFileName) (jvmtiEnv* env,
883 char** source_name_ptr);
884 jvmtiError (JNICALL *GetClassModifiers) (jvmtiEnv* env,
886 jint* modifiers_ptr);
887 jvmtiError (JNICALL *GetClassMethods) (jvmtiEnv* env,
889 jint* method_count_ptr,
890 jmethodID** methods_ptr);
891 jvmtiError (JNICALL *GetClassFields) (jvmtiEnv* env,
893 jint* field_count_ptr,
894 jfieldID** fields_ptr);
895 jvmtiError (JNICALL *GetImplementedInterfaces) (jvmtiEnv* env,
897 jint* interface_count_ptr,
898 jclass** interfaces_ptr);
899 jvmtiError (JNICALL *IsInterface) (jvmtiEnv* env,
901 jboolean* is_interface_ptr);
902 jvmtiError (JNICALL *IsArrayClass) (jvmtiEnv* env,
904 jboolean* is_array_class_ptr);
905 jvmtiError (JNICALL *GetClassLoader) (jvmtiEnv* env,
907 jobject* classloader_ptr);
908 jvmtiError (JNICALL *GetObjectHashCode) (jvmtiEnv* env,
910 jint* hash_code_ptr);
911 jvmtiError (JNICALL *GetObjectMonitorUsage) (jvmtiEnv* env,
913 jvmtiMonitorUsage* info_ptr);
914 jvmtiError (JNICALL *GetFieldName) (jvmtiEnv* env,
918 char** signature_ptr,
920 jvmtiError (JNICALL *GetFieldDeclaringClass) (jvmtiEnv* env,
923 jclass* declaring_class_ptr);
924 jvmtiError (JNICALL *GetFieldModifiers) (jvmtiEnv* env,
927 jint* modifiers_ptr);
928 jvmtiError (JNICALL *IsFieldSynthetic) (jvmtiEnv* env,
931 jboolean* is_synthetic_ptr);
932 jvmtiError (JNICALL *GetMethodName) (jvmtiEnv* env,
935 char** signature_ptr,
937 jvmtiError (JNICALL *GetMethodDeclaringClass) (jvmtiEnv* env,
939 jclass* declaring_class_ptr);
940 jvmtiError (JNICALL *GetMethodModifiers) (jvmtiEnv* env,
942 jint* modifiers_ptr);
944 jvmtiError (JNICALL *GetMaxLocals) (jvmtiEnv* env,
947 jvmtiError (JNICALL *GetArgumentsSize) (jvmtiEnv* env,
950 jvmtiError (JNICALL *GetLineNumberTable) (jvmtiEnv* env,
952 jint* entry_count_ptr,
953 jvmtiLineNumberEntry** table_ptr);
954 jvmtiError (JNICALL *GetMethodLocation) (jvmtiEnv* env,
956 jlocation* start_location_ptr,
957 jlocation* end_location_ptr);
958 jvmtiError (JNICALL *GetLocalVariableTable) (jvmtiEnv* env,
960 jint* entry_count_ptr,
961 jvmtiLocalVariableEntry** table_ptr);
964 jvmtiError (JNICALL *GetBytecodes) (jvmtiEnv* env,
966 jint* bytecode_count_ptr,
967 unsigned char** bytecodes_ptr);
968 jvmtiError (JNICALL *IsMethodNative) (jvmtiEnv* env,
970 jboolean* is_native_ptr);
971 jvmtiError (JNICALL *IsMethodSynthetic) (jvmtiEnv* env,
973 jboolean* is_synthetic_ptr);
974 jvmtiError (JNICALL *GetLoadedClasses) (jvmtiEnv* env,
975 jint* class_count_ptr,
976 jclass** classes_ptr);
977 jvmtiError (JNICALL *GetClassLoaderClasses) (jvmtiEnv* env,
978 jobject initiating_loader,
979 jint* class_count_ptr,
980 jclass** classes_ptr);
981 jvmtiError (JNICALL *PopFrame) (jvmtiEnv* env,
989 jvmtiError (JNICALL *RedefineClasses) (jvmtiEnv* env,
991 const jvmtiClassDefinition* class_definitions);
992 jvmtiError (JNICALL *GetVersionNumber) (jvmtiEnv* env,
994 jvmtiError (JNICALL *GetCapabilities) (jvmtiEnv* env,
995 jvmtiCapabilities* capabilities_ptr);
996 jvmtiError (JNICALL *GetSourceDebugExtension) (jvmtiEnv* env,
998 char** source_debug_extension_ptr);
999 jvmtiError (JNICALL *IsMethodObsolete) (jvmtiEnv* env,
1001 jboolean* is_obsolete_ptr);
1002 jvmtiError (JNICALL *SuspendThreadList) (jvmtiEnv* env,
1004 const jthread* request_list,
1005 jvmtiError* results);
1006 jvmtiError (JNICALL *ResumeThreadList) (jvmtiEnv* env,
1008 const jthread* request_list,
1009 jvmtiError* results);
1016 jvmtiError (JNICALL *GetAllStackTraces) (jvmtiEnv* env,
1017 jint max_frame_count,
1018 jvmtiStackInfo** stack_info_ptr,
1019 jint* thread_count_ptr);
1020 jvmtiError (JNICALL *GetThreadListStackTraces) (jvmtiEnv* env,
1022 const jthread* thread_list,
1023 jint max_frame_count,
1024 jvmtiStackInfo** stack_info_ptr);
1025 jvmtiError (JNICALL *GetThreadLocalStorage) (jvmtiEnv* env,
1028 jvmtiError (JNICALL *SetThreadLocalStorage) (jvmtiEnv* env,
1031 jvmtiError (JNICALL *GetStackTrace) (jvmtiEnv* env,
1034 jint max_frame_count,
1035 jvmtiFrameInfo* frame_buffer,
1038 jvmtiError (JNICALL *GetTag) (jvmtiEnv* env,
1041 jvmtiError (JNICALL *SetTag) (jvmtiEnv* env,
1044 jvmtiError (JNICALL *ForceGarbageCollection) (jvmtiEnv* env);
1045 jvmtiError (JNICALL *IterateOverObjectsReachableFromObject) (jvmtiEnv* env,
1047 jvmtiObjectReferenceCallback object_reference_callback,
1049 jvmtiError (JNICALL *IterateOverReachableObjects) (jvmtiEnv* env,
1050 jvmtiHeapRootCallback heap_root_callback,
1051 jvmtiStackReferenceCallback stack_ref_callback,
1052 jvmtiObjectReferenceCallback object_ref_callback,
1054 jvmtiError (JNICALL *IterateOverHeap) (jvmtiEnv* env,
1055 jvmtiHeapObjectFilter object_filter,
1056 jvmtiHeapObjectCallback heap_object_callback,
1058 jvmtiError (JNICALL *IterateOverInstancesOfClass) (jvmtiEnv* env,
1060 jvmtiHeapObjectFilter object_filter,
1061 jvmtiHeapObjectCallback heap_object_callback,
1064 jvmtiError (JNICALL *GetObjectsWithTags) (jvmtiEnv* env,
1068 jobject** object_result_ptr,
1069 jlong** tag_result_ptr);
1075 jvmtiError (JNICALL *SetJNIFunctionTable) (jvmtiEnv* env,
1076 const jniNativeInterface* function_table);
1077 jvmtiError (JNICALL *GetJNIFunctionTable) (jvmtiEnv* env,
1078 jniNativeInterface** function_table);
1079 jvmtiError (JNICALL *SetEventCallbacks) (jvmtiEnv* env,
1080 const jvmtiEventCallbacks* callbacks,
1081 jint size_of_callbacks);
1082 jvmtiError (JNICALL *GenerateEvents) (jvmtiEnv* env,
1083 jvmtiEvent event_type);
1084 jvmtiError (JNICALL *GetExtensionFunctions) (jvmtiEnv* env,
1085 jint* extension_count_ptr,
1086 jvmtiExtensionFunctionInfo** extensions);
1087 jvmtiError (JNICALL *GetExtensionEvents) (jvmtiEnv* env,
1088 jint* extension_count_ptr,
1089 jvmtiExtensionEventInfo** extensions);
1090 jvmtiError (JNICALL *SetExtensionEventCallback) (jvmtiEnv* env,
1091 jint extension_event_index,
1092 jvmtiExtensionEvent callback);
1093 jvmtiError (JNICALL *DisposeEnvironment) (jvmtiEnv* env);
1094 jvmtiError (JNICALL *GetErrorName) (jvmtiEnv* env,
1097 jvmtiError (JNICALL *GetJLocationFormat) (jvmtiEnv* env,
1098 jvmtiJlocationFormat* format_ptr);
1099 jvmtiError (JNICALL *GetSystemProperties) (jvmtiEnv* env,
1101 char*** property_ptr);
1102 jvmtiError (JNICALL *GetSystemProperty) (jvmtiEnv* env,
1103 const char* property,
1105 jvmtiError (JNICALL *SetSystemProperty) (jvmtiEnv* env,
1106 const char* property,
1108 jvmtiError (JNICALL *GetPhase) (jvmtiEnv* env,
1109 jvmtiPhase* phase_ptr);
1110 jvmtiError (JNICALL *GetCurrentThreadCpuTimerInfo) (jvmtiEnv* env,
1111 jvmtiTimerInfo* info_ptr);
1112 jvmtiError (JNICALL *GetCurrentThreadCpuTime) (jvmtiEnv* env,
1114 jvmtiError (JNICALL *GetThreadCpuTimerInfo) (jvmtiEnv* env,
1115 jvmtiTimerInfo* info_ptr);
1116 jvmtiError (JNICALL *GetThreadCpuTime) (jvmtiEnv* env,
1119 jvmtiError (JNICALL *GetTimerInfo) (jvmtiEnv* env,
1120 jvmtiTimerInfo* info_ptr);
1121 jvmtiError (JNICALL *GetTime) (jvmtiEnv* env,
1123 jvmtiError (JNICALL *GetPotentialCapabilities) (jvmtiEnv* env,
1124 jvmtiCapabilities* capabilities_ptr);
1126 jvmtiError (JNICALL *AddCapabilities) (jvmtiEnv* env,
1127 const jvmtiCapabilities* capabilities_ptr);
1128 jvmtiError (JNICALL *RelinquishCapabilities) (jvmtiEnv* env,
1129 const jvmtiCapabilities* capabilities_ptr);
1130 jvmtiError (JNICALL *GetAvailableProcessors) (jvmtiEnv* env,
1131 jint* processor_count_ptr);
1134 jvmtiError (JNICALL *GetEnvironmentLocalStorage) (jvmtiEnv* env,
1136 jvmtiError (JNICALL *SetEnvironmentLocalStorage) (jvmtiEnv* env,
1138 jvmtiError (JNICALL *AddToBootstrapClassLoaderSearch) (jvmtiEnv* env,
1139 const char* segment);
1140 jvmtiError (JNICALL *SetVerboseFlag) (jvmtiEnv* env,
1141 jvmtiVerboseFlag flag,
1146 jvmtiError (JNICALL *GetObjectSize) (jvmtiEnv* env,
1152 #define JVMTI_THREAD_STATE_ALIVE 0x0001
1153 #define JVMTI_THREAD_STATE_TERMINATED 0x0002
1154 #define JVMTI_THREAD_STATE_RUNNABLE 0x0004
1155 #define JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 0x0400
1156 #define JVMTI_THREAD_STATE_WAITING 0x0080
1157 #define JVMTI_THREAD_STATE_WAITING_INDEFINITELY 0x0010
1158 #define JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT 0x0020
1159 #define JVMTI_THREAD_STATE_SLEEPING 0x0040
1160 #define JVMTI_THREAD_STATE_IN_OBJECT_WAIT 0x0100
1161 #define JVMTI_THREAD_STATE_PARKED 0x0200
1162 #define JVMTI_THREAD_STATE_SUSPENDED 0x100000
1163 #define JVMTI_THREAD_STATE_INTERRUPTED 0x200000
1164 #define JVMTI_THREAD_STATE_IN_NATIVE 0x400000
1165 #define JVMTI_THREAD_STATE_VENDOR_1 0x10000000
1166 #define JVMTI_THREAD_STATE_VENDOR_2 0x20000000
1167 #define JVMTI_THREAD_STATE_VENDOR_3 0x40000000
1169 #define JVMTI_THREAD_MIN_PRIORITY 1
1170 #define JVMTI_THREAD_NORM_PRIORITY 5
1171 #define JVMTI_THREAD_MAX_PRIORITY 10
1173 #define JVMTI_CLASS_STATUS_VERIFIED 1
1174 #define JVMTI_CLASS_STATUS_PREPARED 2
1175 #define JVMTI_CLASS_STATUS_INITIALIZED 4
1176 #define JVMTI_CLASS_STATUS_ERROR 8
1177 #define JVMTI_CLASS_STATUS_ARRAY 16
1178 #define JVMTI_CLASS_STATUS_PRIMITIVE 32
1180 /* cacao specific */
1183 jvmtiEnv *jvmti_env;
1190 char signature_type;
1194 void** new_address_ptr;
1195 jmethodID catch_method;
1196 jlocation catch_location;
1198 jobject protection_domain;
1201 unsigned char* class_data;
1202 jint* new_class_data_len;
1203 unsigned char** new_class_data;
1204 jvmtiAddrLocationMap* map;
1209 #if defined(USE_THREADS) && defined(NATIVE_THREADS)
1210 struct _jrawMonitorID {
1211 java_lang_String *name;
1215 jvmtiEnv* new_jvmtienv();
1216 void set_jvmti_phase(jvmtiPhase p);
1218 jvmtiEnv* remotedbgjvmtienv;
1219 jvmtiEventCallbacks jvmti_jdwp_EventCallbacks;
1220 void agentload(char* opt_arg);
1228 * These are local overrides for various environment variables in Emacs.
1229 * Please do not remove this and leave it at the end of the file, where
1230 * Emacs will automagically detect them.
1231 * ---------------------------------------------------------------------
1234 * indent-tabs-mode: t