-
Notifications
You must be signed in to change notification settings - Fork 729
/
jvmti.h.m4
1362 lines (1217 loc) · 69.2 KB
/
jvmti.h.m4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*******************************************************************************
* Copyright IBM Corp. and others 1991
*
* This program and the accompanying materials are made available under
* the terms of the Eclipse Public License 2.0 which accompanies this
* distribution and is available at https://www.eclipse.org/legal/epl-2.0/
* or the Apache License, Version 2.0 which accompanies this distribution and
* is available at https://www.apache.org/licenses/LICENSE-2.0.
*
* This Source Code may also be made available under the following
* Secondary Licenses when the conditions for such availability set
* forth in the Eclipse Public License, v. 2.0 are satisfied: GNU
* General Public License, version 2 with the GNU Classpath
* Exception [1] and GNU General Public License, version 2 with the
* OpenJDK Assembly Exception [2].
*
* [1] https://www.gnu.org/software/classpath/license.html
* [2] https://openjdk.org/legal/assembly-exception.html
*
* SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0 OR GPL-2.0-only WITH OpenJDK-assembly-exception-1.0
*******************************************************************************/
changequote(`[',`]')dnl
#ifndef jvmti_h
#define jvmti_h
/* @ddr_namespace: default */
#include "jni.h"
#ifdef __cplusplus
extern "C" {
#endif
JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved);
JNIEXPORT void JNICALL Agent_OnUnload(JavaVM *vm);
JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *options, void *reserved);
/*
*-----------------------------------------------------------------------------
* JVMTI constants
*-----------------------------------------------------------------------------
*/
#define JVMTI_VERSION_1_0 0x30010000
#define JVMTI_VERSION_1_1 0x30010100
#define JVMTI_VERSION_1_2 0x30010200
#define JVMTI_VERSION_1 (JVMTI_VERSION_1_0)
ifelse(eval(JAVA_SPEC_VERSION > 8), 1, [#define JVMTI_VERSION_9 0x30090000
#define JVMTI_VERSION_11 0x300b0000], [dnl])
#define JVMTI_1_0_SPEC_VERSION (JVMTI_VERSION_1_0 + 37) /* Spec version is 1.0.37 */
#define JVMTI_1_1_SPEC_VERSION (JVMTI_VERSION_1_1 + 102) /* Spec version is 1.1.102 */
#define JVMTI_1_2_SPEC_VERSION (JVMTI_VERSION_1_2 + 1) /* Spec version is 1.2.1 */
#define JVMTI_1_2_3_SPEC_VERSION (JVMTI_VERSION_1_2 + 3) /* Spec version is 1.2.3 */
dnl /* JVMTI_VERSION = 0x30000000 + majorversion * 0x10000 + minorversion (always 0) * 0x100 */
ifelse(eval(JAVA_SPEC_VERSION >= 15), 1, [[#]define JVMTI_VERSION (0x30000000 + (JAVA_SPEC_VERSION * 0x10000))], [
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [#define JVMTI_VERSION JVMTI_VERSION_11], [
#define JVMTI_VERSION JVMTI_1_2_SPEC_VERSION])])
#define JVMTI_CLASS_STATUS_VERIFIED 0x00000001
#define JVMTI_CLASS_STATUS_PREPARED 0x00000002
#define JVMTI_CLASS_STATUS_INITIALIZED 0x00000004
#define JVMTI_CLASS_STATUS_ERROR 0x00000008
#define JVMTI_CLASS_STATUS_ARRAY 0x00000010
#define JVMTI_CLASS_STATUS_PRIMITIVE 0x00000020
#define JVMTI_THREAD_MIN_PRIORITY 1
#define JVMTI_THREAD_NORM_PRIORITY 5
#define JVMTI_THREAD_MAX_PRIORITY 10
#define JVMTI_THREAD_STATE_ALIVE 0x00000001
#define JVMTI_THREAD_STATE_TERMINATED 0x00000002
#define JVMTI_THREAD_STATE_RUNNABLE 0x00000004
#define JVMTI_THREAD_STATE_WAITING_INDEFINITELY 0x00000010
#define JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT 0x00000020
#define JVMTI_THREAD_STATE_SLEEPING 0x00000040
#define JVMTI_THREAD_STATE_WAITING 0x00000080
#define JVMTI_THREAD_STATE_IN_OBJECT_WAIT 0x00000100
#define JVMTI_THREAD_STATE_PARKED 0x00000200
#define JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER 0x00000400
#define JVMTI_THREAD_STATE_SUSPENDED 0x00100000
#define JVMTI_THREAD_STATE_INTERRUPTED 0x00200000
#define JVMTI_THREAD_STATE_IN_NATIVE 0x00400000
#define JVMTI_THREAD_STATE_VENDOR_1 0x10000000
#define JVMTI_THREAD_STATE_VENDOR_2 0x20000000
#define JVMTI_THREAD_STATE_VENDOR_3 0x40000000
#define JVMTI_JAVA_LANG_THREAD_STATE_MASK \
( JVMTI_THREAD_STATE_TERMINATED \
| JVMTI_THREAD_STATE_ALIVE \
| JVMTI_THREAD_STATE_RUNNABLE \
| JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER \
| JVMTI_THREAD_STATE_WAITING \
| JVMTI_THREAD_STATE_WAITING_INDEFINITELY \
| JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT )
#define JVMTI_JAVA_LANG_THREAD_STATE_NEW 0
#define JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED \
JVMTI_THREAD_STATE_TERMINATED
#define JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE \
( JVMTI_THREAD_STATE_ALIVE \
| JVMTI_THREAD_STATE_RUNNABLE )
#define JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED \
( JVMTI_THREAD_STATE_ALIVE \
| JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER )
#define JVMTI_JAVA_LANG_THREAD_STATE_WAITING \
( JVMTI_THREAD_STATE_ALIVE \
| JVMTI_THREAD_STATE_WAITING \
| JVMTI_THREAD_STATE_WAITING_INDEFINITELY )
#define JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING \
( JVMTI_THREAD_STATE_ALIVE \
| JVMTI_THREAD_STATE_WAITING \
| JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT )
#define JVMTI_VERSION_INTERFACE_JNI 0x00000000
#define JVMTI_VERSION_INTERFACE_JVMTI 0x30000000
#define JVMTI_VERSION_MASK_INTERFACE_TYPE 0x70000000
#define JVMTI_VERSION_MASK_MAJOR 0x0FFF0000
#define JVMTI_VERSION_MASK_MINOR 0x0000FF00
#define JVMTI_VERSION_MASK_MICRO 0x000000FF
#define JVMTI_VERSION_SHIFT_MAJOR 16
#define JVMTI_VERSION_SHIFT_MINOR 8
#define JVMTI_VERSION_SHIFT_MICRO 0
#define JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR 1
#define JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP 2
#define JVMTI_RESOURCE_EXHAUSTED_THREADS 4
/*
*-----------------------------------------------------------------------------
* JVMTI enumerations
*-----------------------------------------------------------------------------
*/
typedef enum jvmtiEventMode {
JVMTI_ENABLE = 1,
JVMTI_DISABLE = 0,
jvmtiEventModeEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiEventMode;
typedef enum jvmtiHeapObjectFilter {
JVMTI_HEAP_OBJECT_TAGGED = 1,
JVMTI_HEAP_OBJECT_UNTAGGED = 2,
JVMTI_HEAP_OBJECT_EITHER = 3,
jvmtiHeapObjectFilterEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiHeapObjectFilter;
typedef enum jvmtiHeapRootKind {
JVMTI_HEAP_ROOT_JNI_GLOBAL = 1,
JVMTI_HEAP_ROOT_SYSTEM_CLASS = 2,
JVMTI_HEAP_ROOT_MONITOR = 3,
JVMTI_HEAP_ROOT_STACK_LOCAL = 4,
JVMTI_HEAP_ROOT_JNI_LOCAL = 5,
JVMTI_HEAP_ROOT_THREAD = 6,
JVMTI_HEAP_ROOT_OTHER = 7,
jvmtiHeapRootKindEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiHeapRootKind;
typedef enum jvmtiIterationControl {
JVMTI_ITERATION_CONTINUE = 1,
JVMTI_ITERATION_IGNORE = 2,
JVMTI_ITERATION_ABORT = 0,
jvmtiIterationControlEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiIterationControl;
typedef enum jvmtiJlocationFormat {
JVMTI_JLOCATION_JVMBCI = 1,
JVMTI_JLOCATION_MACHINEPC = 2,
JVMTI_JLOCATION_OTHER = 0,
jvmtiJlocationFormatEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiJlocationFormat;
typedef enum jvmtiObjectReferenceKind {
JVMTI_REFERENCE_CLASS = 1,
JVMTI_REFERENCE_FIELD = 2,
JVMTI_REFERENCE_ARRAY_ELEMENT = 3,
JVMTI_REFERENCE_CLASS_LOADER = 4,
JVMTI_REFERENCE_SIGNERS = 5,
JVMTI_REFERENCE_PROTECTION_DOMAIN = 6,
JVMTI_REFERENCE_INTERFACE = 7,
JVMTI_REFERENCE_STATIC_FIELD = 8,
JVMTI_REFERENCE_CONSTANT_POOL = 9,
jvmtiObjectReferenceKindEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiObjectReferenceKind;
typedef enum jvmtiParamKind {
JVMTI_KIND_IN = 91,
JVMTI_KIND_IN_PTR = 92,
JVMTI_KIND_IN_BUF = 93,
JVMTI_KIND_ALLOC_BUF = 94,
JVMTI_KIND_ALLOC_ALLOC_BUF = 95,
JVMTI_KIND_OUT = 96,
JVMTI_KIND_OUT_BUF = 97,
jvmtiParamKindEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiParamKind;
typedef enum jvmtiParamTypes {
JVMTI_TYPE_JBYTE = 101,
JVMTI_TYPE_JCHAR = 102,
JVMTI_TYPE_JSHORT = 103,
JVMTI_TYPE_JINT = 104,
JVMTI_TYPE_JLONG = 105,
JVMTI_TYPE_JFLOAT = 106,
JVMTI_TYPE_JDOUBLE = 107,
JVMTI_TYPE_JBOOLEAN = 108,
JVMTI_TYPE_JOBJECT = 109,
JVMTI_TYPE_JTHREAD = 110,
JVMTI_TYPE_JCLASS = 111,
JVMTI_TYPE_JVALUE = 112,
JVMTI_TYPE_JFIELDID = 113,
JVMTI_TYPE_JMETHODID = 114,
JVMTI_TYPE_CCHAR = 115,
JVMTI_TYPE_CVOID = 116,
JVMTI_TYPE_JNIENV = 117,
jvmtiParamTypesEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiParamTypes;
typedef enum jvmtiPhase {
JVMTI_PHASE_ONLOAD = 1,
JVMTI_PHASE_PRIMORDIAL = 2,
JVMTI_PHASE_LIVE = 4,
JVMTI_PHASE_START = 6,
JVMTI_PHASE_DEAD = 8,
jvmtiPhaseEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiPhase;
typedef enum jvmtiTimerKind {
JVMTI_TIMER_USER_CPU = 30,
JVMTI_TIMER_TOTAL_CPU = 31,
JVMTI_TIMER_ELAPSED = 32,
jvmtiTimerKindEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiTimerKind;
typedef enum jvmtiVerboseFlag {
JVMTI_VERBOSE_OTHER = 0,
JVMTI_VERBOSE_GC = 1,
JVMTI_VERBOSE_CLASS = 2,
JVMTI_VERBOSE_JNI = 4,
jvmtiVerboseFlagEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiVerboseFlag;
#define JVMTI_HEAP_FILTER_TAGGED 0x4
#define JVMTI_HEAP_FILTER_UNTAGGED 0x8
#define JVMTI_HEAP_FILTER_CLASS_TAGGED 0x10
#define JVMTI_HEAP_FILTER_CLASS_UNTAGGED 0x20
#define JVMTI_VISIT_OBJECTS 0x100
#define JVMTI_VISIT_ABORT 0x8000
typedef enum jvmtiHeapReferenceKind {
JVMTI_HEAP_REFERENCE_CLASS = 1,
JVMTI_HEAP_REFERENCE_FIELD = 2,
JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT = 3,
JVMTI_HEAP_REFERENCE_CLASS_LOADER = 4,
JVMTI_HEAP_REFERENCE_SIGNERS = 5,
JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN = 6,
JVMTI_HEAP_REFERENCE_INTERFACE = 7,
JVMTI_HEAP_REFERENCE_STATIC_FIELD = 8,
JVMTI_HEAP_REFERENCE_CONSTANT_POOL = 9,
JVMTI_HEAP_REFERENCE_SUPERCLASS = 10,
JVMTI_HEAP_REFERENCE_JNI_GLOBAL = 21,
JVMTI_HEAP_REFERENCE_SYSTEM_CLASS = 22,
JVMTI_HEAP_REFERENCE_MONITOR = 23,
JVMTI_HEAP_REFERENCE_STACK_LOCAL = 24,
JVMTI_HEAP_REFERENCE_JNI_LOCAL = 25,
JVMTI_HEAP_REFERENCE_THREAD = 26,
JVMTI_HEAP_REFERENCE_OTHER = 27,
jvmtiHeapReferenceKindEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiHeapReferenceKind;
typedef enum jvmtiPrimitiveType {
JVMTI_PRIMITIVE_TYPE_BOOLEAN = 90,
JVMTI_PRIMITIVE_TYPE_BYTE = 66,
JVMTI_PRIMITIVE_TYPE_CHAR = 67,
JVMTI_PRIMITIVE_TYPE_SHORT = 83,
JVMTI_PRIMITIVE_TYPE_INT = 73,
JVMTI_PRIMITIVE_TYPE_LONG = 74,
JVMTI_PRIMITIVE_TYPE_FLOAT = 70,
JVMTI_PRIMITIVE_TYPE_DOUBLE = 68,
jvmtiPrimitiveTypeEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiPrimitiveType;
/*
*-----------------------------------------------------------------------------
* JVMTI error codes
*-----------------------------------------------------------------------------
*/
typedef enum jvmtiError {
JVMTI_ERROR_NONE = 0,
JVMTI_ERROR_INVALID_THREAD = 10,
JVMTI_ERROR_INVALID_THREAD_GROUP = 11,
JVMTI_ERROR_INVALID_PRIORITY = 12,
JVMTI_ERROR_THREAD_NOT_SUSPENDED = 13,
JVMTI_ERROR_THREAD_SUSPENDED = 14,
JVMTI_ERROR_THREAD_NOT_ALIVE = 15,
JVMTI_ERROR_INVALID_OBJECT = 20,
JVMTI_ERROR_INVALID_CLASS = 21,
JVMTI_ERROR_CLASS_NOT_PREPARED = 22,
JVMTI_ERROR_INVALID_METHODID = 23,
JVMTI_ERROR_INVALID_LOCATION = 24,
JVMTI_ERROR_INVALID_FIELDID = 25,
JVMTI_ERROR_INVALID_MODULE = 26,
JVMTI_ERROR_NO_MORE_FRAMES = 31,
JVMTI_ERROR_OPAQUE_FRAME = 32,
JVMTI_ERROR_TYPE_MISMATCH = 34,
JVMTI_ERROR_INVALID_SLOT = 35,
JVMTI_ERROR_DUPLICATE = 40,
JVMTI_ERROR_NOT_FOUND = 41,
JVMTI_ERROR_INVALID_MONITOR = 50,
JVMTI_ERROR_NOT_MONITOR_OWNER = 51,
JVMTI_ERROR_INTERRUPT = 52,
JVMTI_ERROR_INVALID_CLASS_FORMAT = 60,
JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION = 61,
JVMTI_ERROR_FAILS_VERIFICATION = 62,
JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED = 63,
JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED = 64,
JVMTI_ERROR_INVALID_TYPESTATE = 65,
JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED = 66,
JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED = 67,
JVMTI_ERROR_UNSUPPORTED_VERSION = 68,
JVMTI_ERROR_NAMES_DONT_MATCH = 69,
JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED = 70,
JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED = 71,
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1,
[ JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED = 72,], [dnl])
ifelse(eval(JAVA_SPEC_VERSION >= 19), 1,
[ JVMTI_ERROR_UNSUPPORTED_OPERATION = 73,], [dnl])
JVMTI_ERROR_UNMODIFIABLE_CLASS = 79,
JVMTI_ERROR_UNMODIFIABLE_MODULE = 80,
JVMTI_ERROR_NOT_AVAILABLE = 98,
JVMTI_ERROR_MUST_POSSESS_CAPABILITY = 99,
JVMTI_ERROR_NULL_POINTER = 100,
JVMTI_ERROR_ABSENT_INFORMATION = 101,
JVMTI_ERROR_INVALID_EVENT_TYPE = 102,
JVMTI_ERROR_ILLEGAL_ARGUMENT = 103,
JVMTI_ERROR_NATIVE_METHOD = 104,
JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED = 106,
JVMTI_ERROR_OUT_OF_MEMORY = 110,
JVMTI_ERROR_ACCESS_DENIED = 111,
JVMTI_ERROR_WRONG_PHASE = 112,
JVMTI_ERROR_INTERNAL = 113,
JVMTI_ERROR_UNATTACHED_THREAD = 115,
JVMTI_ERROR_INVALID_ENVIRONMENT = 116,
JVMTI_ERROR_MAX = 116,
jvmtiErrorEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiError;
/*
*-----------------------------------------------------------------------------
* JVMTI base types
*-----------------------------------------------------------------------------
*/
typedef jobject jthread;
typedef jobject jthreadGroup;
typedef jlong jlocation;
/* hidden type */
struct _jrawMonitorID;
typedef struct _jrawMonitorID *jrawMonitorID;
typedef struct JNINativeInterface_ jniNativeInterface;
struct _jvmtiEnv;
struct JVMTINativeInterface_;
#ifdef __cplusplus
typedef _jvmtiEnv jvmtiEnv;
#else
typedef const struct JVMTINativeInterface_ *jvmtiEnv;
#endif
typedef void (JNICALL *jvmtiExtensionEvent)
(jvmtiEnv *jvmti_env, ...);
typedef jvmtiError (JNICALL *jvmtiExtensionFunction)
(jvmtiEnv *jvmti_env, ...);
typedef jvmtiIterationControl (JNICALL *jvmtiHeapObjectCallback)
(jlong class_tag, jlong size, jlong *tag_ptr,
void *user_data);
typedef jvmtiIterationControl (JNICALL *jvmtiHeapRootCallback)
(jvmtiHeapRootKind root_kind,
jlong class_tag, jlong size, jlong *tag_ptr,
void *user_data);
typedef jvmtiIterationControl (JNICALL *jvmtiObjectReferenceCallback)
(jvmtiObjectReferenceKind reference_kind,
jlong class_tag, jlong size, jlong *tag_ptr,
jlong referrer_tag, jint referrer_index,
void *user_data);
typedef jvmtiIterationControl (JNICALL *jvmtiStackReferenceCallback)
(jvmtiHeapRootKind root_kind,
jlong class_tag, jlong size, jlong *tag_ptr,
jlong thread_tag, jint depth, jmethodID method, jint slot,
void *user_data);
typedef void (JNICALL *jvmtiStartFunction)
(jvmtiEnv *jvmti_env, JNIEnv *jni_env, void *arg);
typedef struct jvmtiFrameInfo {
jmethodID method;
jlocation location;
} jvmtiFrameInfo;
typedef struct jvmtiStackInfo {
jthread thread;
jint state;
jvmtiFrameInfo *frame_buffer;
jint frame_count;
} jvmtiStackInfo;
typedef struct jvmtiAddrLocationMap {
const void *start_address;
jlocation location;
} jvmtiAddrLocationMap;
typedef struct {
unsigned int can_tag_objects : 1;
unsigned int can_generate_field_modification_events : 1;
unsigned int can_generate_field_access_events : 1;
unsigned int can_get_bytecodes : 1;
unsigned int can_get_synthetic_attribute : 1;
unsigned int can_get_owned_monitor_info : 1;
unsigned int can_get_current_contended_monitor : 1;
unsigned int can_get_monitor_info : 1;
unsigned int can_pop_frame : 1;
unsigned int can_redefine_classes : 1;
unsigned int can_signal_thread : 1;
unsigned int can_get_source_file_name : 1;
unsigned int can_get_line_numbers : 1;
unsigned int can_get_source_debug_extension : 1;
unsigned int can_access_local_variables : 1;
unsigned int can_maintain_original_method_order : 1;
unsigned int can_generate_single_step_events : 1;
unsigned int can_generate_exception_events : 1;
unsigned int can_generate_frame_pop_events : 1;
unsigned int can_generate_breakpoint_events : 1;
unsigned int can_suspend : 1;
unsigned int can_redefine_any_class : 1;
unsigned int can_get_current_thread_cpu_time : 1;
unsigned int can_get_thread_cpu_time : 1;
unsigned int can_generate_method_entry_events : 1;
unsigned int can_generate_method_exit_events : 1;
unsigned int can_generate_all_class_hook_events : 1;
unsigned int can_generate_compiled_method_load_events : 1;
unsigned int can_generate_monitor_events : 1;
unsigned int can_generate_vm_object_alloc_events : 1;
unsigned int can_generate_native_method_bind_events : 1;
unsigned int can_generate_garbage_collection_events : 1;
unsigned int can_generate_object_free_events : 1;
unsigned int can_force_early_return : 1;
unsigned int can_get_owned_monitor_stack_depth_info : 1;
unsigned int can_get_constant_pool : 1;
unsigned int can_set_native_method_prefix : 1;
unsigned int can_retransform_classes : 1;
unsigned int can_retransform_any_class : 1;
unsigned int can_generate_resource_exhaustion_heap_events : 1;
unsigned int can_generate_resource_exhaustion_threads_events : 1;
ifelse(eval(JAVA_SPEC_VERSION >= 9), 1,
[ unsigned int can_generate_early_vmstart : 1;
unsigned int can_generate_early_class_hook_events : 1;
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1,
[ unsigned int can_generate_sampled_object_alloc_events : 1;
ifelse(eval(JAVA_SPEC_VERSION >= 19), 1,
[ unsigned int can_support_virtual_threads : 1;
unsigned int : 3;],
[ unsigned int : 4;])],
[ unsigned int : 5;])],
[ unsigned int : 7;])
unsigned int : 16;
unsigned int : 16;
unsigned int : 16;
unsigned int : 16;
unsigned int : 16;
} jvmtiCapabilities;
typedef struct jvmtiClassDefinition {
jclass klass;
jint class_byte_count;
const unsigned char *class_bytes;
} jvmtiClassDefinition;
typedef struct jvmtiParamInfo {
char *name;
jvmtiParamKind kind;
jvmtiParamTypes base_type;
jboolean null_ok;
} jvmtiParamInfo;
typedef struct jvmtiExtensionEventInfo {
jint extension_event_index;
char *id;
char *short_description;
jint param_count;
jvmtiParamInfo *params;
} jvmtiExtensionEventInfo;
typedef struct jvmtiExtensionFunctionInfo {
jvmtiExtensionFunction func;
char *id;
char *short_description;
jint param_count;
jvmtiParamInfo *params;
jint error_count;
jvmtiError *errors;
} jvmtiExtensionFunctionInfo;
typedef struct jvmtiLineNumberEntry {
jlocation start_location;
jint line_number;
} jvmtiLineNumberEntry;
typedef struct jvmtiLocalVariableEntry {
jlocation start_location;
jint length;
char *name;
char *signature;
char *generic_signature;
jint slot;
} jvmtiLocalVariableEntry;
typedef struct jvmtiMonitorUsage {
jthread owner;
jint entry_count;
jint waiter_count;
jthread *waiters;
jint notify_waiter_count;
jthread *notify_waiters;
} jvmtiMonitorUsage;
typedef struct jvmtiThreadGroupInfo {
jthreadGroup parent;
char *name;
jint max_priority;
jboolean is_daemon;
} jvmtiThreadGroupInfo;
typedef struct jvmtiThreadInfo {
char *name;
jint priority;
jboolean is_daemon;
jthreadGroup thread_group;
jobject context_class_loader;
} jvmtiThreadInfo;
typedef struct jvmtiTimerInfo {
jlong max_value;
jboolean may_skip_forward;
jboolean may_skip_backward;
jvmtiTimerKind kind;
jlong reserved1;
jlong reserved2;
} jvmtiTimerInfo;
typedef struct jvmtiMonitorStackDepthInfo {
jobject monitor;
jint stack_depth;
} jvmtiMonitorStackDepthInfo;
typedef struct jvmtiHeapReferenceInfoField {
jint index;
} jvmtiHeapReferenceInfoField;
typedef struct jvmtiHeapReferenceInfoArray {
jint index;
} jvmtiHeapReferenceInfoArray;
typedef struct jvmtiHeapReferenceInfoConstantPool {
jint index;
} jvmtiHeapReferenceInfoConstantPool;
typedef struct jvmtiHeapReferenceInfoStackLocal {
jlong thread_tag;
jlong thread_id;
jint depth;
jmethodID method;
jlocation location;
jint slot;
} jvmtiHeapReferenceInfoStackLocal;
typedef struct jvmtiHeapReferenceInfoJniLocal {
jlong thread_tag;
jlong thread_id;
jint depth;
jmethodID method;
} jvmtiHeapReferenceInfoJniLocal;
typedef struct jvmtiHeapReferenceInfoReserved {
jlong reserved1;
jlong reserved2;
jlong reserved3;
jlong reserved4;
jlong reserved5;
jlong reserved6;
jlong reserved7;
jlong reserved8;
} jvmtiHeapReferenceInfoReserved;
typedef union {
jvmtiHeapReferenceInfoField field;
jvmtiHeapReferenceInfoArray array;
jvmtiHeapReferenceInfoConstantPool constant_pool;
jvmtiHeapReferenceInfoStackLocal stack_local;
jvmtiHeapReferenceInfoJniLocal jni_local;
jvmtiHeapReferenceInfoReserved other;
} jvmtiHeapReferenceInfo;
typedef jint (JNICALL *jvmtiHeapIterationCallback)
(jlong class_tag,
jlong size,
jlong *tag_ptr,
jint length,
void *user_data);
typedef jint (JNICALL *jvmtiHeapReferenceCallback)
(jvmtiHeapReferenceKind reference_kind,
const jvmtiHeapReferenceInfo *referrer_info,
jlong class_tag,
jlong referrer_class_tag,
jlong size,
jlong *tag_ptr,
jlong *referrer_tag_ptr,
jint length,
void *user_data);
typedef jint (JNICALL *jvmtiPrimitiveFieldCallback)
(jvmtiHeapReferenceKind reference_kind,
const jvmtiHeapReferenceInfo *referrer_info,
jlong class_tag,
jlong *tag_ptr,
jvalue value,
jvmtiPrimitiveType value_type,
void *user_data);
typedef jint (JNICALL *jvmtiArrayPrimitiveValueCallback)
(jlong class_tag,
jlong size,
jlong *tag_ptr,
jint element_count,
jvmtiPrimitiveType element_type,
const void *elements,
void *user_data);
typedef jint (JNICALL *jvmtiStringPrimitiveValueCallback)
(jlong class_tag,
jlong size,
jlong *tag_ptr,
const jchar *value,
jint value_length,
void *user_data);
typedef jint (JNICALL *jvmtiReservedCallback)
();
/*
* JVMTI Heap 1.1 Callbacks
*/
typedef struct {
jvmtiHeapIterationCallback heap_iteration_callback;
jvmtiHeapReferenceCallback heap_reference_callback;
jvmtiPrimitiveFieldCallback primitive_field_callback;
jvmtiArrayPrimitiveValueCallback array_primitive_value_callback;
jvmtiStringPrimitiveValueCallback string_primitive_value_callback;
jvmtiReservedCallback reserved5;
jvmtiReservedCallback reserved6;
jvmtiReservedCallback reserved7;
jvmtiReservedCallback reserved8;
jvmtiReservedCallback reserved9;
jvmtiReservedCallback reserved10;
jvmtiReservedCallback reserved11;
jvmtiReservedCallback reserved12;
jvmtiReservedCallback reserved13;
jvmtiReservedCallback reserved14;
jvmtiReservedCallback reserved15;
} jvmtiHeapCallbacks;
/*
*-----------------------------------------------------------------------------
* JVMTI events
*-----------------------------------------------------------------------------
*/
typedef enum jvmtiEvent {
JVMTI_MIN_EVENT_TYPE_VAL = 50,
JVMTI_EVENT_VM_INIT = 50,
JVMTI_EVENT_VM_DEATH = 51,
JVMTI_EVENT_THREAD_START = 52,
JVMTI_EVENT_THREAD_END = 53,
JVMTI_EVENT_CLASS_FILE_LOAD_HOOK = 54,
JVMTI_EVENT_CLASS_LOAD = 55,
JVMTI_EVENT_CLASS_PREPARE = 56,
JVMTI_EVENT_VM_START = 57,
JVMTI_EVENT_EXCEPTION = 58,
JVMTI_EVENT_EXCEPTION_CATCH = 59,
JVMTI_EVENT_SINGLE_STEP = 60,
JVMTI_EVENT_FRAME_POP = 61,
JVMTI_EVENT_BREAKPOINT = 62,
JVMTI_EVENT_FIELD_ACCESS = 63,
JVMTI_EVENT_FIELD_MODIFICATION = 64,
JVMTI_EVENT_METHOD_ENTRY = 65,
JVMTI_EVENT_METHOD_EXIT = 66,
JVMTI_EVENT_NATIVE_METHOD_BIND = 67,
JVMTI_EVENT_COMPILED_METHOD_LOAD = 68,
JVMTI_EVENT_COMPILED_METHOD_UNLOAD = 69,
JVMTI_EVENT_DYNAMIC_CODE_GENERATED = 70,
JVMTI_EVENT_DATA_DUMP_REQUEST = 71,
JVMTI_EVENT_MONITOR_WAIT = 73,
JVMTI_EVENT_MONITOR_WAITED = 74,
JVMTI_EVENT_MONITOR_CONTENDED_ENTER = 75,
JVMTI_EVENT_MONITOR_CONTENDED_ENTERED = 76,
JVMTI_EVENT_RESOURCE_EXHAUSTED = 80,
JVMTI_EVENT_GARBAGE_COLLECTION_START = 81,
JVMTI_EVENT_GARBAGE_COLLECTION_FINISH = 82,
JVMTI_EVENT_OBJECT_FREE = 83,
JVMTI_EVENT_VM_OBJECT_ALLOC = 84,
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [ JVMTI_EVENT_SAMPLED_OBJECT_ALLOC = 86,], [dnl])
ifelse(eval(JAVA_SPEC_VERSION >= 19), 1, [ JVMTI_EVENT_VIRTUAL_THREAD_START = 87,], [dnl])
ifelse(eval(JAVA_SPEC_VERSION >= 19), 1, [ JVMTI_EVENT_VIRTUAL_THREAD_END = 88,], [dnl])
ifelse(eval(JAVA_SPEC_VERSION >= 19), 1, [ JVMTI_MAX_EVENT_TYPE_VAL = 88,], [
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [ JVMTI_MAX_EVENT_TYPE_VAL = 86,], [
JVMTI_MAX_EVENT_TYPE_VAL = 84,])])
jvmtiEventEnsureWideEnum = 0x1000000 /* ensure 4-byte enum */
} jvmtiEvent;
/*
*-----------------------------------------------------------------------------
* JVMTI callbacks
*-----------------------------------------------------------------------------
*/
typedef void(JNICALL *jvmtiEventSingleStep)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
jlocation location);
typedef void(JNICALL *jvmtiEventBreakpoint)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
jlocation location);
typedef void(JNICALL *jvmtiEventFieldAccess)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
jlocation location,
jclass field_klass,
jobject object,
jfieldID field);
typedef void(JNICALL *jvmtiEventFieldModification)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
jlocation location,
jclass field_klass,
jobject object,
jfieldID field,
char signature_type,
jvalue new_value);
typedef void(JNICALL *jvmtiEventFramePop)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
jboolean was_popped_by_exception);
typedef void(JNICALL *jvmtiEventMethodEntry)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method);
typedef void(JNICALL *jvmtiEventMethodExit)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
jboolean was_popped_by_exception,
jvalue return_value);
typedef void(JNICALL *jvmtiEventNativeMethodBind)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
void *address,
void **new_address_ptr);
typedef void(JNICALL *jvmtiEventException)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
jlocation location,
jobject exception,
jmethodID catch_method,
jlocation catch_location);
typedef void(JNICALL *jvmtiEventExceptionCatch)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jmethodID method,
jlocation location,
jobject exception);
typedef void(JNICALL *jvmtiEventThreadStart)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread);
typedef void(JNICALL *jvmtiEventThreadEnd)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread);
typedef void(JNICALL *jvmtiEventClassLoad)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jclass klass);
typedef void(JNICALL *jvmtiEventClassPrepare)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jclass klass);
typedef void(JNICALL *jvmtiEventClassFileLoadHook)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jclass class_being_redefined,
jobject loader,
const char *name,
jobject protection_domain,
jint class_data_len,
const unsigned char *class_data,
jint *new_class_data_len,
unsigned char **new_class_data);
typedef void(JNICALL *jvmtiEventVMStart)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env);
typedef void(JNICALL *jvmtiEventVMInit)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread);
typedef void(JNICALL *jvmtiEventVMDeath)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env);
typedef void(JNICALL *jvmtiEventCompiledMethodLoad)(
jvmtiEnv *jvmti_env,
jmethodID method,
jint code_size,
const void *code_addr,
jint map_length,
const jvmtiAddrLocationMap *map,
const void *compile_info);
typedef void(JNICALL *jvmtiEventCompiledMethodUnload)(
jvmtiEnv *jvmti_env,
jmethodID method,
const void *code_addr);
typedef void(JNICALL *jvmtiEventDynamicCodeGenerated)(
jvmtiEnv *jvmti_env,
const char *name,
const void *address,
jint length);
typedef void(JNICALL *jvmtiEventDataDumpRequest)(
jvmtiEnv *jvmti_env);
typedef void(JNICALL *jvmtiEventMonitorContendedEnter)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jobject object);
typedef void(JNICALL *jvmtiEventMonitorContendedEntered)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jobject object);
typedef void(JNICALL *jvmtiEventMonitorWait)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jobject object,
jlong timeout);
typedef void(JNICALL *jvmtiEventMonitorWaited)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jobject object,
jboolean timed_out);
typedef void(JNICALL *jvmtiEventVMObjectAlloc)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jobject object,
jclass object_klass,
jlong size);
typedef void(JNICALL *jvmtiEventObjectFree)(
jvmtiEnv *jvmti_env,
jlong tag);
typedef void(JNICALL *jvmtiEventGarbageCollectionStart)(
jvmtiEnv *jvmti_env);
typedef void(JNICALL *jvmtiEventGarbageCollectionFinish)(
jvmtiEnv *jvmti_env);
typedef void (JNICALL *jvmtiEventResourceExhausted) (
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jint flags,
const void *reserved,
const char *description);
ifelse(eval(JAVA_SPEC_VERSION >= 11), 1, [typedef void (JNICALL *jvmtiEventSampledObjectAlloc)(
jvmtiEnv *jvmti_env,
JNIEnv *jni_env,
jthread thread,
jobject object,
jclass object_klass,
jlong size);], [dnl])
ifelse(eval(JAVA_SPEC_VERSION >= 19), 1, [typedef void (JNICALL *jvmtiEventVirtualThreadStart)(
jvmtiEnv *jvmti_env,
JNIEnv *env,
jthread vthread);
typedef void (JNICALL *jvmtiEventVirtualThreadEnd)(
jvmtiEnv *jvmti_env,
JNIEnv *env,
jthread vthread);], [dnl])
typedef void *jvmtiEventReserved;
typedef struct {
jvmtiEventVMInit VMInit;
jvmtiEventVMDeath VMDeath;
jvmtiEventThreadStart ThreadStart;
jvmtiEventThreadEnd ThreadEnd;
jvmtiEventClassFileLoadHook ClassFileLoadHook;
jvmtiEventClassLoad ClassLoad;
jvmtiEventClassPrepare ClassPrepare;
jvmtiEventVMStart VMStart;
jvmtiEventException Exception;
jvmtiEventExceptionCatch ExceptionCatch;
jvmtiEventSingleStep SingleStep;
jvmtiEventFramePop FramePop;
jvmtiEventBreakpoint Breakpoint;
jvmtiEventFieldAccess FieldAccess;