Skip to main content

jvm_ti_sys/
lib.rs

1#![doc(html_root_url = "https://docs.rs/jvm-ti-sys/0.0.0")]
2#![allow(non_snake_case)]
3#![allow(non_camel_case_types)]
4#![warn(missing_debug_implementations)]
5#![warn(rust_2018_idioms)]
6#![no_std]
7
8use core::ffi::c_char;
9use core::ffi::c_uchar;
10use core::ffi::c_uint;
11use core::ffi::c_void;
12
13use jni_sys::jboolean;
14use jni_sys::jchar;
15use jni_sys::jclass;
16use jni_sys::jdouble;
17use jni_sys::jfieldID;
18use jni_sys::jfloat;
19use jni_sys::jint;
20use jni_sys::jlong;
21use jni_sys::jmethodID;
22use jni_sys::jobject;
23use jni_sys::jvalue;
24use jni_sys::JNIEnv;
25use jni_sys::JNINativeInterface_;
26use jni_sys::JavaVM;
27use jni_sys_macros::jni_to_union;
28
29pub type enum_t = c_uint;
30
31pub const JVMTI_VERSION_1: enum_t = 0x30010000;
32pub const JVMTI_VERSION_1_0: enum_t = 0x30010000;
33pub const JVMTI_VERSION_1_1: enum_t = 0x30010100;
34pub const JVMTI_VERSION_1_2: enum_t = 0x30010200;
35pub const JVMTI_VERSION_9: enum_t = 0x30090000;
36pub const JVMTI_VERSION_11: enum_t = 0x300B0000;
37pub const JVMTI_VERSION_19: enum_t = 0x30130000;
38pub const JVMTI_VERSION_21: enum_t = 0x30150000;
39pub const JVMTI_VERSION_25: enum_t = 0x30190000;
40
41pub type Agent_OnLoad =
42    unsafe extern "C" fn(vm: *mut JavaVM, options: *mut c_char, reserved: *mut c_void) -> jint;
43pub type Agent_OnAttach =
44    unsafe extern "C" fn(vm: *mut JavaVM, options: *mut c_char, reserved: *mut c_void) -> jint;
45pub type Agent_OnUnload = unsafe extern "C" fn(vm: *mut JavaVM);
46
47pub type jvmtiEnv = *const jvmtiInterface_1_;
48pub type jthread = jobject;
49pub type jthreadGroup = jobject;
50pub type jlocation = jlong;
51#[derive(Debug)]
52pub enum _jrawMonitorID {}
53pub type jrawMonitorID = *mut _jrawMonitorID;
54pub type jniNativeInterface = JNINativeInterface_;
55
56pub const JVMTI_THREAD_STATE_ALIVE: enum_t = 0x0001;
57pub const JVMTI_THREAD_STATE_TERMINATED: enum_t = 0x0002;
58pub const JVMTI_THREAD_STATE_RUNNABLE: enum_t = 0x0004;
59pub const JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER: enum_t = 0x0400;
60pub const JVMTI_THREAD_STATE_WAITING: enum_t = 0x0080;
61pub const JVMTI_THREAD_STATE_WAITING_INDEFINITELY: enum_t = 0x0010;
62pub const JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT: enum_t = 0x0020;
63pub const JVMTI_THREAD_STATE_SLEEPING: enum_t = 0x0040;
64pub const JVMTI_THREAD_STATE_IN_OBJECT_WAIT: enum_t = 0x0100;
65pub const JVMTI_THREAD_STATE_PARKED: enum_t = 0x0200;
66pub const JVMTI_THREAD_STATE_SUSPENDED: enum_t = 0x100000;
67pub const JVMTI_THREAD_STATE_INTERRUPTED: enum_t = 0x200000;
68pub const JVMTI_THREAD_STATE_IN_NATIVE: enum_t = 0x400000;
69pub const JVMTI_THREAD_STATE_VENDOR_1: enum_t = 0x10000000;
70pub const JVMTI_THREAD_STATE_VENDOR_2: enum_t = 0x20000000;
71pub const JVMTI_THREAD_STATE_VENDOR_3: enum_t = 0x40000000;
72
73pub const JVMTI_JAVA_LANG_THREAD_STATE_MASK: enum_t = JVMTI_THREAD_STATE_TERMINATED
74    | JVMTI_THREAD_STATE_ALIVE
75    | JVMTI_THREAD_STATE_RUNNABLE
76    | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
77    | JVMTI_THREAD_STATE_WAITING
78    | JVMTI_THREAD_STATE_WAITING_INDEFINITELY
79    | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT;
80pub const JVMTI_JAVA_LANG_THREAD_STATE_NEW: enum_t = 0;
81pub const JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED: enum_t = JVMTI_THREAD_STATE_TERMINATED;
82pub const JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE: enum_t =
83    JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE;
84pub const JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED: enum_t =
85    JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER;
86pub const JVMTI_JAVA_LANG_THREAD_STATE_WAITING: enum_t =
87    JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY;
88pub const JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING: enum_t =
89    JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT;
90
91pub const JVMTI_THREAD_MIN_PRIORITY: enum_t = 1;
92pub const JVMTI_THREAD_NORM_PRIORITY: enum_t = 5;
93pub const JVMTI_THREAD_MAX_PRIORITY: enum_t = 10;
94
95pub const JVMTI_HEAP_FILTER_TAGGED: enum_t = 0x4;
96pub const JVMTI_HEAP_FILTER_UNTAGGED: enum_t = 0x8;
97pub const JVMTI_HEAP_FILTER_CLASS_TAGGED: enum_t = 0x10;
98pub const JVMTI_HEAP_FILTER_CLASS_UNTAGGED: enum_t = 0x20;
99
100pub const JVMTI_VISIT_OBJECTS: enum_t = 0x100;
101pub const JVMTI_VISIT_ABORT: enum_t = 0x8000;
102
103#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
104#[repr(transparent)]
105pub struct jvmtiHeapReferenceKind(pub enum_t);
106
107impl jvmtiHeapReferenceKind {
108    pub const JVMTI_HEAP_REFERENCE_CLASS: Self = Self(1);
109    pub const JVMTI_HEAP_REFERENCE_FIELD: Self = Self(2);
110    pub const JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT: Self = Self(3);
111    pub const JVMTI_HEAP_REFERENCE_CLASS_LOADER: Self = Self(4);
112    pub const JVMTI_HEAP_REFERENCE_SIGNERS: Self = Self(5);
113    pub const JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN: Self = Self(6);
114    pub const JVMTI_HEAP_REFERENCE_INTERFACE: Self = Self(7);
115    pub const JVMTI_HEAP_REFERENCE_STATIC_FIELD: Self = Self(8);
116    pub const JVMTI_HEAP_REFERENCE_CONSTANT_POOL: Self = Self(9);
117    pub const JVMTI_HEAP_REFERENCE_SUPERCLASS: Self = Self(10);
118    pub const JVMTI_HEAP_REFERENCE_JNI_GLOBAL: Self = Self(21);
119    pub const JVMTI_HEAP_REFERENCE_SYSTEM_CLASS: Self = Self(22);
120    pub const JVMTI_HEAP_REFERENCE_MONITOR: Self = Self(23);
121    pub const JVMTI_HEAP_REFERENCE_STACK_LOCAL: Self = Self(24);
122    pub const JVMTI_HEAP_REFERENCE_JNI_LOCAL: Self = Self(25);
123    pub const JVMTI_HEAP_REFERENCE_THREAD: Self = Self(26);
124    pub const JVMTI_HEAP_REFERENCE_OTHER: Self = Self(27);
125}
126
127#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
128#[repr(transparent)]
129pub struct jvmtiPrimitiveType(pub enum_t);
130
131impl jvmtiPrimitiveType {
132    pub const JVMTI_PRIMITIVE_TYPE_BOOLEAN: Self = Self(90);
133    pub const JVMTI_PRIMITIVE_TYPE_BYTE: Self = Self(66);
134    pub const JVMTI_PRIMITIVE_TYPE_CHAR: Self = Self(67);
135    pub const JVMTI_PRIMITIVE_TYPE_SHORT: Self = Self(83);
136    pub const JVMTI_PRIMITIVE_TYPE_INT: Self = Self(73);
137    pub const JVMTI_PRIMITIVE_TYPE_LONG: Self = Self(74);
138    pub const JVMTI_PRIMITIVE_TYPE_FLOAT: Self = Self(70);
139    pub const JVMTI_PRIMITIVE_TYPE_DOUBLE: Self = Self(68);
140}
141
142#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
143#[repr(transparent)]
144pub struct jvmtiHeapObjectFilter(pub enum_t);
145
146impl jvmtiHeapObjectFilter {
147    pub const JVMTI_HEAP_OBJECT_TAGGED: Self = Self(1);
148    pub const JVMTI_HEAP_OBJECT_UNTAGGED: Self = Self(2);
149    pub const JVMTI_HEAP_OBJECT_EITHER: Self = Self(3);
150}
151
152#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
153#[repr(transparent)]
154pub struct jvmtiHeapRootKind(pub enum_t);
155
156impl jvmtiHeapRootKind {
157    pub const JVMTI_HEAP_ROOT_JNI_GLOBAL: Self = Self(1);
158    pub const JVMTI_HEAP_ROOT_SYSTEM_CLASS: Self = Self(2);
159    pub const JVMTI_HEAP_ROOT_MONITOR: Self = Self(3);
160    pub const JVMTI_HEAP_ROOT_STACK_LOCAL: Self = Self(4);
161    pub const JVMTI_HEAP_ROOT_JNI_LOCAL: Self = Self(5);
162    pub const JVMTI_HEAP_ROOT_THREAD: Self = Self(6);
163    pub const JVMTI_HEAP_ROOT_OTHER: Self = Self(7);
164}
165
166#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
167#[repr(transparent)]
168pub struct jvmtiObjectReferenceKind(pub enum_t);
169
170impl jvmtiObjectReferenceKind {
171    pub const JVMTI_REFERENCE_CLASS: Self = Self(1);
172    pub const JVMTI_REFERENCE_FIELD: Self = Self(2);
173    pub const JVMTI_REFERENCE_ARRAY_ELEMENT: Self = Self(3);
174    pub const JVMTI_REFERENCE_CLASS_LOADER: Self = Self(4);
175    pub const JVMTI_REFERENCE_SIGNERS: Self = Self(5);
176    pub const JVMTI_REFERENCE_PROTECTION_DOMAIN: Self = Self(6);
177    pub const JVMTI_REFERENCE_INTERFACE: Self = Self(7);
178    pub const JVMTI_REFERENCE_STATIC_FIELD: Self = Self(8);
179    pub const JVMTI_REFERENCE_CONSTANT_POOL: Self = Self(9);
180}
181
182#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
183#[repr(transparent)]
184pub struct jvmtiIterationControl(pub enum_t);
185
186impl jvmtiIterationControl {
187    pub const JVMTI_ITERATION_CONTINUE: Self = Self(1);
188    pub const JVMTI_ITERATION_IGNORE: Self = Self(2);
189    pub const JVMTI_ITERATION_ABORT: Self = Self(0);
190}
191
192pub const JVMTI_CLASS_STATUS_VERIFIED: enum_t = 1;
193pub const JVMTI_CLASS_STATUS_PREPARED: enum_t = 2;
194pub const JVMTI_CLASS_STATUS_INITIALIZED: enum_t = 4;
195pub const JVMTI_CLASS_STATUS_ERROR: enum_t = 8;
196pub const JVMTI_CLASS_STATUS_ARRAY: enum_t = 16;
197pub const JVMTI_CLASS_STATUS_PRIMITIVE: enum_t = 32;
198
199#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
200#[repr(transparent)]
201pub struct jvmtiEventMode(pub enum_t);
202
203impl jvmtiEventMode {
204    pub const JVMTI_ENABLE: Self = Self(1);
205    pub const JVMTI_DISABLE: Self = Self(0);
206}
207
208#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
209#[repr(transparent)]
210pub struct jvmtiParamTypes(pub enum_t);
211
212impl jvmtiParamTypes {
213    pub const JVMTI_TYPE_JBYTE: Self = Self(101);
214    pub const JVMTI_TYPE_JCHAR: Self = Self(102);
215    pub const JVMTI_TYPE_JSHORT: Self = Self(103);
216    pub const JVMTI_TYPE_JINT: Self = Self(104);
217    pub const JVMTI_TYPE_JLONG: Self = Self(105);
218    pub const JVMTI_TYPE_JFLOAT: Self = Self(106);
219    pub const JVMTI_TYPE_JDOUBLE: Self = Self(107);
220    pub const JVMTI_TYPE_JBOOLEAN: Self = Self(108);
221    pub const JVMTI_TYPE_JOBJECT: Self = Self(109);
222    pub const JVMTI_TYPE_JTHREAD: Self = Self(110);
223    pub const JVMTI_TYPE_JCLASS: Self = Self(111);
224    pub const JVMTI_TYPE_JVALUE: Self = Self(112);
225    pub const JVMTI_TYPE_JFIELDID: Self = Self(113);
226    pub const JVMTI_TYPE_JMETHODID: Self = Self(114);
227    pub const JVMTI_TYPE_CCHAR: Self = Self(115);
228    pub const JVMTI_TYPE_CVOID: Self = Self(116);
229    pub const JVMTI_TYPE_JNIENV: Self = Self(117);
230}
231
232#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
233#[repr(transparent)]
234pub struct jvmtiParamKind(pub enum_t);
235
236impl jvmtiParamKind {
237    pub const JVMTI_KIND_IN: Self = Self(91);
238    pub const JVMTI_KIND_IN_PTR: Self = Self(92);
239    pub const JVMTI_KIND_IN_BUF: Self = Self(93);
240    pub const JVMTI_KIND_ALLOC_BUF: Self = Self(94);
241    pub const JVMTI_KIND_ALLOC_ALLOC_BUF: Self = Self(95);
242    pub const JVMTI_KIND_OUT: Self = Self(96);
243    pub const JVMTI_KIND_OUT_BUF: Self = Self(97);
244}
245
246#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
247#[repr(transparent)]
248pub struct jvmtiTimerKind(pub enum_t);
249
250impl jvmtiTimerKind {
251    pub const JVMTI_TIMER_USER_CPU: Self = Self(30);
252    pub const JVMTI_TIMER_TOTAL_CPU: Self = Self(31);
253    pub const JVMTI_TIMER_ELAPSED: Self = Self(32);
254}
255
256#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
257#[repr(transparent)]
258pub struct jvmtiPhase(pub enum_t);
259
260impl jvmtiPhase {
261    pub const JVMTI_PHASE_ONLOAD: Self = Self(1);
262    pub const JVMTI_PHASE_PRIMORDIAL: Self = Self(2);
263    pub const JVMTI_PHASE_START: Self = Self(6);
264    pub const JVMTI_PHASE_LIVE: Self = Self(4);
265    pub const JVMTI_PHASE_DEAD: Self = Self(8);
266}
267
268pub const JVMTI_VERSION_INTERFACE_JNI: enum_t = 0x00000000;
269pub const JVMTI_VERSION_INTERFACE_JVMTI: enum_t = 0x30000000;
270
271pub const JVMTI_VERSION_MASK_INTERFACE_TYPE: enum_t = 0x70000000;
272pub const JVMTI_VERSION_MASK_MAJOR: enum_t = 0x0FFF0000;
273pub const JVMTI_VERSION_MASK_MINOR: enum_t = 0x0000FF00;
274pub const JVMTI_VERSION_MASK_MICRO: enum_t = 0x000000FF;
275
276pub const JVMTI_VERSION_SHIFT_MAJOR: enum_t = 16;
277pub const JVMTI_VERSION_SHIFT_MINOR: enum_t = 8;
278pub const JVMTI_VERSION_SHIFT_MICRO: enum_t = 0;
279
280#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
281#[repr(transparent)]
282pub struct jvmtiVerboseFlag(pub enum_t);
283
284impl jvmtiVerboseFlag {
285    pub const JVMTI_VERBOSE_OTHER: Self = Self(0);
286    pub const JVMTI_VERBOSE_GC: Self = Self(1);
287    pub const JVMTI_VERBOSE_CLASS: Self = Self(2);
288    pub const JVMTI_VERBOSE_JNI: Self = Self(4);
289}
290
291#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
292#[repr(transparent)]
293pub struct jvmtiJlocationFormat(pub enum_t);
294
295impl jvmtiJlocationFormat {
296    pub const JVMTI_JLOCATION_JVMBCI: Self = Self(1);
297    pub const JVMTI_JLOCATION_MACHINEPC: Self = Self(2);
298    pub const JVMTI_JLOCATION_OTHER: Self = Self(0);
299}
300
301pub const JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR: enum_t = 0x0001;
302pub const JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP: enum_t = 0x0002;
303pub const JVMTI_RESOURCE_EXHAUSTED_THREADS: enum_t = 0x0004;
304
305#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
306#[repr(transparent)]
307pub struct jvmtiError(pub enum_t);
308
309impl jvmtiError {
310    pub const JVMTI_ERROR_NONE: Self = Self(0);
311    pub const JVMTI_ERROR_INVALID_THREAD: Self = Self(10);
312    pub const JVMTI_ERROR_INVALID_THREAD_GROUP: Self = Self(11);
313    pub const JVMTI_ERROR_INVALID_PRIORITY: Self = Self(12);
314    pub const JVMTI_ERROR_THREAD_NOT_SUSPENDED: Self = Self(13);
315    pub const JVMTI_ERROR_THREAD_SUSPENDED: Self = Self(14);
316    pub const JVMTI_ERROR_THREAD_NOT_ALIVE: Self = Self(15);
317    pub const JVMTI_ERROR_INVALID_OBJECT: Self = Self(20);
318    pub const JVMTI_ERROR_INVALID_CLASS: Self = Self(21);
319    pub const JVMTI_ERROR_CLASS_NOT_PREPARED: Self = Self(22);
320    pub const JVMTI_ERROR_INVALID_METHODID: Self = Self(23);
321    pub const JVMTI_ERROR_INVALID_LOCATION: Self = Self(24);
322    pub const JVMTI_ERROR_INVALID_FIELDID: Self = Self(25);
323    pub const JVMTI_ERROR_INVALID_MODULE: Self = Self(26);
324    pub const JVMTI_ERROR_NO_MORE_FRAMES: Self = Self(31);
325    pub const JVMTI_ERROR_OPAQUE_FRAME: Self = Self(32);
326    pub const JVMTI_ERROR_TYPE_MISMATCH: Self = Self(34);
327    pub const JVMTI_ERROR_INVALID_SLOT: Self = Self(35);
328    pub const JVMTI_ERROR_DUPLICATE: Self = Self(40);
329    pub const JVMTI_ERROR_NOT_FOUND: Self = Self(41);
330    pub const JVMTI_ERROR_INVALID_MONITOR: Self = Self(50);
331    pub const JVMTI_ERROR_NOT_MONITOR_OWNER: Self = Self(51);
332    pub const JVMTI_ERROR_INTERRUPT: Self = Self(52);
333    pub const JVMTI_ERROR_INVALID_CLASS_FORMAT: Self = Self(60);
334    pub const JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION: Self = Self(61);
335    pub const JVMTI_ERROR_FAILS_VERIFICATION: Self = Self(62);
336    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED: Self = Self(63);
337    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED: Self = Self(64);
338    pub const JVMTI_ERROR_INVALID_TYPESTATE: Self = Self(65);
339    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED: Self = Self(66);
340    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED: Self = Self(67);
341    pub const JVMTI_ERROR_UNSUPPORTED_VERSION: Self = Self(68);
342    pub const JVMTI_ERROR_NAMES_DONT_MATCH: Self = Self(69);
343    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED: Self = Self(70);
344    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED: Self = Self(71);
345    pub const JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED: Self = Self(72);
346    pub const JVMTI_ERROR_UNSUPPORTED_OPERATION: Self = Self(73);
347    pub const JVMTI_ERROR_UNMODIFIABLE_CLASS: Self = Self(79);
348    pub const JVMTI_ERROR_UNMODIFIABLE_MODULE: Self = Self(80);
349    pub const JVMTI_ERROR_NOT_AVAILABLE: Self = Self(98);
350    pub const JVMTI_ERROR_MUST_POSSESS_CAPABILITY: Self = Self(99);
351    pub const JVMTI_ERROR_NULL_POINTER: Self = Self(100);
352    pub const JVMTI_ERROR_ABSENT_INFORMATION: Self = Self(101);
353    pub const JVMTI_ERROR_INVALID_EVENT_TYPE: Self = Self(102);
354    pub const JVMTI_ERROR_ILLEGAL_ARGUMENT: Self = Self(103);
355    pub const JVMTI_ERROR_NATIVE_METHOD: Self = Self(104);
356    pub const JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED: Self = Self(106);
357    pub const JVMTI_ERROR_OUT_OF_MEMORY: Self = Self(110);
358    pub const JVMTI_ERROR_ACCESS_DENIED: Self = Self(111);
359    pub const JVMTI_ERROR_WRONG_PHASE: Self = Self(112);
360    pub const JVMTI_ERROR_INTERNAL: Self = Self(113);
361    pub const JVMTI_ERROR_UNATTACHED_THREAD: Self = Self(115);
362    pub const JVMTI_ERROR_INVALID_ENVIRONMENT: Self = Self(116);
363    pub const JVMTI_ERROR_MAX: Self = Self::JVMTI_ERROR_INVALID_ENVIRONMENT;
364}
365
366#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
367#[repr(transparent)]
368pub struct jvmtiEvent(pub enum_t);
369
370impl jvmtiEvent {
371    pub const JVMTI_MIN_EVENT_TYPE_VAL: Self = Self::JVMTI_EVENT_VM_INIT;
372    pub const JVMTI_EVENT_VM_INIT: Self = Self(50);
373    pub const JVMTI_EVENT_VM_DEATH: Self = Self(51);
374    pub const JVMTI_EVENT_THREAD_START: Self = Self(52);
375    pub const JVMTI_EVENT_THREAD_END: Self = Self(53);
376    pub const JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: Self = Self(54);
377    pub const JVMTI_EVENT_CLASS_LOAD: Self = Self(55);
378    pub const JVMTI_EVENT_CLASS_PREPARE: Self = Self(56);
379    pub const JVMTI_EVENT_VM_START: Self = Self(57);
380    pub const JVMTI_EVENT_EXCEPTION: Self = Self(58);
381    pub const JVMTI_EVENT_EXCEPTION_CATCH: Self = Self(59);
382    pub const JVMTI_EVENT_SINGLE_STEP: Self = Self(60);
383    pub const JVMTI_EVENT_FRAME_POP: Self = Self(61);
384    pub const JVMTI_EVENT_BREAKPOINT: Self = Self(62);
385    pub const JVMTI_EVENT_FIELD_ACCESS: Self = Self(63);
386    pub const JVMTI_EVENT_FIELD_MODIFICATION: Self = Self(64);
387    pub const JVMTI_EVENT_METHOD_ENTRY: Self = Self(65);
388    pub const JVMTI_EVENT_METHOD_EXIT: Self = Self(66);
389    pub const JVMTI_EVENT_NATIVE_METHOD_BIND: Self = Self(67);
390    pub const JVMTI_EVENT_COMPILED_METHOD_LOAD: Self = Self(68);
391    pub const JVMTI_EVENT_COMPILED_METHOD_UNLOAD: Self = Self(69);
392    pub const JVMTI_EVENT_DYNAMIC_CODE_GENERATED: Self = Self(70);
393    pub const JVMTI_EVENT_DATA_DUMP_REQUEST: Self = Self(71);
394    pub const JVMTI_EVENT_MONITOR_WAIT: Self = Self(73);
395    pub const JVMTI_EVENT_MONITOR_WAITED: Self = Self(74);
396    pub const JVMTI_EVENT_MONITOR_CONTENDED_ENTER: Self = Self(75);
397    pub const JVMTI_EVENT_MONITOR_CONTENDED_ENTERED: Self = Self(76);
398    pub const JVMTI_EVENT_RESOURCE_EXHAUSTED: Self = Self(80);
399    pub const JVMTI_EVENT_GARBAGE_COLLECTION_START: Self = Self(81);
400    pub const JVMTI_EVENT_GARBAGE_COLLECTION_FINISH: Self = Self(82);
401    pub const JVMTI_EVENT_OBJECT_FREE: Self = Self(83);
402    pub const JVMTI_EVENT_VM_OBJECT_ALLOC: Self = Self(84);
403    pub const JVMTI_EVENT_SAMPLED_OBJECT_ALLOC: Self = Self(86);
404    pub const JVMTI_EVENT_VIRTUAL_THREAD_START: Self = Self(87);
405    pub const JVMTI_EVENT_VIRTUAL_THREAD_END: Self = Self(88);
406    pub const JVMTI_MAX_EVENT_TYPE_VAL: Self = Self::JVMTI_EVENT_VIRTUAL_THREAD_END;
407}
408
409pub type jvmtiStartFunction =
410    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, arg: *mut c_void)>;
411
412pub type jvmtiHeapIterationCallback = Option<
413    unsafe extern "C" fn(
414        class_tag: jlong,
415        size: jlong,
416        tag_ptr: *mut jlong,
417        length: jint,
418        user_data: *mut c_void,
419    ) -> jint,
420>;
421
422pub type jvmtiHeapReferenceCallback = Option<
423    unsafe extern "C" fn(
424        reference_kind: jvmtiHeapReferenceKind,
425        reference_info: *const jvmtiHeapReferenceInfo,
426        class_tag: jlong,
427        referrer_class_tag: jlong,
428        size: jlong,
429        tag_ptr: *mut jlong,
430        referrer_tag_ptr: *mut jlong,
431        length: jint,
432        user_data: *mut c_void,
433    ) -> jint,
434>;
435
436pub type jvmtiPrimitiveFieldCallback = Option<
437    unsafe extern "C" fn(
438        kind: jvmtiHeapReferenceKind,
439        info: *const jvmtiHeapReferenceInfo,
440        object_class_tag: jlong,
441        object_tag_ptr: *mut jlong,
442        value: jvalue,
443        value_type: jvmtiPrimitiveType,
444        user_data: *mut c_void,
445    ) -> jint,
446>;
447
448pub type jvmtiArrayPrimitiveValueCallback = Option<
449    unsafe extern "C" fn(
450        class_tag: jlong,
451        size: jlong,
452        tag_ptr: *mut jlong,
453        element_count: jint,
454        element_type: jvmtiPrimitiveType,
455        elements: *const c_void,
456        user_data: *mut c_void,
457    ) -> jint,
458>;
459
460pub type jvmtiStringPrimitiveValueCallback = Option<
461    unsafe extern "C" fn(
462        class_tag: jlong,
463        size: jlong,
464        tag_ptr: *mut jlong,
465        value: *const jchar,
466        value_length: jint,
467        user_data: *mut c_void,
468    ) -> jint,
469>;
470
471pub type jvmtiReservedCallback = Option<unsafe extern "C" fn() -> jint>;
472
473pub type jvmtiHeapObjectCallback = Option<
474    unsafe extern "C" fn(
475        class_tag: jlong,
476        size: jlong,
477        tag_ptr: *mut jlong,
478        user_data: *mut c_void,
479    ) -> jvmtiIterationControl,
480>;
481
482pub type jvmtiHeapRootCallback = Option<
483    unsafe extern "C" fn(
484        root_kind: jvmtiHeapRootKind,
485        class_tag: jlong,
486        size: jlong,
487        tag_ptr: *mut jlong,
488        user_data: *mut c_void,
489    ) -> jvmtiIterationControl,
490>;
491
492pub type jvmtiStackReferenceCallback = Option<
493    unsafe extern "C" fn(
494        root_kind: jvmtiHeapRootKind,
495        class_tag: jlong,
496        size: jlong,
497        tag_ptr: *mut jlong,
498        thread_tag: jlong,
499        depth: jint,
500        method: jmethodID,
501        slot: jint,
502        user_data: *mut c_void,
503    ) -> jvmtiIterationControl,
504>;
505
506pub type jvmtiObjectReferenceCallback = Option<
507    unsafe extern "C" fn(
508        reference_kind: jvmtiObjectReferenceKind,
509        class_tag: jlong,
510        size: jlong,
511        tag_ptr: *mut jlong,
512        referrer_tag: jlong,
513        referrer_index: jint,
514        user_data: *mut c_void,
515    ) -> jvmtiIterationControl,
516>;
517
518pub type jvmtiExtensionFunction =
519    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, ...) -> jvmtiError>;
520
521pub type jvmtiExtensionEvent = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, ...)>;
522
523#[repr(C)]
524#[derive(Debug, Copy, Clone)]
525pub struct jvmtiThreadInfo {
526    pub name: *mut c_char,
527    pub priority: jint,
528    pub is_daemon: jboolean,
529    pub thread_group: jthreadGroup,
530    pub context_class_loader: jobject,
531}
532
533#[repr(C)]
534#[derive(Debug, Copy, Clone)]
535pub struct jvmtiMonitorStackDepthInfo {
536    pub monitor: jobject,
537    pub stack_depth: jint,
538}
539
540#[repr(C)]
541#[derive(Debug, Copy, Clone)]
542pub struct jvmtiThreadGroupInfo {
543    pub parent: jthreadGroup,
544    pub name: *mut c_char,
545    pub max_priority: jint,
546    pub is_daemon: jboolean,
547}
548
549#[repr(C)]
550#[derive(Debug, Copy, Clone)]
551pub struct jvmtiFrameInfo {
552    pub method: jmethodID,
553    pub location: jlocation,
554}
555
556#[repr(C)]
557#[derive(Debug, Copy, Clone)]
558pub struct jvmtiStackInfo {
559    pub thread: jthread,
560    pub state: jint,
561    pub frame_buffer: *mut jvmtiFrameInfo,
562    pub frame_count: jint,
563}
564
565#[repr(C)]
566#[derive(Debug, Copy, Clone)]
567pub struct jvmtiHeapReferenceInfoField {
568    pub index: jint,
569}
570
571#[repr(C)]
572#[derive(Debug, Copy, Clone)]
573pub struct jvmtiHeapReferenceInfoArray {
574    pub index: jint,
575}
576
577#[repr(C)]
578#[derive(Debug, Copy, Clone)]
579pub struct jvmtiHeapReferenceInfoConstantPool {
580    pub index: jint,
581}
582
583#[repr(C)]
584#[derive(Debug, Copy, Clone)]
585pub struct jvmtiHeapReferenceInfoStackLocal {
586    pub thread_tag: jlong,
587    pub thread_id: jlong,
588    pub depth: jint,
589    pub method: jmethodID,
590    pub location: jlocation,
591    pub slot: jint,
592}
593
594#[repr(C)]
595#[derive(Debug, Copy, Clone)]
596pub struct jvmtiHeapReferenceInfoJniLocal {
597    pub thread_tag: jlong,
598    pub thread_id: jlong,
599    pub depth: jint,
600    pub method: jmethodID,
601}
602
603#[repr(C)]
604#[derive(Debug, Copy, Clone)]
605pub struct jvmtiHeapReferenceInfoReserved {
606    pub reserved1: jlong,
607    pub reserved2: jlong,
608    pub reserved3: jlong,
609    pub reserved4: jlong,
610    pub reserved5: jlong,
611    pub reserved6: jlong,
612    pub reserved7: jlong,
613    pub reserved8: jlong,
614}
615
616#[repr(C)]
617#[derive(Copy, Clone)]
618pub union jvmtiHeapReferenceInfo {
619    pub field: jvmtiHeapReferenceInfoField,
620    pub array: jvmtiHeapReferenceInfoArray,
621    pub constant_pool: jvmtiHeapReferenceInfoConstantPool,
622    pub stack_local: jvmtiHeapReferenceInfoStackLocal,
623    pub jni_local: jvmtiHeapReferenceInfoJniLocal,
624    pub other: jvmtiHeapReferenceInfoReserved,
625}
626
627impl core::fmt::Debug for jvmtiHeapReferenceInfo {
628    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
629        f.write_str(core::any::type_name::<Self>())
630    }
631}
632
633#[repr(C)]
634#[derive(Default, Debug, Copy, Clone)]
635pub struct jvmtiHeapCallbacks {
636    pub heap_iteration_callback: jvmtiHeapIterationCallback,
637    pub heap_reference_callback: jvmtiHeapReferenceCallback,
638    pub primitive_field_callback: jvmtiPrimitiveFieldCallback,
639    pub array_primitive_value_callback: jvmtiArrayPrimitiveValueCallback,
640    pub string_primitive_value_callback: jvmtiStringPrimitiveValueCallback,
641    pub reserved5: jvmtiReservedCallback,
642    pub reserved6: jvmtiReservedCallback,
643    pub reserved7: jvmtiReservedCallback,
644    pub reserved8: jvmtiReservedCallback,
645    pub reserved9: jvmtiReservedCallback,
646    pub reserved10: jvmtiReservedCallback,
647    pub reserved11: jvmtiReservedCallback,
648    pub reserved12: jvmtiReservedCallback,
649    pub reserved13: jvmtiReservedCallback,
650    pub reserved14: jvmtiReservedCallback,
651    pub reserved15: jvmtiReservedCallback,
652}
653
654impl jvmtiHeapCallbacks {
655    #[inline(always)]
656    pub const fn new() -> Self {
657        Self {
658            heap_iteration_callback: None,
659            heap_reference_callback: None,
660            primitive_field_callback: None,
661            array_primitive_value_callback: None,
662            string_primitive_value_callback: None,
663            reserved5: None,
664            reserved6: None,
665            reserved7: None,
666            reserved8: None,
667            reserved9: None,
668            reserved10: None,
669            reserved11: None,
670            reserved12: None,
671            reserved13: None,
672            reserved14: None,
673            reserved15: None,
674        }
675    }
676}
677
678#[repr(C)]
679#[derive(Debug, Copy, Clone)]
680pub struct jvmtiClassDefinition {
681    pub klass: jclass,
682    pub class_byte_count: jint,
683    pub class_bytes: *const c_uchar,
684}
685
686#[repr(C)]
687#[derive(Debug, Copy, Clone)]
688pub struct jvmtiMonitorUsage {
689    pub owner: jthread,
690    pub entry_count: jint,
691    pub waiter_count: jint,
692    pub waiters: *mut jthread,
693    pub notify_waiter_count: jint,
694    pub notify_waiters: *mut jthread,
695}
696
697#[repr(C)]
698#[derive(Debug, Copy, Clone)]
699pub struct jvmtiLineNumberEntry {
700    pub start_location: jlocation,
701    pub line_number: jint,
702}
703
704#[repr(C)]
705#[derive(Debug, Copy, Clone)]
706pub struct jvmtiLocalVariableEntry {
707    pub start_location: jlocation,
708    pub length: jint,
709    pub name: *mut c_char,
710    pub signature: *mut c_char,
711    pub generic_signature: *mut c_char,
712    pub slot: jint,
713}
714
715#[repr(C)]
716#[derive(Debug, Copy, Clone)]
717pub struct jvmtiParamInfo {
718    pub name: *mut c_char,
719    pub kind: jvmtiParamKind,
720    pub base_type: jvmtiParamTypes,
721    pub null_ok: jboolean,
722}
723
724#[repr(C)]
725#[derive(Debug, Copy, Clone)]
726pub struct jvmtiExtensionFunctionInfo {
727    pub func: jvmtiExtensionFunction,
728    pub id: *mut c_char,
729    pub short_description: *mut c_char,
730    pub param_count: jint,
731    pub params: *mut jvmtiParamInfo,
732    pub error_count: jint,
733    pub errors: *mut jvmtiError,
734}
735
736#[repr(C)]
737#[derive(Debug, Copy, Clone)]
738pub struct jvmtiExtensionEventInfo {
739    pub extension_event_index: jint,
740    pub id: *mut c_char,
741    pub short_description: *mut c_char,
742    pub param_count: jint,
743    pub params: *mut jvmtiParamInfo,
744}
745
746#[repr(C)]
747#[derive(Debug, Copy, Clone)]
748pub struct jvmtiTimerInfo {
749    pub max_value: jlong,
750    pub may_skip_forward: jboolean,
751    pub may_skip_backward: jboolean,
752    pub kind: jvmtiTimerKind,
753    pub reserved1: jlong,
754    pub reserved2: jlong,
755}
756
757#[repr(C)]
758#[derive(Debug, Copy, Clone)]
759pub struct jvmtiAddrLocationMap {
760    pub start_address: *const c_void,
761    pub location: jlocation,
762}
763
764#[repr(C)]
765#[repr(align(4))]
766#[derive(Default, Copy, Clone)]
767pub struct jvmtiCapabilities {
768    pub inner: [u8; 16],
769}
770
771// bit twiddling
772mod capabilities;
773
774pub type jvmtiEventReserved = Option<unsafe extern "C" fn()>;
775
776pub type jvmtiEventBreakpoint = Option<
777    unsafe extern "C" fn(
778        jvmti_env: *mut jvmtiEnv,
779        jni_env: *mut JNIEnv,
780        thread: jthread,
781        method: jmethodID,
782        location: jlocation,
783    ),
784>;
785
786pub type jvmtiEventClassFileLoadHook = Option<
787    unsafe extern "C" fn(
788        jvmti_env: *mut jvmtiEnv,
789        jni_env: *mut JNIEnv,
790        class_being_redefined: jclass,
791        loader: jobject,
792        name: *const c_char,
793        protection_domain: jobject,
794        class_data_len: jint,
795        class_data: *const c_uchar,
796        new_class_data_len: *mut jint,
797        new_class_data: *mut *mut c_uchar,
798    ),
799>;
800
801pub type jvmtiEventClassLoad = Option<
802    unsafe extern "C" fn(
803        jvmti_env: *mut jvmtiEnv,
804        jni_env: *mut JNIEnv,
805        thread: jthread,
806        klass: jclass,
807    ),
808>;
809
810pub type jvmtiEventClassPrepare = Option<
811    unsafe extern "C" fn(
812        jvmti_env: *mut jvmtiEnv,
813        jni_env: *mut JNIEnv,
814        thread: jthread,
815        klass: jclass,
816    ),
817>;
818
819pub type jvmtiEventCompiledMethodLoad = Option<
820    unsafe extern "C" fn(
821        jvmti_env: *mut jvmtiEnv,
822        method: jmethodID,
823        code_size: jint,
824        code_addr: *const c_void,
825        map_length: jint,
826        map: *const jvmtiAddrLocationMap,
827        compile_info: *const c_void,
828    ),
829>;
830
831pub type jvmtiEventCompiledMethodUnload = Option<
832    unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, method: jmethodID, code_addr: *const c_void),
833>;
834
835pub type jvmtiEventDataDumpRequest = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv)>;
836
837pub type jvmtiEventDynamicCodeGenerated = Option<
838    unsafe extern "C" fn(
839        jvmti_env: *mut jvmtiEnv,
840        name: *const c_char,
841        address: *const c_void,
842        length: jint,
843    ),
844>;
845
846pub type jvmtiEventException = Option<
847    unsafe extern "C" fn(
848        jvmti_env: *mut jvmtiEnv,
849        jni_env: *mut JNIEnv,
850        thread: jthread,
851        method: jmethodID,
852        location: jlocation,
853        exception: jobject,
854        catch_method: jmethodID,
855        catch_location: jlocation,
856    ),
857>;
858
859pub type jvmtiEventExceptionCatch = Option<
860    unsafe extern "C" fn(
861        jvmti_env: *mut jvmtiEnv,
862        jni_env: *mut JNIEnv,
863        thread: jthread,
864        method: jmethodID,
865        location: jlocation,
866        exception: jobject,
867    ),
868>;
869
870pub type jvmtiEventFieldAccess = Option<
871    unsafe extern "C" fn(
872        jvmti_env: *mut jvmtiEnv,
873        jni_env: *mut JNIEnv,
874        thread: jthread,
875        method: jmethodID,
876        location: jlocation,
877        field_klass: jclass,
878        object: jobject,
879        field: jfieldID,
880    ),
881>;
882
883pub type jvmtiEventFieldModification = Option<
884    unsafe extern "C" fn(
885        jvmti_env: *mut jvmtiEnv,
886        jni_env: *mut JNIEnv,
887        thread: jthread,
888        method: jmethodID,
889        location: jlocation,
890        field_klass: jclass,
891        object: jobject,
892        field: jfieldID,
893        signature_type: c_char,
894        new_value: jvalue,
895    ),
896>;
897
898pub type jvmtiEventFramePop = Option<
899    unsafe extern "C" fn(
900        jvmti_env: *mut jvmtiEnv,
901        jni_env: *mut JNIEnv,
902        thread: jthread,
903        method: jmethodID,
904        was_popped_by_exception: jboolean,
905    ),
906>;
907
908pub type jvmtiEventGarbageCollectionFinish = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv)>;
909
910pub type jvmtiEventGarbageCollectionStart = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv)>;
911
912pub type jvmtiEventMethodEntry = Option<
913    unsafe extern "C" fn(
914        jvmti_env: *mut jvmtiEnv,
915        jni_env: *mut JNIEnv,
916        thread: jthread,
917        method: jmethodID,
918    ),
919>;
920
921pub type jvmtiEventMethodExit = Option<
922    unsafe extern "C" fn(
923        jvmti_env: *mut jvmtiEnv,
924        jni_env: *mut JNIEnv,
925        thread: jthread,
926        method: jmethodID,
927        was_popped_by_exception: jboolean,
928        return_value: jvalue,
929    ),
930>;
931
932pub type jvmtiEventMonitorContendedEnter = Option<
933    unsafe extern "C" fn(
934        jvmti_env: *mut jvmtiEnv,
935        jni_env: *mut JNIEnv,
936        thread: jthread,
937        object: jobject,
938    ),
939>;
940
941pub type jvmtiEventMonitorContendedEntered = Option<
942    unsafe extern "C" fn(
943        jvmti_env: *mut jvmtiEnv,
944        jni_env: *mut JNIEnv,
945        thread: jthread,
946        object: jobject,
947    ),
948>;
949
950pub type jvmtiEventMonitorWait = Option<
951    unsafe extern "C" fn(
952        jvmti_env: *mut jvmtiEnv,
953        jni_env: *mut JNIEnv,
954        thread: jthread,
955        object: jobject,
956        timeout: jlong,
957    ),
958>;
959
960pub type jvmtiEventMonitorWaited = Option<
961    unsafe extern "C" fn(
962        jvmti_env: *mut jvmtiEnv,
963        jni_env: *mut JNIEnv,
964        thread: jthread,
965        object: jobject,
966        timed_out: jboolean,
967    ),
968>;
969
970pub type jvmtiEventNativeMethodBind = Option<
971    unsafe extern "C" fn(
972        jvmti_env: *mut jvmtiEnv,
973        jni_env: *mut JNIEnv,
974        thread: jthread,
975        method: jmethodID,
976        address: *mut c_void,
977        new_address_ptr: *mut *mut c_void,
978    ),
979>;
980
981pub type jvmtiEventObjectFree = Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, tag: jlong)>;
982
983pub type jvmtiEventResourceExhausted = Option<
984    unsafe extern "C" fn(
985        jvmti_env: *mut jvmtiEnv,
986        jni_env: *mut JNIEnv,
987        flags: jint,
988        reserved: *const c_void,
989        description: *const c_char,
990    ),
991>;
992
993pub type jvmtiEventSampledObjectAlloc = Option<
994    unsafe extern "C" fn(
995        jvmti_env: *mut jvmtiEnv,
996        jni_env: *mut JNIEnv,
997        thread: jthread,
998        object: jobject,
999        object_klass: jclass,
1000        size: jlong,
1001    ),
1002>;
1003
1004pub type jvmtiEventSingleStep = Option<
1005    unsafe extern "C" fn(
1006        jvmti_env: *mut jvmtiEnv,
1007        jni_env: *mut JNIEnv,
1008        thread: jthread,
1009        method: jmethodID,
1010        location: jlocation,
1011    ),
1012>;
1013
1014pub type jvmtiEventThreadEnd =
1015    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, thread: jthread)>;
1016
1017pub type jvmtiEventThreadStart =
1018    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, thread: jthread)>;
1019
1020pub type jvmtiEventVirtualThreadEnd = Option<
1021    unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, virtual_thread: jthread),
1022>;
1023
1024pub type jvmtiEventVirtualThreadStart = Option<
1025    unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, virtual_thread: jthread),
1026>;
1027
1028pub type jvmtiEventVMDeath =
1029    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv)>;
1030
1031pub type jvmtiEventVMInit =
1032    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv, thread: jthread)>;
1033
1034pub type jvmtiEventVMObjectAlloc = Option<
1035    unsafe extern "C" fn(
1036        jvmti_env: *mut jvmtiEnv,
1037        jni_env: *mut JNIEnv,
1038        thread: jthread,
1039        object: jobject,
1040        object_klass: jclass,
1041        size: jlong,
1042    ),
1043>;
1044
1045pub type jvmtiEventVMStart =
1046    Option<unsafe extern "C" fn(jvmti_env: *mut jvmtiEnv, jni_env: *mut JNIEnv)>;
1047
1048#[repr(C)]
1049#[derive(Default, Debug, Copy, Clone)]
1050pub struct jvmtiEventCallbacks {
1051    pub VMInit: jvmtiEventVMInit,
1052    pub VMDeath: jvmtiEventVMDeath,
1053    pub ThreadStart: jvmtiEventThreadStart,
1054    pub ThreadEnd: jvmtiEventThreadEnd,
1055    pub ClassFileLoadHook: jvmtiEventClassFileLoadHook,
1056    pub ClassLoad: jvmtiEventClassLoad,
1057    pub ClassPrepare: jvmtiEventClassPrepare,
1058    pub VMStart: jvmtiEventVMStart,
1059    pub Exception: jvmtiEventException,
1060    pub ExceptionCatch: jvmtiEventExceptionCatch,
1061    pub SingleStep: jvmtiEventSingleStep,
1062    pub FramePop: jvmtiEventFramePop,
1063    pub Breakpoint: jvmtiEventBreakpoint,
1064    pub FieldAccess: jvmtiEventFieldAccess,
1065    pub FieldModification: jvmtiEventFieldModification,
1066    pub MethodEntry: jvmtiEventMethodEntry,
1067    pub MethodExit: jvmtiEventMethodExit,
1068    pub NativeMethodBind: jvmtiEventNativeMethodBind,
1069    pub CompiledMethodLoad: jvmtiEventCompiledMethodLoad,
1070    pub CompiledMethodUnload: jvmtiEventCompiledMethodUnload,
1071    pub DynamicCodeGenerated: jvmtiEventDynamicCodeGenerated,
1072    pub DataDumpRequest: jvmtiEventDataDumpRequest,
1073    pub reserved72: jvmtiEventReserved,
1074    pub MonitorWait: jvmtiEventMonitorWait,
1075    pub MonitorWaited: jvmtiEventMonitorWaited,
1076    pub MonitorContendedEnter: jvmtiEventMonitorContendedEnter,
1077    pub MonitorContendedEntered: jvmtiEventMonitorContendedEntered,
1078    pub reserved77: jvmtiEventReserved,
1079    pub reserved78: jvmtiEventReserved,
1080    pub reserved79: jvmtiEventReserved,
1081    pub ResourceExhausted: jvmtiEventResourceExhausted,
1082    pub GarbageCollectionStart: jvmtiEventGarbageCollectionStart,
1083    pub GarbageCollectionFinish: jvmtiEventGarbageCollectionFinish,
1084    pub ObjectFree: jvmtiEventObjectFree,
1085    pub VMObjectAlloc: jvmtiEventVMObjectAlloc,
1086    pub reserved85: jvmtiEventReserved,
1087    pub SampledObjectAlloc: jvmtiEventSampledObjectAlloc,
1088    pub VirtualThreadStart: jvmtiEventVirtualThreadStart,
1089    pub VirtualThreadEnd: jvmtiEventVirtualThreadEnd,
1090}
1091
1092impl jvmtiEventCallbacks {
1093    #[inline(always)]
1094    pub const fn new() -> Self {
1095        Self {
1096            VMInit: None,
1097            VMDeath: None,
1098            ThreadStart: None,
1099            ThreadEnd: None,
1100            ClassFileLoadHook: None,
1101            ClassLoad: None,
1102            ClassPrepare: None,
1103            VMStart: None,
1104            Exception: None,
1105            ExceptionCatch: None,
1106            SingleStep: None,
1107            FramePop: None,
1108            Breakpoint: None,
1109            FieldAccess: None,
1110            FieldModification: None,
1111            MethodEntry: None,
1112            MethodExit: None,
1113            NativeMethodBind: None,
1114            CompiledMethodLoad: None,
1115            CompiledMethodUnload: None,
1116            DynamicCodeGenerated: None,
1117            DataDumpRequest: None,
1118            reserved72: None,
1119            MonitorWait: None,
1120            MonitorWaited: None,
1121            MonitorContendedEnter: None,
1122            MonitorContendedEntered: None,
1123            reserved77: None,
1124            reserved78: None,
1125            reserved79: None,
1126            ResourceExhausted: None,
1127            GarbageCollectionStart: None,
1128            GarbageCollectionFinish: None,
1129            ObjectFree: None,
1130            VMObjectAlloc: None,
1131            reserved85: None,
1132            SampledObjectAlloc: None,
1133            VirtualThreadStart: None,
1134            VirtualThreadEnd: None,
1135        }
1136    }
1137}
1138
1139#[repr(C)]
1140#[jni_to_union("JVMTI", "1.0")]
1141#[non_exhaustive]
1142#[derive(Debug, Copy, Clone)]
1143pub struct jvmtiInterface_1_ {
1144    #[jni_added("reserved")]
1145    pub reserved1: *mut c_void,
1146    pub SetEventNotificationMode: unsafe extern "C" fn(
1147        env: *mut jvmtiEnv,
1148        mode: jvmtiEventMode,
1149        event_type: jvmtiEvent,
1150        event_thread: jthread,
1151        ...
1152    ) -> jvmtiError,
1153    #[jni_added("9")]
1154    pub GetAllModules: unsafe extern "C" fn(
1155        env: *mut jvmtiEnv,
1156        module_count_ptr: *mut jint,
1157        modules_ptr: *mut *mut jobject,
1158    ) -> jvmtiError,
1159    pub GetAllThreads: unsafe extern "C" fn(
1160        env: *mut jvmtiEnv,
1161        threads_count_ptr: *mut jint,
1162        threads_ptr: *mut *mut jthread,
1163    ) -> jvmtiError,
1164    pub SuspendThread: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
1165    pub ResumeThread: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
1166    pub StopThread:
1167        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, exception: jobject) -> jvmtiError,
1168    pub InterruptThread: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
1169    pub GetThreadInfo: unsafe extern "C" fn(
1170        env: *mut jvmtiEnv,
1171        thread: jthread,
1172        info_ptr: *mut jvmtiThreadInfo,
1173    ) -> jvmtiError,
1174    pub GetOwnedMonitorInfo: unsafe extern "C" fn(
1175        env: *mut jvmtiEnv,
1176        thread: jthread,
1177        owned_monitor_count_ptr: *mut jint,
1178        owned_monitors_ptr: *mut *mut jobject,
1179    ) -> jvmtiError,
1180    pub GetCurrentContendedMonitor: unsafe extern "C" fn(
1181        env: *mut jvmtiEnv,
1182        thread: jthread,
1183        monitor_ptr: *mut jobject,
1184    ) -> jvmtiError,
1185    pub RunAgentThread: unsafe extern "C" fn(
1186        env: *mut jvmtiEnv,
1187        thread: jthread,
1188        proc: jvmtiStartFunction,
1189        arg: *const c_void,
1190        priority: jint,
1191    ) -> jvmtiError,
1192    pub GetTopThreadGroups: unsafe extern "C" fn(
1193        env: *mut jvmtiEnv,
1194        group_count_ptr: *mut jint,
1195        groups_ptr: *mut *mut jthreadGroup,
1196    ) -> jvmtiError,
1197    pub GetThreadGroupInfo: unsafe extern "C" fn(
1198        env: *mut jvmtiEnv,
1199        group: jthreadGroup,
1200        info_ptr: *mut jvmtiThreadGroupInfo,
1201    ) -> jvmtiError,
1202    pub GetThreadGroupChildren: unsafe extern "C" fn(
1203        env: *mut jvmtiEnv,
1204        group: jthreadGroup,
1205        thread_count_ptr: *mut jint,
1206        threads_ptr: *mut *mut jthread,
1207        group_count_ptr: *mut jint,
1208        groups_ptr: *mut *mut jthreadGroup,
1209    ) -> jvmtiError,
1210    pub GetFrameCount: unsafe extern "C" fn(
1211        env: *mut jvmtiEnv,
1212        thread: jthread,
1213        count_ptr: *mut jint,
1214    ) -> jvmtiError,
1215    pub GetThreadState: unsafe extern "C" fn(
1216        env: *mut jvmtiEnv,
1217        thread: jthread,
1218        thread_state_ptr: *mut jint,
1219    ) -> jvmtiError,
1220    #[jni_added("1.1")]
1221    pub GetCurrentThread:
1222        unsafe extern "C" fn(env: *mut jvmtiEnv, thread_ptr: *mut jthread) -> jvmtiError,
1223    pub GetFrameLocation: unsafe extern "C" fn(
1224        env: *mut jvmtiEnv,
1225        thread: jthread,
1226        depth: jint,
1227        method_ptr: *mut jmethodID,
1228        location_ptr: *mut jlocation,
1229    ) -> jvmtiError,
1230    pub NotifyFramePop:
1231        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, depth: jint) -> jvmtiError,
1232    pub GetLocalObject: unsafe extern "C" fn(
1233        env: *mut jvmtiEnv,
1234        thread: jthread,
1235        depth: jint,
1236        slot: jint,
1237        value_ptr: *mut jobject,
1238    ) -> jvmtiError,
1239    pub GetLocalInt: unsafe extern "C" fn(
1240        env: *mut jvmtiEnv,
1241        thread: jthread,
1242        depth: jint,
1243        slot: jint,
1244        value_ptr: *mut jint,
1245    ) -> jvmtiError,
1246    pub GetLocalLong: unsafe extern "C" fn(
1247        env: *mut jvmtiEnv,
1248        thread: jthread,
1249        depth: jint,
1250        slot: jint,
1251        value_ptr: *mut jlong,
1252    ) -> jvmtiError,
1253    pub GetLocalFloat: unsafe extern "C" fn(
1254        env: *mut jvmtiEnv,
1255        thread: jthread,
1256        depth: jint,
1257        slot: jint,
1258        value_ptr: *mut jfloat,
1259    ) -> jvmtiError,
1260    pub GetLocalDouble: unsafe extern "C" fn(
1261        env: *mut jvmtiEnv,
1262        thread: jthread,
1263        depth: jint,
1264        slot: jint,
1265        value_ptr: *mut jdouble,
1266    ) -> jvmtiError,
1267    pub SetLocalObject: unsafe extern "C" fn(
1268        env: *mut jvmtiEnv,
1269        thread: jthread,
1270        depth: jint,
1271        slot: jint,
1272        value: jobject,
1273    ) -> jvmtiError,
1274    pub SetLocalInt: unsafe extern "C" fn(
1275        env: *mut jvmtiEnv,
1276        thread: jthread,
1277        depth: jint,
1278        slot: jint,
1279        value: jint,
1280    ) -> jvmtiError,
1281    pub SetLocalLong: unsafe extern "C" fn(
1282        env: *mut jvmtiEnv,
1283        thread: jthread,
1284        depth: jint,
1285        slot: jint,
1286        value: jlong,
1287    ) -> jvmtiError,
1288    pub SetLocalFloat: unsafe extern "C" fn(
1289        env: *mut jvmtiEnv,
1290        thread: jthread,
1291        depth: jint,
1292        slot: jint,
1293        value: jfloat,
1294    ) -> jvmtiError,
1295    pub SetLocalDouble: unsafe extern "C" fn(
1296        env: *mut jvmtiEnv,
1297        thread: jthread,
1298        depth: jint,
1299        slot: jint,
1300        value: jdouble,
1301    ) -> jvmtiError,
1302    pub CreateRawMonitor: unsafe extern "C" fn(
1303        env: *mut jvmtiEnv,
1304        name: *const c_char,
1305        monitor_ptr: *mut jrawMonitorID,
1306    ) -> jvmtiError,
1307    pub DestroyRawMonitor:
1308        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
1309    pub RawMonitorEnter:
1310        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
1311    pub RawMonitorExit:
1312        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
1313    pub RawMonitorWait: unsafe extern "C" fn(
1314        env: *mut jvmtiEnv,
1315        monitor: jrawMonitorID,
1316        millis: jlong,
1317    ) -> jvmtiError,
1318    pub RawMonitorNotify:
1319        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
1320    pub RawMonitorNotifyAll:
1321        unsafe extern "C" fn(env: *mut jvmtiEnv, monitor: jrawMonitorID) -> jvmtiError,
1322    pub SetBreakpoint: unsafe extern "C" fn(
1323        env: *mut jvmtiEnv,
1324        method: jmethodID,
1325        location: jlocation,
1326    ) -> jvmtiError,
1327    pub ClearBreakpoint: unsafe extern "C" fn(
1328        env: *mut jvmtiEnv,
1329        method: jmethodID,
1330        location: jlocation,
1331    ) -> jvmtiError,
1332    #[jni_added("9")]
1333    pub GetNamedModule: unsafe extern "C" fn(
1334        env: *mut jvmtiEnv,
1335        class_loader: jobject,
1336        package_name: *const c_char,
1337        module_ptr: *mut jobject,
1338    ) -> jvmtiError,
1339    pub SetFieldAccessWatch:
1340        unsafe extern "C" fn(env: *mut jvmtiEnv, klass: jclass, field: jfieldID) -> jvmtiError,
1341    pub ClearFieldAccessWatch:
1342        unsafe extern "C" fn(env: *mut jvmtiEnv, klass: jclass, field: jfieldID) -> jvmtiError,
1343    pub SetFieldModificationWatch:
1344        unsafe extern "C" fn(env: *mut jvmtiEnv, klass: jclass, field: jfieldID) -> jvmtiError,
1345    pub ClearFieldModificationWatch:
1346        unsafe extern "C" fn(env: *mut jvmtiEnv, klass: jclass, field: jfieldID) -> jvmtiError,
1347    #[jni_added("1.1")]
1348    pub IsModifiableClass: unsafe extern "C" fn(
1349        env: *mut jvmtiEnv,
1350        klass: jclass,
1351        is_modifiable_class_ptr: *mut jboolean,
1352    ) -> jvmtiError,
1353    pub Allocate: unsafe extern "C" fn(
1354        env: *mut jvmtiEnv,
1355        size: jlong,
1356        mem_ptr: *mut *mut c_uchar,
1357    ) -> jvmtiError,
1358    pub Deallocate: unsafe extern "C" fn(env: *mut jvmtiEnv, mem: *mut c_uchar) -> jvmtiError,
1359    pub GetClassSignature: unsafe extern "C" fn(
1360        env: *mut jvmtiEnv,
1361        klass: jclass,
1362        signature_ptr: *mut *mut c_char,
1363        generic_ptr: *mut *mut c_char,
1364    ) -> jvmtiError,
1365    pub GetClassStatus: unsafe extern "C" fn(
1366        env: *mut jvmtiEnv,
1367        klass: jclass,
1368        status_ptr: *mut jint,
1369    ) -> jvmtiError,
1370    pub GetSourceFileName: unsafe extern "C" fn(
1371        env: *mut jvmtiEnv,
1372        klass: jclass,
1373        source_name_ptr: *mut *mut c_char,
1374    ) -> jvmtiError,
1375    pub GetClassModifiers: unsafe extern "C" fn(
1376        env: *mut jvmtiEnv,
1377        klass: jclass,
1378        modifiers_ptr: *mut jint,
1379    ) -> jvmtiError,
1380    pub GetClassMethods: unsafe extern "C" fn(
1381        env: *mut jvmtiEnv,
1382        klass: jclass,
1383        method_count_ptr: *mut jint,
1384        methods_ptr: *mut *mut jmethodID,
1385    ) -> jvmtiError,
1386    pub GetClassFields: unsafe extern "C" fn(
1387        env: *mut jvmtiEnv,
1388        klass: jclass,
1389        field_count_ptr: *mut jint,
1390        fields_ptr: *mut *mut jfieldID,
1391    ) -> jvmtiError,
1392    pub GetImplementedInterfaces: unsafe extern "C" fn(
1393        env: *mut jvmtiEnv,
1394        klass: jclass,
1395        interface_count_ptr: *mut jint,
1396        interfaces_ptr: *mut *mut jclass,
1397    ) -> jvmtiError,
1398    pub IsInterface: unsafe extern "C" fn(
1399        env: *mut jvmtiEnv,
1400        klass: jclass,
1401        is_interface_ptr: *mut jboolean,
1402    ) -> jvmtiError,
1403    pub IsArrayClass: unsafe extern "C" fn(
1404        env: *mut jvmtiEnv,
1405        klass: jclass,
1406        is_array_class_ptr: *mut jboolean,
1407    ) -> jvmtiError,
1408    pub GetClassLoader: unsafe extern "C" fn(
1409        env: *mut jvmtiEnv,
1410        klass: jclass,
1411        classloader_ptr: *mut jobject,
1412    ) -> jvmtiError,
1413    pub GetObjectHashCode: unsafe extern "C" fn(
1414        env: *mut jvmtiEnv,
1415        object: jobject,
1416        hash_code_ptr: *mut jint,
1417    ) -> jvmtiError,
1418    pub GetObjectMonitorUsage: unsafe extern "C" fn(
1419        env: *mut jvmtiEnv,
1420        object: jobject,
1421        info_ptr: *mut jvmtiMonitorUsage,
1422    ) -> jvmtiError,
1423    pub GetFieldName: unsafe extern "C" fn(
1424        env: *mut jvmtiEnv,
1425        klass: jclass,
1426        field: jfieldID,
1427        name_ptr: *mut *mut c_char,
1428        signature_ptr: *mut *mut c_char,
1429        generic_ptr: *mut *mut c_char,
1430    ) -> jvmtiError,
1431    pub GetFieldDeclaringClass: unsafe extern "C" fn(
1432        env: *mut jvmtiEnv,
1433        klass: jclass,
1434        field: jfieldID,
1435        declaring_class_ptr: *mut jclass,
1436    ) -> jvmtiError,
1437    pub GetFieldModifiers: unsafe extern "C" fn(
1438        env: *mut jvmtiEnv,
1439        klass: jclass,
1440        field: jfieldID,
1441        modifiers_ptr: *mut jint,
1442    ) -> jvmtiError,
1443    pub IsFieldSynthetic: unsafe extern "C" fn(
1444        env: *mut jvmtiEnv,
1445        klass: jclass,
1446        field: jfieldID,
1447        is_synthetic_ptr: *mut jboolean,
1448    ) -> jvmtiError,
1449    pub GetMethodName: unsafe extern "C" fn(
1450        env: *mut jvmtiEnv,
1451        method: jmethodID,
1452        name_ptr: *mut *mut c_char,
1453        signature_ptr: *mut *mut c_char,
1454        generic_ptr: *mut *mut c_char,
1455    ) -> jvmtiError,
1456    pub GetMethodDeclaringClass: unsafe extern "C" fn(
1457        env: *mut jvmtiEnv,
1458        method: jmethodID,
1459        declaring_class_ptr: *mut jclass,
1460    ) -> jvmtiError,
1461    pub GetMethodModifiers: unsafe extern "C" fn(
1462        env: *mut jvmtiEnv,
1463        method: jmethodID,
1464        modifiers_ptr: *mut jint,
1465    ) -> jvmtiError,
1466    #[jni_added("25")]
1467    pub ClearAllFramePops: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
1468    pub GetMaxLocals: unsafe extern "C" fn(
1469        env: *mut jvmtiEnv,
1470        method: jmethodID,
1471        max_ptr: *mut jint,
1472    ) -> jvmtiError,
1473    pub GetArgumentsSize: unsafe extern "C" fn(
1474        env: *mut jvmtiEnv,
1475        method: jmethodID,
1476        size_ptr: *mut jint,
1477    ) -> jvmtiError,
1478    pub GetLineNumberTable: unsafe extern "C" fn(
1479        env: *mut jvmtiEnv,
1480        method: jmethodID,
1481        entry_count_ptr: *mut jint,
1482        table_ptr: *mut *mut jvmtiLineNumberEntry,
1483    ) -> jvmtiError,
1484    pub GetMethodLocation: unsafe extern "C" fn(
1485        env: *mut jvmtiEnv,
1486        method: jmethodID,
1487        start_location_ptr: *mut jlocation,
1488        end_location_ptr: *mut jlocation,
1489    ) -> jvmtiError,
1490    pub GetLocalVariableTable: unsafe extern "C" fn(
1491        env: *mut jvmtiEnv,
1492        method: jmethodID,
1493        entry_count_ptr: *mut jint,
1494        table_ptr: *mut *mut jvmtiLocalVariableEntry,
1495    ) -> jvmtiError,
1496    #[jni_added("1.1")]
1497    pub SetNativeMethodPrefix:
1498        unsafe extern "C" fn(env: *mut jvmtiEnv, prefix: *const c_char) -> jvmtiError,
1499    #[jni_added("1.1")]
1500    pub SetNativeMethodPrefixes: unsafe extern "C" fn(
1501        env: *mut jvmtiEnv,
1502        prefix_count: jint,
1503        prefixes: *mut *mut c_char,
1504    ) -> jvmtiError,
1505    pub GetBytecodes: unsafe extern "C" fn(
1506        env: *mut jvmtiEnv,
1507        method: jmethodID,
1508        bytecode_count_ptr: *mut jint,
1509        bytecodes_ptr: *mut *mut c_uchar,
1510    ) -> jvmtiError,
1511    pub IsMethodNative: unsafe extern "C" fn(
1512        env: *mut jvmtiEnv,
1513        method: jmethodID,
1514        is_native_ptr: *mut jboolean,
1515    ) -> jvmtiError,
1516    pub IsMethodSynthetic: unsafe extern "C" fn(
1517        env: *mut jvmtiEnv,
1518        method: jmethodID,
1519        is_synthetic_ptr: *mut jboolean,
1520    ) -> jvmtiError,
1521    pub GetLoadedClasses: unsafe extern "C" fn(
1522        env: *mut jvmtiEnv,
1523        class_count_ptr: *mut jint,
1524        classes_ptr: *mut *mut jclass,
1525    ) -> jvmtiError,
1526    pub GetClassLoaderClasses: unsafe extern "C" fn(
1527        env: *mut jvmtiEnv,
1528        initiating_loader: jobject,
1529        class_count_ptr: *mut jint,
1530        classes_ptr: *mut *mut jclass,
1531    ) -> jvmtiError,
1532    pub PopFrame: unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
1533    #[jni_added("1.1")]
1534    pub ForceEarlyReturnObject:
1535        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jobject) -> jvmtiError,
1536    #[jni_added("1.1")]
1537    pub ForceEarlyReturnInt:
1538        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jint) -> jvmtiError,
1539    #[jni_added("1.1")]
1540    pub ForceEarlyReturnLong:
1541        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jlong) -> jvmtiError,
1542    #[jni_added("1.1")]
1543    pub ForceEarlyReturnFloat:
1544        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jfloat) -> jvmtiError,
1545    #[jni_added("1.1")]
1546    pub ForceEarlyReturnDouble:
1547        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread, value: jdouble) -> jvmtiError,
1548    #[jni_added("1.1")]
1549    pub ForceEarlyReturnVoid:
1550        unsafe extern "C" fn(env: *mut jvmtiEnv, thread: jthread) -> jvmtiError,
1551    pub RedefineClasses: unsafe extern "C" fn(
1552        env: *mut jvmtiEnv,
1553        class_count: jint,
1554        class_definitions: *const jvmtiClassDefinition,
1555    ) -> jvmtiError,
1556    pub GetVersionNumber:
1557        unsafe extern "C" fn(env: *mut jvmtiEnv, version_ptr: *mut jint) -> jvmtiError,
1558    pub GetCapabilities: unsafe extern "C" fn(
1559        env: *mut jvmtiEnv,
1560        capabilities_ptr: *mut jvmtiCapabilities,
1561    ) -> jvmtiError,
1562    pub GetSourceDebugExtension: unsafe extern "C" fn(
1563        env: *mut jvmtiEnv,
1564        klass: jclass,
1565        source_debug_extension_ptr: *mut *mut c_char,
1566    ) -> jvmtiError,
1567    pub IsMethodObsolete: unsafe extern "C" fn(
1568        env: *mut jvmtiEnv,
1569        method: jmethodID,
1570        is_obsolete_ptr: *mut jboolean,
1571    ) -> jvmtiError,
1572    pub SuspendThreadList: unsafe extern "C" fn(
1573        env: *mut jvmtiEnv,
1574        request_count: jint,
1575        request_list: *const jthread,
1576        results: *mut jvmtiError,
1577    ) -> jvmtiError,
1578    pub ResumeThreadList: unsafe extern "C" fn(
1579        env: *mut jvmtiEnv,
1580        request_count: jint,
1581        request_list: *const jthread,
1582        results: *mut jvmtiError,
1583    ) -> jvmtiError,
1584    #[jni_added("9")]
1585    pub AddModuleReads:
1586        unsafe extern "C" fn(env: *mut jvmtiEnv, module: jobject, to_module: jobject) -> jvmtiError,
1587    #[jni_added("9")]
1588    pub AddModuleExports: unsafe extern "C" fn(
1589        env: *mut jvmtiEnv,
1590        module: jobject,
1591        pkg_name: *const c_char,
1592        to_module: jobject,
1593    ) -> jvmtiError,
1594    #[jni_added("9")]
1595    pub AddModuleOpens: unsafe extern "C" fn(
1596        env: *mut jvmtiEnv,
1597        module: jobject,
1598        pkg_name: *const c_char,
1599        to_module: jobject,
1600    ) -> jvmtiError,
1601    #[jni_added("9")]
1602    pub AddModuleUses:
1603        unsafe extern "C" fn(env: *mut jvmtiEnv, module: jobject, service: jclass) -> jvmtiError,
1604    #[jni_added("9")]
1605    pub AddModuleProvides: unsafe extern "C" fn(
1606        env: *mut jvmtiEnv,
1607        module: jobject,
1608        service: jclass,
1609        impl_class: jclass,
1610    ) -> jvmtiError,
1611    #[jni_added("9")]
1612    pub IsModifiableModule: unsafe extern "C" fn(
1613        env: *mut jvmtiEnv,
1614        module: jobject,
1615        is_modifiable_module_ptr: *mut jboolean,
1616    ) -> jvmtiError,
1617    pub GetAllStackTraces: unsafe extern "C" fn(
1618        env: *mut jvmtiEnv,
1619        max_frame_count: jint,
1620        stack_info_ptr: *mut *mut jvmtiStackInfo,
1621        thread_count_ptr: *mut jint,
1622    ) -> jvmtiError,
1623    pub GetThreadListStackTraces: unsafe extern "C" fn(
1624        env: *mut jvmtiEnv,
1625        thread_count: jint,
1626        thread_list: *const jthread,
1627        max_frame_count: jint,
1628        stack_info_ptr: *mut *mut jvmtiStackInfo,
1629    ) -> jvmtiError,
1630    pub GetThreadLocalStorage: unsafe extern "C" fn(
1631        env: *mut jvmtiEnv,
1632        thread: jthread,
1633        data_ptr: *mut *mut c_void,
1634    ) -> jvmtiError,
1635    pub SetThreadLocalStorage: unsafe extern "C" fn(
1636        env: *mut jvmtiEnv,
1637        thread: jthread,
1638        data: *const c_void,
1639    ) -> jvmtiError,
1640    pub GetStackTrace: unsafe extern "C" fn(
1641        env: *mut jvmtiEnv,
1642        thread: jthread,
1643        start_depth: jint,
1644        max_frame_count: jint,
1645        frame_buffer: *mut jvmtiFrameInfo,
1646        count_ptr: *mut jint,
1647    ) -> jvmtiError,
1648    #[jni_added("reserved")]
1649    pub reserved105: *mut c_void,
1650    pub GetTag: unsafe extern "C" fn(
1651        env: *mut jvmtiEnv,
1652        object: jobject,
1653        tag_ptr: *mut jlong,
1654    ) -> jvmtiError,
1655    pub SetTag: unsafe extern "C" fn(env: *mut jvmtiEnv, object: jobject, tag: jlong) -> jvmtiError,
1656    pub ForceGarbageCollection: unsafe extern "C" fn(env: *mut jvmtiEnv) -> jvmtiError,
1657    pub IterateOverObjectsReachableFromObject: unsafe extern "C" fn(
1658        env: *mut jvmtiEnv,
1659        object: jobject,
1660        object_reference_callback: jvmtiObjectReferenceCallback,
1661        user_data: *const c_void,
1662    ) -> jvmtiError,
1663    pub IterateOverReachableObjects: unsafe extern "C" fn(
1664        env: *mut jvmtiEnv,
1665        heap_root_callback: jvmtiHeapRootCallback,
1666        stack_ref_callback: jvmtiStackReferenceCallback,
1667        object_ref_callback: jvmtiObjectReferenceCallback,
1668        user_data: *const c_void,
1669    ) -> jvmtiError,
1670    pub IterateOverHeap: unsafe extern "C" fn(
1671        env: *mut jvmtiEnv,
1672        object_filter: jvmtiHeapObjectFilter,
1673        heap_object_callback: jvmtiHeapObjectCallback,
1674        user_data: *const c_void,
1675    ) -> jvmtiError,
1676    pub IterateOverInstancesOfClass: unsafe extern "C" fn(
1677        env: *mut jvmtiEnv,
1678        klass: jclass,
1679        object_filter: jvmtiHeapObjectFilter,
1680        heap_object_callback: jvmtiHeapObjectCallback,
1681        user_data: *const c_void,
1682    ) -> jvmtiError,
1683    #[jni_added("reserved")]
1684    pub reserved113: *mut c_void,
1685    pub GetObjectsWithTags: unsafe extern "C" fn(
1686        env: *mut jvmtiEnv,
1687        tag_count: jint,
1688        tags: *const jlong,
1689        count_ptr: *mut jint,
1690        object_result_ptr: *mut *mut jobject,
1691        tag_result_ptr: *mut *mut jlong,
1692    ) -> jvmtiError,
1693    #[jni_added("1.1")]
1694    pub FollowReferences: unsafe extern "C" fn(
1695        env: *mut jvmtiEnv,
1696        heap_filter: jint,
1697        klass: jclass,
1698        initial_object: jobject,
1699        callbacks: *const jvmtiHeapCallbacks,
1700        user_data: *const c_void,
1701    ) -> jvmtiError,
1702    #[jni_added("1.1")]
1703    pub IterateThroughHeap: unsafe extern "C" fn(
1704        env: *mut jvmtiEnv,
1705        heap_filter: jint,
1706        klass: jclass,
1707        callbacks: *const jvmtiHeapCallbacks,
1708        user_data: *const c_void,
1709    ) -> jvmtiError,
1710    #[jni_added("reserved")]
1711    pub reserved117: *mut c_void,
1712    #[jni_added("21")]
1713    pub SuspendAllVirtualThreads: unsafe extern "C" fn(
1714        env: *mut jvmtiEnv,
1715        except_count: jint,
1716        except_list: *const jthread,
1717    ) -> jvmtiError,
1718    #[jni_added("21")]
1719    pub ResumeAllVirtualThreads: unsafe extern "C" fn(
1720        env: *mut jvmtiEnv,
1721        except_count: jint,
1722        except_list: *const jthread,
1723    ) -> jvmtiError,
1724    pub SetJNIFunctionTable: unsafe extern "C" fn(
1725        env: *mut jvmtiEnv,
1726        function_table: *const jniNativeInterface,
1727    ) -> jvmtiError,
1728    pub GetJNIFunctionTable: unsafe extern "C" fn(
1729        env: *mut jvmtiEnv,
1730        function_table: *mut *mut jniNativeInterface,
1731    ) -> jvmtiError,
1732    pub SetEventCallbacks: unsafe extern "C" fn(
1733        env: *mut jvmtiEnv,
1734        callbacks: *const jvmtiEventCallbacks,
1735        size_of_callbacks: jint,
1736    ) -> jvmtiError,
1737    pub GenerateEvents:
1738        unsafe extern "C" fn(env: *mut jvmtiEnv, event_type: jvmtiEvent) -> jvmtiError,
1739    pub GetExtensionFunctions: unsafe extern "C" fn(
1740        env: *mut jvmtiEnv,
1741        extension_count_ptr: *mut jint,
1742        extensions: *mut *mut jvmtiExtensionFunctionInfo,
1743    ) -> jvmtiError,
1744    pub GetExtensionEvents: unsafe extern "C" fn(
1745        env: *mut jvmtiEnv,
1746        extension_count_ptr: *mut jint,
1747        extensions: *mut *mut jvmtiExtensionEventInfo,
1748    ) -> jvmtiError,
1749    pub SetExtensionEventCallback: unsafe extern "C" fn(
1750        env: *mut jvmtiEnv,
1751        extension_event_index: jint,
1752        callback: jvmtiExtensionEvent,
1753    ) -> jvmtiError,
1754    pub DisposeEnvironment: unsafe extern "C" fn(env: *mut jvmtiEnv) -> jvmtiError,
1755    pub GetErrorName: unsafe extern "C" fn(
1756        env: *mut jvmtiEnv,
1757        error: jvmtiError,
1758        name_ptr: *mut *mut c_char,
1759    ) -> jvmtiError,
1760    pub GetJLocationFormat: unsafe extern "C" fn(
1761        env: *mut jvmtiEnv,
1762        format_ptr: *mut jvmtiJlocationFormat,
1763    ) -> jvmtiError,
1764    pub GetSystemProperties: unsafe extern "C" fn(
1765        env: *mut jvmtiEnv,
1766        count_ptr: *mut jint,
1767        property_ptr: *mut *mut *mut c_char,
1768    ) -> jvmtiError,
1769    pub GetSystemProperty: unsafe extern "C" fn(
1770        env: *mut jvmtiEnv,
1771        property: *const c_char,
1772        value_ptr: *mut *mut c_char,
1773    ) -> jvmtiError,
1774    pub SetSystemProperty: unsafe extern "C" fn(
1775        env: *mut jvmtiEnv,
1776        property: *const c_char,
1777        value_ptr: *const c_char,
1778    ) -> jvmtiError,
1779    pub GetPhase:
1780        unsafe extern "C" fn(env: *mut jvmtiEnv, phase_ptr: *mut jvmtiPhase) -> jvmtiError,
1781    pub GetCurrentThreadCpuTimerInfo:
1782        unsafe extern "C" fn(env: *mut jvmtiEnv, info_ptr: *mut jvmtiTimerInfo) -> jvmtiError,
1783    pub GetCurrentThreadCpuTime:
1784        unsafe extern "C" fn(env: *mut jvmtiEnv, nanos_ptr: *mut jlong) -> jvmtiError,
1785    pub GetThreadCpuTimerInfo:
1786        unsafe extern "C" fn(env: *mut jvmtiEnv, info_ptr: *mut jvmtiTimerInfo) -> jvmtiError,
1787    pub GetThreadCpuTime: unsafe extern "C" fn(
1788        env: *mut jvmtiEnv,
1789        thread: jthread,
1790        nanos_ptr: *mut jlong,
1791    ) -> jvmtiError,
1792    pub GetTimerInfo:
1793        unsafe extern "C" fn(env: *mut jvmtiEnv, info_ptr: *mut jvmtiTimerInfo) -> jvmtiError,
1794    pub GetTime: unsafe extern "C" fn(env: *mut jvmtiEnv, nanos_ptr: *mut jlong) -> jvmtiError,
1795    pub GetPotentialCapabilities: unsafe extern "C" fn(
1796        env: *mut jvmtiEnv,
1797        capabilities_ptr: *mut jvmtiCapabilities,
1798    ) -> jvmtiError,
1799    #[jni_added("reserved")]
1800    pub reserved141: *mut c_void,
1801    pub AddCapabilities: unsafe extern "C" fn(
1802        env: *mut jvmtiEnv,
1803        capabilities_ptr: *const jvmtiCapabilities,
1804    ) -> jvmtiError,
1805    pub RelinquishCapabilities: unsafe extern "C" fn(
1806        env: *mut jvmtiEnv,
1807        capabilities_ptr: *const jvmtiCapabilities,
1808    ) -> jvmtiError,
1809    pub GetAvailableProcessors:
1810        unsafe extern "C" fn(env: *mut jvmtiEnv, processor_count_ptr: *mut jint) -> jvmtiError,
1811    #[jni_added("1.1")]
1812    pub GetClassVersionNumbers: unsafe extern "C" fn(
1813        env: *mut jvmtiEnv,
1814        klass: jclass,
1815        minor_version_ptr: *mut jint,
1816        major_version_ptr: *mut jint,
1817    ) -> jvmtiError,
1818    #[jni_added("1.1")]
1819    pub GetConstantPool: unsafe extern "C" fn(
1820        env: *mut jvmtiEnv,
1821        klass: jclass,
1822        constant_pool_count_ptr: *mut jint,
1823        constant_pool_byte_count_ptr: *mut jint,
1824        constant_pool_bytes_ptr: *mut *mut c_uchar,
1825    ) -> jvmtiError,
1826    pub GetEnvironmentLocalStorage:
1827        unsafe extern "C" fn(env: *mut jvmtiEnv, data_ptr: *mut *mut c_void) -> jvmtiError,
1828    pub SetEnvironmentLocalStorage:
1829        unsafe extern "C" fn(env: *mut jvmtiEnv, data: *const c_void) -> jvmtiError,
1830    pub AddToBootstrapClassLoaderSearch:
1831        unsafe extern "C" fn(env: *mut jvmtiEnv, segment: *const c_char) -> jvmtiError,
1832    pub SetVerboseFlag: unsafe extern "C" fn(
1833        env: *mut jvmtiEnv,
1834        flag: jvmtiVerboseFlag,
1835        value: jboolean,
1836    ) -> jvmtiError,
1837    #[jni_added("1.1")]
1838    pub AddToSystemClassLoaderSearch:
1839        unsafe extern "C" fn(env: *mut jvmtiEnv, segment: *const c_char) -> jvmtiError,
1840    #[jni_added("1.1")]
1841    pub RetransformClasses: unsafe extern "C" fn(
1842        env: *mut jvmtiEnv,
1843        class_count: jint,
1844        classes: *const jclass,
1845    ) -> jvmtiError,
1846    #[jni_added("1.1")]
1847    pub GetOwnedMonitorStackDepthInfo: unsafe extern "C" fn(
1848        env: *mut jvmtiEnv,
1849        thread: jthread,
1850        monitor_info_count_ptr: *mut jint,
1851        monitor_info_ptr: *mut *mut jvmtiMonitorStackDepthInfo,
1852    ) -> jvmtiError,
1853    pub GetObjectSize: unsafe extern "C" fn(
1854        env: *mut jvmtiEnv,
1855        object: jobject,
1856        size_ptr: *mut jlong,
1857    ) -> jvmtiError,
1858    #[jni_added("1.2")]
1859    pub GetLocalInstance: unsafe extern "C" fn(
1860        env: *mut jvmtiEnv,
1861        thread: jthread,
1862        depth: jint,
1863        value_ptr: *mut jobject,
1864    ) -> jvmtiError,
1865    #[jni_added("11")]
1866    pub SetHeapSamplingInterval:
1867        unsafe extern "C" fn(env: *mut jvmtiEnv, sampling_interval: jint) -> jvmtiError,
1868}