Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/jdk17u
Path: blob/master/src/hotspot/share/prims/jvmti.xml
64441 views
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>
3
<!--
4
Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved.
5
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
7
This code is free software; you can redistribute it and/or modify it
8
under the terms of the GNU General Public License version 2 only, as
9
published by the Free Software Foundation.
10
11
This code is distributed in the hope that it will be useful, but WITHOUT
12
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
version 2 for more details (a copy is included in the LICENSE file that
15
accompanied this code).
16
17
You should have received a copy of the GNU General Public License version
18
2 along with this work; if not, write to the Free Software Foundation,
19
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
or visit www.oracle.com if you need additional information or have any
23
questions.
24
-->
25
26
<!DOCTYPE specification [
27
<!ELEMENT specification (title, intro*, functionsection, errorsection,
28
eventsection, datasection, issuessection, changehistory)>
29
<!ATTLIST specification label CDATA #REQUIRED>
30
31
<!ELEMENT title (#PCDATA|jvmti|tm)*>
32
<!ATTLIST title subtitle CDATA #REQUIRED>
33
34
<!ELEMENT intro ANY>
35
<!ATTLIST intro id CDATA #IMPLIED
36
label CDATA "">
37
38
<!ELEMENT functionsection (intro*, category*)>
39
<!ATTLIST functionsection label CDATA #REQUIRED>
40
41
<!ELEMENT category ((intro|typedef|uniontypedef|capabilitiestypedef)*,
42
(function|callback|elide)*)>
43
<!ATTLIST category id CDATA #REQUIRED
44
label CDATA #REQUIRED>
45
46
<!ELEMENT function (synopsis, typedef*, description?, origin,
47
(capabilities|eventcapabilities),
48
parameters, errors)>
49
<!ATTLIST function id CDATA #REQUIRED
50
num CDATA #REQUIRED
51
phase (onload|onloadOnly|start|live|any) #IMPLIED
52
callbacksafe (safe|unsafe) #IMPLIED
53
impl CDATA #IMPLIED
54
hide CDATA #IMPLIED
55
jkernel (yes|no) #IMPLIED
56
since CDATA "1.0">
57
58
<!ELEMENT callback ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|
59
jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void),
60
synopsis, description?, parameters)>
61
<!ATTLIST callback id CDATA #REQUIRED
62
since CDATA "1.0">
63
64
<!ELEMENT synopsis (#PCDATA|jvmti)*>
65
66
<!ELEMENT typedef (description?, field*)>
67
<!ATTLIST typedef id CDATA #REQUIRED
68
label CDATA #REQUIRED
69
since CDATA "1.0">
70
71
<!ELEMENT uniontypedef (description?, field*)>
72
<!ATTLIST uniontypedef id CDATA #REQUIRED
73
label CDATA #REQUIRED
74
since CDATA "1.0">
75
76
<!ELEMENT field ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|
77
jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|allocfieldbuf|inptr|inbuf|outbuf|vmbuf|ptrtype|struct),
78
description)>
79
<!ATTLIST field id CDATA #REQUIRED>
80
81
<!ELEMENT capabilitiestypedef (description?, capabilityfield*)>
82
<!ATTLIST capabilitiestypedef id CDATA #REQUIRED
83
label CDATA #REQUIRED>
84
85
<!ELEMENT capabilityfield (description)>
86
<!ATTLIST capabilityfield id CDATA #REQUIRED
87
disp1 CDATA ""
88
disp2 CDATA ""
89
since CDATA "1.0">
90
91
<!ELEMENT description ANY>
92
93
<!ELEMENT capabilities (required*, capability*)>
94
95
<!ELEMENT eventcapabilities EMPTY>
96
97
<!ELEMENT required ANY>
98
<!ATTLIST required id CDATA #REQUIRED>
99
100
<!ELEMENT capability ANY>
101
<!ATTLIST capability id CDATA #REQUIRED>
102
103
<!ELEMENT parameters (param*)>
104
105
<!ELEMENT param ((jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|jthreadGroup|jobject|
106
jvalue|enum|jint|jlong|jfloat|jdouble|jlocation|jboolean|char|uchar|size_t|void|varargs|struct|ptrtype|
107
outptr|allocbuf|allocallocbuf|inptr|inbuf|outbuf|vmbuf|agentbuf),
108
description)>
109
<!ATTLIST param id CDATA #REQUIRED>
110
111
<!ELEMENT jmethodID EMPTY>
112
<!ATTLIST jmethodID class CDATA #IMPLIED
113
native CDATA #IMPLIED>
114
115
<!ELEMENT jfieldID EMPTY>
116
<!ATTLIST jfieldID class CDATA #IMPLIED>
117
118
<!ELEMENT jclass EMPTY>
119
<!ATTLIST jclass method CDATA #IMPLIED
120
field CDATA #IMPLIED>
121
122
<!ELEMENT jframeID EMPTY>
123
<!ATTLIST jframeID thread CDATA #IMPLIED>
124
125
<!ELEMENT jrawMonitorID EMPTY>
126
127
<!ELEMENT jthread EMPTY>
128
<!ATTLIST jthread started CDATA #IMPLIED
129
null CDATA #IMPLIED
130
frame CDATA #IMPLIED
131
impl CDATA #IMPLIED>
132
133
<!ELEMENT varargs EMPTY>
134
135
<!ELEMENT jthreadGroup EMPTY>
136
<!ELEMENT jobject EMPTY>
137
<!ELEMENT jvalue EMPTY>
138
<!ELEMENT jchar EMPTY>
139
<!ELEMENT jint EMPTY>
140
<!ATTLIST jint min CDATA #IMPLIED>
141
<!ELEMENT jlong EMPTY>
142
<!ELEMENT jfloat EMPTY>
143
<!ELEMENT jdouble EMPTY>
144
<!ELEMENT jlocation EMPTY>
145
<!ELEMENT jboolean EMPTY>
146
<!ELEMENT char EMPTY>
147
<!ELEMENT uchar EMPTY>
148
<!ELEMENT size_t EMPTY>
149
<!ELEMENT void EMPTY>
150
<!ELEMENT enum (#PCDATA)*>
151
<!ELEMENT struct (#PCDATA)*>
152
153
<!ELEMENT nullok ANY>
154
155
<!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
156
jthreadGroup|jobject|jvalue), nullok?)>
157
158
<!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
159
jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|
160
jlocation|jboolean|char|uchar|size_t|void), nullok?)>
161
162
<!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
163
jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
164
jlocation|jboolean|char|uchar|size_t|void), nullok?)>
165
<!ATTLIST allocbuf incount CDATA #IMPLIED
166
outcount CDATA #IMPLIED>
167
168
<!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
169
jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
170
jlocation|jboolean|char|uchar|size_t|void), nullok?)>
171
<!ATTLIST allocallocbuf incount CDATA #IMPLIED
172
outcount CDATA #IMPLIED>
173
174
<!ELEMENT inptr (struct, nullok?)>
175
176
<!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
177
jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
178
jlocation|jboolean|char|uchar|size_t|void), nullok?)>
179
<!ATTLIST inbuf incount CDATA #IMPLIED>
180
181
<!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
182
jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
183
jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)>
184
<!ATTLIST outbuf incount CDATA #IMPLIED
185
outcount CDATA #IMPLIED>
186
187
<!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
188
jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|
189
jlocation|jboolean|char|uchar|size_t|void), nullok?)>
190
<!ATTLIST vmbuf incount CDATA #IMPLIED
191
outcount CDATA #IMPLIED>
192
193
<!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
194
jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
195
jlocation|jboolean|char|uchar|size_t|void), nullok?)>
196
<!ATTLIST agentbuf incount CDATA #IMPLIED
197
outcount CDATA #IMPLIED>
198
199
<!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
200
jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
201
jlocation|jboolean|char|uchar|size_t|void))>
202
<!ATTLIST allocfieldbuf outcount CDATA #IMPLIED>
203
204
<!ELEMENT errors (error*)>
205
206
<!ELEMENT error ANY>
207
<!ATTLIST error id CDATA #REQUIRED>
208
209
<!ELEMENT errorsection (intro*, errorcategory*)>
210
<!ATTLIST errorsection label CDATA #REQUIRED>
211
212
<!ELEMENT errorcategory (intro*, errorid*)>
213
<!ATTLIST errorcategory id CDATA #REQUIRED
214
label CDATA #REQUIRED>
215
216
<!ELEMENT errorid ANY>
217
<!ATTLIST errorid id CDATA #REQUIRED
218
num CDATA #REQUIRED>
219
220
<!ELEMENT datasection (intro*, basetypes*)>
221
222
<!ELEMENT basetypes (intro*, basetype*)>
223
<!ATTLIST basetypes id CDATA #REQUIRED
224
label CDATA #REQUIRED>
225
226
<!ELEMENT basetype (definition?,description)>
227
<!ATTLIST basetype id CDATA #REQUIRED
228
name CDATA #IMPLIED>
229
230
<!ELEMENT definition (#PCDATA|jvmti)*>
231
232
<!ELEMENT eventsection (intro*, (event|elide)*)>
233
<!ATTLIST eventsection label CDATA #REQUIRED>
234
235
<!ELEMENT event (description, origin, typedef*, capabilities, parameters)>
236
<!ATTLIST event id CDATA #REQUIRED
237
label CDATA #REQUIRED
238
const CDATA #REQUIRED
239
num CDATA #REQUIRED
240
phase (onload|start|live|any) #IMPLIED
241
filtered (thread|global) #IMPLIED
242
since CDATA "1.0">
243
244
<!ELEMENT issuessection (intro*)>
245
<!ATTLIST issuessection label CDATA #REQUIRED>
246
247
<!ELEMENT changehistory (intro*, change*)>
248
<!ATTLIST changehistory update CDATA #REQUIRED
249
id CDATA #REQUIRED>
250
251
<!ELEMENT change ANY>
252
<!ATTLIST change date CDATA #REQUIRED
253
version CDATA #IMPLIED>
254
255
<!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*>
256
<!ATTLIST functionlink id CDATA #REQUIRED>
257
258
<!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*>
259
<!ATTLIST datalink id CDATA #REQUIRED>
260
261
<!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*>
262
<!ATTLIST typelink id CDATA #REQUIRED>
263
264
<!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*>
265
<!ATTLIST fieldlink id CDATA #REQUIRED
266
struct CDATA #REQUIRED>
267
268
<!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*>
269
<!ATTLIST paramlink id CDATA #REQUIRED>
270
271
<!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*>
272
<!ATTLIST eventlink id CDATA #REQUIRED>
273
274
<!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*>
275
<!ATTLIST errorlink id CDATA #REQUIRED>
276
277
<!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*>
278
<!ATTLIST externallink id CDATA #REQUIRED>
279
280
<!ELEMENT vmspec EMPTY>
281
<!ATTLIST vmspec chapter CDATA #IMPLIED>
282
283
<!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*>
284
<!ATTLIST internallink id CDATA #REQUIRED>
285
286
<!ELEMENT functionphaselist EMPTY>
287
<!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED>
288
289
<!ELEMENT eventphaselist EMPTY>
290
<!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED>
291
292
<!ELEMENT issue ANY>
293
294
<!ELEMENT rationale ANY>
295
296
<!ELEMENT todo ANY>
297
298
<!ELEMENT origin (#PCDATA)*>
299
300
<!ELEMENT elide (intro|function|callback|event)*>
301
<!ATTLIST elide why CDATA #IMPLIED>
302
303
<!ELEMENT constants (constant*)>
304
<!ATTLIST constants id CDATA #REQUIRED
305
label CDATA #REQUIRED
306
kind (enum|bits|const) #REQUIRED
307
since CDATA "1.0">
308
309
<!ELEMENT constant ANY>
310
<!ATTLIST constant id CDATA #REQUIRED
311
num CDATA #REQUIRED>
312
313
<!ELEMENT tm (#PCDATA)>
314
315
<!ELEMENT i (#PCDATA|jvmti|tm)*>
316
317
<!ELEMENT b (#PCDATA|jvmti|code)*>
318
319
<!ELEMENT code (#PCDATA|space)*>
320
321
<!ELEMENT pre ANY>
322
323
<!ELEMENT space EMPTY>
324
325
<!ELEMENT jvmti EMPTY>
326
327
<!ELEMENT example (#PCDATA|i)*>
328
329
<!ELEMENT br EMPTY>
330
331
<!ELEMENT p EMPTY>
332
333
<!ELEMENT blockquote ANY>
334
335
<!ELEMENT dl (dt|dd)+>
336
337
<!ELEMENT dd ANY>
338
339
<!ELEMENT dt (#PCDATA|jvmti|code|i|b)*>
340
341
<!ELEMENT table (tr)+>
342
343
<!ELEMENT tr (td|th)*>
344
<!ATTLIST tr class CDATA #IMPLIED>
345
346
<!ELEMENT td ANY>
347
<!ATTLIST td class CDATA #IMPLIED>
348
349
<!ELEMENT th ANY>
350
<!ATTLIST th class CDATA #IMPLIED
351
scope (col|row) #IMPLIED>
352
353
<!ELEMENT ul (li)+>
354
<!ATTLIST ul type (disc|circle|square) "disc">
355
356
<!ELEMENT li ANY>
357
]>
358
359
<specification label="JVM(TM) Tool Interface">
360
<title subtitle="Version">
361
<tm>JVM</tm> Tool Interface
362
</title>
363
364
<intro id="whatIs" label="What is the JVM Tool Interface?">
365
The <tm>JVM</tm> Tool Interface (<jvmti/>)
366
is a programming interface used by development and monitoring tools.
367
It provides both a way to inspect the state and
368
to control the execution of applications running in the
369
<tm>Java</tm> virtual machine (VM).
370
<p/>
371
<jvmti/> is intended to provide a VM interface for the full breadth of tools
372
that need access to VM state, including but not limited to: profiling,
373
debugging, monitoring, thread analysis, and coverage analysis tools.
374
<p/>
375
<jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual
376
machine.
377
<p/>
378
<jvmti/> is a two-way interface.
379
A client of <jvmti/>, hereafter called an <i>agent</i>,
380
can be notified of
381
interesting occurrences through <internallink id="EventSection">events</internallink>.
382
<jvmti/>
383
can query and control the application through many
384
<internallink id="FunctionSection">functions</internallink>,
385
either in response to events or
386
independent of them.
387
<p/>
388
Agents run in the same process with and communicate directly with
389
the virtual machine executing
390
the application being examined. This communication is
391
through a native interface (<jvmti/>). The native in-process interface allows
392
maximal control with minimal intrusion on the part of a tool.
393
Typically, agents are relatively compact. They can be controlled
394
by a separate process which implements the bulk of a tool's
395
function without interfering with the target application's normal execution.
396
</intro>
397
398
<intro id="architecture" label="Architecture">
399
Tools can be written directly to <jvmti/> or indirectly
400
through higher level interfaces.
401
The Java Platform Debugger Architecture includes <jvmti/>, but also
402
contains higher-level, out-of-process debugger interfaces. The higher-level
403
interfaces are more appropriate than <jvmti/> for many tools.
404
For more information on the Java Platform Debugger Architecture,
405
see the
406
<externallink id="jpda/architecture.html">Java
407
Platform Debugger Architecture website</externallink>.
408
</intro>
409
410
<intro id="writingAgents" label="Writing Agents">
411
Agents can be written in any native language that supports C
412
language calling conventions and C or C++
413
definitions.
414
<p/>
415
The function, event, data type, and constant definitions needed for
416
using <jvmti/> are defined in the include file <code>jvmti.h</code>.
417
To use these definitions add the <tm>J2SE</tm> include directory
418
to your include path and add
419
<example>
420
#include &lt;jvmti.h&gt;
421
</example>
422
to your source code.
423
</intro>
424
425
<intro id="deployingAgents" label="Deploying Agents">
426
An agent is deployed in a platform specific manner but is typically the
427
platform equivalent of a dynamic library. On the <tm>Windows</tm> operating
428
system, for example, an agent library is a "Dynamic Linked Library" (DLL).
429
On <tm>Linux</tm> Operating Environment, an agent library is a shared object
430
(<code>.so</code> file).
431
<p/>
432
433
An agent may be started at VM startup by specifying the agent library
434
name using a <internallink id="starting">command line option</internallink>.
435
Some implementations may support a mechanism to <internallink id="onattach">
436
start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>.
437
The details of how this is initiated are implementation specific.
438
</intro>
439
440
<intro id="entryPoint" label="Statically Linked Agents (since version 1.2.3)">
441
442
A native JVMTI Agent may be <i>statically linked</i> with the VM.
443
The manner in which the library and VM image are combined is
444
implementation-dependent.
445
An agent L whose image has been combined with the VM is defined as
446
<i>statically linked</i> if and only if the agent exports a function
447
called Agent_OnLoad_L.
448
<p/>
449
If a <i>statically linked</i> agent L exports a function called
450
Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad
451
function will be ignored.
452
If an agent L is <i>statically linked</i>, an Agent_OnLoad_L
453
function will be invoked with the same arguments and expected return
454
value as specified for the Agent_OnLoad function.
455
An agent L that is <i>statically linked</i> will prohibit an agent of
456
the same name from being loaded dynamically.
457
<p/>
458
The VM will invoke the Agent_OnUnload_L function of the agent, if such
459
a function is exported, at the same point during VM execution as it would
460
have called the dynamic entry point Agent_OnUnLoad. A statically loaded
461
agent cannot be unloaded. The Agent_OnUnload_L function will still be
462
called to do any other agent shutdown related tasks.
463
If a <i>statically linked</i> agent L exports a function called
464
Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad
465
function will be ignored.
466
<p/>
467
If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function
468
will be invoked with the same arguments and expected return value as
469
specified for the Agent_OnAttach function.
470
If a <i>statically linked</i> agent L exports a function called
471
Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach
472
function will be ignored.
473
</intro>
474
475
<intro id="starting" label="Agent Command Line Options">
476
The term "command-line option" is used below to
477
mean options supplied in the <code>JavaVMInitArgs</code> argument
478
to the <code>JNI_CreateJavaVM</code> function of the JNI
479
Invocation API.
480
<p/>
481
One of the two following
482
command-line options is used on VM startup to
483
properly load and run agents.
484
These arguments identify the library containing
485
the agent as well as an options
486
string to be passed in at startup.
487
<dl>
488
<dt><code>-agentlib:</code><i>&lt;agent-lib-name&gt;</i><code>=</code><i>&lt;options&gt;</i></dt>
489
<dd>
490
The name following <code>-agentlib:</code> is the name of the
491
library to load. Lookup of the library, both its full name and location,
492
proceeds in a platform-specific manner.
493
Typically, the <i>&lt;agent-lib-name&gt;</i> is expanded to an
494
operating system specific file name.
495
The <i>&lt;options&gt;</i> will be passed to the agent on start-up.
496
For example, if the option
497
<code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to
498
load the shared library <code>foo.dll</code> from the system <code>PATH</code>
499
under <tm>Windows</tm> or <code>libfoo.so</code> from the
500
<code>LD_LIBRARY_PATH</code> under <tm>Linux</tm>.
501
If the agent library is statically linked into the executable
502
then no actual loading takes place.
503
<p/>
504
</dd>
505
<dt><code>-agentpath:</code><i>&lt;path-to-agent&gt;</i><code>=</code><i>&lt;options&gt;</i></dt>
506
<dd>
507
The path following <code>-agentpath:</code> is the absolute path from which
508
to load the library.
509
No library name expansion will occur.
510
The <i>&lt;options&gt;</i> will be passed to the agent on start-up.
511
For example, if the option
512
<code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to
513
load the shared library <code>c:\myLibs\foo.dll</code>. If the agent
514
library is statically linked into the executable
515
then no actual loading takes place.
516
<p/>
517
</dd>
518
</dl>
519
For a dynamic shared library agent, the start-up routine
520
<internallink id="onload"><code>Agent_OnLoad</code></internallink>
521
in the library will be invoked. If the agent library is statically linked
522
into the executable then the system will attempt to invoke the
523
<code>Agent_OnLoad_&lt;agent-lib-name&gt;</code> entry point where
524
&lt;agent-lib-name&gt; is the basename of the
525
agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>,
526
the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine.
527
<p/>
528
Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code>
529
will be searched for JNI native method implementations to facilitate the
530
use of Java programming language code in tools, as is needed for
531
<internallink id="bci">bytecode instrumentation</internallink>.
532
<p/>
533
The agent libraries will be searched after all other libraries have been
534
searched (agents wishing to override or intercept the native method
535
implementations of non-agent methods can use the
536
<eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>).
537
<p/>
538
These switches do the above and nothing more - they do not change the
539
state of the VM or <jvmti/>. No command line options are needed
540
to enable <jvmti/>
541
or aspects of <jvmti/>, this is handled programmatically
542
by the use of
543
<internallink id="capability">capabilities</internallink>.
544
</intro>
545
546
<intro id="startup" label="Agent Start-Up">
547
The VM starts each agent by invoking a start-up function.
548
If the agent is started in the <code>OnLoad</code>
549
<functionlink id="GetPhase">phase</functionlink> the function
550
<internallink id="onload"><code>Agent_OnLoad</code></internallink>
551
or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink>
552
for statically linked agents will be invoked.
553
If the agent is started in the live
554
<functionlink id="GetPhase">phase</functionlink> the function
555
<internallink id="onattach"><code>Agent_OnAttach</code></internallink>
556
or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink>
557
for statically linked agents will be invoked.
558
Exactly one call to a start-up function is made per agent.
559
</intro>
560
561
<intro id="onload" label="Agent Start-Up (OnLoad phase)">
562
If an agent is started during the <code>OnLoad</code> phase then its
563
agent library must export a start-up function with the following prototype:
564
<example>
565
JNIEXPORT jint JNICALL
566
Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
567
Or for a statically linked agent named 'L':
568
<example>
569
JNIEXPORT jint JNICALL
570
Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example>
571
572
The VM will start the agent by calling this function.
573
It will be called early enough in VM initialization that:
574
<ul>
575
<li><functionlink id="SetSystemProperty">system properties</functionlink>
576
may be set before they have been used in the start-up of the VM</li>
577
<li>the full set of
578
<internallink id="capability">capabilities</internallink>
579
is still available (note that capabilities that configure the VM
580
may only be available at this time--see the
581
<internallink id="capability">Capability function section</internallink>)</li>
582
<li>no bytecodes have executed</li>
583
<li>no classes have been loaded</li>
584
<li>no objects have been created</li>
585
</ul>
586
<p/>
587
The VM will call the <code>Agent_OnLoad</code> or
588
<code>Agent_OnLoad_&lt;agent-lib-name&gt;</code> function with
589
<i>&lt;options&gt;</i> as the second argument -
590
that is, using the command-line option examples,
591
<code>"opt1,opt2"</code> will be passed to the <code>char *options</code>
592
argument of <code>Agent_OnLoad</code>.
593
The <code>options</code> argument is encoded as a
594
<internallink id="mUTF">modified UTF-8</internallink> string.
595
If <i>=&lt;options&gt;</i> is not specified,
596
a zero length string is passed to <code>options</code>.
597
The lifespan of the <code>options</code> string is the
598
<code>Agent_OnLoad</code> or <code>Agent_OnLoad_&lt;agent-lib-name&gt;</code>
599
call. If needed beyond this time the string or parts of the string must
600
be copied.
601
The period between when <code>Agent_OnLoad</code> is called and when it
602
returns is called the <i>OnLoad phase</i>.
603
Since the VM is not initialized during the OnLoad
604
<functionlink id="GetPhase">phase</functionlink>,
605
the set of allowed operations
606
inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the
607
functionality available at this time).
608
The agent can safely process the options and set
609
event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once
610
the VM initialization event is received
611
(that is, the <eventlink id="VMInit">VMInit</eventlink>
612
callback is invoked), the agent
613
can complete its initialization.
614
<rationale>
615
Early startup is required so that agents can set the desired capabilities,
616
many of which must be set before the VM is initialized.
617
In JVMDI, the -Xdebug command-line option provided
618
very coarse-grain control of capabilities.
619
JVMPI implementations use various tricks to provide a single "JVMPI on" switch.
620
No reasonable command-line
621
option could provide the fine-grain of control required to balance needed capabilities vs
622
performance impact.
623
Early startup is also needed so that agents can control the execution
624
environment - modifying the file system and system properties to install
625
their functionality.
626
</rationale>
627
<p/>
628
The return value from <code>Agent_OnLoad</code> or
629
<code>Agent_OnLoad_&lt;agent-lib-name&gt;</code> is used to indicate an error.
630
Any value other than zero indicates an error and causes termination of the VM.
631
</intro>
632
633
<intro id="onattach" label="Agent Start-Up (Live phase)">
634
A VM may support a mechanism that allows agents to be started in the VM during the live
635
<functionlink id="GetPhase">phase</functionlink>. The details of how this is supported,
636
are implementation specific. For example, a tool may use some platform specific mechanism,
637
or implementation specific API, to attach to the running VM, and request it start a given
638
agent.
639
<p/>
640
If an agent is started during the live phase then its agent library
641
must export a start-up function
642
with the following prototype:
643
<example>
644
JNIEXPORT jint JNICALL
645
Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>
646
Or for a statically linked agent named 'L':
647
<example>
648
JNIEXPORT jint JNICALL
649
Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example>
650
651
<p/>
652
The VM will start the agent by calling this function.
653
It will be called in the context of a thread
654
that is attached to the VM. The first argument <i>&lt;vm&gt;</i> is the Java VM.
655
The <i>&lt;options&gt;</i> argument is the startup options provided to the agent.
656
<i>&lt;options&gt;</i> is encoded as a <internallink id="mUTF">modified UTF-8
657
</internallink> string.
658
If startup options were not provided, a zero length string is passed to
659
<code>options</code>. The lifespan of the <code>options</code> string is the
660
<code>Agent_OnAttach</code> or <code>Agent_OnAttach_&lt;agent-lib-name&gt;</code> call.
661
If needed beyond this time the string or parts of the string must be copied.
662
<p/>
663
Note that some <internallink id="capability">capabilities</internallink>
664
may not be available in the live phase.
665
<p/>
666
The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_&lt;agent-lib-name
667
&gt;</code> function initializes the agent and returns a value
668
to the VM to indicate if an error occurred. Any value other than zero indicates an error.
669
An error does not cause the VM to terminate. Instead the VM ignores the error, or takes
670
some implementation specific action -- for example it might print an error to standard error,
671
or record the error in a system log.
672
</intro>
673
674
<intro id="onunload" label="Agent Shutdown">
675
The library may optionally export a
676
shutdown function with the following prototype:
677
<example>
678
JNIEXPORT void JNICALL
679
Agent_OnUnload(JavaVM *vm)</example>
680
Or for a statically linked agent named 'L':
681
<example>
682
JNIEXPORT void JNICALL
683
Agent_OnUnload_L(JavaVM *vm)</example>
684
685
This function will be called by the VM when the library is about to be unloaded.
686
The library will be unloaded (unless it is statically linked into the
687
executable) and this function will be called if some platform specific
688
mechanism causes the unload (an unload mechanism is not specified in this document)
689
or the library is (in effect) unloaded by the termination of the VM.
690
VM termination includes normal termination and VM failure, including start-up failure,
691
but not, of course, uncontrolled shutdown. An implementation may also
692
choose to not call this function if the <code>Agent_OnAttach</code>/
693
<code>Agent_OnAttach_L</code> function reported an error (returned a non-zero value).
694
Note the distinction between this function and the
695
<eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event
696
to be sent, the VM must have run at least to the point of initialization and a valid
697
<jvmti/> environment must exist which has set a callback for VMDeath
698
and enabled the event.
699
None of these are required for <code>Agent_OnUnload</code> or
700
<code>Agent_OnUnload_&lt;agent-lib-name&gt;</code> and this function
701
is also called if the library is unloaded for other reasons.
702
In the case that a VM Death event is sent, it will be sent before this
703
function is called (assuming this function is called due to VM termination).
704
This function can be used to clean-up resources allocated by the agent.
705
</intro>
706
707
<intro id="tooloptions" label="JAVA_TOOL_OPTIONS">
708
Since the command-line cannot always be accessed or modified, for example in embedded VMs
709
or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is
710
provided so that agents may be launched in these cases.
711
<p/>
712
Platforms which support environment variables or other named strings, may support the
713
<code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space
714
boundaries. White-space characters include space, tab, carriage-return, new-line,
715
vertical-tab, and form-feed. Sequences of white-space characters are considered
716
equivalent to a single white-space character. No white-space is included in the options
717
unless quoted. Quoting is as follows:
718
<ul>
719
<li>All characters enclosed between a pair of single quote marks (''), except a single
720
quote, are quoted.</li>
721
<li>Double quote characters have no special meaning inside a pair of single quote marks.</li>
722
<li>All characters enclosed between a pair of double quote marks (""), except a double
723
quote, are quoted.</li>
724
<li>Single quote characters have no special meaning inside a pair of double quote marks.</li>
725
<li>A quoted part can start or end anywhere in the variable.</li>
726
<li>White-space characters have no special meaning when quoted -- they are included in
727
the option like any other character and do not mark white-space boundaries.</li>
728
<li>The pair of quote marks is not included in the option.</li>
729
</ul>
730
<code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied
731
in its <code>JavaVMInitArgs</code> argument. Platforms may disable this feature in cases where security is
732
a concern; for example, the Reference Implementation disables this feature on Unix systems when
733
the effective user or group ID differs from the real ID.
734
This feature is intended to support the initialization of tools -- specifically including the
735
launching of native or Java programming language agents. Multiple tools may wish to use this
736
feature, so the variable should not be overwritten, instead, options should be appended to
737
the variable. Note that since the variable is processed at the time of the JNI Invocation
738
API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled.
739
</intro>
740
741
<intro id="environments" label="Environments">
742
The <jvmti/> specification supports the use of multiple simultaneous
743
<jvmti/> agents.
744
Each agent has its own <jvmti/> environment.
745
That is, the <jvmti/> state is
746
separate for each agent - changes to one environment do not affect the
747
others. The state of a <jvmti/>
748
environment includes:
749
<ul>
750
<li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li>
751
<li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li>
752
<li><internallink id="capability">the capabilities</internallink></li>
753
<li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li>
754
</ul>
755
Although their <jvmti/> state
756
is separate, agents inspect and modify the shared state
757
of the VM, they also share the native environment in which they execute.
758
As such, an agent can perturb the results of other agents or cause them
759
to fail. It is the responsibility of the agent writer to specify the level
760
of compatibility with other agents. <jvmti/> implementations are not capable
761
of preventing destructive interactions between agents. Techniques to reduce
762
the likelihood of these occurrences are beyond the scope of this document.
763
<p/>
764
An agent creates a <jvmti/> environment
765
by passing a <jvmti/> version
766
as the interface ID to the JNI Invocation API function
767
<externallink id="jni/invocation.html#getenv">
768
<code>GetEnv</code></externallink>.
769
See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink>
770
for more details on the creation and use of
771
<jvmti/> environments.
772
Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from
773
<internallink id="onload"><code>Agent_OnLoad</code></internallink>.
774
</intro>
775
776
<intro id="bci" label="Bytecode Instrumentation">
777
This interface does not include some events that one might expect in an interface with
778
profiling support. Some examples include full speed
779
method enter and exit events. The interface instead provides support for
780
<i>bytecode instrumentation</i>, the ability to alter the Java virtual machine
781
bytecode instructions which comprise the target program. Typically, these alterations
782
are to add "events" to the code of a method - for example, to add, at the beginning of a method,
783
a call to <code>MyProfiler.methodEntered()</code>.
784
Since the changes are purely additive, they do not modify application
785
state or behavior.
786
Because the inserted agent code is standard bytecodes, the VM can run at full speed,
787
optimizing not only the target program but also the instrumentation. If the
788
instrumentation does not involve switching from bytecode execution, no expensive
789
state transitions are needed. The result is high performance events.
790
This approach also provides complete control to the agent: instrumentation can be
791
restricted to "interesting" portions of the code (e.g., the end user's code) and
792
can be conditional. Instrumentation can run entirely in Java programming language
793
code or can call into the native agent. Instrumentation can simply maintain
794
counters or can statistically sample events.
795
<p/>
796
Instrumentation can be inserted in one of three ways:
797
<ul>
798
<li>
799
Static Instrumentation: The class file is instrumented before it
800
is loaded into the VM - for example, by creating a duplicate directory of
801
<code>*.class</code> files which have been modified to add the instrumentation.
802
This method is extremely awkward and, in general, an agent cannot know
803
the origin of the class files which will be loaded.
804
</li>
805
<li>
806
Load-Time Instrumentation: When a class file is loaded by the VM, the raw
807
bytes of the class file are sent for instrumentation to the agent.
808
The <eventlink id="ClassFileLoadHook"/>
809
event, triggered by the class load,
810
provides this functionality. This mechanism provides efficient
811
and complete access to one-time instrumentation.
812
</li>
813
<li>
814
Dynamic Instrumentation: A class which is already loaded (and possibly
815
even running) is modified. This optional feature is provided by the
816
<eventlink id="ClassFileLoadHook"/> event, triggered by calling the
817
<functionlink id="RetransformClasses"/> function.
818
Classes can be modified multiple times and can be returned to their
819
original state.
820
The mechanism allows instrumentation which changes during the
821
course of execution.
822
</li>
823
</ul>
824
<p/>
825
The class modification functionality provided in this interface
826
is intended to provide a mechanism for instrumentation
827
(the <eventlink id="ClassFileLoadHook"/> event
828
and the <functionlink id="RetransformClasses"/> function)
829
and, during development, for fix-and-continue debugging
830
(the <functionlink id="RedefineClasses"/> function).
831
<p/>
832
Care must be taken to avoid perturbing dependencies, especially when
833
instrumenting core classes. For example, an approach to getting notification
834
of every object allocation is to instrument the constructor on
835
<code>Object</code>. Assuming that the constructor is initially
836
empty, the constructor could be changed to:
837
<example>
838
public Object() {
839
MyProfiler.allocationTracker(this);
840
}
841
</example>
842
However, if this change was made using the
843
<eventlink id="ClassFileLoadHook"/>
844
event then this might impact a typical VM as follows:
845
the first created object will call the constructor causing a class load of
846
<code>MyProfiler</code>; which will then cause
847
object creation, and since <code>MyProfiler</code> isn't loaded yet,
848
infinite recursion; resulting in a stack overflow. A refinement of this
849
would be to delay invoking the tracking method until a safe time. For
850
example, <code>trackAllocations</code> could be set in the
851
handler for the <code>VMInit</code> event.
852
<example>
853
static boolean trackAllocations = false;
854
855
public Object() {
856
if (trackAllocations) {
857
MyProfiler.allocationTracker(this);
858
}
859
}
860
</example>
861
<p/>
862
The <functionlink id="SetNativeMethodPrefix"/> allows native methods
863
to be instrumented by the use of wrapper methods.
864
</intro>
865
866
<intro id="bcimodules" label="Bytecode Instrumentation of code in modules">
867
Agents can use the functions <functionlink id="AddModuleReads"/>,
868
<functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>,
869
<functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/>
870
to update a module to expand the set of modules that it reads, the set of
871
packages that it exports or opens to other modules, or the services that it
872
uses and provides.
873
<p/>
874
As an aid to agents that deploy supporting classes on the search path of
875
the bootstrap class loader, or the search path of the class loader that
876
loads the main class, the Java virtual machine arranges for the module
877
of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to
878
read the unnamed module of both class loaders.
879
</intro>
880
881
<intro id="mUTF" label="Modified UTF-8 String Encoding">
882
<jvmti/> uses modified UTF-8 to encode character strings.
883
This is the same encoding used by JNI.
884
Modified UTF-8 differs
885
from standard UTF-8 in the representation of supplementary characters
886
and of the null character. See the
887
<externallink id="jni/types.html#modified-utf-8-strings">
888
Modified UTF-8 Strings</externallink>
889
section of the JNI specification for details.
890
</intro>
891
892
<intro id="context" label="Specification Context">
893
Since this interface provides access to the state of applications running in the
894
Java virtual machine;
895
terminology refers to the Java platform and not the native
896
platform (unless stated otherwise). For example:
897
<ul>
898
<li>"thread" means Java programming language thread.</li>
899
<li>"stack frame" means Java virtual machine stack frame.</li>
900
<li>"class" means Java programming language class.</li>
901
<li>"heap" means Java virtual machine heap.</li>
902
<li>"monitor" means Java programming language object monitor.</li>
903
</ul>
904
<p/>
905
Sun, Sun Microsystems, the Sun logo, Java, and JVM
906
are trademarks or registered trademarks of Oracle
907
and/or its affiliates, in the U.S. and other countries.
908
</intro>
909
910
911
<functionsection label="Functions">
912
<intro id="jvmtiEnvAccess" label="Accessing Functions">
913
Native code accesses <jvmti/> features
914
by calling <jvmti/> functions.
915
Access to <jvmti/> functions is by use of an interface pointer
916
in the same manner as
917
<externallink id="jni/design.html">Java
918
Native Interface (JNI) functions</externallink> are accessed.
919
The <jvmti/> interface pointer is called the
920
<i>environment pointer</i>.
921
<p/>
922
An environment pointer is a pointer to an environment and has
923
the type <code>jvmtiEnv*</code>.
924
An environment has information about its <jvmti/> connection.
925
The first value in the environment is a pointer to the function table.
926
The function table is an array of pointers to <jvmti/> functions.
927
Every function pointer is at a predefined offset inside the
928
array.
929
<p/>
930
When used from the C language:
931
double indirection is used to access the functions;
932
the environment pointer provides context and is the first
933
parameter of each function call; for example:
934
<example>
935
jvmtiEnv *jvmti;
936
...
937
jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &amp;class_count, &amp;classes);
938
</example>
939
<p/>
940
When used from the C++ language:
941
functions are accessed as member functions of <code>jvmtiEnv</code>;
942
the environment pointer is not passed to the function call; for example:
943
<example>
944
jvmtiEnv *jvmti;
945
...
946
jvmtiError err = jvmti->GetLoadedClasses(&amp;class_count, &amp;classes);
947
</example>
948
Unless otherwise stated, all examples and declarations in this
949
specification use the C language.
950
<p/>
951
A <jvmti/> environment can be obtained through the JNI Invocation API
952
<code>GetEnv</code> function:
953
<example>
954
jvmtiEnv *jvmti;
955
...
956
(*jvm)->GetEnv(jvm, &amp;jvmti, JVMTI_VERSION_1_0);
957
</example>
958
Each call to <code>GetEnv</code>
959
creates a new <jvmti/> connection and thus
960
a new <jvmti/> environment.
961
The <code>version</code> argument of <code>GetEnv</code> must be
962
a <jvmti/> version.
963
The returned environment may have a different version than the
964
requested version but the returned environment must be compatible.
965
<code>GetEnv</code> will return <code>JNI_EVERSION</code> if a
966
compatible version is not available, if <jvmti/> is not supported or
967
<jvmti/> is not supported in the current VM configuration.
968
Other interfaces may be added for creating <jvmti/> environments
969
in specific contexts.
970
Each environment has its own state (for example,
971
<functionlink id="SetEventNotificationMode">desired events</functionlink>,
972
<functionlink id="SetEventCallbacks">event handling functions</functionlink>, and
973
<functionlink id="AddCapabilities">capabilities</functionlink>).
974
An environment is released with
975
<functionlink id="DisposeEnvironment"></functionlink>.
976
Thus, unlike JNI which has one environment per thread, <jvmti/> environments work
977
across threads and are created dynamically.
978
</intro>
979
980
<intro id="functionReturn" label="Function Return Values">
981
<jvmti/> functions always return an
982
<internallink id="ErrorSection">error code</internallink> via the
983
<datalink id="jvmtiError"/> function return value.
984
Some functions can return additional
985
values through pointers provided by the calling function.
986
In some cases, <jvmti/> functions allocate memory that your program must
987
explicitly deallocate. This is indicated in the individual <jvmti/>
988
function descriptions. Empty lists, arrays, sequences, etc are
989
returned as <code>NULL</code>.
990
<p/>
991
In the event that the <jvmti/> function encounters
992
an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values
993
of memory referenced by argument pointers is undefined, but no memory
994
will have been allocated and no global references will have been allocated.
995
If the error occurs because of invalid input, no action will have occurred.
996
</intro>
997
998
<intro id="refs" label="Managing JNI Object References">
999
<jvmti/> functions identify objects with JNI references
1000
(<datalink id="jobject"/> and <datalink id="jclass"/>)
1001
and their derivatives
1002
(<datalink id="jthread"/> and <datalink id="jthreadGroup"/>).
1003
References passed to
1004
<jvmti/> functions can be either global or local, but they must be
1005
strong references. All references returned by <jvmti/> functions are
1006
local references--these local references are created
1007
during the <jvmti/> call.
1008
Local references are a resource that must be managed (see the
1009
<externallink id="jni/functions.html#local-references">
1010
JNI Documentation</externallink>).
1011
When threads return from native code all local references
1012
are freed. Note that some threads, including typical
1013
agent threads, will never return from native code.
1014
A thread is ensured the ability to create sixteen local
1015
references without the need for any explicit management.
1016
For threads executing a limited number of <jvmti/> calls before
1017
returning from native code
1018
(for example, threads processing events),
1019
it may be determined that no explicit management
1020
is needed.
1021
However, long running agent threads will need explicit
1022
local reference management--usually with the JNI functions
1023
<code>PushLocalFrame</code> and <code>PopLocalFrame</code>.
1024
Conversely, to preserve references beyond the
1025
return from native code, they must be converted to global references.
1026
These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/>
1027
as they are not <datalink id="jobject"/>s.
1028
</intro>
1029
1030
<intro id="prereqState" label="Prerequisite State for Calling Functions">
1031
Unless the function explicitly states that the agent must bring
1032
a thread or the VM to a particular state (for example, suspended),
1033
the <jvmti/> implementation is responsible for bringing the VM to a
1034
safe and consistent state for performing the function.
1035
</intro>
1036
1037
<intro id="functionsExceptions" label="Exceptions and Functions">
1038
<jvmti/> functions never throw exceptions; error conditions are
1039
communicated via the
1040
<internallink id="functionReturn">function return value</internallink>.
1041
Any existing exception state is preserved across a call to a
1042
<jvmti/> function.
1043
See the
1044
<externallink
1045
id="jni/design.html#java-exceptions"
1046
>Java Exceptions</externallink>
1047
section of the JNI specification for information on handling exceptions.
1048
</intro>
1049
1050
<category id="memory" label="Memory Management">
1051
<intro>
1052
These functions provide for the allocation and deallocation of
1053
memory used by <jvmti/> functionality and can be used to provide
1054
working memory for agents.
1055
Memory managed by <jvmti/> is not compatible with other memory
1056
allocation libraries and mechanisms.
1057
</intro>
1058
1059
<function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46">
1060
<synopsis>Allocate</synopsis>
1061
<description>
1062
Allocate an area of memory through the <jvmti/> allocator.
1063
The allocated
1064
memory should be freed with <functionlink id="Deallocate"></functionlink>.
1065
</description>
1066
<origin>jvmdi</origin>
1067
<capabilities>
1068
</capabilities>
1069
<parameters>
1070
<param id="size">
1071
<jlong/>
1072
<description>
1073
The number of bytes to allocate.
1074
<rationale>
1075
<code>jlong</code> is used for compatibility with JVMDI.
1076
</rationale>
1077
</description>
1078
</param>
1079
<param id="mem_ptr">
1080
<allocbuf incount="size"><uchar/></allocbuf>
1081
<description>
1082
On return, a pointer to the beginning of the allocated memory.
1083
If <code>size</code> is zero, <code>NULL</code> is returned.
1084
</description>
1085
</param>
1086
</parameters>
1087
<errors>
1088
<error id="JVMTI_ERROR_OUT_OF_MEMORY">
1089
Memory request cannot be honored.
1090
</error>
1091
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
1092
<paramlink id="size"></paramlink> is less than zero.
1093
</error>
1094
</errors>
1095
</function>
1096
1097
<function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47">
1098
<synopsis>Deallocate</synopsis>
1099
<description>
1100
Deallocate <code>mem</code> using the <jvmti/> allocator.
1101
This function should
1102
be used to deallocate any memory allocated and returned
1103
by a <jvmti/> function
1104
(including memory allocated with <functionlink id="Allocate"></functionlink>).
1105
All allocated memory must be deallocated
1106
or the memory cannot be reclaimed.
1107
</description>
1108
<origin>jvmdi</origin>
1109
<capabilities>
1110
</capabilities>
1111
<parameters>
1112
<param id="mem">
1113
<outbuf>
1114
<uchar/>
1115
<nullok>the call is ignored</nullok>
1116
</outbuf>
1117
<description>
1118
A pointer to the beginning of the allocated memory.
1119
Please ignore "On return, the elements are set."
1120
<todo>keep it from generating "On return, the elements are set"</todo>
1121
</description>
1122
</param>
1123
</parameters>
1124
<errors>
1125
</errors>
1126
</function>
1127
</category>
1128
1129
<category id="threadCategory" label="Thread">
1130
<intro>
1131
</intro>
1132
1133
<function id="GetThreadState" num="17">
1134
<synopsis>Get Thread State</synopsis>
1135
<description>
1136
Get the state of a thread. The state of the thread is represented by the
1137
answers to the hierarchical set of questions below:
1138
<ul type="circle">
1139
<li><i>Alive?</i>
1140
<ul>
1141
<li>Not alive.
1142
<ul type="circle">
1143
<li><i>Why not alive?</i>
1144
<ul>
1145
<li>New.</li>
1146
<li>Terminated (<datalink
1147
id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li>
1148
</ul>
1149
</li>
1150
</ul>
1151
</li>
1152
<li>Alive (<datalink
1153
id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>)
1154
<ul type="circle">
1155
<li><i>Suspended?</i>
1156
<ul>
1157
<li>Suspended (<datalink
1158
id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li>
1159
<li>Not suspended</li>
1160
</ul>
1161
</li>
1162
<li><i>Interrupted?</i>
1163
<ul>
1164
<li>Interrupted (<datalink
1165
id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li>
1166
<li>Not interrupted.</li>
1167
</ul>
1168
</li>
1169
<li><i>In native?</i>
1170
<ul>
1171
<li>In native code (<datalink
1172
id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li>
1173
<li>In Java programming language code</li>
1174
</ul>
1175
</li>
1176
<li><i>What alive state?</i>
1177
<ul>
1178
<li>Runnable (<datalink
1179
id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li>
1180
<li>Blocked (<datalink
1181
id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li>
1182
<li>Waiting (<datalink
1183
id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>)
1184
<ul type="circle">
1185
<li><i>Timed wait?</i>
1186
<ul>
1187
<li>Indefinite (<datalink
1188
id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink></li>
1189
<li>Timed (<datalink
1190
id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li>
1191
</ul>
1192
</li>
1193
<li><i>Why waiting?</i>
1194
<ul>
1195
<li>Object.wait (<datalink
1196
id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li>
1197
<li>LockSupport.park (<datalink
1198
id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li>
1199
<li>Sleeping (<datalink
1200
id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li>
1201
</ul>
1202
</li>
1203
</ul>
1204
</li>
1205
</ul>
1206
</li>
1207
</ul>
1208
</li>
1209
</ul>
1210
</li>
1211
</ul>
1212
<p/>
1213
The answers are represented by the following bit vector.
1214
<constants id="jvmtiThreadState" label="Thread State Flags" kind="bits">
1215
<constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001">
1216
Thread is alive. Zero if thread is new (not started) or terminated.
1217
</constant>
1218
<constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002">
1219
Thread has completed execution.
1220
</constant>
1221
<constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004">
1222
Thread is runnable.
1223
</constant>
1224
<constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400">
1225
Thread is waiting to enter a synchronization block/method or,
1226
after an <code>Object.wait()</code>, waiting to re-enter a
1227
synchronization block/method.
1228
</constant>
1229
<constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080">
1230
Thread is waiting.
1231
</constant>
1232
<constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010">
1233
Thread is waiting without a timeout.
1234
For example, <code>Object.wait()</code>.
1235
</constant>
1236
<constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020">
1237
Thread is waiting with a maximum time to wait specified.
1238
For example, <code>Object.wait(long)</code>.
1239
</constant>
1240
<constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040">
1241
Thread is sleeping -- <code>Thread.sleep(long)</code>.
1242
</constant>
1243
<constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100">
1244
Thread is waiting on an object monitor -- <code>Object.wait</code>.
1245
</constant>
1246
<constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200">
1247
Thread is parked, for example: <code>LockSupport.park</code>,
1248
<code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>.
1249
</constant>
1250
<constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000">
1251
Thread suspended.
1252
<code>java.lang.Thread.suspend()</code>
1253
or a <jvmti/> suspend function
1254
(such as <functionlink id="SuspendThread"></functionlink>)
1255
has been called on the thread. If this bit
1256
is set, the other bits refer to the thread state before suspension.
1257
</constant>
1258
<constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000">
1259
Thread has been interrupted.
1260
</constant>
1261
<constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000">
1262
Thread is in native code--that is, a native method is running
1263
which has not called back into the VM or Java programming
1264
language code.
1265
<p/>
1266
This flag is not set when running VM compiled Java programming
1267
language code nor is it set when running VM code or
1268
VM support code. Native VM interface functions, such as JNI and
1269
<jvmti/> functions, may be implemented as VM code.
1270
</constant>
1271
<constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000">
1272
Defined by VM vendor.
1273
</constant>
1274
<constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000">
1275
Defined by VM vendor.
1276
</constant>
1277
<constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000">
1278
Defined by VM vendor.
1279
</constant>
1280
</constants>
1281
The following definitions are used to convert <jvmti/> thread state
1282
to <code>java.lang.Thread.State</code> style states.
1283
<constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits">
1284
<constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK"
1285
num="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">
1286
Mask the state with this before comparison
1287
</constant>
1288
<constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW"
1289
num="0">
1290
<code>java.lang.Thread.State.NEW</code>
1291
</constant>
1292
<constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED"
1293
num="JVMTI_THREAD_STATE_TERMINATED">
1294
<code>java.lang.Thread.State.TERMINATED</code>
1295
</constant>
1296
<constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE"
1297
num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE">
1298
<code>java.lang.Thread.State.RUNNABLE</code>
1299
</constant>
1300
<constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED"
1301
num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER">
1302
<code>java.lang.Thread.State.BLOCKED</code>
1303
</constant>
1304
<constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING"
1305
num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY">
1306
<code>java.lang.Thread.State.WAITING</code>
1307
</constant>
1308
<constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING"
1309
num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT">
1310
<code>java.lang.Thread.State.TIMED_WAITING</code>
1311
</constant>
1312
</constants>
1313
<b>Rules</b>
1314
<p/>
1315
There can be no more than one answer to a question, although there can be no
1316
answer (because the answer is unknown, does not apply, or none of the answers is
1317
correct). An answer is set only when the enclosing answers match.
1318
That is, no more than one of
1319
<ul type="circle">
1320
<li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li>
1321
<li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li>
1322
<li><code>JVMTI_THREAD_STATE_WAITING</code></li>
1323
</ul>
1324
can be set (a <tm>J2SE</tm> compliant implementation will always set
1325
one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set).
1326
And if any of these are set, the enclosing answer
1327
<code>JVMTI_THREAD_STATE_ALIVE</code> is set.
1328
No more than one of
1329
<ul type="circle">
1330
<li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li>
1331
<li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li>
1332
</ul>
1333
can be set (a <tm>J2SE</tm> compliant implementation will always set
1334
one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set).
1335
And if either is set, the enclosing answers
1336
<code>JVMTI_THREAD_STATE_ALIVE</code> and
1337
<code>JVMTI_THREAD_STATE_WAITING</code> are set.
1338
No more than one of
1339
<ul type="circle">
1340
<li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li>
1341
<li><code>JVMTI_THREAD_STATE_PARKED</code></li>
1342
<li><code>JVMTI_THREAD_STATE_SLEEPING</code></li>
1343
</ul>
1344
can be set. And if any of these is set, the enclosing answers
1345
<code>JVMTI_THREAD_STATE_ALIVE</code> and
1346
<code>JVMTI_THREAD_STATE_WAITING</code> are set.
1347
Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set,
1348
then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set.
1349
If a state <i>A</i> is implemented using the mechanism of
1350
state <i>B</i> then it is state <i>A</i> which
1351
is returned by this function.
1352
For example, if <code>Thread.sleep(long)</code>
1353
is implemented using <code>Object.wait(long)</code>
1354
then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code>
1355
which is returned.
1356
More than one of
1357
<ul type="circle">
1358
<li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li>
1359
<li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li>
1360
<li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li>
1361
</ul>
1362
can be set, but if any is set,
1363
<code>JVMTI_THREAD_STATE_ALIVE</code> is set.
1364
<p/>
1365
And finally,
1366
<code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless
1367
<code>JVMTI_THREAD_STATE_ALIVE</code> is not set.
1368
<p/>
1369
The thread state representation is designed for extension in future versions
1370
of the specification; thread state values should be used accordingly, that is
1371
they should not be used as ordinals.
1372
Most queries can be made by testing a single bit, if use in a switch statement is desired,
1373
the state bits should be masked with the interesting bits.
1374
All bits not defined above are reserved for future use.
1375
A VM, compliant to the current specification, must set reserved bits to zero.
1376
An agent should ignore reserved bits --
1377
they should not be assumed to be zero and thus should not be included in comparisons.
1378
<p/>
1379
<b>Examples</b>
1380
<p/>
1381
Note that the values below exclude reserved and vendor bits.
1382
<p/>
1383
The state of a thread blocked at a <code>synchronized</code>-statement would be:
1384
<example>
1385
JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
1386
</example>
1387
The state of a thread which hasn't started yet would be:
1388
<example>
1389
0
1390
</example>
1391
The state of a thread at a <code>Object.wait(3000)</code> would be:
1392
<example>
1393
JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING +
1394
JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
1395
JVMTI_THREAD_STATE_MONITOR_WAITING
1396
</example>
1397
The state of a thread suspended while runnable would be:
1398
<example>
1399
JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED
1400
</example>
1401
<p/>
1402
<b>Testing the State</b>
1403
<p/>
1404
In most cases, the thread state can be determined by testing the one bit corresponding
1405
to that question. For example, the code to test if a thread is sleeping:
1406
<example>
1407
jint state;
1408
jvmtiError err;
1409
1410
err = (*jvmti)-&gt;GetThreadState(jvmti, thread, &amp;state);
1411
if (err == JVMTI_ERROR_NONE) {
1412
if (state &amp; JVMTI_THREAD_STATE_SLEEPING) { ...
1413
</example>
1414
<p/>
1415
For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be:
1416
<example>
1417
if (state &amp; JVMTI_THREAD_STATE_WAITING) { ...
1418
</example>
1419
For some states, more than one bit will need to be tested as is the case
1420
when testing if a thread has not yet been started:
1421
<example>
1422
if ((state &amp; (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ...
1423
</example>
1424
To distinguish timed from untimed <code>Object.wait</code>:
1425
<example>
1426
if (state &amp; JVMTI_THREAD_STATE_IN_OBJECT_WAIT) {
1427
if (state &amp; JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) {
1428
printf("in Object.wait(long timeout)\n");
1429
} else {
1430
printf("in Object.wait()\n");
1431
}
1432
}
1433
</example>
1434
<p/>
1435
<b>Relationship to <code>java.lang.Thread.State</code></b>
1436
<p/>
1437
The thread state represented by <code>java.lang.Thread.State</code>
1438
returned from <code>java.lang.Thread.getState()</code> is a subset of the
1439
information returned from this function.
1440
The corresponding <code>java.lang.Thread.State</code> can be determined
1441
by using the provided conversion masks.
1442
For example, this returns the name of the <code>java.lang.Thread.State</code> thread state:
1443
<example>
1444
err = (*jvmti)-&gt;GetThreadState(jvmti, thread, &amp;state);
1445
abortOnError(err);
1446
switch (state &amp; JVMTI_JAVA_LANG_THREAD_STATE_MASK) {
1447
case JVMTI_JAVA_LANG_THREAD_STATE_NEW:
1448
return "NEW";
1449
case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED:
1450
return "TERMINATED";
1451
case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE:
1452
return "RUNNABLE";
1453
case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED:
1454
return "BLOCKED";
1455
case JVMTI_JAVA_LANG_THREAD_STATE_WAITING:
1456
return "WAITING";
1457
case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING:
1458
return "TIMED_WAITING";
1459
}
1460
</example>
1461
</description>
1462
<origin>new</origin>
1463
<capabilities>
1464
</capabilities>
1465
<parameters>
1466
<param id="thread">
1467
<jthread null="current" started="maybe" impl="noconvert"/>
1468
<description>
1469
The thread to query.
1470
</description>
1471
</param>
1472
<param id="thread_state_ptr">
1473
<outptr><jint/></outptr>
1474
<description>
1475
On return, points to state flags,
1476
as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>.
1477
</description>
1478
</param>
1479
</parameters>
1480
<errors>
1481
</errors>
1482
</function>
1483
1484
<function id="GetCurrentThread" phase="start" num="18" since="1.1">
1485
<synopsis>Get Current Thread</synopsis>
1486
<description>
1487
Get the current thread.
1488
The current thread is the Java programming language thread which has called the function.
1489
The function may return <code>NULL</code> in the start phase if the
1490
<internallink id="jvmtiCapabilities.can_generate_early_vmstart">
1491
<code>can_generate_early_vmstart</code></internallink> capability is enabled
1492
and the <code>java.lang.Thread</code> class has not been initialized yet.
1493
<p/>
1494
Note that most <jvmti/> functions that take a thread
1495
as an argument will accept <code>NULL</code> to mean
1496
the current thread.
1497
</description>
1498
<origin>new</origin>
1499
<capabilities>
1500
</capabilities>
1501
<parameters>
1502
<param id="thread_ptr">
1503
<outptr><jthread/></outptr>
1504
<description>
1505
On return, points to the current thread, or <code>NULL</code>.
1506
</description>
1507
</param>
1508
</parameters>
1509
<errors>
1510
</errors>
1511
</function>
1512
1513
<function id="GetAllThreads" num="4">
1514
<synopsis>Get All Threads</synopsis>
1515
<description>
1516
Get all live threads.
1517
The threads are Java programming language threads;
1518
that is, threads that are attached to the VM.
1519
A thread is live if <code>java.lang.Thread.isAlive()</code>
1520
would return <code>true</code>, that is, the thread has
1521
been started and has not yet died.
1522
The universe of threads is determined by the context of the <jvmti/>
1523
environment, which typically is all threads attached to the VM.
1524
Note that this includes <jvmti/> agent threads
1525
(see <functionlink id="RunAgentThread"/>).
1526
</description>
1527
<origin>jvmdi</origin>
1528
<capabilities>
1529
</capabilities>
1530
<parameters>
1531
<param id="threads_count_ptr">
1532
<outptr><jint/></outptr>
1533
<description>
1534
On return, points to the number of running threads.
1535
</description>
1536
</param>
1537
<param id="threads_ptr">
1538
<allocbuf outcount="threads_count_ptr"><jthread/></allocbuf>
1539
<description>
1540
On return, points to an array of references, one
1541
for each running thread.
1542
</description>
1543
</param>
1544
</parameters>
1545
<errors>
1546
</errors>
1547
</function>
1548
1549
<function id="SuspendThread" num="5">
1550
<synopsis>Suspend Thread</synopsis>
1551
<description>
1552
Suspend the specified thread. If the calling thread is specified,
1553
this function will not return until some other thread calls
1554
<functionlink id="ResumeThread"></functionlink>.
1555
If the thread is currently suspended, this function
1556
does nothing and returns an error.
1557
</description>
1558
<origin>jvmdi</origin>
1559
<capabilities>
1560
<required id="can_suspend"></required>
1561
</capabilities>
1562
<parameters>
1563
<param id="thread">
1564
<jthread null="current"/>
1565
<description>
1566
The thread to suspend.
1567
</description>
1568
</param>
1569
</parameters>
1570
<errors>
1571
<error id="JVMTI_ERROR_THREAD_SUSPENDED">
1572
Thread already suspended.
1573
</error>
1574
</errors>
1575
</function>
1576
1577
<elide>
1578
<function id="SuspendAllThreads" num="101">
1579
<synopsis>Suspend All Threads</synopsis>
1580
<description>
1581
<issue>
1582
There has been no explicit call for this function, and it will
1583
thus be removed if there is no interest.
1584
</issue>
1585
Suspend all live threads except:
1586
<ul>
1587
<li>already suspended threads</li>
1588
<li>those listed in <paramlink id="except_list"></paramlink></li>
1589
<li>certain system (non application) threads, as determined
1590
by the VM implementation</li>
1591
</ul>
1592
The threads are Java programming language threads;
1593
native threads which are not attached to the VM are not
1594
Java programming language threads.
1595
A thread is live if <code>java.lang.Thread.isAlive()</code>
1596
would return <code>true</code>, that is, the thread has
1597
been started and has not yet died.
1598
The universe of threads is determined
1599
by the context of the <jvmti/>
1600
environment, which, typically, is all threads attached to the VM,
1601
except critical VM internal threads and <jvmti/> agent threads
1602
(see <functionlink id="RunAgentThread"/>).
1603
<p/>
1604
If the calling thread is specified,
1605
all other threads are suspended first then the caller thread is suspended -
1606
this function will not return until some other thread calls
1607
<functionlink id="ResumeThread"></functionlink>.
1608
<p/>
1609
The list of actually
1610
suspended threads is returned in
1611
<paramlink id="suspended_list_ptr"></paramlink>.
1612
Suspension is as defined in <functionlink id="SuspendThread"></functionlink>.
1613
<functionlink id="ResumeThreadList"></functionlink>
1614
can be used to resume the suspended threads.
1615
</description>
1616
<origin>new</origin>
1617
<capabilities>
1618
<required id="can_suspend"></required>
1619
</capabilities>
1620
<parameters>
1621
<param id="except_count">
1622
<jint min="0"/>
1623
<description>
1624
The number of threads in the list of threads not to be suspended.
1625
</description>
1626
</param>
1627
<param id="except_list">
1628
<inbuf incount="except_count">
1629
<jthread/>
1630
<nullok>not an error if <code>except_count == 0</code></nullok>
1631
</inbuf>
1632
<description>
1633
The list of threads not to be suspended.
1634
</description>
1635
</param>
1636
<param id="suspended_count_ptr">
1637
<outptr><jint/></outptr>
1638
<description>
1639
On return, points to the number of threads suspended by this call.
1640
</description>
1641
</param>
1642
<param id="suspended_list_ptr">
1643
<allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf>
1644
<description>
1645
On return, points to an array of references, one
1646
for each thread suspended.
1647
</description>
1648
</param>
1649
</parameters>
1650
<errors>
1651
<error id="JVMTI_ERROR_INVALID_THREAD">
1652
A thread in <paramlink id="except_list"></paramlink> was invalid.
1653
</error>
1654
<error id="JVMTI_ERROR_NULL_POINTER">
1655
Both <paramlink id="except_list"></paramlink> was <code>NULL</code>
1656
and <paramlink id="except_count"></paramlink> was non-zero.
1657
</error>
1658
</errors>
1659
</function>
1660
</elide>
1661
1662
<function id="SuspendThreadList" num="92">
1663
<synopsis>Suspend Thread List</synopsis>
1664
<description>
1665
Suspend the <paramlink id="request_count"></paramlink>
1666
threads specified in the
1667
<paramlink id="request_list"></paramlink> array.
1668
Threads may be resumed with
1669
<functionlink id="ResumeThreadList"></functionlink> or
1670
<functionlink id="ResumeThread"></functionlink>.
1671
If the calling thread is specified in the
1672
<paramlink id="request_list"></paramlink> array, this function will
1673
not return until some other thread resumes it.
1674
Errors encountered in the suspension of a thread
1675
are returned in the <paramlink id="results"></paramlink>
1676
array, <b>not</b> in the return value of this function.
1677
Threads that are currently suspended do not change state.
1678
</description>
1679
<origin>jvmdi</origin>
1680
<capabilities>
1681
<required id="can_suspend"></required>
1682
</capabilities>
1683
<parameters>
1684
<param id="request_count">
1685
<jint min="0"/>
1686
<description>
1687
The number of threads to suspend.
1688
</description>
1689
</param>
1690
<param id="request_list">
1691
<inbuf incount="request_count"><jthread/></inbuf>
1692
<description>
1693
The list of threads to suspend.
1694
</description>
1695
</param>
1696
<param id="results">
1697
<outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>
1698
<description>
1699
An agent supplied array of
1700
<paramlink id="request_count"></paramlink> elements.
1701
On return, filled with the error code for
1702
the suspend of the corresponding thread.
1703
The error code will be
1704
<errorlink id="JVMTI_ERROR_NONE"></errorlink>
1705
if the thread was suspended by this call.
1706
Possible error codes are those specified
1707
for <functionlink id="SuspendThread"></functionlink>.
1708
</description>
1709
</param>
1710
</parameters>
1711
<errors>
1712
</errors>
1713
</function>
1714
1715
<function id="ResumeThread" num="6">
1716
<synopsis>Resume Thread</synopsis>
1717
<description>
1718
Resume a suspended thread.
1719
Any threads currently suspended through
1720
a <jvmti/> suspend function (eg.
1721
<functionlink id="SuspendThread"></functionlink>)
1722
or <code>java.lang.Thread.suspend()</code>
1723
will resume execution;
1724
all other threads are unaffected.
1725
</description>
1726
<origin>jvmdi</origin>
1727
<capabilities>
1728
<required id="can_suspend"></required>
1729
</capabilities>
1730
<parameters>
1731
<param id="thread">
1732
<jthread/>
1733
<description>
1734
The thread to resume.
1735
</description>
1736
</param>
1737
</parameters>
1738
<errors>
1739
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
1740
Thread was not suspended.
1741
</error>
1742
<error id="JVMTI_ERROR_INVALID_TYPESTATE">
1743
The state of the thread has been modified, and is now inconsistent.
1744
</error>
1745
</errors>
1746
</function>
1747
1748
<function id="ResumeThreadList" num="93">
1749
<synopsis>Resume Thread List</synopsis>
1750
<description>
1751
Resume the <paramlink id="request_count"></paramlink>
1752
threads specified in the
1753
<paramlink id="request_list"></paramlink> array.
1754
Any thread suspended through
1755
a <jvmti/> suspend function (eg.
1756
<functionlink id="SuspendThreadList"></functionlink>)
1757
or <code>java.lang.Thread.suspend()</code>
1758
will resume execution.
1759
</description>
1760
<origin>jvmdi</origin>
1761
<capabilities>
1762
<required id="can_suspend"></required>
1763
</capabilities>
1764
<parameters>
1765
<param id="request_count">
1766
<jint min="0"/>
1767
<description>
1768
The number of threads to resume.
1769
</description>
1770
</param>
1771
<param id="request_list">
1772
<inbuf incount="request_count"><jthread/></inbuf>
1773
<description>
1774
The threads to resume.
1775
</description>
1776
</param>
1777
<param id="results">
1778
<outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>
1779
<description>
1780
An agent supplied array of
1781
<paramlink id="request_count"></paramlink> elements.
1782
On return, filled with the error code for
1783
the resume of the corresponding thread.
1784
The error code will be
1785
<errorlink id="JVMTI_ERROR_NONE"></errorlink>
1786
if the thread was suspended by this call.
1787
Possible error codes are those specified
1788
for <functionlink id="ResumeThread"></functionlink>.
1789
</description>
1790
</param>
1791
</parameters>
1792
<errors>
1793
</errors>
1794
</function>
1795
1796
<function id="StopThread" num="7">
1797
<synopsis>Stop Thread</synopsis>
1798
<description>
1799
Send the specified asynchronous exception to the specified thread.
1800
Normally, this function is used to kill the specified thread with an
1801
instance of the exception <code>ThreadDeath</code>, similar to
1802
<code>java.lang.Thread.stop</code>.
1803
</description>
1804
<origin>jvmdi</origin>
1805
<capabilities>
1806
<required id="can_signal_thread"></required>
1807
</capabilities>
1808
<parameters>
1809
<param id="thread">
1810
<jthread/>
1811
<description>
1812
The thread to stop.
1813
</description>
1814
</param>
1815
<param id="exception">
1816
<jobject/>
1817
<description>
1818
The asynchronous exception object.
1819
</description>
1820
</param>
1821
</parameters>
1822
<errors>
1823
</errors>
1824
</function>
1825
1826
<function id="InterruptThread" num="8">
1827
<synopsis>Interrupt Thread</synopsis>
1828
<description>
1829
Interrupt the specified thread
1830
(similar to <code>java.lang.Thread.interrupt</code>).
1831
</description>
1832
<origin>jvmdi</origin>
1833
<capabilities>
1834
<required id="can_signal_thread"></required>
1835
</capabilities>
1836
<parameters>
1837
<param id="thread">
1838
<jthread impl="noconvert"/>
1839
<description>
1840
The thread to interrupt.
1841
</description>
1842
</param>
1843
</parameters>
1844
<errors>
1845
</errors>
1846
</function>
1847
1848
<function id="GetThreadInfo" num="9">
1849
<synopsis>Get Thread Info</synopsis>
1850
<typedef id="jvmtiThreadInfo" label="Thread information structure">
1851
<field id="name">
1852
<allocfieldbuf><char/></allocfieldbuf>
1853
<description>
1854
The thread name, encoded as a
1855
<internallink id="mUTF">modified UTF-8</internallink> string.
1856
</description>
1857
</field>
1858
<field id="priority">
1859
<jint/>
1860
<description>
1861
The thread priority. See the thread priority constants:
1862
<datalink id="jvmtiThreadPriority"></datalink>.
1863
</description>
1864
</field>
1865
<field id="is_daemon">
1866
<jboolean/>
1867
<description>
1868
Is this a daemon thread?
1869
</description>
1870
</field>
1871
<field id="thread_group">
1872
<jthreadGroup/>
1873
<description>
1874
The thread group to which this thread belongs.
1875
<code>NULL</code> if the thread has died.
1876
</description>
1877
</field>
1878
<field id="context_class_loader">
1879
<jobject/>
1880
<description>
1881
The context class loader associated with this thread.
1882
</description>
1883
</field>
1884
</typedef>
1885
<description>
1886
Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure
1887
are filled in with details of the specified thread.
1888
</description>
1889
<origin>jvmdi</origin>
1890
<capabilities>
1891
</capabilities>
1892
<parameters>
1893
<param id="thread">
1894
<jthread null="current" impl="noconvert" started="maybe"/>
1895
<description>
1896
The thread to query.
1897
</description>
1898
</param>
1899
<param id="info_ptr">
1900
<outptr><struct>jvmtiThreadInfo</struct></outptr>
1901
<description>
1902
On return, filled with information describing the specified thread.
1903
</description>
1904
</param>
1905
</parameters>
1906
<errors>
1907
</errors>
1908
</function>
1909
1910
<function id="GetOwnedMonitorInfo" num="10">
1911
<synopsis>Get Owned Monitor Info</synopsis>
1912
<description>
1913
Get information about the monitors owned by the
1914
specified thread.
1915
</description>
1916
<origin>jvmdiClone</origin>
1917
<capabilities>
1918
<required id="can_get_owned_monitor_info"></required>
1919
</capabilities>
1920
<parameters>
1921
<param id="thread">
1922
<jthread null="current"/>
1923
<description>
1924
The thread to query.
1925
</description>
1926
</param>
1927
<param id="owned_monitor_count_ptr">
1928
<outptr><jint/></outptr>
1929
<description>
1930
The number of monitors returned.
1931
</description>
1932
</param>
1933
<param id="owned_monitors_ptr">
1934
<allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf>
1935
<description>
1936
The array of owned monitors.
1937
</description>
1938
</param>
1939
</parameters>
1940
<errors>
1941
</errors>
1942
</function>
1943
1944
<function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1">
1945
<synopsis>Get Owned Monitor Stack Depth Info</synopsis>
1946
<typedef id="jvmtiMonitorStackDepthInfo"
1947
label="Monitor stack depth information structure">
1948
<field id="monitor">
1949
<jobject/>
1950
<description>
1951
The owned monitor.
1952
</description>
1953
</field>
1954
<field id="stack_depth">
1955
<jint/>
1956
<description>
1957
The stack depth. Corresponds to the stack depth used in the
1958
<internallink id="stack">Stack Frame functions</internallink>.
1959
That is, zero is the current frame, one is the frame which
1960
called the current frame. And it is negative one if the
1961
implementation cannot determine the stack depth (e.g., for
1962
monitors acquired by JNI <code>MonitorEnter</code>).
1963
</description>
1964
</field>
1965
</typedef>
1966
<description>
1967
Get information about the monitors owned by the
1968
specified thread and the depth of the stack frame which locked them.
1969
</description>
1970
<origin>new</origin>
1971
<capabilities>
1972
<required id="can_get_owned_monitor_stack_depth_info"></required>
1973
</capabilities>
1974
<parameters>
1975
<param id="thread">
1976
<jthread null="current"/>
1977
<description>
1978
The thread to query.
1979
</description>
1980
</param>
1981
<param id="monitor_info_count_ptr">
1982
<outptr><jint/></outptr>
1983
<description>
1984
The number of monitors returned.
1985
</description>
1986
</param>
1987
<param id="monitor_info_ptr">
1988
<allocbuf outcount="monitor_info_count_ptr">
1989
<struct>jvmtiMonitorStackDepthInfo</struct>
1990
</allocbuf>
1991
<description>
1992
The array of owned monitor depth information.
1993
</description>
1994
</param>
1995
</parameters>
1996
<errors>
1997
</errors>
1998
</function>
1999
2000
<function id="GetCurrentContendedMonitor" num="11">
2001
<synopsis>Get Current Contended Monitor</synopsis>
2002
<description>
2003
Get the object, if any, whose monitor the specified thread is waiting to
2004
enter or waiting to regain through <code>java.lang.Object.wait</code>.
2005
</description>
2006
<origin>jvmdi</origin>
2007
<capabilities>
2008
<required id="can_get_current_contended_monitor"></required>
2009
</capabilities>
2010
<parameters>
2011
<param id="thread">
2012
<jthread null="current"/>
2013
<description>
2014
The thread to query.
2015
</description>
2016
</param>
2017
<param id="monitor_ptr">
2018
<outptr><jobject/></outptr>
2019
<description>
2020
On return, filled with the current contended monitor, or
2021
NULL if there is none.
2022
</description>
2023
</param>
2024
</parameters>
2025
<errors>
2026
</errors>
2027
</function>
2028
2029
<callback id="jvmtiStartFunction">
2030
<void/>
2031
<synopsis>Agent Start Function</synopsis>
2032
<description>
2033
Agent supplied callback function.
2034
This function is the entry point for an agent thread
2035
started with
2036
<functionlink id="RunAgentThread"></functionlink>.
2037
</description>
2038
<parameters>
2039
<param id="jvmti_env">
2040
<outptr>
2041
<struct>jvmtiEnv</struct>
2042
</outptr>
2043
<description>
2044
The <jvmti/> environment.
2045
</description>
2046
</param>
2047
<param id="jni_env">
2048
<outptr>
2049
<struct>JNIEnv</struct>
2050
</outptr>
2051
<description>
2052
The JNI environment.
2053
</description>
2054
</param>
2055
<param id="arg">
2056
<outptr>
2057
<void/>
2058
</outptr>
2059
<description>
2060
The <code>arg</code> parameter passed to
2061
<functionlink id="RunAgentThread"></functionlink>.
2062
</description>
2063
</param>
2064
</parameters>
2065
</callback>
2066
2067
<function id="RunAgentThread" num="12">
2068
<synopsis>Run Agent Thread</synopsis>
2069
<description>
2070
Starts the execution of an agent thread. with the specified native function.
2071
The parameter <paramlink id="arg"></paramlink> is forwarded on to the
2072
<functionlink id="jvmtiStartFunction">start function</functionlink>
2073
(specified with <paramlink id="proc"></paramlink>) as its single argument.
2074
This function allows the creation of agent threads
2075
for handling communication with another process or for handling events
2076
without the need to load a special subclass of <code>java.lang.Thread</code> or
2077
implementer of <code>java.lang.Runnable</code>.
2078
Instead, the created thread can run entirely in native code.
2079
However, the created thread does require a newly created instance
2080
of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to
2081
which it will be associated.
2082
The thread object can be created with JNI calls.
2083
<p/>
2084
The following common thread priorities are provided for your convenience:
2085
<constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const">
2086
<constant id="JVMTI_THREAD_MIN_PRIORITY" num="1">
2087
Minimum possible thread priority
2088
</constant>
2089
<constant id="JVMTI_THREAD_NORM_PRIORITY" num="5">
2090
Normal thread priority
2091
</constant>
2092
<constant id="JVMTI_THREAD_MAX_PRIORITY" num="10">
2093
Maximum possible thread priority
2094
</constant>
2095
</constants>
2096
<p/>
2097
The new thread is started as a daemon thread with the specified
2098
<paramlink id="priority"></paramlink>.
2099
If enabled, a <eventlink id="ThreadStart"/> event will be sent.
2100
<p/>
2101
Since the thread has been started, the thread will be live when this function
2102
returns, unless the thread has died immediately.
2103
<p/>
2104
The thread group of the thread is ignored -- specifically, the thread is not
2105
added to the thread group and the thread is not seen on queries of the thread
2106
group at either the Java programming language or <jvmti/> levels.
2107
<p/>
2108
The thread is not visible to Java programming language queries but is
2109
included in <jvmti/> queries (for example,
2110
<functionlink id="GetAllThreads"/> and
2111
<functionlink id="GetAllStackTraces"/>).
2112
<p/>
2113
Upon execution of <code>proc</code>, the new thread will be attached to the
2114
VM -- see the JNI documentation on
2115
<externallink id="jni/invocation.html#attaching-to-the-vm"
2116
>Attaching to the VM</externallink>.
2117
</description>
2118
<origin>jvmdiClone</origin>
2119
<capabilities>
2120
</capabilities>
2121
<parameters>
2122
<param id="thread">
2123
<jthread impl="noconvert" started="no"/>
2124
<description>
2125
The thread to run.
2126
</description>
2127
</param>
2128
<param id="proc">
2129
<ptrtype>
2130
<struct>jvmtiStartFunction</struct>
2131
</ptrtype>
2132
<description>
2133
The start function.
2134
</description>
2135
</param>
2136
<param id="arg">
2137
<inbuf>
2138
<void/>
2139
<nullok><code>NULL</code> is passed to the start function</nullok>
2140
</inbuf>
2141
<description>
2142
The argument to the start function.
2143
</description>
2144
</param>
2145
<param id="priority">
2146
<jint/>
2147
<description>
2148
The priority of the started thread. Any thread
2149
priority allowed by <code>java.lang.Thread.setPriority</code> can be used including
2150
those in <datalink id="jvmtiThreadPriority"></datalink>.
2151
</description>
2152
</param>
2153
</parameters>
2154
<errors>
2155
<error id="JVMTI_ERROR_INVALID_PRIORITY">
2156
<paramlink id="priority"/> is less than
2157
<datalink id="JVMTI_THREAD_MIN_PRIORITY"/>
2158
or greater than
2159
<datalink id="JVMTI_THREAD_MAX_PRIORITY"/>
2160
</error>
2161
</errors>
2162
</function>
2163
2164
<function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103">
2165
<synopsis>Set Thread Local Storage</synopsis>
2166
<description>
2167
The VM stores a pointer value associated with each environment-thread
2168
pair. This pointer value is called <i>thread-local storage</i>.
2169
This value is <code>NULL</code> unless set with this function.
2170
Agents can allocate memory in which they store thread specific
2171
information. By setting thread-local storage it can then be
2172
accessed with
2173
<functionlink id="GetThreadLocalStorage"></functionlink>.
2174
<p/>
2175
This function is called by the agent to set the value of the <jvmti/>
2176
thread-local storage. <jvmti/> supplies to the agent a pointer-size
2177
thread-local storage that can be used to record per-thread
2178
information.
2179
</description>
2180
<origin>jvmpi</origin>
2181
<capabilities>
2182
</capabilities>
2183
<parameters>
2184
<param id="thread">
2185
<jthread null="current"/>
2186
<description>
2187
Store to this thread.
2188
</description>
2189
</param>
2190
<param id="data">
2191
<inbuf>
2192
<void/>
2193
<nullok>value is set to <code>NULL</code></nullok>
2194
</inbuf>
2195
<description>
2196
The value to be entered into the thread-local storage.
2197
</description>
2198
</param>
2199
</parameters>
2200
<errors>
2201
</errors>
2202
</function>
2203
2204
<function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102">
2205
<synopsis>Get Thread Local Storage</synopsis>
2206
<description>
2207
Called by the agent to get the value of the <jvmti/> thread-local
2208
storage.
2209
</description>
2210
<origin>jvmpi</origin>
2211
<capabilities>
2212
</capabilities>
2213
<parameters>
2214
<param id="thread">
2215
<jthread null="current" impl="noconvert"/>
2216
<description>
2217
Retrieve from this thread.
2218
</description>
2219
</param>
2220
<param id="data_ptr">
2221
<agentbuf><void/></agentbuf>
2222
<description>
2223
Pointer through which the value of the thread local
2224
storage is returned.
2225
If thread-local storage has not been set with
2226
<functionlink id="SetThreadLocalStorage"></functionlink> the returned
2227
pointer is <code>NULL</code>.
2228
</description>
2229
</param>
2230
</parameters>
2231
<errors>
2232
</errors>
2233
</function>
2234
2235
</category>
2236
2237
<category id="thread_groups" label="Thread Group">
2238
<intro>
2239
</intro>
2240
2241
<function id="GetTopThreadGroups" num="13">
2242
<synopsis>Get Top Thread Groups</synopsis>
2243
<description>
2244
Return all top-level (parentless) thread groups in the VM.
2245
</description>
2246
<origin>jvmdi</origin>
2247
<capabilities>
2248
</capabilities>
2249
<parameters>
2250
<param id="group_count_ptr">
2251
<outptr><jint/></outptr>
2252
<description>
2253
On return, points to the number of top-level thread groups.
2254
</description>
2255
</param>
2256
<param id="groups_ptr">
2257
<allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>
2258
<description>
2259
On return, refers to a pointer to the top-level thread group array.
2260
</description>
2261
</param>
2262
</parameters>
2263
<errors>
2264
</errors>
2265
</function>
2266
2267
<function id="GetThreadGroupInfo" num="14">
2268
<synopsis>Get Thread Group Info</synopsis>
2269
<typedef id="jvmtiThreadGroupInfo" label="Thread group information structure">
2270
<field id="parent">
2271
<jthreadGroup/>
2272
<description>
2273
The parent thread group.
2274
</description>
2275
</field>
2276
<field id="name">
2277
<allocfieldbuf><char/></allocfieldbuf>
2278
<description>
2279
The thread group's name, encoded as a
2280
<internallink id="mUTF">modified UTF-8</internallink> string.
2281
</description>
2282
</field>
2283
<field id="max_priority">
2284
<jint/>
2285
<description>
2286
The maximum priority for this thread group.
2287
</description>
2288
</field>
2289
<field id="is_daemon">
2290
<jboolean/>
2291
<description>
2292
Is this a daemon thread group?
2293
</description>
2294
</field>
2295
</typedef>
2296
<description>
2297
Get information about the thread group. The fields of the
2298
<functionlink id="jvmtiThreadGroupInfo"></functionlink> structure
2299
are filled in with details of the specified thread group.
2300
</description>
2301
<origin>jvmdi</origin>
2302
<capabilities>
2303
</capabilities>
2304
<parameters>
2305
<param id="group">
2306
<jthreadGroup/>
2307
<description>
2308
The thread group to query.
2309
</description>
2310
</param>
2311
<param id="info_ptr">
2312
<outptr><struct>jvmtiThreadGroupInfo</struct></outptr>
2313
<description>
2314
On return, filled with information describing the specified
2315
thread group.
2316
</description>
2317
</param>
2318
</parameters>
2319
<errors>
2320
</errors>
2321
</function>
2322
2323
<function id="GetThreadGroupChildren" num="15">
2324
<synopsis>Get Thread Group Children</synopsis>
2325
<description>
2326
Get the live threads and active subgroups in this thread group.
2327
</description>
2328
<origin>jvmdi</origin>
2329
<capabilities>
2330
</capabilities>
2331
<parameters>
2332
<param id="group">
2333
<jthreadGroup/>
2334
<description>
2335
The group to query.
2336
</description>
2337
</param>
2338
<param id="thread_count_ptr">
2339
<outptr><jint/></outptr>
2340
<description>
2341
On return, points to the number of live threads in this thread group.
2342
</description>
2343
</param>
2344
<param id="threads_ptr">
2345
<allocbuf outcount="thread_count_ptr"><jthread/></allocbuf>
2346
<description>
2347
On return, points to an array of the live threads in this thread group.
2348
</description>
2349
</param>
2350
<param id="group_count_ptr">
2351
<outptr><jint/></outptr>
2352
<description>
2353
On return, points to the number of active child thread groups
2354
</description>
2355
</param>
2356
<param id="groups_ptr">
2357
<allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>
2358
<description>
2359
On return, points to an array of the active child thread groups.
2360
</description>
2361
</param>
2362
</parameters>
2363
<errors>
2364
</errors>
2365
</function>
2366
</category>
2367
2368
<category id="stack" label="Stack Frame">
2369
<intro>
2370
These functions provide information about the stack of a thread.
2371
Stack frames are referenced by depth.
2372
The frame at depth zero is the current frame.
2373
<p/>
2374
Stack frames are as described in
2375
<vmspec chapter="3.6"/>,
2376
That is, they correspond to method
2377
invocations (including native methods) but do not correspond to platform native or
2378
VM internal frames.
2379
<p/>
2380
A <jvmti/> implementation may use method invocations to launch a thread and
2381
the corresponding frames may be included in the stack as presented by these functions --
2382
that is, there may be frames shown
2383
deeper than <code>main()</code> and <code>run()</code>.
2384
However this presentation must be consistent across all <jvmti/> functionality which
2385
uses stack frames or stack depth.
2386
</intro>
2387
2388
<typedef id="jvmtiFrameInfo" label="Stack frame information structure">
2389
<description>
2390
Information about a stack frame is returned in this structure.
2391
</description>
2392
<field id="method">
2393
<jmethodID/>
2394
<description>
2395
The method executing in this frame.
2396
</description>
2397
</field>
2398
<field id="location">
2399
<jlocation/>
2400
<description>
2401
The index of the instruction executing in this frame.
2402
<code>-1</code> if the frame is executing a native method.
2403
</description>
2404
</field>
2405
</typedef>
2406
2407
<typedef id="jvmtiStackInfo" label="Stack information structure">
2408
<description>
2409
Information about a set of stack frames is returned in this structure.
2410
</description>
2411
<field id="thread">
2412
<jthread/>
2413
<description>
2414
On return, the thread traced.
2415
</description>
2416
</field>
2417
<field id="state">
2418
<jint/>
2419
<description>
2420
On return, the thread state. See <functionlink id="GetThreadState"></functionlink>.
2421
</description>
2422
</field>
2423
<field id="frame_buffer">
2424
<outbuf incount="max_frame_count">
2425
<struct>jvmtiFrameInfo</struct>
2426
</outbuf>
2427
<description>
2428
On return, this agent allocated buffer is filled
2429
with stack frame information.
2430
</description>
2431
</field>
2432
<field id="frame_count">
2433
<jint/>
2434
<description>
2435
On return, the number of records filled into
2436
<code>frame_buffer</code>.
2437
This will be
2438
min(<code>max_frame_count</code>, <i>stackDepth</i>).
2439
</description>
2440
</field>
2441
</typedef>
2442
2443
<function id="GetStackTrace" num="104">
2444
<synopsis>Get Stack Trace</synopsis>
2445
<description>
2446
Get information about the stack of a thread.
2447
If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack,
2448
the <paramlink id="max_frame_count"></paramlink> topmost frames are returned,
2449
otherwise the entire stack is returned.
2450
The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2451
<p/>
2452
The following example causes up to five of the topmost frames
2453
to be returned and (if there are any frames) the currently
2454
executing method name to be printed.
2455
<example>
2456
jvmtiFrameInfo frames[5];
2457
jint count;
2458
jvmtiError err;
2459
2460
err = (*jvmti)-&gt;GetStackTrace(jvmti, aThread, 0, 5,
2461
frames, &amp;count);
2462
if (err == JVMTI_ERROR_NONE &amp;&amp; count &gt;= 1) {
2463
char *methodName;
2464
err = (*jvmti)-&gt;GetMethodName(jvmti, frames[0].method,
2465
&amp;methodName, NULL, NULL);
2466
if (err == JVMTI_ERROR_NONE) {
2467
printf("Executing method: %s", methodName);
2468
}
2469
}
2470
</example>
2471
<todo>
2472
check example code.
2473
</todo>
2474
<p/>
2475
The <paramlink id="thread"></paramlink> need not be suspended
2476
to call this function.
2477
<p/>
2478
The <functionlink id="GetLineNumberTable"></functionlink>
2479
function can be used to map locations to line numbers. Note that
2480
this mapping can be done lazily.
2481
</description>
2482
<origin>jvmpi</origin>
2483
<capabilities>
2484
</capabilities>
2485
<parameters>
2486
<param id="thread">
2487
<jthread null="current"/>
2488
<description>
2489
Fetch the stack trace of this thread.
2490
</description>
2491
</param>
2492
<param id="start_depth">
2493
<jint/>
2494
<description>
2495
Begin retrieving frames at this depth.
2496
If non-negative, count from the current frame,
2497
the first frame retrieved is at depth <code>start_depth</code>.
2498
For example, if zero, start from the current frame; if one, start from the
2499
caller of the current frame; if two, start from the caller of the
2500
caller of the current frame; and so on.
2501
If negative, count from below the oldest frame,
2502
the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>,
2503
where <i>stackDepth</i> is the count of frames on the stack.
2504
For example, if negative one, only the oldest frame is retrieved;
2505
if negative two, start from the frame called by the oldest frame.
2506
</description>
2507
</param>
2508
<param id="max_frame_count">
2509
<jint min="0"/>
2510
<description>
2511
The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.
2512
</description>
2513
</param>
2514
<param id="frame_buffer">
2515
<outbuf incount="max_frame_count" outcount="count_ptr">
2516
<struct>jvmtiFrameInfo</struct>
2517
</outbuf>
2518
<description>
2519
On return, this agent allocated buffer is filled
2520
with stack frame information.
2521
</description>
2522
</param>
2523
<param id="count_ptr">
2524
<outptr><jint/></outptr>
2525
<description>
2526
On return, points to the number of records filled in.
2527
For non-negative <code>start_depth</code>, this will be
2528
min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>).
2529
For negative <code>start_depth</code>, this will be
2530
min(<code>max_frame_count</code>, <code>-start_depth</code>).
2531
</description>
2532
</param>
2533
</parameters>
2534
<errors>
2535
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
2536
<paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>.
2537
Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>.
2538
</error>
2539
</errors>
2540
</function>
2541
2542
2543
<function id="GetAllStackTraces" num="100">
2544
<synopsis>Get All Stack Traces</synopsis>
2545
<description>
2546
Get information about the stacks of all live threads
2547
(including <internallink id="RunAgentThread">agent threads</internallink>).
2548
If <paramlink id="max_frame_count"/> is less than the depth of a stack,
2549
the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,
2550
otherwise the entire stack is returned.
2551
The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2552
<p/>
2553
All stacks are collected simultaneously, that is, no changes will occur to the
2554
thread state or stacks between the sampling of one thread and the next.
2555
The threads need not be suspended.
2556
2557
<example>
2558
jvmtiStackInfo *stack_info;
2559
jint thread_count;
2560
int ti;
2561
jvmtiError err;
2562
2563
err = (*jvmti)-&gt;GetAllStackTraces(jvmti, MAX_FRAMES, &amp;stack_info, &amp;thread_count);
2564
if (err != JVMTI_ERROR_NONE) {
2565
...
2566
}
2567
for (ti = 0; ti &lt; thread_count; ++ti) {
2568
jvmtiStackInfo *infop = &amp;stack_info[ti];
2569
jthread thread = infop-&gt;thread;
2570
jint state = infop-&gt;state;
2571
jvmtiFrameInfo *frames = infop-&gt;frame_buffer;
2572
int fi;
2573
2574
myThreadAndStatePrinter(thread, state);
2575
for (fi = 0; fi &lt; infop-&gt;frame_count; fi++) {
2576
myFramePrinter(frames[fi].method, frames[fi].location);
2577
}
2578
}
2579
/* this one Deallocate call frees all data allocated by GetAllStackTraces */
2580
err = (*jvmti)-&gt;Deallocate(jvmti, stack_info);
2581
</example>
2582
<todo>
2583
check example code.
2584
</todo>
2585
2586
</description>
2587
<origin>new</origin>
2588
<capabilities>
2589
</capabilities>
2590
<parameters>
2591
<param id="max_frame_count">
2592
<jint min="0"/>
2593
<description>
2594
The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread.
2595
</description>
2596
</param>
2597
<param id="stack_info_ptr">
2598
<allocbuf>
2599
<struct>jvmtiStackInfo</struct>
2600
</allocbuf>
2601
<description>
2602
On return, this buffer is filled
2603
with stack information for each thread.
2604
The number of <datalink id="jvmtiStackInfo"/> records is determined
2605
by <paramlink id="thread_count_ptr"/>.
2606
<p/>
2607
Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>
2608
buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.
2609
These buffers must not be separately deallocated.
2610
</description>
2611
</param>
2612
<param id="thread_count_ptr">
2613
<outptr><jint/></outptr>
2614
<description>
2615
The number of threads traced.
2616
</description>
2617
</param>
2618
</parameters>
2619
<errors>
2620
</errors>
2621
</function>
2622
2623
<function id="GetThreadListStackTraces" num="101">
2624
<synopsis>Get Thread List Stack Traces</synopsis>
2625
<description>
2626
Get information about the stacks of the supplied threads.
2627
If <paramlink id="max_frame_count"/> is less than the depth of a stack,
2628
the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,
2629
otherwise the entire stack is returned.
2630
The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2631
<p/>
2632
All stacks are collected simultaneously, that is, no changes will occur to the
2633
thread state or stacks between the sampling one thread and the next.
2634
The threads need not be suspended.
2635
<p/>
2636
If a thread has not yet started or terminates before the stack information is collected,
2637
a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero)
2638
will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked.
2639
<p/>
2640
See the example for the similar function
2641
<functionlink id="GetAllStackTraces"/>.
2642
</description>
2643
<origin>new</origin>
2644
<capabilities>
2645
</capabilities>
2646
<parameters>
2647
<param id="thread_count">
2648
<jint min="0"/>
2649
<description>
2650
The number of threads to trace.
2651
</description>
2652
</param>
2653
<param id="thread_list">
2654
<inbuf incount="thread_count"><jthread/></inbuf>
2655
<description>
2656
The list of threads to trace.
2657
</description>
2658
</param>
2659
<param id="max_frame_count">
2660
<jint min="0"/>
2661
<description>
2662
The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread.
2663
</description>
2664
</param>
2665
<param id="stack_info_ptr">
2666
<allocbuf outcount="thread_count">
2667
<struct>jvmtiStackInfo</struct>
2668
</allocbuf>
2669
<description>
2670
On return, this buffer is filled
2671
with stack information for each thread.
2672
The number of <datalink id="jvmtiStackInfo"/> records is determined
2673
by <paramlink id="thread_count"/>.
2674
<p/>
2675
Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>
2676
buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.
2677
These buffers must not be separately deallocated.
2678
</description>
2679
</param>
2680
</parameters>
2681
<errors>
2682
<error id="JVMTI_ERROR_INVALID_THREAD">
2683
An element in <paramlink id="thread_list"/> is not a thread object.
2684
</error>
2685
</errors>
2686
</function>
2687
2688
<elide>
2689
<function id="AsyncGetStackTrace" num="1000">
2690
<synopsis>Get Stack Trace--Asynchronous</synopsis>
2691
<description>
2692
Get information about the entire stack of a thread (or a sub-section of it).
2693
This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink>
2694
and is reentrant and safe to call
2695
from asynchronous signal handlers.
2696
The stack trace is returned only for the calling thread.
2697
<p/>
2698
The <functionlink id="GetLineNumberTable"></functionlink>
2699
function can be used to map locations to line numbers. Note that
2700
this mapping can be done lazily.
2701
</description>
2702
<origin>jvmpi</origin>
2703
<capabilities>
2704
<required id="can_get_async_stack_trace"></required>
2705
<capability id="can_show_JVM_spec_async_frames">
2706
If <code>false</code>,
2707
<paramlink id="use_java_stack"></paramlink>
2708
must be <code>false</code>.
2709
</capability>
2710
</capabilities>
2711
<parameters>
2712
<param id="use_java_stack">
2713
<jboolean/>
2714
<description>
2715
Return the stack showing <vmspec/>
2716
model of the stack;
2717
otherwise, show the internal representation of the stack with
2718
inlined and optimized methods missing. If the virtual machine
2719
is using the <i>Java Virtual Machine Specification</i> stack model
2720
internally, this flag is ignored.
2721
</description>
2722
</param>
2723
<param id="max_count">
2724
<jint min="0"/>
2725
<description>
2726
The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.
2727
Retrieve this many unless the stack depth is less than <code>max_count</code>.
2728
</description>
2729
</param>
2730
<param id="frame_buffer">
2731
<outbuf incount="max_count" outcount="count_ptr">
2732
<struct>jvmtiFrameInfo</struct>
2733
<nullok>this information is not returned</nullok>
2734
</outbuf>
2735
<description>
2736
The agent passes in a buffer
2737
large enough to hold <code>max_count</code> records of
2738
<datalink id="jvmtiFrameInfo"></datalink>. This buffer must be
2739
pre-allocated by the agent.
2740
</description>
2741
</param>
2742
<param id="count_ptr">
2743
<outptr><jint/></outptr>
2744
<description>
2745
On return, points to the number of records filled in..
2746
</description>
2747
</param>
2748
</parameters>
2749
<errors>
2750
<error id="JVMTI_ERROR_UNATTACHED_THREAD">
2751
The thread being used to call this function is not attached
2752
to the virtual machine. Calls must be made from attached threads.
2753
</error>
2754
</errors>
2755
</function>
2756
</elide>
2757
2758
<function id="GetFrameCount" num="16">
2759
<synopsis>Get Frame Count</synopsis>
2760
<description>
2761
Get the number of frames currently in the specified thread's call stack.
2762
<p/>
2763
If this function is called for a thread actively executing bytecodes (for example,
2764
not the current thread and not suspended), the information returned is transient.
2765
</description>
2766
<origin>jvmdi</origin>
2767
<capabilities>
2768
</capabilities>
2769
<parameters>
2770
<param id="thread">
2771
<jthread null="current"/>
2772
<description>
2773
The thread to query.
2774
</description>
2775
</param>
2776
<param id="count_ptr">
2777
<outptr><jint/></outptr>
2778
<description>
2779
On return, points to the number of frames in the call stack.
2780
</description>
2781
</param>
2782
</parameters>
2783
<errors>
2784
</errors>
2785
</function>
2786
2787
<function id="PopFrame" num="80">
2788
<synopsis>Pop Frame</synopsis>
2789
<description>
2790
Pop the current frame of <code>thread</code>'s stack.
2791
Popping a frame takes you to the previous frame.
2792
When the thread is resumed, the execution
2793
state of the thread is reset to the state
2794
immediately before the called method was invoked.
2795
That is (using <vmspec/> terminology):
2796
<ul>
2797
<li>the current frame is discarded as the previous frame becomes the current one</li>
2798
<li>the operand stack is restored--the argument values are added back
2799
and if the invoke was not <code>invokestatic</code>,
2800
<code>objectref</code> is added back as well</li>
2801
<li>the Java virtual machine PC is restored to the opcode
2802
of the invoke instruction</li>
2803
</ul>
2804
Note however, that any changes to the arguments, which
2805
occurred in the called method, remain;
2806
when execution continues, the first instruction to
2807
execute will be the invoke.
2808
<p/>
2809
Between calling <code>PopFrame</code> and resuming the
2810
thread the state of the stack is undefined.
2811
To pop frames beyond the first,
2812
these three steps must be repeated:
2813
<ul>
2814
<li>suspend the thread via an event (step, breakpoint, ...)</li>
2815
<li>call <code>PopFrame</code></li>
2816
<li>resume the thread</li>
2817
</ul>
2818
<p/>
2819
A lock acquired by calling the called method
2820
(if it is a <code>synchronized</code> method)
2821
and locks acquired by entering <code>synchronized</code>
2822
blocks within the called method are released.
2823
Note: this does not apply to native locks or
2824
<code>java.util.concurrent.locks</code> locks.
2825
<p/>
2826
Finally blocks are not executed.
2827
<p/>
2828
Changes to global state are not addressed and thus remain changed.
2829
<p/>
2830
The specified thread must be suspended or must be the current thread.
2831
<p/>
2832
Both the called method and calling method must be non-native Java programming
2833
language methods.
2834
<p/>
2835
No <jvmti/> events are generated by this function.
2836
</description>
2837
<origin>jvmdi</origin>
2838
<capabilities>
2839
<required id="can_pop_frame"></required>
2840
</capabilities>
2841
<parameters>
2842
<param id="thread">
2843
<jthread/>
2844
<description>
2845
The thread whose current frame is to be popped.
2846
</description>
2847
</param>
2848
</parameters>
2849
<errors>
2850
<error id="JVMTI_ERROR_OPAQUE_FRAME">
2851
Called or calling method is a native method.
2852
The implementation is unable to pop this frame.
2853
</error>
2854
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
2855
Thread was not suspended and was not the current thread.
2856
</error>
2857
<error id="JVMTI_ERROR_NO_MORE_FRAMES">
2858
There are less than two stack frames on the call stack.
2859
</error>
2860
</errors>
2861
</function>
2862
2863
<function id="GetFrameLocation" num="19">
2864
<synopsis>Get Frame Location</synopsis>
2865
<description>
2866
<p/>
2867
For a Java programming language frame, return the location of the instruction
2868
currently executing.
2869
</description>
2870
<origin>jvmdiClone</origin>
2871
<capabilities>
2872
</capabilities>
2873
<parameters>
2874
<param id="thread">
2875
<jthread null="current" frame="frame"/>
2876
<description>
2877
The thread of the frame to query.
2878
</description>
2879
</param>
2880
<param id="depth">
2881
<jframeID thread="thread"/>
2882
<description>
2883
The depth of the frame to query.
2884
</description>
2885
</param>
2886
<param id="method_ptr">
2887
<outptr><jmethodID/></outptr>
2888
<description>
2889
On return, points to the method for the current location.
2890
</description>
2891
</param>
2892
<param id="location_ptr">
2893
<outptr><jlocation/></outptr>
2894
<description>
2895
On return, points to the index of the currently
2896
executing instruction.
2897
Is set to <code>-1</code> if the frame is executing
2898
a native method.
2899
</description>
2900
</param>
2901
</parameters>
2902
<errors>
2903
</errors>
2904
</function>
2905
2906
<function id="NotifyFramePop" num="20">
2907
<synopsis>Notify Frame Pop</synopsis>
2908
<description>
2909
When the frame that is currently at <paramlink id="depth"></paramlink>
2910
is popped from the stack, generate a
2911
<eventlink id="FramePop"></eventlink> event. See the
2912
<eventlink id="FramePop"></eventlink> event for details.
2913
Only frames corresponding to non-native Java programming language
2914
methods can receive notification.
2915
<p/>
2916
The specified thread must be suspended or must be the current thread.
2917
</description>
2918
<origin>jvmdi</origin>
2919
<capabilities>
2920
<required id="can_generate_frame_pop_events"></required>
2921
</capabilities>
2922
<parameters>
2923
<param id="thread">
2924
<jthread null="current" frame="depth"/>
2925
<description>
2926
The thread of the frame for which the frame pop event will be generated.
2927
</description>
2928
</param>
2929
<param id="depth">
2930
<jframeID thread="thread"/>
2931
<description>
2932
The depth of the frame for which the frame pop event will be generated.
2933
</description>
2934
</param>
2935
</parameters>
2936
<errors>
2937
<error id="JVMTI_ERROR_OPAQUE_FRAME">
2938
The frame at <code>depth</code> is executing a
2939
native method.
2940
</error>
2941
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
2942
Thread was not suspended and was not the current thread.
2943
</error>
2944
</errors>
2945
</function>
2946
2947
</category>
2948
2949
<category id="ForceEarlyReturn" label="Force Early Return">
2950
<intro>
2951
These functions allow an agent to force a method
2952
to return at any point during its execution.
2953
The method which will return early is referred to as the <i>called method</i>.
2954
The called method is the current method
2955
(as defined by
2956
<vmspec chapter="3.6"/>)
2957
for the specified thread at
2958
the time the function is called.
2959
<p/>
2960
The specified thread must be suspended or must be the current thread.
2961
The return occurs when execution of Java programming
2962
language code is resumed on this thread.
2963
Between calling one of these functions and resumption
2964
of thread execution, the state of the stack is undefined.
2965
<p/>
2966
No further instructions are executed in the called method.
2967
Specifically, finally blocks are not executed.
2968
Note: this can cause inconsistent states in the application.
2969
<p/>
2970
A lock acquired by calling the called method
2971
(if it is a <code>synchronized</code> method)
2972
and locks acquired by entering <code>synchronized</code>
2973
blocks within the called method are released.
2974
Note: this does not apply to native locks or
2975
<code>java.util.concurrent.locks</code> locks.
2976
<p/>
2977
Events, such as <eventlink id="MethodExit"></eventlink>,
2978
are generated as they would be in a normal return.
2979
<p/>
2980
The called method must be a non-native Java programming
2981
language method.
2982
Forcing return on a thread with only one frame on the
2983
stack causes the thread to exit when resumed.
2984
</intro>
2985
2986
<function id="ForceEarlyReturnObject" num="81" since="1.1">
2987
<synopsis>Force Early Return - Object</synopsis>
2988
<description>
2989
This function can be used to return from a method whose
2990
result type is <code>Object</code>
2991
or a subclass of <code>Object</code>.
2992
</description>
2993
<origin>new</origin>
2994
<capabilities>
2995
<required id="can_force_early_return"></required>
2996
</capabilities>
2997
<parameters>
2998
<param id="thread">
2999
<jthread null="current"/>
3000
<description>
3001
The thread whose current frame is to return early.
3002
</description>
3003
</param>
3004
<param id="value">
3005
<jobject/>
3006
<description>
3007
The return value for the called frame.
3008
An object or <code>NULL</code>.
3009
</description>
3010
</param>
3011
</parameters>
3012
<errors>
3013
<error id="JVMTI_ERROR_OPAQUE_FRAME">
3014
Attempted to return early from a frame
3015
corresponding to a native method.
3016
Or the implementation is unable to provide
3017
this functionality on this frame.
3018
</error>
3019
<error id="JVMTI_ERROR_TYPE_MISMATCH">
3020
The result type of the called method is not
3021
<code>Object</code> or a subclass of <code>Object</code>.
3022
</error>
3023
<error id="JVMTI_ERROR_TYPE_MISMATCH">
3024
The supplied <paramlink id="value"/> is not compatible with the
3025
result type of the called method.
3026
</error>
3027
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3028
Thread was not suspended and was not the current thread.
3029
</error>
3030
<error id="JVMTI_ERROR_NO_MORE_FRAMES">
3031
There are no more frames on the call stack.
3032
</error>
3033
</errors>
3034
</function>
3035
3036
<function id="ForceEarlyReturnInt" num="82" since="1.1">
3037
<synopsis>Force Early Return - Int</synopsis>
3038
<description>
3039
This function can be used to return from a method whose
3040
result type is <code>int</code>, <code>short</code>,
3041
<code>char</code>, <code>byte</code>, or
3042
<code>boolean</code>.
3043
</description>
3044
<origin>new</origin>
3045
<capabilities>
3046
<required id="can_force_early_return"></required>
3047
</capabilities>
3048
<parameters>
3049
<param id="thread">
3050
<jthread null="current"/>
3051
<description>
3052
The thread whose current frame is to return early.
3053
</description>
3054
</param>
3055
<param id="value">
3056
<jint/>
3057
<description>
3058
The return value for the called frame.
3059
</description>
3060
</param>
3061
</parameters>
3062
<errors>
3063
<error id="JVMTI_ERROR_OPAQUE_FRAME">
3064
Attempted to return early from a frame
3065
corresponding to a native method.
3066
Or the implementation is unable to provide
3067
this functionality on this frame.
3068
</error>
3069
<error id="JVMTI_ERROR_TYPE_MISMATCH">
3070
The result type of the called method is not
3071
<code>int</code>, <code>short</code>,
3072
<code>char</code>, <code>byte</code>, or
3073
<code>boolean</code>.
3074
</error>
3075
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3076
Thread was not suspended and was not the current thread.
3077
</error>
3078
<error id="JVMTI_ERROR_NO_MORE_FRAMES">
3079
There are no frames on the call stack.
3080
</error>
3081
</errors>
3082
</function>
3083
3084
<function id="ForceEarlyReturnLong" num="83" since="1.1">
3085
<synopsis>Force Early Return - Long</synopsis>
3086
<description>
3087
This function can be used to return from a method whose
3088
result type is <code>long</code>.
3089
</description>
3090
<origin>new</origin>
3091
<capabilities>
3092
<required id="can_force_early_return"></required>
3093
</capabilities>
3094
<parameters>
3095
<param id="thread">
3096
<jthread null="current"/>
3097
<description>
3098
The thread whose current frame is to return early.
3099
</description>
3100
</param>
3101
<param id="value">
3102
<jlong/>
3103
<description>
3104
The return value for the called frame.
3105
</description>
3106
</param>
3107
</parameters>
3108
<errors>
3109
<error id="JVMTI_ERROR_OPAQUE_FRAME">
3110
Attempted to return early from a frame
3111
corresponding to a native method.
3112
Or the implementation is unable to provide
3113
this functionality on this frame.
3114
</error>
3115
<error id="JVMTI_ERROR_TYPE_MISMATCH">
3116
The result type of the called method is not <code>long</code>.
3117
</error>
3118
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3119
Thread was not suspended and was not the current thread.
3120
</error>
3121
<error id="JVMTI_ERROR_NO_MORE_FRAMES">
3122
There are no frames on the call stack.
3123
</error>
3124
</errors>
3125
</function>
3126
3127
<function id="ForceEarlyReturnFloat" num="84" since="1.1">
3128
<synopsis>Force Early Return - Float</synopsis>
3129
<description>
3130
This function can be used to return from a method whose
3131
result type is <code>float</code>.
3132
</description>
3133
<origin>new</origin>
3134
<capabilities>
3135
<required id="can_force_early_return"></required>
3136
</capabilities>
3137
<parameters>
3138
<param id="thread">
3139
<jthread null="current"/>
3140
<description>
3141
The thread whose current frame is to return early.
3142
</description>
3143
</param>
3144
<param id="value">
3145
<jfloat/>
3146
<description>
3147
The return value for the called frame.
3148
</description>
3149
</param>
3150
</parameters>
3151
<errors>
3152
<error id="JVMTI_ERROR_OPAQUE_FRAME">
3153
Attempted to return early from a frame
3154
corresponding to a native method.
3155
Or the implementation is unable to provide
3156
this functionality on this frame.
3157
</error>
3158
<error id="JVMTI_ERROR_TYPE_MISMATCH">
3159
The result type of the called method is not <code>float</code>.
3160
</error>
3161
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3162
Thread was not suspended and was not the current thread.
3163
</error>
3164
<error id="JVMTI_ERROR_NO_MORE_FRAMES">
3165
There are no frames on the call stack.
3166
</error>
3167
</errors>
3168
</function>
3169
3170
<function id="ForceEarlyReturnDouble" num="85" since="1.1">
3171
<synopsis>Force Early Return - Double</synopsis>
3172
<description>
3173
This function can be used to return from a method whose
3174
result type is <code>double</code>.
3175
</description>
3176
<origin>new</origin>
3177
<capabilities>
3178
<required id="can_force_early_return"></required>
3179
</capabilities>
3180
<parameters>
3181
<param id="thread">
3182
<jthread null="current"/>
3183
<description>
3184
The thread whose current frame is to return early.
3185
</description>
3186
</param>
3187
<param id="value">
3188
<jdouble/>
3189
<description>
3190
The return value for the called frame.
3191
</description>
3192
</param>
3193
</parameters>
3194
<errors>
3195
<error id="JVMTI_ERROR_OPAQUE_FRAME">
3196
Attempted to return early from a frame corresponding to a native method.
3197
Or the implementation is unable to provide this functionality on this frame.
3198
</error>
3199
<error id="JVMTI_ERROR_TYPE_MISMATCH">
3200
The result type of the called method is not <code>double</code>.
3201
</error>
3202
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3203
Thread was not suspended and was not the current thread.
3204
</error>
3205
<error id="JVMTI_ERROR_NO_MORE_FRAMES">
3206
There are no frames on the call stack.
3207
</error>
3208
</errors>
3209
</function>
3210
3211
<function id="ForceEarlyReturnVoid" num="86" since="1.1">
3212
<synopsis>Force Early Return - Void</synopsis>
3213
<description>
3214
This function can be used to return from a method with no result type.
3215
That is, the called method must be declared <code>void</code>.
3216
</description>
3217
<origin>new</origin>
3218
<capabilities>
3219
<required id="can_force_early_return"></required>
3220
</capabilities>
3221
<parameters>
3222
<param id="thread">
3223
<jthread null="current"/>
3224
<description>
3225
The thread whose current frame is to return early.
3226
</description>
3227
</param>
3228
</parameters>
3229
<errors>
3230
<error id="JVMTI_ERROR_OPAQUE_FRAME">
3231
Attempted to return early from a frame
3232
corresponding to a native method.
3233
Or the implementation is unable to provide
3234
this functionality on this frame.
3235
</error>
3236
<error id="JVMTI_ERROR_TYPE_MISMATCH">
3237
The called method has a result type.
3238
</error>
3239
<error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3240
Thread was not suspended and was not the current thread.
3241
</error>
3242
<error id="JVMTI_ERROR_NO_MORE_FRAMES">
3243
There are no frames on the call stack.
3244
</error>
3245
</errors>
3246
</function>
3247
3248
</category>
3249
3250
<category id="Heap" label="Heap">
3251
<intro>
3252
These functions are used to analyze the heap.
3253
Functionality includes the ability to view the objects in the
3254
heap and to tag these objects.
3255
</intro>
3256
3257
<intro id="objectTags" label="Object Tags">
3258
A <i>tag</i> is a value associated with an object.
3259
Tags are explicitly set by the agent using the
3260
<functionlink id="SetTag"></functionlink> function or by
3261
callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>.
3262
<p/>
3263
Tags are local to the environment; that is, the tags of one
3264
environment are not visible in another.
3265
<p/>
3266
Tags are <code>jlong</code> values which can be used
3267
simply to mark an object or to store a pointer to more detailed
3268
information. Objects which have not been tagged have a
3269
tag of zero.
3270
Setting a tag to zero makes the object untagged.
3271
</intro>
3272
3273
<intro id="heapCallbacks" label="Heap Callback Functions">
3274
Heap functions which iterate through the heap and recursively
3275
follow object references use agent supplied callback functions
3276
to deliver the information.
3277
<p/>
3278
These heap callback functions must adhere to the following restrictions --
3279
These callbacks must not use JNI functions.
3280
These callbacks must not use <jvmti/> functions except
3281
<i>callback safe</i> functions which
3282
specifically allow such use (see the raw monitor, memory management,
3283
and environment local storage functions).
3284
<p/>
3285
An implementation may invoke a callback on an internal thread or
3286
the thread which called the iteration function.
3287
Heap callbacks are single threaded -- no more than one callback will
3288
be invoked at a time.
3289
<p/>
3290
The Heap Filter Flags can be used to prevent reporting
3291
based on the tag status of an object or its class.
3292
If no flags are set (the <code>jint</code> is zero), objects
3293
will not be filtered out.
3294
3295
<constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits">
3296
<constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4">
3297
Filter out tagged objects. Objects which are tagged are not included.
3298
</constant>
3299
<constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8">
3300
Filter out untagged objects. Objects which are not tagged are not included.
3301
</constant>
3302
<constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10">
3303
Filter out objects with tagged classes. Objects whose class is tagged are not included.
3304
</constant>
3305
<constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20">
3306
Filter out objects with untagged classes. Objects whose class is not tagged are not included.
3307
</constant>
3308
</constants>
3309
3310
<p/>
3311
The Heap Visit Control Flags are returned by the heap callbacks
3312
and can be used to abort the iteration. For the
3313
<functionlink id="jvmtiHeapReferenceCallback">Heap
3314
Reference Callback</functionlink>, it can also be used
3315
to prune the graph of traversed references
3316
(<code>JVMTI_VISIT_OBJECTS</code> is not set).
3317
3318
<constants id="jvmtiHeapVisitControl"
3319
label="Heap Visit Control Flags"
3320
kind="bits"
3321
since="1.1">
3322
<constant id="JVMTI_VISIT_OBJECTS" num="0x100">
3323
If we are visiting an object and if this callback
3324
was initiated by <functionlink id="FollowReferences"/>,
3325
traverse the references of this object.
3326
Otherwise ignored.
3327
</constant>
3328
<constant id="JVMTI_VISIT_ABORT" num="0x8000">
3329
Abort the iteration. Ignore all other bits.
3330
</constant>
3331
</constants>
3332
3333
<p/>
3334
The Heap Reference Enumeration is provided by the
3335
<functionlink id="jvmtiHeapReferenceCallback">Heap
3336
Reference Callback</functionlink> and
3337
<functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field
3338
Callback</functionlink> to
3339
describe the kind of reference
3340
being reported.
3341
3342
<constants id="jvmtiHeapReferenceKind"
3343
label="Heap Reference Enumeration"
3344
kind="enum"
3345
since="1.1">
3346
<constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1">
3347
Reference from an object to its class.
3348
</constant>
3349
<constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2">
3350
Reference from an object to the value of one of its instance fields.
3351
</constant>
3352
<constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3">
3353
Reference from an array to one of its elements.
3354
</constant>
3355
<constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4">
3356
Reference from a class to its class loader.
3357
</constant>
3358
<constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5">
3359
Reference from a class to its signers array.
3360
</constant>
3361
<constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6">
3362
Reference from a class to its protection domain.
3363
</constant>
3364
<constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7">
3365
Reference from a class to one of its interfaces.
3366
Note: interfaces are defined via a constant pool reference,
3367
so the referenced interfaces may also be reported with a
3368
<code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.
3369
</constant>
3370
<constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8">
3371
Reference from a class to the value of one of its static fields.
3372
</constant>
3373
<constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9">
3374
Reference from a class to a resolved entry in the constant pool.
3375
</constant>
3376
<constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10">
3377
Reference from a class to its superclass.
3378
A callback is not sent if the superclass is <code>java.lang.Object</code>.
3379
Note: loaded classes define superclasses via a constant pool
3380
reference, so the referenced superclass may also be reported with
3381
a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.
3382
</constant>
3383
<constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21">
3384
Heap root reference: JNI global reference.
3385
</constant>
3386
<constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22">
3387
Heap root reference: System class.
3388
</constant>
3389
<constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23">
3390
Heap root reference: monitor.
3391
</constant>
3392
<constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24">
3393
Heap root reference: local variable on the stack.
3394
</constant>
3395
<constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25">
3396
Heap root reference: JNI local reference.
3397
</constant>
3398
<constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26">
3399
Heap root reference: Thread.
3400
</constant>
3401
<constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27">
3402
Heap root reference: other heap root reference.
3403
</constant>
3404
</constants>
3405
3406
<p/>
3407
Definitions for the single character type descriptors of
3408
primitive types.
3409
3410
<constants id="jvmtiPrimitiveType"
3411
label="Primitive Type Enumeration"
3412
kind="enum"
3413
since="1.1">
3414
<constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90">
3415
'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code>
3416
</constant>
3417
<constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66">
3418
'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code>
3419
</constant>
3420
<constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67">
3421
'C' - Java programming language <code>char</code> - JNI <code>jchar</code>
3422
</constant>
3423
<constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83">
3424
'S' - Java programming language <code>short</code> - JNI <code>jshort</code>
3425
</constant>
3426
<constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73">
3427
'I' - Java programming language <code>int</code> - JNI <code>jint</code>
3428
</constant>
3429
<constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74">
3430
'J' - Java programming language <code>long</code> - JNI <code>jlong</code>
3431
</constant>
3432
<constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70">
3433
'F' - Java programming language <code>float</code> - JNI <code>jfloat</code>
3434
</constant>
3435
<constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68">
3436
'D' - Java programming language <code>double</code> - JNI <code>jdouble</code>
3437
</constant>
3438
</constants>
3439
</intro>
3440
3441
<typedef id="jvmtiHeapReferenceInfoField"
3442
label="Reference information structure for Field references"
3443
since="1.1">
3444
<description>
3445
Reference information returned for
3446
<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and
3447
<datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.
3448
</description>
3449
<field id="index">
3450
<jint/>
3451
<description>
3452
For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the
3453
referrer object is not a class or an interface.
3454
In this case, <code>index</code> is the index of the field
3455
in the class of the referrer object.
3456
This class is referred to below as <i>C</i>.
3457
<p/>
3458
For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,
3459
the referrer object is a class (referred to below as <i>C</i>)
3460
or an interface (referred to below as <i>I</i>).
3461
In this case, <code>index</code> is the index of the field in
3462
that class or interface.
3463
<p/>
3464
If the referrer object is not an interface, then the field
3465
indices are determined as follows:
3466
<ul>
3467
<li>make a list of all the fields in <i>C</i> and its
3468
superclasses, starting with all the fields in
3469
<code>java.lang.Object</code> and ending with all the
3470
fields in <i>C</i>.</li>
3471
<li>Within this list, put
3472
the fields for a given class in the order returned by
3473
<functionlink id="GetClassFields"/>.</li>
3474
<li>Assign the fields in this list indices
3475
<i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>
3476
is the count of the fields in all the interfaces
3477
implemented by <i>C</i>.
3478
Note that <i>C</i> implements all interfaces
3479
directly implemented by its superclasses; as well
3480
as all superinterfaces of these interfaces.</li>
3481
</ul>
3482
If the referrer object is an interface, then the field
3483
indices are determined as follows:
3484
<ul>
3485
<li>make a list of the fields directly declared in
3486
<i>I</i>.</li>
3487
<li>Within this list, put
3488
the fields in the order returned by
3489
<functionlink id="GetClassFields"/>.</li>
3490
<li>Assign the fields in this list indices
3491
<i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>
3492
is the count of the fields in all the superinterfaces
3493
of <i>I</i>.</li>
3494
</ul>
3495
All fields are included in this computation, regardless of
3496
field modifier (static, public, private, etc).
3497
<p/>
3498
For example, given the following classes and interfaces:
3499
<example>
3500
interface I0 {
3501
int p = 0;
3502
}
3503
3504
interface I1 extends I0 {
3505
int x = 1;
3506
}
3507
3508
interface I2 extends I0 {
3509
int y = 2;
3510
}
3511
3512
class C1 implements I1 {
3513
public static int a = 3;
3514
private int b = 4;
3515
}
3516
3517
class C2 extends C1 implements I2 {
3518
static int q = 5;
3519
final int r = 6;
3520
}
3521
</example>
3522
Assume that <functionlink id="GetClassFields"/> called on
3523
<code>C1</code> returns the fields of <code>C1</code> in the
3524
order: a, b; and that the fields of <code>C2</code> are
3525
returned in the order: q, r.
3526
An instance of class <code>C1</code> will have the
3527
following field indices:
3528
<blockquote><table>
3529
<tr class="bgLight">
3530
<th class="centered" scope="col">Field</th>
3531
<th class="centered" scope="col">Index</th>
3532
<th scope="col">Description</th>
3533
</tr>
3534
<tr>
3535
<th class="centered" scope="row">
3536
a
3537
</th>
3538
<td class="centered">
3539
2
3540
</td>
3541
<td>
3542
The count of the fields in the interfaces
3543
implemented by <code>C1</code> is two (<i>n</i>=2):
3544
<code>p</code> of <code>I0</code>
3545
and <code>x</code> of <code>I1</code>.
3546
</td>
3547
</tr>
3548
<tr>
3549
<th class="centered" scope="row">
3550
b
3551
</th>
3552
<td class="centered">
3553
3
3554
</td>
3555
<td>
3556
the subsequent index.
3557
</td>
3558
</tr>
3559
</table></blockquote>
3560
The class <code>C1</code> will have the same field indices.
3561
<p/>
3562
An instance of class <code>C2</code> will have the
3563
following field indices:
3564
<blockquote><table>
3565
<tr class="bgLight">
3566
<th class="centered" scope="col">Field</th>
3567
<th class="centered" scope="col">Index</th>
3568
<th scope="col">Description</th>
3569
</tr>
3570
<tr>
3571
<th class="centered" scope="row">
3572
a
3573
</th>
3574
<td class="centered">
3575
3
3576
</td>
3577
<td>
3578
The count of the fields in the interfaces
3579
implemented by <code>C2</code> is three (<i>n</i>=3):
3580
<code>p</code> of <code>I0</code>,
3581
<code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code>
3582
(an interface of <code>C2</code>). Note that the field <code>p</code>
3583
of <code>I0</code> is only included once.
3584
</td>
3585
</tr>
3586
<tr>
3587
<th class="centered" scope="row">
3588
b
3589
</th>
3590
<td class="centered">
3591
4
3592
</td>
3593
<td>
3594
the subsequent index to "a".
3595
</td>
3596
</tr>
3597
<tr>
3598
<th class="centered" scope="row">
3599
q
3600
</th>
3601
<td class="centered">
3602
5
3603
</td>
3604
<td>
3605
the subsequent index to "b".
3606
</td>
3607
</tr>
3608
<tr>
3609
<th class="centered" scope="row">
3610
r
3611
</th>
3612
<td class="centered">
3613
6
3614
</td>
3615
<td>
3616
the subsequent index to "q".
3617
</td>
3618
</tr>
3619
</table></blockquote>
3620
The class <code>C2</code> will have the same field indices.
3621
Note that a field may have a different index depending on the
3622
object that is viewing it -- for example field "a" above.
3623
Note also: not all field indices may be visible from the
3624
callbacks, but all indices are shown for illustrative purposes.
3625
<p/>
3626
The interface <code>I1</code> will have the
3627
following field indices:
3628
<blockquote><table>
3629
<tr class="bgLight">
3630
<th class="centered" scope="col">Field</th>
3631
<th class="centered" scope="col">Index</th>
3632
<th scope="col">Description</th>
3633
</tr>
3634
<tr>
3635
<th class="centered" scope="row">
3636
x
3637
</th>
3638
<td class="centered">
3639
1
3640
</td>
3641
<td>
3642
The count of the fields in the superinterfaces
3643
of <code>I1</code> is one (<i>n</i>=1):
3644
<code>p</code> of <code>I0</code>.
3645
</td>
3646
</tr>
3647
</table></blockquote>
3648
</description>
3649
</field>
3650
</typedef>
3651
3652
<typedef id="jvmtiHeapReferenceInfoArray"
3653
label="Reference information structure for Array references"
3654
since="1.1">
3655
<description>
3656
Reference information returned for
3657
<datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.
3658
</description>
3659
<field id="index">
3660
<jint/>
3661
<description>
3662
The array index.
3663
</description>
3664
</field>
3665
</typedef>
3666
3667
<typedef id="jvmtiHeapReferenceInfoConstantPool"
3668
label="Reference information structure for Constant Pool references"
3669
since="1.1">
3670
<description>
3671
Reference information returned for
3672
<datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.
3673
</description>
3674
<field id="index">
3675
<jint/>
3676
<description>
3677
The index into the constant pool of the class. See the description in
3678
<vmspec chapter="4.4"/>.
3679
</description>
3680
</field>
3681
</typedef>
3682
3683
<typedef id="jvmtiHeapReferenceInfoStackLocal"
3684
label="Reference information structure for Local Variable references"
3685
since="1.1">
3686
<description>
3687
Reference information returned for
3688
<datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.
3689
</description>
3690
<field id="thread_tag">
3691
<jlong/>
3692
<description>
3693
The tag of the thread corresponding to this stack, zero if not tagged.
3694
</description>
3695
</field>
3696
<field id="thread_id">
3697
<jlong/>
3698
<description>
3699
The unique thread ID of the thread corresponding to this stack.
3700
</description>
3701
</field>
3702
<field id="depth">
3703
<jint/>
3704
<description>
3705
The depth of the frame.
3706
</description>
3707
</field>
3708
<field id="method">
3709
<jmethodID/>
3710
<description>
3711
The method executing in this frame.
3712
</description>
3713
</field>
3714
<field id="location">
3715
<jlocation/>
3716
<description>
3717
The currently executing location in this frame.
3718
</description>
3719
</field>
3720
<field id="slot">
3721
<jint/>
3722
<description>
3723
The slot number of the local variable.
3724
</description>
3725
</field>
3726
</typedef>
3727
3728
<typedef id="jvmtiHeapReferenceInfoJniLocal"
3729
label="Reference information structure for JNI local references"
3730
since="1.1">
3731
<description>
3732
Reference information returned for
3733
<datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.
3734
</description>
3735
<field id="thread_tag">
3736
<jlong/>
3737
<description>
3738
The tag of the thread corresponding to this stack, zero if not tagged.
3739
</description>
3740
</field>
3741
<field id="thread_id">
3742
<jlong/>
3743
<description>
3744
The unique thread ID of the thread corresponding to this stack.
3745
</description>
3746
</field>
3747
<field id="depth">
3748
<jint/>
3749
<description>
3750
The depth of the frame.
3751
</description>
3752
</field>
3753
<field id="method">
3754
<jmethodID/>
3755
<description>
3756
The method executing in this frame.
3757
</description>
3758
</field>
3759
</typedef>
3760
3761
<typedef id="jvmtiHeapReferenceInfoReserved"
3762
label="Reference information structure for Other references"
3763
since="1.1">
3764
<description>
3765
Reference information returned for other references.
3766
</description>
3767
<field id="reserved1">
3768
<jlong/>
3769
<description>
3770
reserved for future use.
3771
</description>
3772
</field>
3773
<field id="reserved2">
3774
<jlong/>
3775
<description>
3776
reserved for future use.
3777
</description>
3778
</field>
3779
<field id="reserved3">
3780
<jlong/>
3781
<description>
3782
reserved for future use.
3783
</description>
3784
</field>
3785
<field id="reserved4">
3786
<jlong/>
3787
<description>
3788
reserved for future use.
3789
</description>
3790
</field>
3791
<field id="reserved5">
3792
<jlong/>
3793
<description>
3794
reserved for future use.
3795
</description>
3796
</field>
3797
<field id="reserved6">
3798
<jlong/>
3799
<description>
3800
reserved for future use.
3801
</description>
3802
</field>
3803
<field id="reserved7">
3804
<jlong/>
3805
<description>
3806
reserved for future use.
3807
</description>
3808
</field>
3809
<field id="reserved8">
3810
<jlong/>
3811
<description>
3812
reserved for future use.
3813
</description>
3814
</field>
3815
</typedef>
3816
3817
<uniontypedef id="jvmtiHeapReferenceInfo"
3818
label="Reference information structure"
3819
since="1.1">
3820
<description>
3821
The information returned about referrers.
3822
Represented as a union of the various kinds of reference information.
3823
</description>
3824
<field id="field">
3825
<struct>jvmtiHeapReferenceInfoField</struct>
3826
<description>
3827
The referrer information for
3828
<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>
3829
and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.
3830
</description>
3831
</field>
3832
<field id="array">
3833
<struct>jvmtiHeapReferenceInfoArray</struct>
3834
<description>
3835
The referrer information for
3836
For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.
3837
</description>
3838
</field>
3839
<field id="constant_pool">
3840
<struct>jvmtiHeapReferenceInfoConstantPool</struct>
3841
<description>
3842
The referrer information for
3843
For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.
3844
</description>
3845
</field>
3846
<field id="stack_local">
3847
<struct>jvmtiHeapReferenceInfoStackLocal</struct>
3848
<description>
3849
The referrer information for
3850
For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.
3851
</description>
3852
</field>
3853
<field id="jni_local">
3854
<struct>jvmtiHeapReferenceInfoJniLocal</struct>
3855
<description>
3856
The referrer information for
3857
For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.
3858
</description>
3859
</field>
3860
<field id="other">
3861
<struct>jvmtiHeapReferenceInfoReserved</struct>
3862
<description>
3863
reserved for future use.
3864
</description>
3865
</field>
3866
</uniontypedef>
3867
3868
<typedef id="jvmtiHeapCallbacks"
3869
label="Heap callback function structure"
3870
since="1.1">
3871
<field id="heap_iteration_callback">
3872
<ptrtype>
3873
<struct>jvmtiHeapIterationCallback</struct>
3874
</ptrtype>
3875
<description>
3876
The callback to be called to describe an
3877
object in the heap. Used by the
3878
<functionlink id="IterateThroughHeap"/> function, ignored by the
3879
<functionlink id="FollowReferences"/> function.
3880
</description>
3881
</field>
3882
<field id="heap_reference_callback">
3883
<ptrtype>
3884
<struct>jvmtiHeapReferenceCallback</struct>
3885
</ptrtype>
3886
<description>
3887
The callback to be called to describe an
3888
object reference. Used by the
3889
<functionlink id="FollowReferences"/> function, ignored by the
3890
<functionlink id="IterateThroughHeap"/> function.
3891
</description>
3892
</field>
3893
<field id="primitive_field_callback">
3894
<ptrtype>
3895
<struct>jvmtiPrimitiveFieldCallback</struct>
3896
</ptrtype>
3897
<description>
3898
The callback to be called to describe a
3899
primitive field.
3900
</description>
3901
</field>
3902
<field id="array_primitive_value_callback">
3903
<ptrtype>
3904
<struct>jvmtiArrayPrimitiveValueCallback</struct>
3905
</ptrtype>
3906
<description>
3907
The callback to be called to describe an
3908
array of primitive values.
3909
</description>
3910
</field>
3911
<field id="string_primitive_value_callback">
3912
<ptrtype>
3913
<struct>jvmtiStringPrimitiveValueCallback</struct>
3914
</ptrtype>
3915
<description>
3916
The callback to be called to describe a String value.
3917
</description>
3918
</field>
3919
<field id="reserved5">
3920
<ptrtype>
3921
<struct>jvmtiReservedCallback</struct>
3922
</ptrtype>
3923
<description>
3924
Reserved for future use..
3925
</description>
3926
</field>
3927
<field id="reserved6">
3928
<ptrtype>
3929
<struct>jvmtiReservedCallback</struct>
3930
</ptrtype>
3931
<description>
3932
Reserved for future use..
3933
</description>
3934
</field>
3935
<field id="reserved7">
3936
<ptrtype>
3937
<struct>jvmtiReservedCallback</struct>
3938
</ptrtype>
3939
<description>
3940
Reserved for future use..
3941
</description>
3942
</field>
3943
<field id="reserved8">
3944
<ptrtype>
3945
<struct>jvmtiReservedCallback</struct>
3946
</ptrtype>
3947
<description>
3948
Reserved for future use..
3949
</description>
3950
</field>
3951
<field id="reserved9">
3952
<ptrtype>
3953
<struct>jvmtiReservedCallback</struct>
3954
</ptrtype>
3955
<description>
3956
Reserved for future use..
3957
</description>
3958
</field>
3959
<field id="reserved10">
3960
<ptrtype>
3961
<struct>jvmtiReservedCallback</struct>
3962
</ptrtype>
3963
<description>
3964
Reserved for future use..
3965
</description>
3966
</field>
3967
<field id="reserved11">
3968
<ptrtype>
3969
<struct>jvmtiReservedCallback</struct>
3970
</ptrtype>
3971
<description>
3972
Reserved for future use..
3973
</description>
3974
</field>
3975
<field id="reserved12">
3976
<ptrtype>
3977
<struct>jvmtiReservedCallback</struct>
3978
</ptrtype>
3979
<description>
3980
Reserved for future use..
3981
</description>
3982
</field>
3983
<field id="reserved13">
3984
<ptrtype>
3985
<struct>jvmtiReservedCallback</struct>
3986
</ptrtype>
3987
<description>
3988
Reserved for future use..
3989
</description>
3990
</field>
3991
<field id="reserved14">
3992
<ptrtype>
3993
<struct>jvmtiReservedCallback</struct>
3994
</ptrtype>
3995
<description>
3996
Reserved for future use..
3997
</description>
3998
</field>
3999
<field id="reserved15">
4000
<ptrtype>
4001
<struct>jvmtiReservedCallback</struct>
4002
</ptrtype>
4003
<description>
4004
Reserved for future use..
4005
</description>
4006
</field>
4007
</typedef>
4008
4009
4010
<intro>
4011
<rationale>
4012
The heap dumping functionality (below) uses a callback
4013
for each object. While it would seem that a buffered approach
4014
would provide better throughput, tests do
4015
not show this to be the case--possibly due to locality of
4016
memory reference or array access overhead.
4017
</rationale>
4018
4019
<issue>
4020
Still under investigation as to if java.lang.ref references
4021
are reported as a different type of reference.
4022
</issue>
4023
4024
<issue>
4025
Should or can an indication of the cost or relative cost of
4026
these operations be included?
4027
</issue>
4028
4029
</intro>
4030
4031
<callback id="jvmtiHeapIterationCallback" since="1.1">
4032
<jint/>
4033
<synopsis>Heap Iteration Callback</synopsis>
4034
<description>
4035
Agent supplied callback function.
4036
Describes (but does not pass in) an object in the heap.
4037
<p/>
4038
This function should return a bit vector of the desired
4039
<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4040
This will determine if the entire iteration should be aborted
4041
(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4042
<p/>
4043
See the <internallink id="heapCallbacks">heap callback
4044
function restrictions</internallink>.
4045
</description>
4046
<parameters>
4047
<param id="class_tag">
4048
<jlong/>
4049
<description>
4050
The tag of the class of object (zero if the class is not tagged).
4051
If the object represents a runtime class,
4052
the <code>class_tag</code> is the tag
4053
associated with <code>java.lang.Class</code>
4054
(zero if <code>java.lang.Class</code> is not tagged).
4055
</description>
4056
</param>
4057
<param id="size">
4058
<jlong/>
4059
<description>
4060
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
4061
</description>
4062
</param>
4063
<param id="tag_ptr">
4064
<outptr><jlong/></outptr>
4065
<description>
4066
The object tag value, or zero if the object is not tagged.
4067
To set the tag value to be associated with the object
4068
the agent sets the <code>jlong</code> pointed to by the parameter.
4069
</description>
4070
</param>
4071
<param id="length">
4072
<jint/>
4073
<description>
4074
If this object is an array, the length of the array. Otherwise negative one (-1).
4075
</description>
4076
</param>
4077
<param id="user_data">
4078
<outptr><void/></outptr>
4079
<description>
4080
The user supplied data that was passed into the iteration function.
4081
</description>
4082
</param>
4083
</parameters>
4084
</callback>
4085
4086
<callback id="jvmtiHeapReferenceCallback" since="1.1">
4087
<jint/>
4088
<synopsis>Heap Reference Callback</synopsis>
4089
<description>
4090
Agent supplied callback function.
4091
Describes a reference from an object or the VM (the referrer) to another object
4092
(the referree) or a heap root to a referree.
4093
<p/>
4094
This function should return a bit vector of the desired
4095
<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4096
This will determine if the objects referenced by the referree
4097
should be visited or if the entire iteration should be aborted.
4098
<p/>
4099
See the <internallink id="heapCallbacks">heap callback
4100
function restrictions</internallink>.
4101
</description>
4102
<parameters>
4103
<param id="reference_kind">
4104
<enum>jvmtiHeapReferenceKind</enum>
4105
<description>
4106
The kind of reference.
4107
</description>
4108
</param>
4109
<param id="reference_info">
4110
<inptr>
4111
<struct>jvmtiHeapReferenceInfo</struct>
4112
</inptr>
4113
<description>
4114
Details about the reference.
4115
Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is
4116
<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>,
4117
<datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,
4118
<datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>,
4119
<datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>,
4120
<datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>,
4121
or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>.
4122
Otherwise <code>NULL</code>.
4123
</description>
4124
</param>
4125
<param id="class_tag">
4126
<jlong/>
4127
<description>
4128
The tag of the class of referree object (zero if the class is not tagged).
4129
If the referree object represents a runtime class,
4130
the <code>class_tag</code> is the tag
4131
associated with <code>java.lang.Class</code>
4132
(zero if <code>java.lang.Class</code> is not tagged).
4133
</description>
4134
</param>
4135
<param id="referrer_class_tag">
4136
<jlong/>
4137
<description>
4138
The tag of the class of the referrer object (zero if the class is not tagged
4139
or the referree is a heap root). If the referrer object represents a runtime
4140
class, the <code>referrer_class_tag</code> is the tag associated with
4141
the <code>java.lang.Class</code>
4142
(zero if <code>java.lang.Class</code> is not tagged).
4143
</description>
4144
</param>
4145
<param id="size">
4146
<jlong/>
4147
<description>
4148
Size of the referree object (in bytes).
4149
See <functionlink id="GetObjectSize"/>.
4150
</description>
4151
</param>
4152
<param id="tag_ptr">
4153
<outptr><jlong/></outptr>
4154
<description>
4155
Points to the referree object tag value, or zero if the object is not
4156
tagged.
4157
To set the tag value to be associated with the object
4158
the agent sets the <code>jlong</code> pointed to by the parameter.
4159
</description>
4160
</param>
4161
<param id="referrer_tag_ptr">
4162
<outptr><jlong/></outptr>
4163
<description>
4164
Points to the tag of the referrer object, or
4165
points to the zero if the referrer
4166
object is not tagged.
4167
<code>NULL</code> if the referrer in not an object (that is,
4168
this callback is reporting a heap root).
4169
To set the tag value to be associated with the referrer object
4170
the agent sets the <code>jlong</code> pointed to by the parameter.
4171
If this callback is reporting a reference from an object to itself,
4172
<code>referrer_tag_ptr == tag_ptr</code>.
4173
</description>
4174
</param>
4175
<param id="length">
4176
<jint/>
4177
<description>
4178
If this object is an array, the length of the array. Otherwise negative one (-1).
4179
</description>
4180
</param>
4181
<param id="user_data">
4182
<outptr><void/></outptr>
4183
<description>
4184
The user supplied data that was passed into the iteration function.
4185
</description>
4186
</param>
4187
</parameters>
4188
</callback>
4189
4190
<callback id="jvmtiPrimitiveFieldCallback" since="1.1">
4191
<jint/>
4192
<synopsis>Primitive Field Callback</synopsis>
4193
<description>
4194
Agent supplied callback function which
4195
describes a primitive field of an object (<i>the object</i>).
4196
A primitive field is a field whose type is a primitive type.
4197
This callback will describe a static field if the object is a class,
4198
and otherwise will describe an instance field.
4199
<p/>
4200
This function should return a bit vector of the desired
4201
<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4202
This will determine if the entire iteration should be aborted
4203
(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4204
<p/>
4205
See the <internallink id="heapCallbacks">heap callback
4206
function restrictions</internallink>.
4207
</description>
4208
<parameters>
4209
<param id="kind">
4210
<enum>jvmtiHeapReferenceKind</enum>
4211
<description>
4212
The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or
4213
<datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>).
4214
</description>
4215
</param>
4216
<param id="info">
4217
<inptr>
4218
<struct>jvmtiHeapReferenceInfo</struct>
4219
</inptr>
4220
<description>
4221
Which field (the field index).
4222
</description>
4223
</param>
4224
<param id="object_class_tag">
4225
<jlong/>
4226
<description>
4227
The tag of the class of the object (zero if the class is not tagged).
4228
If the object represents a runtime class, the
4229
<code>object_class_tag</code> is the tag
4230
associated with <code>java.lang.Class</code>
4231
(zero if <code>java.lang.Class</code> is not tagged).
4232
</description>
4233
</param>
4234
<param id="object_tag_ptr">
4235
<outptr><jlong/></outptr>
4236
<description>
4237
Points to the tag of the object, or zero if the object is not
4238
tagged.
4239
To set the tag value to be associated with the object
4240
the agent sets the <code>jlong</code> pointed to by the parameter.
4241
</description>
4242
</param>
4243
<param id="value">
4244
<jvalue/>
4245
<description>
4246
The value of the field.
4247
</description>
4248
</param>
4249
<param id="value_type">
4250
<enum>jvmtiPrimitiveType</enum>
4251
<description>
4252
The type of the field.
4253
</description>
4254
</param>
4255
<param id="user_data">
4256
<outptr><void/></outptr>
4257
<description>
4258
The user supplied data that was passed into the iteration function.
4259
</description>
4260
</param>
4261
</parameters>
4262
</callback>
4263
4264
<callback id="jvmtiArrayPrimitiveValueCallback" since="1.1">
4265
<jint/>
4266
<synopsis>Array Primitive Value Callback</synopsis>
4267
<description>
4268
Agent supplied callback function.
4269
Describes the values in an array of a primitive type.
4270
<p/>
4271
This function should return a bit vector of the desired
4272
<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4273
This will determine if the entire iteration should be aborted
4274
(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4275
<p/>
4276
See the <internallink id="heapCallbacks">heap callback
4277
function restrictions</internallink>.
4278
</description>
4279
<parameters>
4280
<param id="class_tag">
4281
<jlong/>
4282
<description>
4283
The tag of the class of the array object (zero if the class is not tagged).
4284
</description>
4285
</param>
4286
<param id="size">
4287
<jlong/>
4288
<description>
4289
Size of the array (in bytes).
4290
See <functionlink id="GetObjectSize"/>.
4291
</description>
4292
</param>
4293
<param id="tag_ptr">
4294
<outptr><jlong/></outptr>
4295
<description>
4296
Points to the tag of the array object, or zero if the object is not
4297
tagged.
4298
To set the tag value to be associated with the object
4299
the agent sets the <code>jlong</code> pointed to by the parameter.
4300
</description>
4301
</param>
4302
<param id="element_count">
4303
<jint/>
4304
<description>
4305
The length of the primitive array.
4306
</description>
4307
</param>
4308
<param id="element_type">
4309
<enum>jvmtiPrimitiveType</enum>
4310
<description>
4311
The type of the elements of the array.
4312
</description>
4313
</param>
4314
<param id="elements">
4315
<vmbuf><void/></vmbuf>
4316
<description>
4317
The elements of the array in a packed array of <code>element_count</code>
4318
items of <code>element_type</code> size each.
4319
</description>
4320
</param>
4321
<param id="user_data">
4322
<outptr><void/></outptr>
4323
<description>
4324
The user supplied data that was passed into the iteration function.
4325
</description>
4326
</param>
4327
</parameters>
4328
</callback>
4329
4330
<callback id="jvmtiStringPrimitiveValueCallback" since="1.1">
4331
<jint/>
4332
<synopsis>String Primitive Value Callback</synopsis>
4333
<description>
4334
Agent supplied callback function.
4335
Describes the value of a java.lang.String.
4336
<p/>
4337
This function should return a bit vector of the desired
4338
<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4339
This will determine if the entire iteration should be aborted
4340
(the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4341
<p/>
4342
See the <internallink id="heapCallbacks">heap callback
4343
function restrictions</internallink>.
4344
</description>
4345
<parameters>
4346
<param id="class_tag">
4347
<jlong/>
4348
<description>
4349
The tag of the class of the String class (zero if the class is not tagged).
4350
<issue>Is this needed?</issue>
4351
</description>
4352
</param>
4353
<param id="size">
4354
<jlong/>
4355
<description>
4356
Size of the string (in bytes).
4357
See <functionlink id="GetObjectSize"/>.
4358
</description>
4359
</param>
4360
<param id="tag_ptr">
4361
<outptr><jlong/></outptr>
4362
<description>
4363
Points to the tag of the String object, or zero if the object is not
4364
tagged.
4365
To set the tag value to be associated with the object
4366
the agent sets the <code>jlong</code> pointed to by the parameter.
4367
</description>
4368
</param>
4369
<param id="value">
4370
<vmbuf><jchar/></vmbuf>
4371
<description>
4372
The value of the String, encoded as a Unicode string.
4373
</description>
4374
</param>
4375
<param id="value_length">
4376
<jint/>
4377
<description>
4378
The length of the string.
4379
The length is equal to the number of 16-bit Unicode
4380
characters in the string.
4381
</description>
4382
</param>
4383
<param id="user_data">
4384
<outptr><void/></outptr>
4385
<description>
4386
The user supplied data that was passed into the iteration function.
4387
</description>
4388
</param>
4389
</parameters>
4390
</callback>
4391
4392
4393
<callback id="jvmtiReservedCallback" since="1.1">
4394
<jint/>
4395
<synopsis>reserved for future use Callback</synopsis>
4396
<description>
4397
Placeholder -- reserved for future use.
4398
</description>
4399
<parameters>
4400
</parameters>
4401
</callback>
4402
4403
<function id="FollowReferences" num="115" since="1.1">
4404
<synopsis>Follow References</synopsis>
4405
<description>
4406
This function initiates a traversal over the objects that are
4407
directly and indirectly reachable from the specified object or,
4408
if <code>initial_object</code> is not specified, all objects
4409
reachable from the heap roots.
4410
The heap root are the set of system classes,
4411
JNI globals, references from thread stacks, and other objects used as roots
4412
for the purposes of garbage collection.
4413
<p/>
4414
This function operates by traversing the reference graph.
4415
Let <i>A</i>, <i>B</i>, ... represent objects.
4416
When a reference from <i>A</i> to <i>B</i> is traversed,
4417
when a reference from a heap root to <i>B</i> is traversed,
4418
or when <i>B</i> is specified as the <paramlink id="initial_object"/>,
4419
then <i>B</i> is said to be <i>visited</i>.
4420
A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i>
4421
is visited.
4422
References are reported in the same order that the references are traversed.
4423
Object references are reported by invoking the agent supplied
4424
callback function <functionlink id="jvmtiHeapReferenceCallback"/>.
4425
In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known
4426
as the <i>referrer</i> and <i>B</i> as the <i>referree</i>.
4427
The callback is invoked exactly once for each reference from a referrer;
4428
this is true even if there are reference cycles or multiple paths to
4429
the referrer.
4430
There may be more than one reference between a referrer and a referree,
4431
each reference is reported.
4432
These references may be distinguished by examining the
4433
<datalink
4434
id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink>
4435
and
4436
<datalink
4437
id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink>
4438
parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback.
4439
<p/>
4440
This function reports a Java programming language view of object references,
4441
not a virtual machine implementation view. The following object references
4442
are reported when they are non-null:
4443
<ul>
4444
<li>Instance objects report references to each non-primitive instance fields
4445
(including inherited fields).</li>
4446
<li>Instance objects report a reference to the object type (class).</li>
4447
<li>Classes report a reference to the superclass and directly
4448
implemented/extended interfaces.</li>
4449
<li>Classes report a reference to the class loader, protection domain,
4450
signers, and resolved entries in the constant pool.</li>
4451
<li>Classes report a reference to each directly declared non-primitive
4452
static field.</li>
4453
<li>Arrays report a reference to the array type (class) and each
4454
array element.</li>
4455
<li>Primitive arrays report a reference to the array type.</li>
4456
</ul>
4457
<p/>
4458
This function can also be used to examine primitive (non-object) values.
4459
The primitive value of an array or String
4460
is reported after the object has been visited;
4461
it is reported by invoking the agent supplied callback function
4462
<functionlink id="jvmtiArrayPrimitiveValueCallback"/> or
4463
<functionlink id="jvmtiStringPrimitiveValueCallback"/>.
4464
A primitive field
4465
is reported after the object with that field is visited;
4466
it is reported by invoking the agent supplied callback function
4467
<functionlink id="jvmtiPrimitiveFieldCallback"/>.
4468
<p/>
4469
Whether a callback is provided or is <code>NULL</code> only determines
4470
whether the callback will be invoked, it does not influence
4471
which objects are visited nor does it influence whether other callbacks
4472
will be invoked.
4473
However, the
4474
<datalink id="jvmtiHeapVisitControl">visit control flags</datalink>
4475
returned by <functionlink id="jvmtiHeapReferenceCallback"/>
4476
do determine if the objects referenced by the
4477
current object as visited.
4478
The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>
4479
and <paramlink id="klass"/> provided as parameters to this function
4480
do not control which objects are visited but they do control which
4481
objects and primitive values are reported by the callbacks.
4482
For example, if the only callback that was set is
4483
<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>
4484
is set to the array of bytes class, then only arrays of byte will be
4485
reported.
4486
The table below summarizes this:
4487
<p/>
4488
<table>
4489
<tr class="bgLight">
4490
<th/>
4491
<th class="centered" scope="col">Controls objects visited</th>
4492
<th class="centered" scope="col">Controls objects reported</th>
4493
<th class="centered" scope="col">Controls primitives reported</th>
4494
</tr>
4495
<tr>
4496
<th scope="row">
4497
the
4498
<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4499
returned by <functionlink id="jvmtiHeapReferenceCallback"/>
4500
</th>
4501
<td class="centered">
4502
<b>Yes</b>
4503
</td>
4504
<td class="centered">
4505
<b>Yes</b>, since visits are controlled
4506
</td>
4507
<td class="centered">
4508
<b>Yes</b>, since visits are controlled
4509
</td>
4510
</tr>
4511
<tr>
4512
<th scope="row">
4513
<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>
4514
in <paramlink id="callbacks"/> set
4515
</th>
4516
<td class="centered">
4517
No
4518
</td>
4519
<td class="centered">
4520
<b>Yes</b>
4521
</td>
4522
<td class="centered">
4523
No
4524
</td>
4525
</tr>
4526
<tr>
4527
<th scope="row">
4528
<paramlink id="heap_filter"/>
4529
</th>
4530
<td class="centered">
4531
No
4532
</td>
4533
<td class="centered">
4534
<b>Yes</b>
4535
</td>
4536
<td class="centered">
4537
<b>Yes</b>
4538
</td>
4539
</tr>
4540
<tr>
4541
<th scope="row">
4542
<paramlink id="klass"/>
4543
</th>
4544
<td class="centered">
4545
No
4546
</td>
4547
<td class="centered">
4548
<b>Yes</b>
4549
</td>
4550
<td class="centered">
4551
<b>Yes</b>
4552
</td>
4553
</tr>
4554
</table>
4555
<p/>
4556
During the execution of this function the state of the heap
4557
does not change: no objects are allocated, no objects are
4558
garbage collected, and the state of objects (including
4559
held values) does not change.
4560
As a result, threads executing Java
4561
programming language code, threads attempting to resume the
4562
execution of Java programming language code, and threads
4563
attempting to execute JNI functions are typically stalled.
4564
</description>
4565
<origin>new</origin>
4566
<capabilities>
4567
<required id="can_tag_objects"></required>
4568
</capabilities>
4569
<parameters>
4570
<param id="heap_filter">
4571
<jint/>
4572
<description>
4573
This bit vector of
4574
<datalink id="jvmtiHeapFilter">heap filter flags</datalink>.
4575
restricts the objects for which the callback function is called.
4576
This applies to both the object and primitive callbacks.
4577
</description>
4578
</param>
4579
<param id="klass">
4580
<ptrtype>
4581
<jclass/>
4582
<nullok>callbacks are not limited to instances of a particular
4583
class</nullok>
4584
</ptrtype>
4585
<description>
4586
Callbacks are only reported when the object is an instance of
4587
this class.
4588
Objects which are instances of a subclass of <code>klass</code>
4589
are not reported.
4590
If <code>klass</code> is an interface, no objects are reported.
4591
This applies to both the object and primitive callbacks.
4592
</description>
4593
</param>
4594
<param id="initial_object">
4595
<ptrtype>
4596
<jobject/>
4597
<nullok>references are followed from the heap roots</nullok>
4598
</ptrtype>
4599
<description>
4600
The object to follow
4601
</description>
4602
</param>
4603
<param id="callbacks">
4604
<inptr>
4605
<struct>jvmtiHeapCallbacks</struct>
4606
</inptr>
4607
<description>
4608
Structure defining the set of callback functions.
4609
</description>
4610
</param>
4611
<param id="user_data">
4612
<inbuf>
4613
<void/>
4614
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
4615
</inbuf>
4616
<description>
4617
User supplied data to be passed to the callback.
4618
</description>
4619
</param>
4620
</parameters>
4621
<errors>
4622
<error id="JVMTI_ERROR_INVALID_CLASS">
4623
<paramlink id="klass"/> is not a valid class.
4624
</error>
4625
<error id="JVMTI_ERROR_INVALID_OBJECT">
4626
<paramlink id="initial_object"/> is not a valid object.
4627
</error>
4628
</errors>
4629
</function>
4630
4631
4632
<function id="IterateThroughHeap" num="116" since="1.1">
4633
<synopsis>Iterate Through Heap</synopsis>
4634
<description>
4635
Initiate an iteration over all objects in the heap.
4636
This includes both reachable and
4637
unreachable objects. Objects are visited in no particular order.
4638
<p/>
4639
Heap objects are reported by invoking the agent supplied
4640
callback function <functionlink id="jvmtiHeapIterationCallback"/>.
4641
References between objects are not reported.
4642
If only reachable objects are desired, or if object reference information
4643
is needed, use <functionlink id="FollowReferences"/>.
4644
<p/>
4645
This function can also be used to examine primitive (non-object) values.
4646
The primitive value of an array or String
4647
is reported after the object has been visited;
4648
it is reported by invoking the agent supplied callback function
4649
<functionlink id="jvmtiArrayPrimitiveValueCallback"/> or
4650
<functionlink id="jvmtiStringPrimitiveValueCallback"/>.
4651
A primitive field
4652
is reported after the object with that field is visited;
4653
it is reported by invoking the agent supplied
4654
callback function
4655
<functionlink id="jvmtiPrimitiveFieldCallback"/>.
4656
<p/>
4657
Unless the iteration is aborted by the
4658
<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4659
returned by a callback, all objects in the heap are visited.
4660
Whether a callback is provided or is <code>NULL</code> only determines
4661
whether the callback will be invoked, it does not influence
4662
which objects are visited nor does it influence whether other callbacks
4663
will be invoked.
4664
The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>
4665
and <paramlink id="klass"/> provided as parameters to this function
4666
do not control which objects are visited but they do control which
4667
objects and primitive values are reported by the callbacks.
4668
For example, if the only callback that was set is
4669
<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>
4670
is set to the array of bytes class, then only arrays of byte will be
4671
reported. The table below summarizes this (contrast this with
4672
<functionlink id="FollowReferences"/>):
4673
<p/>
4674
<table>
4675
<tr class="bgLight">
4676
<th/>
4677
<th class="centered" scope="col">Controls objects visited</th>
4678
<th class="centered" scope="col">Controls objects reported</th>
4679
<th class="centered" scope="col">Controls primitives reported</th>
4680
</tr>
4681
<tr>
4682
<th scope="row">
4683
the
4684
<datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4685
returned by <functionlink id="jvmtiHeapIterationCallback"/>
4686
</th>
4687
<td class="centered">
4688
No<br/>(unless they abort the iteration)
4689
</td>
4690
<td class="centered">
4691
No<br/>(unless they abort the iteration)
4692
</td>
4693
<td class="centered">
4694
No<br/>(unless they abort the iteration)
4695
</td>
4696
</tr>
4697
<tr>
4698
<th scope="row">
4699
<fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>
4700
in <paramlink id="callbacks"/> set
4701
</th>
4702
<td class="centered">
4703
No
4704
</td>
4705
<td class="centered">
4706
<b>Yes</b>
4707
</td>
4708
<td class="centered">
4709
No
4710
</td>
4711
</tr>
4712
<tr>
4713
<th scope="row">
4714
<paramlink id="heap_filter"/>
4715
</th>
4716
<td class="centered">
4717
No
4718
</td>
4719
<td class="centered">
4720
<b>Yes</b>
4721
</td>
4722
<td class="centered">
4723
<b>Yes</b>
4724
</td>
4725
</tr>
4726
<tr>
4727
<th scope="row">
4728
<paramlink id="klass"/>
4729
</th>
4730
<td class="centered">
4731
No
4732
</td>
4733
<td class="centered">
4734
<b>Yes</b>
4735
</td>
4736
<td class="centered">
4737
<b>Yes</b>
4738
</td>
4739
</tr>
4740
</table>
4741
<p/>
4742
During the execution of this function the state of the heap
4743
does not change: no objects are allocated, no objects are
4744
garbage collected, and the state of objects (including
4745
held values) does not change.
4746
As a result, threads executing Java
4747
programming language code, threads attempting to resume the
4748
execution of Java programming language code, and threads
4749
attempting to execute JNI functions are typically stalled.
4750
</description>
4751
<origin>new</origin>
4752
<capabilities>
4753
<required id="can_tag_objects"></required>
4754
</capabilities>
4755
<parameters>
4756
<param id="heap_filter">
4757
<jint/>
4758
<description>
4759
This bit vector of
4760
<datalink id="jvmtiHeapFilter">heap filter flags</datalink>.
4761
restricts the objects for which the callback function is called.
4762
This applies to both the object and primitive callbacks.
4763
</description>
4764
</param>
4765
<param id="klass">
4766
<ptrtype>
4767
<jclass/>
4768
<nullok>callbacks are not limited to instances of a particular class</nullok>
4769
</ptrtype>
4770
<description>
4771
Callbacks are only reported when the object is an instance of
4772
this class.
4773
Objects which are instances of a subclass of <code>klass</code>
4774
are not reported.
4775
If <code>klass</code> is an interface, no objects are reported.
4776
This applies to both the object and primitive callbacks.
4777
</description>
4778
</param>
4779
<param id="callbacks">
4780
<inptr>
4781
<struct>jvmtiHeapCallbacks</struct>
4782
</inptr>
4783
<description>
4784
Structure defining the set callback functions.
4785
</description>
4786
</param>
4787
<param id="user_data">
4788
<inbuf>
4789
<void/>
4790
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
4791
</inbuf>
4792
<description>
4793
User supplied data to be passed to the callback.
4794
</description>
4795
</param>
4796
</parameters>
4797
<errors>
4798
<error id="JVMTI_ERROR_INVALID_CLASS">
4799
<paramlink id="klass"/> is not a valid class.
4800
</error>
4801
</errors>
4802
</function>
4803
4804
<function id="GetTag" phase="start" num="106">
4805
<synopsis>Get Tag</synopsis>
4806
<description>
4807
Retrieve the tag associated with an object.
4808
The tag is a long value typically used to store a
4809
unique identifier or pointer to object information.
4810
The tag is set with
4811
<functionlink id="SetTag"></functionlink>.
4812
Objects for which no tags have been set return a
4813
tag value of zero.
4814
</description>
4815
<origin>new</origin>
4816
<capabilities>
4817
<required id="can_tag_objects"></required>
4818
</capabilities>
4819
<parameters>
4820
<param id="object">
4821
<jobject/>
4822
<description>
4823
The object whose tag is to be retrieved.
4824
</description>
4825
</param>
4826
<param id="tag_ptr">
4827
<outptr><jlong/></outptr>
4828
<description>
4829
On return, the referenced long is set to the value
4830
of the tag.
4831
</description>
4832
</param>
4833
</parameters>
4834
<errors>
4835
</errors>
4836
</function>
4837
4838
<function id="SetTag" phase="start" num="107">
4839
<synopsis>Set Tag</synopsis>
4840
<description>
4841
Set the tag associated with an object.
4842
The tag is a long value typically used to store a
4843
unique identifier or pointer to object information.
4844
The tag is visible with
4845
<functionlink id="GetTag"></functionlink>.
4846
</description>
4847
<origin>new</origin>
4848
<capabilities>
4849
<required id="can_tag_objects"></required>
4850
</capabilities>
4851
<parameters>
4852
<param id="object">
4853
<jobject/>
4854
<description>
4855
The object whose tag is to be set.
4856
</description>
4857
</param>
4858
<param id="tag">
4859
<jlong/>
4860
<description>
4861
The new value of the tag.
4862
</description>
4863
</param>
4864
</parameters>
4865
<errors>
4866
</errors>
4867
</function>
4868
4869
<function id="GetObjectsWithTags" num="114">
4870
<synopsis>Get Objects With Tags</synopsis>
4871
<description>
4872
Return objects in the heap with the specified tags.
4873
The format is parallel arrays of objects and tags.
4874
</description>
4875
<origin>new</origin>
4876
<capabilities>
4877
<required id="can_tag_objects"></required>
4878
</capabilities>
4879
<parameters>
4880
<param id="tag_count">
4881
<jint min="0"/>
4882
<description>
4883
Number of tags to scan for.
4884
</description>
4885
</param>
4886
<param id="tags">
4887
<inbuf incount="tag_count">
4888
<jlong/>
4889
</inbuf>
4890
<description>
4891
Scan for objects with these tags.
4892
Zero is not permitted in this array.
4893
</description>
4894
</param>
4895
<param id="count_ptr">
4896
<outptr>
4897
<jint/>
4898
</outptr>
4899
<description>
4900
Return the number of objects with any of the tags
4901
in <paramlink id="tags"/>.
4902
</description>
4903
</param>
4904
<param id="object_result_ptr">
4905
<allocbuf outcount="count_ptr">
4906
<jobject/>
4907
<nullok>this information is not returned</nullok>
4908
</allocbuf>
4909
<description>
4910
Returns the array of objects with any of the tags
4911
in <paramlink id="tags"/>.
4912
</description>
4913
</param>
4914
<param id="tag_result_ptr">
4915
<allocbuf outcount="count_ptr">
4916
<jlong/>
4917
<nullok>this information is not returned</nullok>
4918
</allocbuf>
4919
<description>
4920
For each object in <paramlink id="object_result_ptr"/>,
4921
return the tag at the corresponding index.
4922
</description>
4923
</param>
4924
</parameters>
4925
<errors>
4926
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
4927
Zero is present in <paramlink id="tags"></paramlink>.
4928
</error>
4929
</errors>
4930
</function>
4931
4932
<function id="ForceGarbageCollection" num="108">
4933
<synopsis>Force Garbage Collection</synopsis>
4934
<description>
4935
Force the VM to perform a garbage collection.
4936
The garbage collection is as complete as possible.
4937
This function does not cause finalizers to be run.
4938
This function does not return until the garbage collection
4939
is finished.
4940
<p/>
4941
Although garbage collection is as complete
4942
as possible there is no guarantee that all
4943
<eventlink id="ObjectFree"/>
4944
events will have been
4945
sent by the time that this function
4946
returns. In particular, an object may be
4947
prevented from being freed because it
4948
is awaiting finalization.
4949
</description>
4950
<origin>new</origin>
4951
<capabilities>
4952
</capabilities>
4953
<parameters>
4954
</parameters>
4955
<errors>
4956
</errors>
4957
</function>
4958
4959
4960
</category>
4961
4962
<category id="Heap_1_0" label="Heap (1.0)">
4963
<intro>
4964
<b>
4965
These functions and data types were introduced in the original
4966
<jvmti/> version 1.0. They are deprecated and will be changed
4967
to return an error in a future release. They were superseded in
4968
<jvmti/> version 1.2 (Java SE 6) by more
4969
</b>
4970
<internallink id="Heap"><b>powerful and flexible versions</b></internallink>
4971
<b>
4972
which:
4973
</b>
4974
<ul>
4975
<li>
4976
<b>
4977
Allow access to primitive values (the value of Strings, arrays,
4978
and primitive fields)
4979
</b>
4980
</li>
4981
<li>
4982
<b>
4983
Allow the tag of the referrer to be set, thus enabling more
4984
efficient localized reference graph building
4985
</b>
4986
</li>
4987
<li>
4988
<b>
4989
Provide more extensive filtering abilities
4990
</b>
4991
</li>
4992
<li>
4993
<b>
4994
Are extensible, allowing their abilities to grow in future versions of <jvmti/>
4995
</b>
4996
</li>
4997
</ul>
4998
<p/>
4999
<b>Please use the </b>
5000
<internallink id="Heap"><b>current Heap functions</b></internallink>.
5001
<p/>
5002
<constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum">
5003
<constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1">
5004
Tagged objects only.
5005
</constant>
5006
<constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2">
5007
Untagged objects only.
5008
</constant>
5009
<constant id="JVMTI_HEAP_OBJECT_EITHER" num="3">
5010
Either tagged or untagged objects.
5011
</constant>
5012
</constants>
5013
5014
<constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum">
5015
<constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1">
5016
JNI global reference.
5017
</constant>
5018
<constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2">
5019
System class.
5020
</constant>
5021
<constant id="JVMTI_HEAP_ROOT_MONITOR" num="3">
5022
Monitor.
5023
</constant>
5024
<constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4">
5025
Stack local.
5026
</constant>
5027
<constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5">
5028
JNI local reference.
5029
</constant>
5030
<constant id="JVMTI_HEAP_ROOT_THREAD" num="6">
5031
Thread.
5032
</constant>
5033
<constant id="JVMTI_HEAP_ROOT_OTHER" num="7">
5034
Other.
5035
</constant>
5036
</constants>
5037
5038
<constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum">
5039
<constant id="JVMTI_REFERENCE_CLASS" num="1">
5040
Reference from an object to its class.
5041
</constant>
5042
<constant id="JVMTI_REFERENCE_FIELD" num="2">
5043
Reference from an object to the value of one of its instance fields.
5044
For references of this kind the <code>referrer_index</code>
5045
parameter to the <internallink id="jvmtiObjectReferenceCallback">
5046
jvmtiObjectReferenceCallback</internallink> is the index of the
5047
the instance field. The index is based on the order of all the
5048
object's fields. This includes all fields of the directly declared
5049
static and instance fields in the class, and includes all fields (both
5050
public and private) fields declared in superclasses and superinterfaces.
5051
The index is thus calculated by summing the index of the field in the directly
5052
declared class (see <functionlink id="GetClassFields"/>), with the total
5053
number of fields (both public and private) declared in all superclasses
5054
and superinterfaces. The index starts at zero.
5055
</constant>
5056
<constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3">
5057
Reference from an array to one of its elements.
5058
For references of this kind the <code>referrer_index</code>
5059
parameter to the <internallink id="jvmtiObjectReferenceCallback">
5060
jvmtiObjectReferenceCallback</internallink> is the array index.
5061
</constant>
5062
<constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4">
5063
Reference from a class to its class loader.
5064
</constant>
5065
<constant id="JVMTI_REFERENCE_SIGNERS" num="5">
5066
Reference from a class to its signers array.
5067
</constant>
5068
<constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6">
5069
Reference from a class to its protection domain.
5070
</constant>
5071
<constant id="JVMTI_REFERENCE_INTERFACE" num="7">
5072
Reference from a class to one of its interfaces.
5073
</constant>
5074
<constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8">
5075
Reference from a class to the value of one of its static fields.
5076
For references of this kind the <code>referrer_index</code>
5077
parameter to the <internallink id="jvmtiObjectReferenceCallback">
5078
jvmtiObjectReferenceCallback</internallink> is the index of the
5079
the static field. The index is based on the order of all the
5080
object's fields. This includes all fields of the directly declared
5081
static and instance fields in the class, and includes all fields (both
5082
public and private) fields declared in superclasses and superinterfaces.
5083
The index is thus calculated by summing the index of the field in the directly
5084
declared class (see <functionlink id="GetClassFields"/>), with the total
5085
number of fields (both public and private) declared in all superclasses
5086
and superinterfaces. The index starts at zero.
5087
Note: this definition differs from that in the <jvmti/> 1.0 Specification.
5088
<rationale>No known implementations used the 1.0 definition.</rationale>
5089
</constant>
5090
<constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9">
5091
Reference from a class to a resolved entry in the constant pool.
5092
For references of this kind the <code>referrer_index</code>
5093
parameter to the <internallink id="jvmtiObjectReferenceCallback">
5094
jvmtiObjectReferenceCallback</internallink> is the index into
5095
constant pool table of the class, starting at 1. See
5096
<vmspec chapter="4.4"/>.
5097
</constant>
5098
</constants>
5099
5100
<constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum">
5101
<constant id="JVMTI_ITERATION_CONTINUE" num="1">
5102
Continue the iteration.
5103
If this is a reference iteration, follow the references of this object.
5104
</constant>
5105
<constant id="JVMTI_ITERATION_IGNORE" num="2">
5106
Continue the iteration.
5107
If this is a reference iteration, ignore the references of this object.
5108
</constant>
5109
<constant id="JVMTI_ITERATION_ABORT" num="0">
5110
Abort the iteration.
5111
</constant>
5112
</constants>
5113
</intro>
5114
5115
<callback id="jvmtiHeapObjectCallback">
5116
<enum>jvmtiIterationControl</enum>
5117
<synopsis>Heap Object Callback</synopsis>
5118
<description>
5119
Agent supplied callback function.
5120
Describes (but does not pass in) an object in the heap.
5121
<p/>
5122
Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5123
or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5124
<p/>
5125
See the <internallink id="heapCallbacks">heap callback
5126
function restrictions</internallink>.
5127
</description>
5128
<parameters>
5129
<param id="class_tag">
5130
<jlong/>
5131
<description>
5132
The tag of the class of object (zero if the class is not tagged).
5133
If the object represents a runtime class,
5134
the <code>class_tag</code> is the tag
5135
associated with <code>java.lang.Class</code>
5136
(zero if <code>java.lang.Class</code> is not tagged).
5137
</description>
5138
</param>
5139
<param id="size">
5140
<jlong/>
5141
<description>
5142
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5143
</description>
5144
</param>
5145
<param id="tag_ptr">
5146
<outptr><jlong/></outptr>
5147
<description>
5148
The object tag value, or zero if the object is not tagged.
5149
To set the tag value to be associated with the object
5150
the agent sets the <code>jlong</code> pointed to by the parameter.
5151
</description>
5152
</param>
5153
<param id="user_data">
5154
<outptr><void/></outptr>
5155
<description>
5156
The user supplied data that was passed into the iteration function.
5157
</description>
5158
</param>
5159
</parameters>
5160
</callback>
5161
5162
<callback id="jvmtiHeapRootCallback">
5163
<enum>jvmtiIterationControl</enum>
5164
<synopsis>Heap Root Object Callback</synopsis>
5165
<description>
5166
Agent supplied callback function.
5167
Describes (but does not pass in) an object that is a root for the purposes
5168
of garbage collection.
5169
<p/>
5170
Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5171
<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5172
references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5173
<p/>
5174
See the <internallink id="heapCallbacks">heap callback
5175
function restrictions</internallink>.
5176
</description>
5177
<parameters>
5178
<param id="root_kind">
5179
<enum>jvmtiHeapRootKind</enum>
5180
<description>
5181
The kind of heap root.
5182
</description>
5183
</param>
5184
<param id="class_tag">
5185
<jlong/>
5186
<description>
5187
The tag of the class of object (zero if the class is not tagged).
5188
If the object represents a runtime class, the <code>class_tag</code> is the tag
5189
associated with <code>java.lang.Class</code>
5190
(zero if <code>java.lang.Class</code> is not tagged).
5191
</description>
5192
</param>
5193
<param id="size">
5194
<jlong/>
5195
<description>
5196
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5197
</description>
5198
</param>
5199
<param id="tag_ptr">
5200
<outptr><jlong/></outptr>
5201
<description>
5202
The object tag value, or zero if the object is not tagged.
5203
To set the tag value to be associated with the object
5204
the agent sets the <code>jlong</code> pointed to by the parameter.
5205
</description>
5206
</param>
5207
<param id="user_data">
5208
<outptr><void/></outptr>
5209
<description>
5210
The user supplied data that was passed into the iteration function.
5211
</description>
5212
</param>
5213
</parameters>
5214
</callback>
5215
5216
<callback id="jvmtiStackReferenceCallback">
5217
<enum>jvmtiIterationControl</enum>
5218
<synopsis>Stack Reference Object Callback</synopsis>
5219
<description>
5220
Agent supplied callback function.
5221
Describes (but does not pass in) an object on the stack that is a root for
5222
the purposes of garbage collection.
5223
<p/>
5224
Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5225
<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5226
references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5227
<p/>
5228
See the <internallink id="heapCallbacks">heap callback
5229
function restrictions</internallink>.
5230
</description>
5231
<parameters>
5232
<param id="root_kind">
5233
<enum>jvmtiHeapRootKind</enum>
5234
<description>
5235
The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5236
<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>).
5237
</description>
5238
</param>
5239
<param id="class_tag">
5240
<jlong/>
5241
<description>
5242
The tag of the class of object (zero if the class is not tagged).
5243
If the object represents a runtime class, the <code>class_tag</code> is the tag
5244
associated with <code>java.lang.Class</code>
5245
(zero if <code>java.lang.Class</code> is not tagged).
5246
</description>
5247
</param>
5248
<param id="size">
5249
<jlong/>
5250
<description>
5251
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5252
</description>
5253
</param>
5254
<param id="tag_ptr">
5255
<outptr><jlong/></outptr>
5256
<description>
5257
The object tag value, or zero if the object is not tagged.
5258
To set the tag value to be associated with the object
5259
the agent sets the <code>jlong</code> pointed to by the parameter.
5260
</description>
5261
</param>
5262
<param id="thread_tag">
5263
<jlong/>
5264
<description>
5265
The tag of the thread corresponding to this stack, zero if not tagged.
5266
</description>
5267
</param>
5268
<param id="depth">
5269
<jint/>
5270
<description>
5271
The depth of the frame.
5272
</description>
5273
</param>
5274
<param id="method">
5275
<jmethodID/>
5276
<description>
5277
The method executing in this frame.
5278
</description>
5279
</param>
5280
<param id="slot">
5281
<jint/>
5282
<description>
5283
The slot number.
5284
</description>
5285
</param>
5286
<param id="user_data">
5287
<outptr><void/></outptr>
5288
<description>
5289
The user supplied data that was passed into the iteration function.
5290
</description>
5291
</param>
5292
</parameters>
5293
</callback>
5294
5295
<callback id="jvmtiObjectReferenceCallback">
5296
<enum>jvmtiIterationControl</enum>
5297
<synopsis>Object Reference Callback</synopsis>
5298
<description>
5299
Agent supplied callback function.
5300
Describes a reference from an object (the referrer) to another object
5301
(the referree).
5302
<p/>
5303
Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5304
<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5305
references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5306
<p/>
5307
See the <internallink id="heapCallbacks">heap callback
5308
function restrictions</internallink>.
5309
</description>
5310
<parameters>
5311
<param id="reference_kind">
5312
<enum>jvmtiObjectReferenceKind</enum>
5313
<description>
5314
The type of reference.
5315
</description>
5316
</param>
5317
<param id="class_tag">
5318
<jlong/>
5319
<description>
5320
The tag of the class of referree object (zero if the class is not tagged).
5321
If the referree object represents a runtime class,
5322
the <code>class_tag</code> is the tag
5323
associated with <code>java.lang.Class</code>
5324
(zero if <code>java.lang.Class</code> is not tagged).
5325
</description>
5326
</param>
5327
<param id="size">
5328
<jlong/>
5329
<description>
5330
Size of the referree object (in bytes).
5331
See <functionlink id="GetObjectSize"/>.
5332
</description>
5333
</param>
5334
<param id="tag_ptr">
5335
<outptr><jlong/></outptr>
5336
<description>
5337
The referree object tag value, or zero if the object is not
5338
tagged.
5339
To set the tag value to be associated with the object
5340
the agent sets the <code>jlong</code> pointed to by the parameter.
5341
</description>
5342
</param>
5343
<param id="referrer_tag">
5344
<jlong/>
5345
<description>
5346
The tag of the referrer object, or zero if the referrer
5347
object is not tagged.
5348
</description>
5349
</param>
5350
<param id="referrer_index">
5351
<jint/>
5352
<description>
5353
For references of type <code>JVMTI_REFERENCE_FIELD</code> or
5354
<code>JVMTI_REFERENCE_STATIC_FIELD</code> the index
5355
of the field in the referrer object. The index is based on the
5356
order of all the object's fields - see <internallink
5357
id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink>
5358
or <internallink
5359
id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD
5360
</internallink> for further description.
5361
<p/>
5362
For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code>
5363
the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT">
5364
JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description.
5365
<p/>
5366
For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code>
5367
the index into the constant pool of the class - see
5368
<internallink id="JVMTI_REFERENCE_CONSTANT_POOL">
5369
JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further
5370
description.
5371
<p/>
5372
For references of other kinds the <code>referrer_index</code> is
5373
<code>-1</code>.
5374
</description>
5375
</param>
5376
<param id="user_data">
5377
<outptr><void/></outptr>
5378
<description>
5379
The user supplied data that was passed into the iteration function.
5380
</description>
5381
</param>
5382
</parameters>
5383
</callback>
5384
5385
<function id="IterateOverObjectsReachableFromObject" num="109">
5386
<synopsis>Iterate Over Objects Reachable From Object</synopsis>
5387
<description>
5388
This function iterates over all objects that are directly
5389
and indirectly reachable from the specified object.
5390
For each object <i>A</i> (known
5391
as the referrer) with a reference to object <i>B</i> the specified
5392
callback function is called to describe the object reference.
5393
The callback is called exactly once for each reference from a referrer;
5394
this is true even if there are reference cycles or multiple paths to
5395
the referrer.
5396
There may be more than one reference between a referrer and a referree,
5397
These may be distinguished by the
5398
<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5399
<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5400
The callback for an object will always occur after the callback for
5401
its referrer.
5402
<p/>
5403
See <functionlink id="FollowReferences"/> for the object
5404
references which are reported.
5405
<p/>
5406
During the execution of this function the state of the heap
5407
does not change: no objects are allocated, no objects are
5408
garbage collected, and the state of objects (including
5409
held values) does not change.
5410
As a result, threads executing Java
5411
programming language code, threads attempting to resume the
5412
execution of Java programming language code, and threads
5413
attempting to execute JNI functions are typically stalled.
5414
</description>
5415
<origin>new</origin>
5416
<capabilities>
5417
<required id="can_tag_objects"></required>
5418
</capabilities>
5419
<parameters>
5420
<param id="object">
5421
<jobject/>
5422
<description>
5423
The object
5424
</description>
5425
</param>
5426
<param id="object_reference_callback">
5427
<ptrtype>
5428
<struct>jvmtiObjectReferenceCallback</struct>
5429
</ptrtype>
5430
<description>
5431
The callback to be called to describe each
5432
object reference.
5433
</description>
5434
</param>
5435
<param id="user_data">
5436
<inbuf>
5437
<void/>
5438
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
5439
</inbuf>
5440
<description>
5441
User supplied data to be passed to the callback.
5442
</description>
5443
</param>
5444
</parameters>
5445
<errors>
5446
</errors>
5447
</function>
5448
5449
<function id="IterateOverReachableObjects" num="110">
5450
<synopsis>Iterate Over Reachable Objects</synopsis>
5451
<description>
5452
This function iterates over the root objects and all objects that
5453
are directly and indirectly reachable from the root objects.
5454
The root objects comprise the set of system classes,
5455
JNI globals, references from thread stacks, and other objects used as roots
5456
for the purposes of garbage collection.
5457
<p/>
5458
For each root the <paramlink id="heap_root_callback"></paramlink>
5459
or <paramlink id="stack_ref_callback"></paramlink> callback is called.
5460
An object can be a root object for more than one reason and in that case
5461
the appropriate callback is called for each reason.
5462
<p/>
5463
For each object reference the <paramlink id="object_ref_callback"></paramlink>
5464
callback function is called to describe the object reference.
5465
The callback is called exactly once for each reference from a referrer;
5466
this is true even if there are reference cycles or multiple paths to
5467
the referrer.
5468
There may be more than one reference between a referrer and a referree,
5469
These may be distinguished by the
5470
<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5471
<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5472
The callback for an object will always occur after the callback for
5473
its referrer.
5474
<p/>
5475
See <functionlink id="FollowReferences"/> for the object
5476
references which are reported.
5477
<p/>
5478
Roots are always reported to the profiler before any object references
5479
are reported. In other words, the <paramlink id="object_ref_callback"></paramlink>
5480
callback will not be called until the appropriate callback has been called
5481
for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is
5482
specified as <code>NULL</code> then this function returns after
5483
reporting the root objects to the profiler.
5484
<p/>
5485
During the execution of this function the state of the heap
5486
does not change: no objects are allocated, no objects are
5487
garbage collected, and the state of objects (including
5488
held values) does not change.
5489
As a result, threads executing Java
5490
programming language code, threads attempting to resume the
5491
execution of Java programming language code, and threads
5492
attempting to execute JNI functions are typically stalled.
5493
</description>
5494
<origin>new</origin>
5495
<capabilities>
5496
<required id="can_tag_objects"></required>
5497
</capabilities>
5498
<parameters>
5499
<param id="heap_root_callback">
5500
<ptrtype>
5501
<struct>jvmtiHeapRootCallback</struct>
5502
<nullok>do not report heap roots</nullok>
5503
</ptrtype>
5504
<description>
5505
The callback function to be called for each heap root of type
5506
<code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>,
5507
<code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>,
5508
<code>JVMTI_HEAP_ROOT_MONITOR</code>,
5509
<code>JVMTI_HEAP_ROOT_THREAD</code>, or
5510
<code>JVMTI_HEAP_ROOT_OTHER</code>.
5511
</description>
5512
</param>
5513
<param id="stack_ref_callback">
5514
<ptrtype>
5515
<struct>jvmtiStackReferenceCallback</struct>
5516
<nullok>do not report stack references</nullok>
5517
</ptrtype>
5518
<description>
5519
The callback function to be called for each heap root of
5520
<code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5521
<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>.
5522
</description>
5523
</param>
5524
<param id="object_ref_callback">
5525
<ptrtype>
5526
<struct>jvmtiObjectReferenceCallback</struct>
5527
<nullok>do not follow references from the root objects</nullok>
5528
</ptrtype>
5529
<description>
5530
The callback function to be called for each object reference.
5531
</description>
5532
</param>
5533
<param id="user_data">
5534
<inbuf>
5535
<void/>
5536
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
5537
</inbuf>
5538
<description>
5539
User supplied data to be passed to the callback.
5540
</description>
5541
</param>
5542
</parameters>
5543
<errors>
5544
</errors>
5545
</function>
5546
5547
<function id="IterateOverHeap" num="111">
5548
<synopsis>Iterate Over Heap</synopsis>
5549
<description>
5550
Iterate over all objects in the heap. This includes both reachable and
5551
unreachable objects.
5552
<p/>
5553
The <paramlink id="object_filter"></paramlink> parameter indicates the
5554
objects for which the callback function is called. If this parameter
5555
is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5556
called for every object that is tagged. If the parameter is
5557
<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5558
for objects that are not tagged. If the parameter
5559
is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5560
called for every object in the heap, irrespective of whether it is
5561
tagged or not.
5562
<p/>
5563
During the execution of this function the state of the heap
5564
does not change: no objects are allocated, no objects are
5565
garbage collected, and the state of objects (including
5566
held values) does not change.
5567
As a result, threads executing Java
5568
programming language code, threads attempting to resume the
5569
execution of Java programming language code, and threads
5570
attempting to execute JNI functions are typically stalled.
5571
</description>
5572
<origin>new</origin>
5573
<capabilities>
5574
<required id="can_tag_objects"></required>
5575
</capabilities>
5576
<parameters>
5577
<param id="object_filter">
5578
<enum>jvmtiHeapObjectFilter</enum>
5579
<description>
5580
Indicates the objects for which the callback function is called.
5581
</description>
5582
</param>
5583
<param id="heap_object_callback">
5584
<ptrtype>
5585
<struct>jvmtiHeapObjectCallback</struct>
5586
</ptrtype>
5587
<description>
5588
The iterator function to be called for each
5589
object matching the <paramlink id="object_filter"/>.
5590
</description>
5591
</param>
5592
<param id="user_data">
5593
<inbuf>
5594
<void/>
5595
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
5596
</inbuf>
5597
<description>
5598
User supplied data to be passed to the callback.
5599
</description>
5600
</param>
5601
</parameters>
5602
<errors>
5603
</errors>
5604
</function>
5605
5606
<function id="IterateOverInstancesOfClass" num="112">
5607
<synopsis>Iterate Over Instances Of Class</synopsis>
5608
<description>
5609
Iterate over all objects in the heap that are instances of the specified class.
5610
This includes direct instances of the specified class and
5611
instances of all subclasses of the specified class.
5612
This includes both reachable and unreachable objects.
5613
<p/>
5614
The <paramlink id="object_filter"></paramlink> parameter indicates the
5615
objects for which the callback function is called. If this parameter
5616
is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5617
called for every object that is tagged. If the parameter is
5618
<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5619
called for objects that are not tagged. If the parameter
5620
is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5621
called for every object in the heap, irrespective of whether it is
5622
tagged or not.
5623
<p/>
5624
During the execution of this function the state of the heap
5625
does not change: no objects are allocated, no objects are
5626
garbage collected, and the state of objects (including
5627
held values) does not change.
5628
As a result, threads executing Java
5629
programming language code, threads attempting to resume the
5630
execution of Java programming language code, and threads
5631
attempting to execute JNI functions are typically stalled.
5632
</description>
5633
<origin>new</origin>
5634
<capabilities>
5635
<required id="can_tag_objects"></required>
5636
</capabilities>
5637
<parameters>
5638
<param id="klass">
5639
<jclass/>
5640
<description>
5641
Iterate over objects of this class only.
5642
</description>
5643
</param>
5644
<param id="object_filter">
5645
<enum>jvmtiHeapObjectFilter</enum>
5646
<description>
5647
Indicates the objects for which the callback function is called.
5648
</description>
5649
</param>
5650
<param id="heap_object_callback">
5651
<ptrtype>
5652
<struct>jvmtiHeapObjectCallback</struct>
5653
</ptrtype>
5654
<description>
5655
The iterator function to be called for each
5656
<paramlink id="klass"/> instance matching
5657
the <paramlink id="object_filter"/>.
5658
</description>
5659
</param>
5660
<param id="user_data">
5661
<inbuf>
5662
<void/>
5663
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
5664
</inbuf>
5665
<description>
5666
User supplied data to be passed to the callback.
5667
</description>
5668
</param>
5669
</parameters>
5670
<errors>
5671
</errors>
5672
</function>
5673
5674
</category>
5675
5676
<category id="local" label="Local Variable">
5677
5678
<intro>
5679
These functions are used to retrieve or set the value of a local variable.
5680
The variable is identified by the depth of the frame containing its
5681
value and the variable's slot number within that frame.
5682
The mapping of variables to
5683
slot numbers can be obtained with the function
5684
<functionlink id="GetLocalVariableTable"></functionlink>.
5685
</intro>
5686
5687
<function id="GetLocalObject" num="21">
5688
<synopsis>Get Local Variable - Object</synopsis>
5689
<description>
5690
This function can be used to retrieve the value of a local
5691
variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
5692
</description>
5693
<origin>jvmdi</origin>
5694
<capabilities>
5695
<required id="can_access_local_variables"></required>
5696
</capabilities>
5697
<parameters>
5698
<param id="thread">
5699
<jthread null="current" frame="frame"/>
5700
<description>
5701
The thread of the frame containing the variable's value.
5702
</description>
5703
</param>
5704
<param id="depth">
5705
<jframeID thread="thread"/>
5706
<description>
5707
The depth of the frame containing the variable's value.
5708
</description>
5709
</param>
5710
<param id="slot">
5711
<jint/>
5712
<description>
5713
The variable's slot number.
5714
</description>
5715
</param>
5716
<param id="value_ptr">
5717
<outptr><jobject/></outptr>
5718
<description>
5719
On return, points to the variable's value.
5720
</description>
5721
</param>
5722
</parameters>
5723
<errors>
5724
<error id="JVMTI_ERROR_INVALID_SLOT">
5725
Invalid <code>slot</code>.
5726
</error>
5727
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5728
The variable type is not
5729
<code>Object</code> or a subclass of <code>Object</code>.
5730
</error>
5731
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5732
Not a visible frame
5733
</error>
5734
</errors>
5735
</function>
5736
5737
<function id="GetLocalInstance" num="155" since="1.2">
5738
<synopsis>Get Local Instance</synopsis>
5739
<description>
5740
This function can be used to retrieve the value of the local object
5741
variable at slot 0 (the "<code>this</code>" object) from non-static
5742
frames. This function can retrieve the "<code>this</code>" object from
5743
native method frames, whereas <code>GetLocalObject()</code> would
5744
return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases.
5745
</description>
5746
<origin>new</origin>
5747
<capabilities>
5748
<required id="can_access_local_variables"></required>
5749
</capabilities>
5750
<parameters>
5751
<param id="thread">
5752
<jthread null="current" frame="frame"/>
5753
<description>
5754
The thread of the frame containing the variable's value.
5755
</description>
5756
</param>
5757
<param id="depth">
5758
<jframeID thread="thread"/>
5759
<description>
5760
The depth of the frame containing the variable's value.
5761
</description>
5762
</param>
5763
<param id="value_ptr">
5764
<outptr><jobject/></outptr>
5765
<description>
5766
On return, points to the variable's value.
5767
</description>
5768
</param>
5769
</parameters>
5770
<errors>
5771
<error id="JVMTI_ERROR_INVALID_SLOT">
5772
If the specified frame is a static method frame.
5773
</error>
5774
</errors>
5775
</function>
5776
<function id="GetLocalInt" num="22">
5777
<synopsis>Get Local Variable - Int</synopsis>
5778
<description>
5779
This function can be used to retrieve the value of a local
5780
variable whose type is <code>int</code>,
5781
<code>short</code>, <code>char</code>, <code>byte</code>, or
5782
<code>boolean</code>.
5783
</description>
5784
<origin>jvmdi</origin>
5785
<capabilities>
5786
<required id="can_access_local_variables"></required>
5787
</capabilities>
5788
<parameters>
5789
<param id="thread">
5790
<jthread null="current" frame="frame"/>
5791
<description>
5792
The thread of the frame containing the variable's value.
5793
</description>
5794
</param>
5795
<param id="depth">
5796
<jframeID thread="thread"/>
5797
<description>
5798
The depth of the frame containing the variable's value.
5799
</description>
5800
</param>
5801
<param id="slot">
5802
<jint/>
5803
<description>
5804
The variable's slot number.
5805
</description>
5806
</param>
5807
<param id="value_ptr">
5808
<outptr><jint/></outptr>
5809
<description>
5810
On return, points to the variable's value.
5811
</description>
5812
</param>
5813
</parameters>
5814
<errors>
5815
<error id="JVMTI_ERROR_INVALID_SLOT">
5816
Invalid <code>slot</code>.
5817
</error>
5818
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5819
The variable type is not
5820
<code>int</code>, <code>short</code>,
5821
<code>char</code>, <code>byte</code>, or
5822
<code>boolean</code>.
5823
</error>
5824
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5825
Not a visible frame
5826
</error>
5827
</errors>
5828
</function>
5829
5830
<function id="GetLocalLong" num="23">
5831
<synopsis>Get Local Variable - Long</synopsis>
5832
<description>
5833
This function can be used to retrieve the value of a local
5834
variable whose type is <code>long</code>.
5835
</description>
5836
<origin>jvmdi</origin>
5837
<capabilities>
5838
<required id="can_access_local_variables"></required>
5839
</capabilities>
5840
<parameters>
5841
<param id="thread">
5842
<jthread null="current" frame="frame"/>
5843
<description>
5844
The thread of the frame containing the variable's value.
5845
</description>
5846
</param>
5847
<param id="depth">
5848
<jframeID thread="thread"/>
5849
<description>
5850
The depth of the frame containing the variable's value.
5851
</description>
5852
</param>
5853
<param id="slot">
5854
<jint/>
5855
<description>
5856
The variable's slot number.
5857
</description>
5858
</param>
5859
<param id="value_ptr">
5860
<outptr><jlong/></outptr>
5861
<description>
5862
On return, points to the variable's value.
5863
</description>
5864
</param>
5865
</parameters>
5866
<errors>
5867
<error id="JVMTI_ERROR_INVALID_SLOT">
5868
Invalid <code>slot</code>.
5869
</error>
5870
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5871
The variable type is not <code>long</code>.
5872
</error>
5873
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5874
Not a visible frame
5875
</error>
5876
</errors>
5877
</function>
5878
5879
<function id="GetLocalFloat" num="24">
5880
<synopsis>Get Local Variable - Float</synopsis>
5881
<description>
5882
This function can be used to retrieve the value of a local
5883
variable whose type is <code>float</code>.
5884
</description>
5885
<origin>jvmdi</origin>
5886
<capabilities>
5887
<required id="can_access_local_variables"></required>
5888
</capabilities>
5889
<parameters>
5890
<param id="thread">
5891
<jthread null="current" frame="frame"/>
5892
<description>
5893
The thread of the frame containing the variable's value.
5894
</description>
5895
</param>
5896
<param id="depth">
5897
<jframeID thread="thread"/>
5898
<description>
5899
The depth of the frame containing the variable's value.
5900
</description>
5901
</param>
5902
<param id="slot">
5903
<jint/>
5904
<description>
5905
The variable's slot number.
5906
</description>
5907
</param>
5908
<param id="value_ptr">
5909
<outptr><jfloat/></outptr>
5910
<description>
5911
On return, points to the variable's value.
5912
</description>
5913
</param>
5914
</parameters>
5915
<errors>
5916
<error id="JVMTI_ERROR_INVALID_SLOT">
5917
Invalid <code>slot</code>.
5918
</error>
5919
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5920
The variable type is not <code>float</code>.
5921
</error>
5922
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5923
Not a visible frame
5924
</error>
5925
</errors>
5926
</function>
5927
5928
<function id="GetLocalDouble" num="25">
5929
<synopsis>Get Local Variable - Double</synopsis>
5930
<description>
5931
This function can be used to retrieve the value of a local
5932
variable whose type is <code>long</code>.
5933
</description>
5934
<origin>jvmdi</origin>
5935
<capabilities>
5936
<required id="can_access_local_variables"></required>
5937
</capabilities>
5938
<parameters>
5939
<param id="thread">
5940
<jthread null="current" frame="frame"/>
5941
<description>
5942
The thread of the frame containing the variable's value.
5943
</description>
5944
</param>
5945
<param id="depth">
5946
<jframeID thread="thread"/>
5947
<description>
5948
The depth of the frame containing the variable's value.
5949
</description>
5950
</param>
5951
<param id="slot">
5952
<jint/>
5953
<description>
5954
The variable's slot number.
5955
</description>
5956
</param>
5957
<param id="value_ptr">
5958
<outptr><jdouble/></outptr>
5959
<description>
5960
On return, points to the variable's value.
5961
</description>
5962
</param>
5963
</parameters>
5964
<errors>
5965
<error id="JVMTI_ERROR_INVALID_SLOT">
5966
Invalid <code>slot</code>.
5967
</error>
5968
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5969
The variable type is not <code>double</code>.
5970
</error>
5971
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5972
Not a visible frame
5973
</error>
5974
</errors>
5975
</function>
5976
5977
<function id="SetLocalObject" num="26">
5978
<synopsis>Set Local Variable - Object</synopsis>
5979
<description>
5980
This function can be used to set the value of a local
5981
variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
5982
</description>
5983
<origin>jvmdi</origin>
5984
<capabilities>
5985
<required id="can_access_local_variables"></required>
5986
</capabilities>
5987
<parameters>
5988
<param id="thread">
5989
<jthread null="current" frame="frame"/>
5990
<description>
5991
The thread of the frame containing the variable's value.
5992
</description>
5993
</param>
5994
<param id="depth">
5995
<jframeID thread="thread"/>
5996
<description>
5997
The depth of the frame containing the variable's value.
5998
</description>
5999
</param>
6000
<param id="slot">
6001
<jint/>
6002
<description>
6003
The variable's slot number.
6004
</description>
6005
</param>
6006
<param id="value">
6007
<jobject/>
6008
<description>
6009
The new value for the variable.
6010
</description>
6011
</param>
6012
</parameters>
6013
<errors>
6014
<error id="JVMTI_ERROR_INVALID_SLOT">
6015
Invalid <code>slot</code>.
6016
</error>
6017
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6018
The variable type is not
6019
<code>Object</code> or a subclass of <code>Object</code>.
6020
</error>
6021
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6022
The supplied <paramlink id="value"/> is not compatible
6023
with the variable type.
6024
</error>
6025
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6026
Not a visible frame
6027
</error>
6028
</errors>
6029
</function>
6030
6031
<function id="SetLocalInt" num="27">
6032
<synopsis>Set Local Variable - Int</synopsis>
6033
<description>
6034
This function can be used to set the value of a local
6035
variable whose type is <code>int</code>,
6036
<code>short</code>, <code>char</code>, <code>byte</code>, or
6037
<code>boolean</code>.
6038
</description>
6039
<origin>jvmdi</origin>
6040
<capabilities>
6041
<required id="can_access_local_variables"></required>
6042
</capabilities>
6043
<parameters>
6044
<param id="thread">
6045
<jthread null="current" frame="frame"/>
6046
<description>
6047
The thread of the frame containing the variable's value.
6048
</description>
6049
</param>
6050
<param id="depth">
6051
<jframeID thread="thread"/>
6052
<description>
6053
The depth of the frame containing the variable's value.
6054
</description>
6055
</param>
6056
<param id="slot">
6057
<jint/>
6058
<description>
6059
The variable's slot number.
6060
</description>
6061
</param>
6062
<param id="value">
6063
<jint/>
6064
<description>
6065
The new value for the variable.
6066
</description>
6067
</param>
6068
</parameters>
6069
<errors>
6070
<error id="JVMTI_ERROR_INVALID_SLOT">
6071
Invalid <code>slot</code>.
6072
</error>
6073
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6074
The variable type is not
6075
<code>int</code>, <code>short</code>,
6076
<code>char</code>, <code>byte</code>, or
6077
<code>boolean</code>.
6078
</error>
6079
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6080
Not a visible frame
6081
</error>
6082
</errors>
6083
</function>
6084
6085
<function id="SetLocalLong" num="28">
6086
<synopsis>Set Local Variable - Long</synopsis>
6087
<description>
6088
This function can be used to set the value of a local
6089
variable whose type is <code>long</code>.
6090
</description>
6091
<origin>jvmdi</origin>
6092
<capabilities>
6093
<required id="can_access_local_variables"></required>
6094
</capabilities>
6095
<parameters>
6096
<param id="thread">
6097
<jthread null="current" frame="frame"/>
6098
<description>
6099
The thread of the frame containing the variable's value.
6100
</description>
6101
</param>
6102
<param id="depth">
6103
<jframeID thread="thread"/>
6104
<description>
6105
The depth of the frame containing the variable's value.
6106
</description>
6107
</param>
6108
<param id="slot">
6109
<jint/>
6110
<description>
6111
The variable's slot number.
6112
</description>
6113
</param>
6114
<param id="value">
6115
<jlong/>
6116
<description>
6117
The new value for the variable.
6118
</description>
6119
</param>
6120
</parameters>
6121
<errors>
6122
<error id="JVMTI_ERROR_INVALID_SLOT">
6123
Invalid <code>slot</code>.
6124
</error>
6125
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6126
The variable type is not <code>long</code>.
6127
</error>
6128
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6129
Not a visible frame
6130
</error>
6131
</errors>
6132
</function>
6133
6134
<function id="SetLocalFloat" num="29">
6135
<synopsis>Set Local Variable - Float</synopsis>
6136
<description>
6137
This function can be used to set the value of a local
6138
variable whose type is <code>float</code>.
6139
</description>
6140
<origin>jvmdi</origin>
6141
<capabilities>
6142
<required id="can_access_local_variables"></required>
6143
</capabilities>
6144
<parameters>
6145
<param id="thread">
6146
<jthread null="current" frame="frame"/>
6147
<description>
6148
The thread of the frame containing the variable's value.
6149
</description>
6150
</param>
6151
<param id="depth">
6152
<jframeID thread="thread"/>
6153
<description>
6154
The depth of the frame containing the variable's value.
6155
</description>
6156
</param>
6157
<param id="slot">
6158
<jint/>
6159
<description>
6160
The variable's slot number.
6161
</description>
6162
</param>
6163
<param id="value">
6164
<jfloat/>
6165
<description>
6166
The new value for the variable.
6167
</description>
6168
</param>
6169
</parameters>
6170
<errors>
6171
<error id="JVMTI_ERROR_INVALID_SLOT">
6172
Invalid <code>slot</code>.
6173
</error>
6174
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6175
The variable type is not <code>float</code>.
6176
</error>
6177
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6178
Not a visible frame
6179
</error>
6180
</errors>
6181
</function>
6182
6183
<function id="SetLocalDouble" num="30">
6184
<synopsis>Set Local Variable - Double</synopsis>
6185
<description>
6186
This function can be used to set the value of a local
6187
variable whose type is <code>double</code>.
6188
</description>
6189
<origin>jvmdi</origin>
6190
<capabilities>
6191
<required id="can_access_local_variables"></required>
6192
</capabilities>
6193
<parameters>
6194
<param id="thread">
6195
<jthread null="current" frame="frame"/>
6196
<description>
6197
The thread of the frame containing the variable's value.
6198
</description>
6199
</param>
6200
<param id="depth">
6201
<jframeID thread="thread"/>
6202
<description>
6203
The depth of the frame containing the variable's value.
6204
</description>
6205
</param>
6206
<param id="slot">
6207
<jint/>
6208
<description>
6209
The variable's slot number.
6210
</description>
6211
</param>
6212
<param id="value">
6213
<jdouble/>
6214
<description>
6215
The new value for the variable.
6216
</description>
6217
</param>
6218
</parameters>
6219
<errors>
6220
<error id="JVMTI_ERROR_INVALID_SLOT">
6221
Invalid <code>slot</code>.
6222
</error>
6223
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6224
The variable type is not <code>double</code>.
6225
</error>
6226
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6227
Not a visible frame
6228
</error>
6229
</errors>
6230
</function>
6231
</category>
6232
6233
<category id="breakpointCategory" label="Breakpoint">
6234
6235
<intro>
6236
</intro>
6237
6238
<function id="SetBreakpoint" num="38">
6239
<synopsis>Set Breakpoint</synopsis>
6240
<description>
6241
Set a breakpoint at the instruction indicated by
6242
<code>method</code> and <code>location</code>.
6243
An instruction can only have one breakpoint.
6244
<p/>
6245
Whenever the designated instruction is about to be executed, a
6246
<eventlink id="Breakpoint"></eventlink> event is generated.
6247
</description>
6248
<origin>jvmdi</origin>
6249
<capabilities>
6250
<required id="can_generate_breakpoint_events"></required>
6251
</capabilities>
6252
<parameters>
6253
<param id="klass">
6254
<jclass method="method"/>
6255
<description>
6256
The class in which to set the breakpoint
6257
</description>
6258
</param>
6259
<param id="method">
6260
<jmethodID class="klass"/>
6261
<description>
6262
The method in which to set the breakpoint
6263
</description>
6264
</param>
6265
<param id="location">
6266
<jlocation/>
6267
<description>
6268
the index of the instruction at which to set the breakpoint
6269
6270
</description>
6271
</param>
6272
</parameters>
6273
<errors>
6274
<error id="JVMTI_ERROR_DUPLICATE">
6275
The designated bytecode already has a breakpoint.
6276
</error>
6277
</errors>
6278
</function>
6279
6280
<function id="ClearBreakpoint" num="39">
6281
<synopsis>Clear Breakpoint</synopsis>
6282
<description>
6283
Clear the breakpoint at the bytecode indicated by
6284
<code>method</code> and <code>location</code>.
6285
</description>
6286
<origin>jvmdi</origin>
6287
<capabilities>
6288
<required id="can_generate_breakpoint_events"></required>
6289
</capabilities>
6290
<parameters>
6291
<param id="klass">
6292
<jclass method="method"/>
6293
<description>
6294
The class in which to clear the breakpoint
6295
</description>
6296
</param>
6297
<param id="method">
6298
<jmethodID class="klass"/>
6299
<description>
6300
The method in which to clear the breakpoint
6301
</description>
6302
</param>
6303
<param id="location">
6304
<jlocation/>
6305
<description>
6306
the index of the instruction at which to clear the breakpoint
6307
</description>
6308
</param>
6309
</parameters>
6310
<errors>
6311
<error id="JVMTI_ERROR_NOT_FOUND">
6312
There's no breakpoint at the designated bytecode.
6313
</error>
6314
</errors>
6315
</function>
6316
6317
</category>
6318
6319
<category id="fieldWatch" label="Watched Field">
6320
6321
<intro>
6322
</intro>
6323
6324
<function id="SetFieldAccessWatch" num="41">
6325
<synopsis>Set Field Access Watch</synopsis>
6326
<description>
6327
Generate a <eventlink id="FieldAccess"></eventlink> event
6328
when the field specified
6329
by <code>klass</code> and
6330
<code>field</code> is about to be accessed.
6331
An event will be generated for each access of the field
6332
until it is canceled with
6333
<functionlink id="ClearFieldAccessWatch"></functionlink>.
6334
Field accesses from Java programming language code or from JNI code are watched,
6335
fields modified by other means are not watched.
6336
Note that <jvmti/> users should be aware that their own field accesses
6337
will trigger the watch.
6338
A field can only have one field access watch set.
6339
Modification of a field is not considered an access--use
6340
<functionlink id="SetFieldModificationWatch"></functionlink>
6341
to monitor modifications.
6342
</description>
6343
<origin>jvmdi</origin>
6344
<capabilities>
6345
<required id="can_generate_field_access_events"></required>
6346
</capabilities>
6347
<parameters>
6348
<param id="klass">
6349
<jclass field="field"/>
6350
<description>
6351
The class containing the field to watch
6352
</description>
6353
</param>
6354
<param id="field">
6355
<jfieldID class="klass"/>
6356
<description>
6357
The field to watch
6358
6359
</description>
6360
</param>
6361
</parameters>
6362
<errors>
6363
<error id="JVMTI_ERROR_DUPLICATE">
6364
The designated field is already being watched for accesses.
6365
</error>
6366
</errors>
6367
</function>
6368
6369
<function id="ClearFieldAccessWatch" num="42">
6370
<synopsis>Clear Field Access Watch</synopsis>
6371
<description>
6372
Cancel a field access watch previously set by
6373
<functionlink id="SetFieldAccessWatch"></functionlink>, on the
6374
field specified
6375
by <code>klass</code> and
6376
<code>field</code>.
6377
</description>
6378
<origin>jvmdi</origin>
6379
<capabilities>
6380
<required id="can_generate_field_access_events"></required>
6381
</capabilities>
6382
<parameters>
6383
<param id="klass">
6384
<jclass field="field"/>
6385
<description>
6386
The class containing the field to watch
6387
</description>
6388
</param>
6389
<param id="field">
6390
<jfieldID class="klass"/>
6391
<description>
6392
The field to watch
6393
6394
</description>
6395
</param>
6396
</parameters>
6397
<errors>
6398
<error id="JVMTI_ERROR_NOT_FOUND">
6399
The designated field is not being watched for accesses.
6400
</error>
6401
</errors>
6402
</function>
6403
6404
<function id="SetFieldModificationWatch" num="43">
6405
<synopsis>Set Field Modification Watch</synopsis>
6406
<description>
6407
Generate a <eventlink id="FieldModification"></eventlink> event
6408
when the field specified
6409
by <code>klass</code> and
6410
<code>field</code> is about to be modified.
6411
An event will be generated for each modification of the field
6412
until it is canceled with
6413
<functionlink id="ClearFieldModificationWatch"></functionlink>.
6414
Field modifications from Java programming language code or from JNI code are watched,
6415
fields modified by other means are not watched.
6416
Note that <jvmti/> users should be aware that their own field modifications
6417
will trigger the watch.
6418
A field can only have one field modification watch set.
6419
</description>
6420
<origin>jvmdi</origin>
6421
<capabilities>
6422
<required id="can_generate_field_modification_events"></required>
6423
</capabilities>
6424
<parameters>
6425
<param id="klass">
6426
<jclass field="field"/>
6427
<description>
6428
The class containing the field to watch
6429
</description>
6430
</param>
6431
<param id="field">
6432
<jfieldID class="klass"/>
6433
<description>
6434
The field to watch
6435
6436
</description>
6437
</param>
6438
</parameters>
6439
<errors>
6440
<error id="JVMTI_ERROR_DUPLICATE">
6441
The designated field is already being watched for modifications.
6442
</error>
6443
</errors>
6444
</function>
6445
6446
<function id="ClearFieldModificationWatch" num="44">
6447
<synopsis>Clear Field Modification Watch</synopsis>
6448
<description>
6449
6450
Cancel a field modification watch previously set by
6451
<functionlink id="SetFieldModificationWatch"></functionlink>, on the
6452
field specified
6453
by <code>klass</code> and
6454
<code>field</code>.
6455
</description>
6456
<origin>jvmdi</origin>
6457
<capabilities>
6458
<required id="can_generate_field_modification_events"></required>
6459
</capabilities>
6460
<parameters>
6461
<param id="klass">
6462
<jclass field="field"/>
6463
<description>
6464
The class containing the field to watch
6465
</description>
6466
</param>
6467
<param id="field">
6468
<jfieldID class="klass"/>
6469
<description>
6470
The field to watch
6471
6472
</description>
6473
</param>
6474
</parameters>
6475
<errors>
6476
<error id="JVMTI_ERROR_NOT_FOUND">
6477
The designated field is not being watched for modifications.
6478
</error>
6479
</errors>
6480
</function>
6481
</category>
6482
6483
<category id="module" label="Module">
6484
6485
<intro>
6486
</intro>
6487
6488
<function id="GetAllModules" num="3" since="9">
6489
<synopsis>Get All Modules</synopsis>
6490
<description>
6491
Return an array of all modules loaded in the virtual machine.
6492
The array includes the unnamed module for each class loader.
6493
The number of modules in the array is returned via
6494
<code>module_count_ptr</code>, and the array itself via
6495
<code>modules_ptr</code>.
6496
<p/>
6497
</description>
6498
<origin>new</origin>
6499
<capabilities>
6500
</capabilities>
6501
<parameters>
6502
<param id="module_count_ptr">
6503
<outptr><jint/></outptr>
6504
<description>
6505
On return, points to the number of returned modules.
6506
</description>
6507
</param>
6508
<param id="modules_ptr">
6509
<allocbuf outcount="module_count_ptr"><jobject/></allocbuf>
6510
<description>
6511
On return, points to an array of references, one
6512
for each module.
6513
</description>
6514
</param>
6515
</parameters>
6516
<errors>
6517
</errors>
6518
</function>
6519
6520
<function id="GetNamedModule" num="40" since="9">
6521
<synopsis>Get Named Module</synopsis>
6522
<description>
6523
Return the <code>java.lang.Module</code> object for a named
6524
module defined to a class loader that contains a given package.
6525
The module is returned via <code>module_ptr</code>.
6526
<p/>
6527
If a named module is defined to the class loader and it
6528
contains the package then that named module is returned,
6529
otherwise <code>NULL</code> is returned.
6530
<p/>
6531
</description>
6532
<origin>new</origin>
6533
<capabilities>
6534
</capabilities>
6535
<parameters>
6536
<param id="class_loader">
6537
<ptrtype>
6538
<jobject/>
6539
<nullok>the bootstrap loader is assumed</nullok>
6540
</ptrtype>
6541
<description>
6542
A class loader.
6543
If the <code>class_loader</code> is not <code>NULL</code>
6544
or a subclass of <code>java.lang.ClassLoader</code>
6545
this function returns
6546
<errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>.
6547
</description>
6548
</param>
6549
<param id="package_name">
6550
<inbuf><char/></inbuf>
6551
<description>
6552
The name of the package, encoded as a
6553
<internallink id="mUTF">modified UTF-8</internallink> string.
6554
The package name is in internal form (JVMS 4.2.1);
6555
identifiers are separated by forward slashes rather than periods.
6556
</description>
6557
</param>
6558
<param id="module_ptr">
6559
<outptr><jobject/></outptr>
6560
<description>
6561
On return, points to a <code>java.lang.Module</code> object
6562
or points to <code>NULL</code>.
6563
</description>
6564
</param>
6565
</parameters>
6566
<errors>
6567
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6568
If class loader is not <code>NULL</code> and is not a class loader object.
6569
</error>
6570
</errors>
6571
</function>
6572
6573
<function id="AddModuleReads" num="94" since="9">
6574
<synopsis>Add Module Reads</synopsis>
6575
<description>
6576
Update a module to read another module. This function is a no-op
6577
when <paramlink id="module"></paramlink> is an unnamed module.
6578
This function facilitates the instrumentation of code
6579
in named modules where that instrumentation requires
6580
expanding the set of modules that a module reads.
6581
</description>
6582
<origin>new</origin>
6583
<capabilities>
6584
</capabilities>
6585
<parameters>
6586
<param id="module">
6587
<ptrtype><jobject/></ptrtype>
6588
<description>
6589
The module to update.
6590
</description>
6591
</param>
6592
<param id="to_module">
6593
<ptrtype><jobject/></ptrtype>
6594
<description>
6595
The additional module to read.
6596
</description>
6597
</param>
6598
</parameters>
6599
<errors>
6600
<error id="JVMTI_ERROR_INVALID_MODULE">
6601
If <paramlink id="module"></paramlink> is not a module object.
6602
</error>
6603
<error id="JVMTI_ERROR_INVALID_MODULE">
6604
If <paramlink id="to_module"></paramlink> is not a module object.
6605
</error>
6606
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6607
if the module cannot be modified.
6608
See <functionlink id="IsModifiableModule"/>.
6609
</error>
6610
</errors>
6611
</function>
6612
6613
<function id="AddModuleExports" num="95" since="9">
6614
<synopsis>Add Module Exports</synopsis>
6615
<description>
6616
Update a module to export a package to another module.
6617
This function is a no-op when <paramlink id="module"></paramlink>
6618
is an unnamed module or an open module.
6619
This function facilitates the instrumentation of code
6620
in named modules where that instrumentation requires
6621
expanding the set of packages that a module exports.
6622
</description>
6623
<origin>new</origin>
6624
<capabilities>
6625
</capabilities>
6626
<parameters>
6627
<param id="module">
6628
<ptrtype><jobject/></ptrtype>
6629
<description>
6630
The module to update.
6631
</description>
6632
</param>
6633
<param id="pkg_name">
6634
<inbuf><char/></inbuf>
6635
<description>
6636
The exported package name.
6637
</description>
6638
</param>
6639
<param id="to_module">
6640
<ptrtype><jobject/></ptrtype>
6641
<description>
6642
The module the package is exported to.
6643
If the <code>to_module</code> is not a subclass of
6644
<code>java.lang.Module</code> this function returns
6645
<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6646
</description>
6647
</param>
6648
</parameters>
6649
<errors>
6650
<error id="JVMTI_ERROR_INVALID_MODULE">
6651
If <paramlink id="module"></paramlink> is not a module object.
6652
</error>
6653
<error id="JVMTI_ERROR_INVALID_MODULE">
6654
If <paramlink id="to_module"></paramlink> is not a module object.
6655
</error>
6656
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6657
If the package <paramlink id="pkg_name"></paramlink>
6658
does not belong to the module.
6659
</error>
6660
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6661
if the module cannot be modified.
6662
See <functionlink id="IsModifiableModule"/>.
6663
</error>
6664
</errors>
6665
</function>
6666
6667
<function id="AddModuleOpens" num="96" since="9">
6668
<synopsis>Add Module Opens</synopsis>
6669
<description>
6670
Update a module to open a package to another module.
6671
This function is a no-op when <paramlink id="module"></paramlink>
6672
is an unnamed module or an open module.
6673
This function facilitates the instrumentation of code
6674
in modules where that instrumentation requires
6675
expanding the set of packages that a module opens to
6676
other modules.
6677
</description>
6678
<origin>new</origin>
6679
<capabilities>
6680
</capabilities>
6681
<parameters>
6682
<param id="module">
6683
<ptrtype><jobject/></ptrtype>
6684
<description>
6685
The module to update.
6686
</description>
6687
</param>
6688
<param id="pkg_name">
6689
<inbuf><char/></inbuf>
6690
<description>
6691
The package name of the package to open.
6692
</description>
6693
</param>
6694
<param id="to_module">
6695
<ptrtype><jobject/></ptrtype>
6696
<description>
6697
The module with the package to open.
6698
If the <code>to_module</code> is not a subclass of
6699
<code>java.lang.Module</code> this function returns
6700
<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6701
</description>
6702
</param>
6703
</parameters>
6704
<errors>
6705
<error id="JVMTI_ERROR_INVALID_MODULE">
6706
If <paramlink id="module"></paramlink> is not a module object.
6707
</error>
6708
<error id="JVMTI_ERROR_INVALID_MODULE">
6709
If <paramlink id="to_module"></paramlink> is not a module object.
6710
</error>
6711
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6712
If the package <paramlink id="pkg_name"></paramlink>
6713
does not belong to the module.
6714
</error>
6715
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6716
if the module cannot be modified.
6717
See <functionlink id="IsModifiableModule"/>.
6718
</error>
6719
</errors>
6720
</function>
6721
6722
<function id="AddModuleUses" num="97" since="9">
6723
<synopsis>Add Module Uses</synopsis>
6724
<description>
6725
Updates a module to add a service to the set of services that
6726
a module uses. This function is a no-op when the module
6727
is an unnamed module.
6728
This function facilitates the instrumentation of code
6729
in named modules where that instrumentation requires
6730
expanding the set of services that a module is using.
6731
</description>
6732
<origin>new</origin>
6733
<capabilities>
6734
</capabilities>
6735
<parameters>
6736
<param id="module">
6737
<ptrtype><jobject/></ptrtype>
6738
<description>
6739
The module to update.
6740
</description>
6741
</param>
6742
<param id="service">
6743
<ptrtype><jclass/></ptrtype>
6744
<description>
6745
The service to use.
6746
</description>
6747
</param>
6748
</parameters>
6749
<errors>
6750
<error id="JVMTI_ERROR_INVALID_MODULE">
6751
If <paramlink id="module"></paramlink> is not a module object.
6752
</error>
6753
<error id="JVMTI_ERROR_INVALID_CLASS">
6754
If <paramlink id="service"></paramlink> is not a class object.
6755
</error>
6756
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6757
if the module cannot be modified.
6758
See <functionlink id="IsModifiableModule"/>.
6759
</error>
6760
</errors>
6761
</function>
6762
6763
<function id="AddModuleProvides" num="98" since="9">
6764
<synopsis>Add Module Provides</synopsis>
6765
<description>
6766
Updates a module to add a service to the set of services that
6767
a module provides. This function is a no-op when the module
6768
is an unnamed module.
6769
This function facilitates the instrumentation of code
6770
in named modules where that instrumentation requires
6771
changes to the services that are provided.
6772
</description>
6773
<origin>new</origin>
6774
<capabilities>
6775
</capabilities>
6776
<parameters>
6777
<param id="module">
6778
<ptrtype><jobject/></ptrtype>
6779
<description>
6780
The module to update.
6781
</description>
6782
</param>
6783
<param id="service">
6784
<ptrtype><jclass/></ptrtype>
6785
<description>
6786
The service to provide.
6787
</description>
6788
</param>
6789
<param id="impl_class">
6790
<ptrtype><jclass/></ptrtype>
6791
<description>
6792
The implementation class for the provided service.
6793
</description>
6794
</param>
6795
</parameters>
6796
<errors>
6797
<error id="JVMTI_ERROR_INVALID_MODULE">
6798
If <paramlink id="module"></paramlink> is not a module object.
6799
</error>
6800
<error id="JVMTI_ERROR_INVALID_CLASS">
6801
If <paramlink id="service"></paramlink> is not a class object.
6802
</error>
6803
<error id="JVMTI_ERROR_INVALID_CLASS">
6804
If <paramlink id="impl_class"></paramlink> is not a class object.
6805
</error>
6806
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6807
if the module cannot be modified.
6808
See <functionlink id="IsModifiableModule"/>.
6809
</error>
6810
</errors>
6811
</function>
6812
6813
<function id="IsModifiableModule" num="99" since="9">
6814
<synopsis>Is Modifiable Module</synopsis>
6815
<description>
6816
Determines whether a module is modifiable.
6817
If a module is modifiable then this module can be updated with
6818
<functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
6819
<functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
6820
and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
6821
then the module can not be updated with these functions. The result of
6822
this function is always <code>JNI_TRUE</code> when called to determine
6823
if an unnamed module is modifiable.
6824
</description>
6825
<origin>new</origin>
6826
<capabilities>
6827
</capabilities>
6828
<parameters>
6829
<param id="module">
6830
<ptrtype><jobject/></ptrtype>
6831
<description>
6832
The module to query.
6833
</description>
6834
</param>
6835
<param id="is_modifiable_module_ptr">
6836
<outptr><jboolean/></outptr>
6837
<description>
6838
On return, points to the boolean result of this function.
6839
</description>
6840
</param>
6841
</parameters>
6842
<errors>
6843
<error id="JVMTI_ERROR_INVALID_MODULE">
6844
If <paramlink id="module"></paramlink> is not a module object.
6845
</error>
6846
</errors>
6847
</function>
6848
6849
</category>
6850
6851
<category id="class" label="Class">
6852
<function id="GetLoadedClasses" jkernel="yes" num="78">
6853
<synopsis>Get Loaded Classes</synopsis>
6854
<description>
6855
Return an array of all classes loaded in the virtual machine.
6856
The number of classes in the array is returned via
6857
<code>class_count_ptr</code>, and the array itself via
6858
<code>classes_ptr</code>.
6859
<p/>
6860
A class or interface creation can be triggered by one of the following:
6861
<ul>
6862
<li>By loading and deriving a class from a <code>class</code> file representation
6863
using a class loader (see <vmspec chapter="5.3"/>).</li>
6864
<li>By invoking <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>
6865
that creates a hidden class or interface from a <code>class</code> file representation.</li>
6866
<li>By invoking methods in certain Java SE Platform APIs such as reflection.</li>
6867
</ul>
6868
<p/>
6869
An array class is created directly by the Java virtual machine. The creation
6870
can be triggered by using class loaders or by invoking methods in certain
6871
Java SE Platform APIs such as reflection.
6872
<p/>
6873
The returned list includes all classes and interfaces, including
6874
<externallink id="../api/java.base/java/lang/Class.html#isHidden()">
6875
hidden classes or interfaces</externallink>,
6876
and also array classes of all types
6877
(including arrays of primitive types).
6878
Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are
6879
<i>not</i> included in the returned list.
6880
</description>
6881
<origin>jvmdi</origin>
6882
<capabilities>
6883
</capabilities>
6884
<parameters>
6885
<param id="class_count_ptr">
6886
<outptr><jint/></outptr>
6887
<description>
6888
On return, points to the number of classes.
6889
</description>
6890
</param>
6891
<param id="classes_ptr">
6892
<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
6893
<description>
6894
On return, points to an array of references, one
6895
for each class.
6896
</description>
6897
</param>
6898
</parameters>
6899
<errors>
6900
</errors>
6901
</function>
6902
6903
<function id="GetClassLoaderClasses" jkernel="yes" num="79">
6904
<synopsis>Get Classloader Classes</synopsis>
6905
<description>
6906
Returns an array of all classes which this class loader
6907
can find by name via
6908
<externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>,
6909
<externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage.
6910
That is, all classes for which <code>initiating_loader</code>
6911
has been recorded as an initiating loader.
6912
Each class in the returned array was created by this class loader,
6913
either by defining it directly or by delegation to another class loader.
6914
See <vmspec chapter="5.3"/>.
6915
<p/>
6916
The returned list does not include
6917
<externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden
6918
classes or interfaces</externallink> or array classes whose
6919
element type is a hidden class or interface as they cannot be discovered
6920
by any class loader.
6921
<p/>
6922
The number of classes in the array is returned via
6923
<code>class_count_ptr</code>, and the array itself via
6924
<code>classes_ptr</code>.
6925
<p/>
6926
See <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>.
6927
</description>
6928
<origin>jvmdi</origin>
6929
<capabilities>
6930
</capabilities>
6931
<parameters>
6932
<param id="initiating_loader">
6933
<ptrtype>
6934
<jobject/>
6935
<nullok>the classes initiated by the bootstrap loader will be returned</nullok>
6936
</ptrtype>
6937
<description>
6938
An initiating class loader.
6939
</description>
6940
</param>
6941
<param id="class_count_ptr">
6942
<outptr><jint/></outptr>
6943
<description>
6944
On return, points to the number of classes.
6945
</description>
6946
</param>
6947
<param id="classes_ptr">
6948
<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
6949
<description>
6950
On return, points to an array of references, one
6951
for each class.
6952
</description>
6953
</param>
6954
</parameters>
6955
<errors>
6956
</errors>
6957
</function>
6958
6959
<function id="GetClassSignature" phase="start" num="48">
6960
<synopsis>Get Class Signature</synopsis>
6961
<description>
6962
Return the name and the generic signature of the class indicated by <code>klass</code>.
6963
<p/>
6964
If the class is a class or interface, then:
6965
<ul>
6966
<li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
6967
then the returned name is the <externallink id="jni/types.html#type-signatures">
6968
JNI type signature</externallink>.
6969
For example, java.util.List is "Ljava/util/List;"
6970
</li>
6971
<li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
6972
then the returned name is a string of the form:
6973
<code>"L" + N + "." + S + ";"</code>
6974
where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1)
6975
indicated by the <code>class</code> file passed to
6976
<externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>,
6977
and <code>S</code> is an unqualified name.
6978
The returned name is not a type descriptor and does not conform to JVMS 4.3.2.
6979
For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;"
6980
</li>
6981
</ul>
6982
<p/>
6983
If the class indicated by <code>klass</code> represents an array class, then
6984
the returned name is a string consisting of one or more "<code>[</code>" characters
6985
representing the depth of the array nesting, followed by the class signature
6986
of the element type. For example the class signature of java.lang.String[] is
6987
"[Ljava/lang/String;" and that of int[] is "[I".
6988
<p/>
6989
If the class indicated by <code>klass</code> represents primitive type or <code>void</code>,
6990
then the returned name is the <externallink id="jni/types.html#type-signatures">
6991
type signature character of the corresponding primitive type</externallink>.
6992
For example, java.lang.Integer.TYPE is "I".
6993
</description>
6994
<origin>jvmdiClone</origin>
6995
<capabilities>
6996
</capabilities>
6997
<parameters>
6998
<param id="klass">
6999
<jclass/>
7000
<description>
7001
The class to query.
7002
</description>
7003
</param>
7004
<param id="signature_ptr">
7005
<allocbuf>
7006
<char/>
7007
<nullok>the signature is not returned</nullok>
7008
</allocbuf>
7009
<description>
7010
On return, points to the JNI type signature of the class, encoded as a
7011
<internallink id="mUTF">modified UTF-8</internallink> string.
7012
</description>
7013
</param>
7014
<param id="generic_ptr">
7015
<allocbuf>
7016
<char/>
7017
<nullok>the generic signature is not returned</nullok>
7018
</allocbuf>
7019
<description>
7020
On return, points to the generic signature of the class, encoded as a
7021
<internallink id="mUTF">modified UTF-8</internallink> string.
7022
If there is no generic signature attribute for the class, then,
7023
on return, points to <code>NULL</code>.
7024
</description>
7025
</param>
7026
</parameters>
7027
<errors>
7028
</errors>
7029
</function>
7030
7031
<function id="GetClassStatus" phase="start" num="49">
7032
<synopsis>Get Class Status</synopsis>
7033
<description>
7034
Get the status of the class. Zero or more of the following bits can be
7035
set.
7036
<constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits">
7037
<constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1">
7038
Class bytecodes have been verified
7039
</constant>
7040
<constant id="JVMTI_CLASS_STATUS_PREPARED" num="2">
7041
Class preparation is complete
7042
</constant>
7043
<constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4">
7044
Class initialization is complete. Static initializer has been run.
7045
</constant>
7046
<constant id="JVMTI_CLASS_STATUS_ERROR" num="8">
7047
Error during initialization makes class unusable
7048
</constant>
7049
<constant id="JVMTI_CLASS_STATUS_ARRAY" num="16">
7050
Class is an array. If set, all other bits are zero.
7051
</constant>
7052
<constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32">
7053
Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>).
7054
If set, all other bits are zero.
7055
</constant>
7056
</constants>
7057
</description>
7058
<origin>jvmdi</origin>
7059
<capabilities>
7060
</capabilities>
7061
<parameters>
7062
<param id="klass">
7063
<jclass/>
7064
<description>
7065
The class to query.
7066
</description>
7067
</param>
7068
<param id="status_ptr">
7069
<outptr><jint/></outptr>
7070
<description>
7071
On return, points to the current state of this class as one or
7072
more of the <internallink id="jvmtiClassStatus">class status flags</internallink>.
7073
</description>
7074
</param>
7075
</parameters>
7076
<errors>
7077
</errors>
7078
</function>
7079
7080
<function id="GetSourceFileName" phase="start" num="50">
7081
<synopsis>Get Source File Name</synopsis>
7082
<description>
7083
For the class indicated by <code>klass</code>, return the source file
7084
name via <code>source_name_ptr</code>. The returned string
7085
is a file name only and never contains a directory name.
7086
<p/>
7087
For primitive classes (for example, <code>java.lang.Integer.TYPE</code>)
7088
and for arrays this function returns
7089
<errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>.
7090
</description>
7091
<origin>jvmdi</origin>
7092
<capabilities>
7093
<required id="can_get_source_file_name"></required>
7094
</capabilities>
7095
<parameters>
7096
<param id="klass">
7097
<jclass/>
7098
<description>
7099
The class to query.
7100
</description>
7101
</param>
7102
<param id="source_name_ptr">
7103
<allocbuf><char/></allocbuf>
7104
<description>
7105
On return, points to the class's source file name, encoded as a
7106
<internallink id="mUTF">modified UTF-8</internallink> string.
7107
</description>
7108
</param>
7109
</parameters>
7110
<errors>
7111
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
7112
Class information does not include a source file name. This includes
7113
cases where the class is an array class or primitive class.
7114
</error>
7115
</errors>
7116
</function>
7117
7118
<function id="GetClassModifiers" phase="start" num="51">
7119
<synopsis>Get Class Modifiers</synopsis>
7120
<description>
7121
For the class indicated by <code>klass</code>, return the access
7122
flags
7123
via <code>modifiers_ptr</code>.
7124
Access flags are defined in <vmspec chapter="4"/>.
7125
<p/>
7126
If the class is an array class, then its public, private, and protected
7127
modifiers are the same as those of its component type. For arrays of
7128
primitives, this component type is represented by one of the primitive
7129
classes (for example, <code>java.lang.Integer.TYPE</code>).
7130
<p/>
7131
If the class is a primitive class, its public modifier is always true,
7132
and its protected and private modifiers are always false.
7133
<p/>
7134
If the class is an array class or a primitive class then its final
7135
modifier is always true and its interface modifier is always false.
7136
The values of its other modifiers are not determined by this specification.
7137
7138
</description>
7139
<origin>jvmdi</origin>
7140
<capabilities>
7141
</capabilities>
7142
<parameters>
7143
<param id="klass">
7144
<jclass/>
7145
<description>
7146
The class to query.
7147
</description>
7148
</param>
7149
<param id="modifiers_ptr">
7150
<outptr><jint/></outptr>
7151
<description>
7152
On return, points to the current access flags of this class.
7153
7154
</description>
7155
</param>
7156
</parameters>
7157
<errors>
7158
</errors>
7159
</function>
7160
7161
<function id="GetClassMethods" phase="start" num="52">
7162
<synopsis>Get Class Methods</synopsis>
7163
<description>
7164
For the class indicated by <code>klass</code>, return a count of
7165
methods via <code>method_count_ptr</code> and a list of
7166
method IDs via <code>methods_ptr</code>. The method list contains
7167
constructors and static initializers as well as true methods.
7168
Only directly declared methods are returned (not inherited methods).
7169
An empty method list is returned for array classes and primitive classes
7170
(for example, <code>java.lang.Integer.TYPE</code>).
7171
</description>
7172
<origin>jvmdi</origin>
7173
<capabilities>
7174
<capability id="can_maintain_original_method_order"/>
7175
</capabilities>
7176
<parameters>
7177
<param id="klass">
7178
<jclass/>
7179
<description>
7180
The class to query.
7181
</description>
7182
</param>
7183
<param id="method_count_ptr">
7184
<outptr><jint/></outptr>
7185
<description>
7186
On return, points to the number of methods declared in this class.
7187
</description>
7188
</param>
7189
<param id="methods_ptr">
7190
<allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>
7191
<description>
7192
On return, points to the method ID array.
7193
</description>
7194
</param>
7195
</parameters>
7196
<errors>
7197
<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7198
<paramlink id="klass"></paramlink> is not prepared.
7199
</error>
7200
</errors>
7201
</function>
7202
7203
<function id="GetClassFields" phase="start" num="53">
7204
<synopsis>Get Class Fields</synopsis>
7205
<description>
7206
For the class indicated by <code>klass</code>, return a count of fields
7207
via <code>field_count_ptr</code> and a list of field IDs via
7208
<code>fields_ptr</code>.
7209
Only directly declared fields are returned (not inherited fields).
7210
Fields are returned in the order they occur in the class file.
7211
An empty field list is returned for array classes and primitive classes
7212
(for example, <code>java.lang.Integer.TYPE</code>).
7213
Use JNI to determine the length of an array.
7214
</description>
7215
<origin>jvmdi</origin>
7216
<capabilities>
7217
</capabilities>
7218
<parameters>
7219
<param id="klass">
7220
<jclass/>
7221
<description>
7222
The class to query.
7223
</description>
7224
</param>
7225
<param id="field_count_ptr">
7226
<outptr><jint/></outptr>
7227
<description>
7228
On return, points to the number of fields declared in this class.
7229
</description>
7230
</param>
7231
<param id="fields_ptr">
7232
<allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>
7233
<description>
7234
On return, points to the field ID array.
7235
</description>
7236
</param>
7237
</parameters>
7238
<errors>
7239
<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7240
<paramlink id="klass"></paramlink> is not prepared.
7241
</error>
7242
</errors>
7243
</function>
7244
7245
<function id="GetImplementedInterfaces" phase="start" num="54">
7246
<synopsis>Get Implemented Interfaces</synopsis>
7247
<description>
7248
Return the direct super-interfaces of this class. For a class, this
7249
function returns the interfaces declared in its <code>implements</code>
7250
clause. For an interface, this function returns the interfaces declared in
7251
its <code>extends</code> clause.
7252
An empty interface list is returned for array classes and primitive classes
7253
(for example, <code>java.lang.Integer.TYPE</code>).
7254
</description>
7255
<origin>jvmdi</origin>
7256
<capabilities>
7257
</capabilities>
7258
<parameters>
7259
<param id="klass">
7260
<jclass/>
7261
<description>
7262
The class to query.
7263
</description>
7264
</param>
7265
<param id="interface_count_ptr">
7266
<outptr><jint/></outptr>
7267
<description>
7268
On return, points to the number of interfaces.
7269
</description>
7270
</param>
7271
<param id="interfaces_ptr">
7272
<allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>
7273
<description>
7274
On return, points to the interface array.
7275
</description>
7276
</param>
7277
</parameters>
7278
<errors>
7279
<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7280
<paramlink id="klass"></paramlink> is not prepared.
7281
</error>
7282
</errors>
7283
</function>
7284
7285
<function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">
7286
<synopsis>Get Class Version Numbers</synopsis>
7287
<description>
7288
For the class indicated by <code>klass</code>,
7289
return the minor and major version numbers,
7290
as defined in
7291
<vmspec chapter="4"/>.
7292
</description>
7293
<origin>new</origin>
7294
<capabilities>
7295
</capabilities>
7296
<parameters>
7297
<param id="klass">
7298
<jclass/>
7299
<description>
7300
The class to query.
7301
</description>
7302
</param>
7303
<param id="minor_version_ptr">
7304
<outptr><jint/></outptr>
7305
<description>
7306
On return, points to the value of the
7307
<code>minor_version</code> item of the
7308
Class File Format.
7309
Note: to be consistent with the Class File Format,
7310
the minor version number is the first parameter.
7311
</description>
7312
</param>
7313
<param id="major_version_ptr">
7314
<outptr><jint/></outptr>
7315
<description>
7316
On return, points to the value of the
7317
<code>major_version</code> item of the
7318
Class File Format.
7319
</description>
7320
</param>
7321
</parameters>
7322
<errors>
7323
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
7324
The class is a primitive or array class.
7325
</error>
7326
</errors>
7327
</function>
7328
7329
<function id="GetConstantPool" phase="start" num="146" since="1.1">
7330
<synopsis>Get Constant Pool</synopsis>
7331
<description>
7332
For the class indicated by <code>klass</code>,
7333
return the raw bytes of the constant pool in the format of the
7334
<code>constant_pool</code> item of
7335
<vmspec chapter="4"/>.
7336
The format of the constant pool may differ between versions
7337
of the Class File Format, so, the
7338
<functionlink id="GetClassVersionNumbers">minor and major
7339
class version numbers</functionlink> should be checked for
7340
compatibility.
7341
<p/>
7342
The returned constant pool might not have the same layout or
7343
contents as the constant pool in the defining class file.
7344
The constant pool returned by GetConstantPool() may have
7345
more or fewer entries than the defining constant pool.
7346
Entries may be in a different order.
7347
The constant pool returned by GetConstantPool() will match the
7348
constant pool used by
7349
<functionlink id="GetBytecodes">GetBytecodes()</functionlink>.
7350
That is, the bytecodes returned by GetBytecodes() will have
7351
constant pool indices which refer to constant pool entries returned
7352
by GetConstantPool().
7353
Note that since <functionlink id="RetransformClasses"/>
7354
and <functionlink id="RedefineClasses"/> can change
7355
the constant pool, the constant pool returned by this function
7356
can change accordingly. Thus, the correspondence between
7357
GetConstantPool() and GetBytecodes() does not hold if there
7358
is an intervening class retransformation or redefinition.
7359
The value of a constant pool entry used by a given bytecode will
7360
match that of the defining class file (even if the indices don't match).
7361
Constant pool entries which are not used directly or indirectly by
7362
bytecodes (for example, UTF-8 strings associated with annotations) are
7363
not required to exist in the returned constant pool.
7364
</description>
7365
<origin>new</origin>
7366
<capabilities>
7367
<required id="can_get_constant_pool"></required>
7368
</capabilities>
7369
<parameters>
7370
<param id="klass">
7371
<jclass/>
7372
<description>
7373
The class to query.
7374
</description>
7375
</param>
7376
<param id="constant_pool_count_ptr">
7377
<outptr><jint/></outptr>
7378
<description>
7379
On return, points to the number of entries
7380
in the constant pool table plus one.
7381
This corresponds to the <code>constant_pool_count</code>
7382
item of the Class File Format.
7383
</description>
7384
</param>
7385
<param id="constant_pool_byte_count_ptr">
7386
<outptr><jint/></outptr>
7387
<description>
7388
On return, points to the number of bytes
7389
in the returned raw constant pool.
7390
</description>
7391
</param>
7392
<param id="constant_pool_bytes_ptr">
7393
<allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>
7394
<description>
7395
On return, points to the raw constant pool, that is the bytes
7396
defined by the <code>constant_pool</code> item of the
7397
Class File Format
7398
</description>
7399
</param>
7400
</parameters>
7401
<errors>
7402
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
7403
The class is a primitive or array class.
7404
</error>
7405
</errors>
7406
</function>
7407
7408
<function id="IsInterface" phase="start" num="55">
7409
<synopsis>Is Interface</synopsis>
7410
<description>
7411
Determines whether a class object reference represents an interface.
7412
The <code>jboolean</code> result is
7413
<code>JNI_TRUE</code> if the "class" is actually an interface,
7414
<code>JNI_FALSE</code> otherwise.
7415
</description>
7416
<origin>jvmdi</origin>
7417
<capabilities>
7418
</capabilities>
7419
<parameters>
7420
<param id="klass">
7421
<jclass/>
7422
<description>
7423
The class to query.
7424
</description>
7425
</param>
7426
<param id="is_interface_ptr">
7427
<outptr><jboolean/></outptr>
7428
<description>
7429
On return, points to the boolean result of this function.
7430
7431
</description>
7432
</param>
7433
</parameters>
7434
<errors>
7435
</errors>
7436
</function>
7437
7438
<function id="IsArrayClass" phase="start" num="56">
7439
<synopsis>Is Array Class</synopsis>
7440
<description>
7441
Determines whether a class object reference represents an array.
7442
The <code>jboolean</code> result is
7443
<code>JNI_TRUE</code> if the class is an array,
7444
<code>JNI_FALSE</code> otherwise.
7445
</description>
7446
<origin>jvmdi</origin>
7447
<capabilities>
7448
</capabilities>
7449
<parameters>
7450
<param id="klass">
7451
<jclass/>
7452
<description>
7453
The class to query.
7454
</description>
7455
</param>
7456
<param id="is_array_class_ptr">
7457
<outptr><jboolean/></outptr>
7458
<description>
7459
On return, points to the boolean result of this function.
7460
7461
</description>
7462
</param>
7463
</parameters>
7464
<errors>
7465
</errors>
7466
</function>
7467
7468
<function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">
7469
<synopsis>Is Modifiable Class</synopsis>
7470
<description>
7471
Determines whether a class is modifiable.
7472
If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>
7473
returns <code>JNI_TRUE</code>) the class can be
7474
redefined with <functionlink id="RedefineClasses"/> (assuming
7475
the agent possesses the
7476
<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
7477
capability) or
7478
retransformed with <functionlink id="RetransformClasses"/> (assuming
7479
the agent possesses the
7480
<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
7481
capability).
7482
If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>
7483
returns <code>JNI_FALSE</code>) the class can be neither
7484
redefined nor retransformed.
7485
<p/>
7486
Primitive classes (for example, <code>java.lang.Integer.TYPE</code>),
7487
array classes, and some implementation defined classes are never modifiable.
7488
<p/>
7489
</description>
7490
<origin>new</origin>
7491
<capabilities>
7492
<capability id="can_redefine_any_class">
7493
If possessed then all classes (except primitive, array, and some implementation defined
7494
classes) are modifiable with <functionlink id="RedefineClasses"/>.
7495
</capability>
7496
<capability id="can_retransform_any_class">
7497
If possessed then all classes (except primitive, array, and some implementation defined
7498
classes) are modifiable with <functionlink id="RetransformClasses"/>.
7499
</capability>
7500
<capability id="can_redefine_classes">
7501
No effect on the result of the function.
7502
But must additionally be possessed to modify the class with
7503
<functionlink id="RedefineClasses"/>.
7504
</capability>
7505
<capability id="can_retransform_classes">
7506
No effect on the result of the function.
7507
But must additionally be possessed to modify the class with
7508
<functionlink id="RetransformClasses"/>.
7509
</capability>
7510
</capabilities>
7511
<parameters>
7512
<param id="klass">
7513
<jclass/>
7514
<description>
7515
The class to query.
7516
</description>
7517
</param>
7518
<param id="is_modifiable_class_ptr">
7519
<outptr><jboolean/></outptr>
7520
<description>
7521
On return, points to the boolean result of this function.
7522
</description>
7523
</param>
7524
</parameters>
7525
<errors>
7526
</errors>
7527
</function>
7528
7529
<function id="GetClassLoader" phase="start" num="57">
7530
<synopsis>Get Class Loader</synopsis>
7531
<description>
7532
For the class indicated by <code>klass</code>, return via
7533
<code>classloader_ptr</code> a reference to the class loader for the
7534
class.
7535
</description>
7536
<origin>jvmdi</origin>
7537
<capabilities>
7538
</capabilities>
7539
<parameters>
7540
<param id="klass">
7541
<jclass/>
7542
<description>
7543
The class to query.
7544
</description>
7545
</param>
7546
<param id="classloader_ptr">
7547
<outptr><jobject/></outptr>
7548
<description>
7549
On return, points to the class loader that loaded
7550
this class.
7551
If the class was not created by a class loader
7552
or if the class loader is the bootstrap class loader,
7553
points to <code>NULL</code>.
7554
</description>
7555
</param>
7556
</parameters>
7557
<errors>
7558
</errors>
7559
7560
</function>
7561
7562
<function id="GetSourceDebugExtension" phase="start" num="90">
7563
<synopsis>Get Source Debug Extension</synopsis>
7564
<description>
7565
For the class indicated by <code>klass</code>, return the debug
7566
extension via <code>source_debug_extension_ptr</code>.
7567
The returned string
7568
contains exactly the debug extension information present in the
7569
class file of <code>klass</code>.
7570
</description>
7571
<origin>jvmdi</origin>
7572
<capabilities>
7573
<required id="can_get_source_debug_extension"></required>
7574
</capabilities>
7575
<parameters>
7576
<param id="klass">
7577
<jclass/>
7578
<description>
7579
The class to query.
7580
</description>
7581
</param>
7582
<param id="source_debug_extension_ptr">
7583
<allocbuf><char/></allocbuf>
7584
<description>
7585
On return, points to the class's debug extension, encoded as a
7586
<internallink id="mUTF">modified UTF-8</internallink> string.
7587
</description>
7588
</param>
7589
</parameters>
7590
<errors>
7591
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
7592
Class information does not include a debug extension.
7593
</error>
7594
</errors>
7595
</function>
7596
7597
<function id="RetransformClasses" jkernel="yes" num="152" since="1.1">
7598
<synopsis>Retransform Classes</synopsis>
7599
<description>
7600
This function facilitates the
7601
<internallink id="bci">bytecode instrumentation</internallink>
7602
of already loaded classes.
7603
To replace the class definition without reference to the existing
7604
bytecodes, as one might do when recompiling from source for
7605
fix-and-continue debugging, <functionlink id="RedefineClasses"/>
7606
function should be used instead.
7607
<p/>
7608
When classes are initially loaded or when they are
7609
<functionlink id="RedefineClasses">redefined</functionlink>,
7610
the initial class file bytes can be transformed with the
7611
<eventlink id="ClassFileLoadHook"/> event.
7612
This function reruns the transformation process
7613
(whether or not a transformation has previously occurred).
7614
This retransformation follows these steps:
7615
<ul>
7616
<li>starting from the initial class file bytes
7617
</li>
7618
<li>for each <fieldlink id="can_retransform_classes"
7619
struct="jvmtiCapabilities">retransformation
7620
incapable</fieldlink>
7621
agent which received a
7622
<code>ClassFileLoadHook</code> event during the previous
7623
load or redefine, the bytes it returned
7624
(via the <code>new_class_data</code> parameter)
7625
are reused as the output of the transformation;
7626
note that this is equivalent to reapplying
7627
the previous transformation, unaltered. except that
7628
the <code>ClassFileLoadHook</code> event
7629
is <b>not</b> sent to these agents
7630
</li>
7631
<li>for each <fieldlink id="can_retransform_classes"
7632
struct="jvmtiCapabilities">retransformation
7633
capable</fieldlink>
7634
agent, the <code>ClassFileLoadHook</code> event is sent,
7635
allowing a new transformation to be applied
7636
</li>
7637
<li>the transformed class file bytes are installed as the new
7638
definition of the class
7639
</li>
7640
</ul>
7641
See the <eventlink id="ClassFileLoadHook"/> event for more details.
7642
<p/>
7643
The initial class file bytes represent the bytes passed to
7644
<code>ClassLoader.defineClass</code>
7645
or <code>RedefineClasses</code> (before any transformations
7646
were applied), however they may not exactly match them.
7647
The constant pool may differ in ways described in
7648
<functionlink id="GetConstantPool"/>.
7649
Constant pool indices in the bytecodes of methods will correspond.
7650
Some attributes may not be present.
7651
Where order is not meaningful, for example the order of methods,
7652
order may not be preserved.
7653
<p/>
7654
Retransformation can cause new versions of methods to be installed.
7655
Old method versions may become
7656
<internallink id="obsoleteMethods">obsolete</internallink>
7657
The new method version will be used on new invokes.
7658
If a method has active stack frames, those active frames continue to
7659
run the bytecodes of the original method version.
7660
<p/>
7661
This function does not cause any initialization except that which
7662
would occur under the customary JVM semantics.
7663
In other words, retransforming a class does not cause its initializers to be
7664
run. The values of static fields will remain as they were
7665
prior to the call.
7666
<p/>
7667
Threads need not be suspended.
7668
<p/>
7669
All breakpoints in the class are cleared.
7670
<p/>
7671
All attributes are updated.
7672
<p/>
7673
Instances of the retransformed class are not affected -- fields retain their
7674
previous values.
7675
<functionlink id="GetTag">Tags</functionlink> on the instances are
7676
also unaffected.
7677
<p/>
7678
In response to this call, no events other than the
7679
<eventlink id="ClassFileLoadHook"/> event
7680
will be sent.
7681
<p/>
7682
The retransformation may change method bodies, the constant pool and attributes
7683
(unless explicitly prohibited).
7684
The retransformation must not add, remove or rename fields or methods, change the
7685
signatures of methods, change modifiers, or change inheritance.
7686
The retransformation must not change the <code>NestHost</code>,
7687
<code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
7688
attributes.
7689
These restrictions may be lifted in future versions.
7690
See the error return description below for information on error codes
7691
returned if an unsupported retransformation is attempted.
7692
The class file bytes are not verified or installed until they have passed
7693
through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
7694
returned error code reflects the result of the transformations.
7695
If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
7696
none of the classes to be retransformed will have a new definition installed.
7697
When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
7698
all of the classes to be retransformed will have their new definitions installed.
7699
</description>
7700
<origin>new</origin>
7701
<capabilities>
7702
<required id="can_retransform_classes"></required>
7703
<capability id="can_retransform_any_class"></capability>
7704
</capabilities>
7705
<parameters>
7706
<param id="class_count">
7707
<jint min="0"/>
7708
<description>
7709
The number of classes to be retransformed.
7710
</description>
7711
</param>
7712
<param id="classes">
7713
<inbuf incount="class_count"><jclass/></inbuf>
7714
<description>
7715
The array of classes to be retransformed.
7716
</description>
7717
</param>
7718
</parameters>
7719
<errors>
7720
<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
7721
One of the <paramlink id="classes"/> cannot be modified.
7722
See <functionlink id="IsModifiableClass"/>.
7723
</error>
7724
<error id="JVMTI_ERROR_INVALID_CLASS">
7725
One of the <paramlink id="classes"/> is not a valid class.
7726
</error>
7727
<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
7728
A retransformed class file has a version number not supported by this VM.
7729
</error>
7730
<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
7731
A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).
7732
</error>
7733
<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
7734
The retransformed class file definitions would lead to a circular definition
7735
(the VM would return a <code>ClassCircularityError</code>).
7736
</error>
7737
<error id="JVMTI_ERROR_FAILS_VERIFICATION">
7738
The retransformed class file bytes fail verification.
7739
</error>
7740
<error id="JVMTI_ERROR_NAMES_DONT_MATCH">
7741
The class name defined in a retransformed class file is
7742
different from the name in the old class object.
7743
</error>
7744
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
7745
A retransformed class file would require adding a method.
7746
</error>
7747
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
7748
A retransformed class file changes a field.
7749
</error>
7750
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
7751
A direct superclass is different for a retransformed class file,
7752
or the set of directly implemented
7753
interfaces is different.
7754
</error>
7755
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
7756
A retransformed class file does not declare a method
7757
declared in the old class version.
7758
</error>
7759
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
7760
A retransformed class file has unsupported differences in class attributes.
7761
</error>
7762
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
7763
A retransformed class file has different class modifiers.
7764
</error>
7765
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
7766
A method in the retransformed class file has different modifiers
7767
than its counterpart in the old class version.
7768
</error>
7769
</errors>
7770
</function>
7771
7772
<function id="RedefineClasses" jkernel="yes" num="87">
7773
<synopsis>Redefine Classes</synopsis>
7774
<typedef id="jvmtiClassDefinition" label="Class redefinition description">
7775
<field id="klass">
7776
<jclass/>
7777
<description>
7778
Class object for this class
7779
</description>
7780
</field>
7781
<field id="class_byte_count">
7782
<jint/>
7783
<description>
7784
Number of bytes defining class (below)
7785
</description>
7786
</field>
7787
<field id="class_bytes">
7788
<inbuf incount="class_byte_count"><uchar/></inbuf>
7789
<description>
7790
Bytes defining class (in <vmspec chapter="4"/>)
7791
</description>
7792
</field>
7793
</typedef>
7794
<description>
7795
All classes given are redefined according to the definitions
7796
supplied.
7797
This function is used to replace the definition of a class
7798
with a new definition, as might be needed in fix-and-continue
7799
debugging.
7800
Where the existing class file bytes are to be transformed, for
7801
example in
7802
<internallink id="bci">bytecode instrumentation</internallink>,
7803
<functionlink id="RetransformClasses"/> should be used.
7804
<p/>
7805
Redefinition can cause new versions of methods to be installed.
7806
Old method versions may become
7807
<internallink id="obsoleteMethods">obsolete</internallink>
7808
The new method version will be used on new invokes.
7809
If a method has active stack frames, those active frames continue to
7810
run the bytecodes of the original method version.
7811
If resetting of stack frames is desired, use
7812
<functionlink id="PopFrame"></functionlink>
7813
to pop frames with obsolete method versions.
7814
<p/>
7815
This function does not cause any initialization except that which
7816
would occur under the customary JVM semantics.
7817
In other words, redefining a class does not cause its initializers to be
7818
run. The values of static fields will remain as they were
7819
prior to the call.
7820
<p/>
7821
Threads need not be suspended.
7822
<p/>
7823
All breakpoints in the class are cleared.
7824
<p/>
7825
All attributes are updated.
7826
<p/>
7827
Instances of the redefined class are not affected -- fields retain their
7828
previous values.
7829
<functionlink id="GetTag">Tags</functionlink> on the instances are
7830
also unaffected.
7831
<p/>
7832
In response to this call, the <jvmti/> event
7833
<eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>
7834
will be sent (if enabled), but no other <jvmti/> events will be sent.
7835
<p/>
7836
The redefinition may change method bodies, the constant pool and attributes
7837
(unless explicitly prohibited).
7838
The redefinition must not add, remove or rename fields or methods, change the
7839
signatures of methods, change modifiers, or change inheritance.
7840
The redefinition must not change the <code>NestHost</code>,
7841
<code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
7842
attributes.
7843
These restrictions may be lifted in future versions.
7844
See the error return description below for information on error codes
7845
returned if an unsupported redefinition is attempted.
7846
The class file bytes are not verified or installed until they have passed
7847
through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
7848
returned error code reflects the result of the transformations applied
7849
to the bytes passed into <paramlink id="class_definitions"/>.
7850
If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
7851
none of the classes to be redefined will have a new definition installed.
7852
When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
7853
all of the classes to be redefined will have their new definitions installed.
7854
</description>
7855
<origin>jvmdi</origin>
7856
<capabilities>
7857
<required id="can_redefine_classes"></required>
7858
<capability id="can_redefine_any_class"></capability>
7859
</capabilities>
7860
<parameters>
7861
<param id="class_count">
7862
<jint min="0"/>
7863
<description>
7864
The number of classes specified in <code>class_definitions</code>
7865
</description>
7866
</param>
7867
<param id="class_definitions">
7868
<inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>
7869
<description>
7870
The array of new class definitions
7871
</description>
7872
</param>
7873
</parameters>
7874
<errors>
7875
<error id="JVMTI_ERROR_NULL_POINTER">
7876
One of <code>class_bytes</code> is <code>NULL</code>.
7877
</error>
7878
<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
7879
An element of <code>class_definitions</code> cannot be modified.
7880
See <functionlink id="IsModifiableClass"/>.
7881
</error>
7882
<error id="JVMTI_ERROR_INVALID_CLASS">
7883
An element of <code>class_definitions</code> is not a valid class.
7884
</error>
7885
<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
7886
A new class file has a version number not supported by this VM.
7887
</error>
7888
<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
7889
A new class file is malformed (The VM would return a <code>ClassFormatError</code>).
7890
</error>
7891
<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
7892
The new class file definitions would lead to a circular definition
7893
(the VM would return a <code>ClassCircularityError</code>).
7894
</error>
7895
<error id="JVMTI_ERROR_FAILS_VERIFICATION">
7896
The class bytes fail verification.
7897
</error>
7898
<error id="JVMTI_ERROR_NAMES_DONT_MATCH">
7899
The class name defined in a new class file is
7900
different from the name in the old class object.
7901
</error>
7902
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
7903
A new class file would require adding a method.
7904
</error>
7905
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
7906
A new class version changes a field.
7907
</error>
7908
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
7909
A direct superclass is different for a new class
7910
version, or the set of directly implemented
7911
interfaces is different.
7912
</error>
7913
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
7914
A new class version does not declare a method
7915
declared in the old class version.
7916
</error>
7917
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
7918
A new class version has unsupported differences in class attributes.
7919
</error>
7920
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
7921
A new class version has different modifiers.
7922
</error>
7923
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
7924
A method in the new class version has different modifiers
7925
than its counterpart in the old class version.
7926
</error>
7927
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7928
A module cannot be modified.
7929
See <functionlink id="IsModifiableModule"/>.
7930
</error>
7931
</errors>
7932
</function>
7933
7934
</category>
7935
7936
<category id="object" label="Object">
7937
7938
<function id="GetObjectSize" jkernel="yes" phase="start" num="154">
7939
<synopsis>Get Object Size</synopsis>
7940
<description>
7941
For the object indicated by <code>object</code>,
7942
return via <code>size_ptr</code> the size of the object.
7943
This size is an implementation-specific approximation of
7944
the amount of storage consumed by this object.
7945
It may include some or all of the object's overhead, and thus
7946
is useful for comparison within an implementation but not
7947
between implementations.
7948
The estimate may change during a single invocation of the JVM.
7949
</description>
7950
<origin>new</origin>
7951
<capabilities>
7952
</capabilities>
7953
<parameters>
7954
<param id="object">
7955
<jobject/>
7956
<description>
7957
The object to query.
7958
</description>
7959
</param>
7960
<param id="size_ptr">
7961
<outptr><jlong/></outptr>
7962
<description>
7963
On return, points to the object's size in bytes.
7964
</description>
7965
</param>
7966
</parameters>
7967
<errors>
7968
</errors>
7969
</function>
7970
7971
<function id="GetObjectHashCode" phase="start" num="58">
7972
<synopsis>Get Object Hash Code</synopsis>
7973
<description>
7974
For the object indicated by <code>object</code>,
7975
return via <code>hash_code_ptr</code> a hash code.
7976
This hash code could be used to maintain a hash table of object references,
7977
however, on some implementations this can cause significant performance
7978
impacts--in most cases
7979
<internallink id="Heap">tags</internallink>
7980
will be a more efficient means of associating information with objects.
7981
This function guarantees
7982
the same hash code value for a particular object throughout its life
7983
</description>
7984
<origin>jvmdi</origin>
7985
<capabilities>
7986
</capabilities>
7987
<parameters>
7988
<param id="object">
7989
<jobject/>
7990
<description>
7991
The object to query.
7992
</description>
7993
</param>
7994
<param id="hash_code_ptr">
7995
<outptr><jint/></outptr>
7996
<description>
7997
On return, points to the object's hash code.
7998
</description>
7999
</param>
8000
</parameters>
8001
<errors>
8002
</errors>
8003
</function>
8004
8005
<function id="GetObjectMonitorUsage" num="59">
8006
<synopsis>Get Object Monitor Usage</synopsis>
8007
<typedef id="jvmtiMonitorUsage" label="Object monitor usage information">
8008
<field id="owner">
8009
<jthread/>
8010
<description>
8011
The thread owning this monitor, or <code>NULL</code> if unused
8012
</description>
8013
</field>
8014
<field id="entry_count">
8015
<jint/>
8016
<description>
8017
The number of times the owning thread has entered the monitor
8018
</description>
8019
</field>
8020
<field id="waiter_count">
8021
<jint/>
8022
<description>
8023
The number of threads waiting to own this monitor
8024
</description>
8025
</field>
8026
<field id="waiters">
8027
<allocfieldbuf><jthread/></allocfieldbuf>
8028
<description>
8029
The <code>waiter_count</code> waiting threads
8030
</description>
8031
</field>
8032
<field id="notify_waiter_count">
8033
<jint/>
8034
<description>
8035
The number of threads waiting to be notified by this monitor
8036
</description>
8037
</field>
8038
<field id="notify_waiters">
8039
<allocfieldbuf><jthread/></allocfieldbuf>
8040
<description>
8041
The <code>notify_waiter_count</code> threads waiting to be notified
8042
</description>
8043
</field>
8044
</typedef>
8045
<description>
8046
Get information about the object's monitor.
8047
The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
8048
are filled in with information about usage of the monitor.
8049
<todo>
8050
Decide and then clarify suspend requirements.
8051
</todo>
8052
</description>
8053
<origin>jvmdi</origin>
8054
<capabilities>
8055
<required id="can_get_monitor_info"></required>
8056
</capabilities>
8057
<parameters>
8058
<param id="object">
8059
<jobject/>
8060
<description>
8061
The object to query.
8062
</description>
8063
</param>
8064
<param id="info_ptr">
8065
<outptr><struct>jvmtiMonitorUsage</struct></outptr>
8066
<description>
8067
On return, filled with monitor information for the
8068
specified object.
8069
</description>
8070
</param>
8071
</parameters>
8072
<errors>
8073
</errors>
8074
</function>
8075
8076
<elide>
8077
<function id="GetObjectMonitors" num="116">
8078
<synopsis>Get Object Monitors</synopsis>
8079
<description>
8080
Return the list of object monitors.
8081
<p/>
8082
Note: details about each monitor can be examined with
8083
<functionlink id="GetObjectMonitorUsage"></functionlink>.
8084
</description>
8085
<origin>new</origin>
8086
<capabilities>
8087
<required id="can_get_monitor_info"></required>
8088
</capabilities>
8089
<parameters>
8090
<param id="monitorCnt">
8091
<outptr><jint/></outptr>
8092
<description>
8093
On return, pointer to the number
8094
of monitors returned in <code>monitors_ptr</code>.
8095
</description>
8096
</param>
8097
<param id="monitors_ptr">
8098
<allocbuf outcount="monitorCnt"><jobject/></allocbuf>
8099
<description>
8100
On return, pointer to the monitor list.
8101
</description>
8102
</param>
8103
</parameters>
8104
<errors>
8105
</errors>
8106
</function>
8107
</elide>
8108
8109
</category>
8110
8111
<category id="fieldCategory" label="Field">
8112
8113
<intro>
8114
</intro>
8115
8116
<function id="GetFieldName" phase="start" num="60">
8117
<synopsis>Get Field Name (and Signature)</synopsis>
8118
<description>
8119
For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,
8120
return the field name via <paramlink id="name_ptr"/> and field signature via
8121
<paramlink id="signature_ptr"/>.
8122
<p/>
8123
Field signatures are defined in the
8124
<externallink id="jni/index.html">JNI Specification</externallink>
8125
and are referred to as <code>field descriptors</code> in
8126
<vmspec chapter="4.3.2"/>.
8127
</description>
8128
<origin>jvmdiClone</origin>
8129
<capabilities>
8130
</capabilities>
8131
<parameters>
8132
<param id="klass">
8133
<jclass field="field"/>
8134
<description>
8135
The class of the field to query.
8136
</description>
8137
</param>
8138
<param id="field">
8139
<jfieldID class="klass"/>
8140
<description>
8141
The field to query.
8142
</description>
8143
</param>
8144
<param id="name_ptr">
8145
<allocbuf>
8146
<char/>
8147
<nullok>the name is not returned</nullok>
8148
</allocbuf>
8149
<description>
8150
On return, points to the field name, encoded as a
8151
<internallink id="mUTF">modified UTF-8</internallink> string.
8152
</description>
8153
</param>
8154
<param id="signature_ptr">
8155
<allocbuf>
8156
<char/>
8157
<nullok>the signature is not returned</nullok>
8158
</allocbuf>
8159
<description>
8160
On return, points to the field signature, encoded as a
8161
<internallink id="mUTF">modified UTF-8</internallink> string.
8162
</description>
8163
</param>
8164
<param id="generic_ptr">
8165
<allocbuf>
8166
<char/>
8167
<nullok>the generic signature is not returned</nullok>
8168
</allocbuf>
8169
<description>
8170
On return, points to the generic signature of the field, encoded as a
8171
<internallink id="mUTF">modified UTF-8</internallink> string.
8172
If there is no generic signature attribute for the field, then,
8173
on return, points to <code>NULL</code>.
8174
</description>
8175
</param>
8176
</parameters>
8177
<errors>
8178
</errors>
8179
</function>
8180
8181
<function id="GetFieldDeclaringClass" phase="start" num="61">
8182
<synopsis>Get Field Declaring Class</synopsis>
8183
<description>
8184
For the field indicated by <code>klass</code> and <code>field</code>
8185
return the class that defined it via <code>declaring_class_ptr</code>.
8186
The declaring class will either be <code>klass</code>, a superclass, or
8187
an implemented interface.
8188
</description>
8189
<origin>jvmdi</origin>
8190
<capabilities>
8191
</capabilities>
8192
<parameters>
8193
<param id="klass">
8194
<jclass field="field"/>
8195
<description>
8196
The class to query.
8197
</description>
8198
</param>
8199
<param id="field">
8200
<jfieldID class="klass"/>
8201
<description>
8202
The field to query.
8203
</description>
8204
</param>
8205
<param id="declaring_class_ptr">
8206
<outptr><jclass/></outptr>
8207
<description>
8208
On return, points to the declaring class
8209
</description>
8210
</param>
8211
</parameters>
8212
<errors>
8213
</errors>
8214
</function>
8215
8216
<function id="GetFieldModifiers" phase="start" num="62">
8217
<synopsis>Get Field Modifiers</synopsis>
8218
<description>
8219
For the field indicated by <code>klass</code> and <code>field</code>
8220
return the access flags via <code>modifiers_ptr</code>.
8221
Access flags are defined in <vmspec chapter="4"/>.
8222
</description>
8223
<origin>jvmdi</origin>
8224
<capabilities>
8225
</capabilities>
8226
<parameters>
8227
<param id="klass">
8228
<jclass field="field"/>
8229
<description>
8230
The class to query.
8231
</description>
8232
</param>
8233
<param id="field">
8234
<jfieldID class="klass"/>
8235
<description>
8236
The field to query.
8237
</description>
8238
</param>
8239
<param id="modifiers_ptr">
8240
<outptr><jint/></outptr>
8241
<description>
8242
On return, points to the access flags.
8243
</description>
8244
</param>
8245
</parameters>
8246
<errors>
8247
</errors>
8248
</function>
8249
8250
<function id="IsFieldSynthetic" phase="start" num="63">
8251
<synopsis>Is Field Synthetic</synopsis>
8252
<description>
8253
For the field indicated by <code>klass</code> and <code>field</code>, return a
8254
value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.
8255
Synthetic fields are generated by the compiler but not present in the
8256
original source code.
8257
</description>
8258
<origin>jvmdi</origin>
8259
<capabilities>
8260
<required id="can_get_synthetic_attribute"></required>
8261
</capabilities>
8262
<parameters>
8263
<param id="klass">
8264
<jclass field="field"/>
8265
<description>
8266
The class of the field to query.
8267
</description>
8268
</param>
8269
<param id="field">
8270
<jfieldID class="klass"/>
8271
<description>
8272
The field to query.
8273
</description>
8274
</param>
8275
<param id="is_synthetic_ptr">
8276
<outptr><jboolean/></outptr>
8277
<description>
8278
On return, points to the boolean result of this function.
8279
</description>
8280
</param>
8281
</parameters>
8282
<errors>
8283
</errors>
8284
</function>
8285
8286
</category>
8287
8288
<category id="method" label="Method">
8289
8290
<intro>
8291
These functions provide information about a method (represented as a
8292
<typelink id="jmethodID"/>) and set how methods are processed.
8293
</intro>
8294
8295
<intro id="obsoleteMethods" label="Obsolete Methods">
8296
The functions <functionlink id="RetransformClasses"/> and
8297
<functionlink id="RedefineClasses"/> can cause new versions
8298
of methods to be installed.
8299
An original version of a method is considered equivalent
8300
to the new version if:
8301
<ul>
8302
<li>their bytecodes are the same except for indices into the
8303
constant pool and </li>
8304
<li>the referenced constants are equal.</li>
8305
</ul>
8306
An original method version which is not equivalent to the
8307
new method version is called obsolete and is assigned a new method ID;
8308
the original method ID now refers to the new method version.
8309
A method ID can be tested for obsolescence with
8310
<functionlink id="IsMethodObsolete"/>.
8311
</intro>
8312
8313
<function id="GetMethodName" phase="start" num="64">
8314
<synopsis>Get Method Name (and Signature)</synopsis>
8315
<description>
8316
For the method indicated by <code>method</code>,
8317
return the method name via <code>name_ptr</code> and method signature via
8318
<code>signature_ptr</code>.
8319
<p/>
8320
Method signatures are defined in the
8321
<externallink id="jni/index.html">JNI Specification</externallink>
8322
and are referred to as <code>method descriptors</code> in
8323
<vmspec chapter="4.3.3"/>.
8324
Note this is different
8325
than method signatures as defined in the <i>Java Language Specification</i>.
8326
</description>
8327
<origin>jvmdiClone</origin>
8328
<capabilities>
8329
</capabilities>
8330
<parameters>
8331
<param id="method">
8332
<jmethodID/>
8333
<description>
8334
The method to query.
8335
</description>
8336
</param>
8337
<param id="name_ptr">
8338
<allocbuf>
8339
<char/>
8340
<nullok>the name is not returned</nullok>
8341
</allocbuf>
8342
<description>
8343
On return, points to the method name, encoded as a
8344
<internallink id="mUTF">modified UTF-8</internallink> string.
8345
</description>
8346
</param>
8347
<param id="signature_ptr">
8348
<allocbuf>
8349
<char/>
8350
<nullok>the signature is not returned</nullok>
8351
</allocbuf>
8352
<description>
8353
On return, points to the method signature, encoded as a
8354
<internallink id="mUTF">modified UTF-8</internallink> string.
8355
</description>
8356
</param>
8357
<param id="generic_ptr">
8358
<allocbuf>
8359
<char/>
8360
<nullok>the generic signature is not returned</nullok>
8361
</allocbuf>
8362
<description>
8363
On return, points to the generic signature of the method, encoded as a
8364
<internallink id="mUTF">modified UTF-8</internallink> string.
8365
If there is no generic signature attribute for the method, then,
8366
on return, points to <code>NULL</code>.
8367
</description>
8368
</param>
8369
</parameters>
8370
<errors>
8371
</errors>
8372
</function>
8373
8374
<function id="GetMethodDeclaringClass" phase="start" num="65">
8375
<synopsis>Get Method Declaring Class</synopsis>
8376
<description>
8377
For the method indicated by <code>method</code>,
8378
return the class that defined it via <code>declaring_class_ptr</code>.
8379
</description>
8380
<origin>jvmdi</origin>
8381
<capabilities>
8382
</capabilities>
8383
<parameters>
8384
<param id="klass">
8385
<jclass method="method"/>
8386
<description>
8387
The class to query.
8388
</description>
8389
</param>
8390
<param id="method">
8391
<jmethodID class="klass"/>
8392
<description>
8393
The method to query.
8394
</description>
8395
</param>
8396
<param id="declaring_class_ptr">
8397
<outptr><jclass/></outptr>
8398
<description>
8399
On return, points to the declaring class
8400
</description>
8401
</param>
8402
</parameters>
8403
<errors>
8404
</errors>
8405
</function>
8406
8407
<function id="GetMethodModifiers" phase="start" num="66">
8408
<synopsis>Get Method Modifiers</synopsis>
8409
<description>
8410
For the method indicated by <code>method</code>,
8411
return the access flags via <code>modifiers_ptr</code>.
8412
Access flags are defined in <vmspec chapter="4"/>.
8413
</description>
8414
<origin>jvmdi</origin>
8415
<capabilities>
8416
</capabilities>
8417
<parameters>
8418
<param id="klass">
8419
<jclass method="method"/>
8420
<description>
8421
The class to query.
8422
</description>
8423
</param>
8424
<param id="method">
8425
<jmethodID class="klass"/>
8426
<description>
8427
The method to query.
8428
</description>
8429
</param>
8430
<param id="modifiers_ptr">
8431
<outptr><jint/></outptr>
8432
<description>
8433
On return, points to the access flags.
8434
</description>
8435
</param>
8436
</parameters>
8437
<errors>
8438
</errors>
8439
</function>
8440
8441
<function id="GetMaxLocals" phase="start" num="68">
8442
<synopsis>Get Max Locals</synopsis>
8443
<description>
8444
For the method indicated by <code>method</code>,
8445
return the number of local variable slots used by the method,
8446
including the local variables used to pass parameters to the
8447
method on its invocation.
8448
<p/>
8449
See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.
8450
</description>
8451
<origin>jvmdi</origin>
8452
<capabilities>
8453
</capabilities>
8454
<parameters>
8455
<param id="klass">
8456
<jclass method="method"/>
8457
<description>
8458
The class to query.
8459
</description>
8460
</param>
8461
<param id="method">
8462
<jmethodID class="klass" native="error"/>
8463
<description>
8464
The method to query.
8465
</description>
8466
</param>
8467
<param id="max_ptr">
8468
<outptr><jint/></outptr>
8469
<description>
8470
On return, points to the maximum number of local slots
8471
</description>
8472
</param>
8473
</parameters>
8474
<errors>
8475
</errors>
8476
</function>
8477
8478
<function id="GetArgumentsSize" phase="start" num="69">
8479
<synopsis>Get Arguments Size</synopsis>
8480
<description>
8481
For the method indicated by <code>method</code>,
8482
return via <code>max_ptr</code> the number of local variable slots used
8483
by the method's arguments.
8484
Note that two-word arguments use two slots.
8485
</description>
8486
<origin>jvmdi</origin>
8487
<capabilities>
8488
</capabilities>
8489
<parameters>
8490
<param id="klass">
8491
<jclass method="method"/>
8492
<description>
8493
The class to query.
8494
</description>
8495
</param>
8496
<param id="method">
8497
<jmethodID class="klass" native="error"/>
8498
<description>
8499
The method to query.
8500
</description>
8501
</param>
8502
<param id="size_ptr">
8503
<outptr><jint/></outptr>
8504
<description>
8505
On return, points to the number of argument slots
8506
</description>
8507
</param>
8508
</parameters>
8509
<errors>
8510
</errors>
8511
</function>
8512
8513
<function id="GetLineNumberTable" phase="start" num="70">
8514
<synopsis>Get Line Number Table</synopsis>
8515
<typedef id="jvmtiLineNumberEntry" label="Line number table entry">
8516
<field id="start_location">
8517
<jlocation/>
8518
<description>
8519
the <datalink id="jlocation"></datalink> where the line begins
8520
</description>
8521
</field>
8522
<field id="line_number">
8523
<jint/>
8524
<description>
8525
the line number
8526
</description>
8527
</field>
8528
</typedef>
8529
<description>
8530
For the method indicated by <code>method</code>,
8531
return a table of source line number entries. The size of the table is
8532
returned via <code>entry_count_ptr</code> and the table itself is
8533
returned via <code>table_ptr</code>.
8534
</description>
8535
<origin>jvmdi</origin>
8536
<capabilities>
8537
<required id="can_get_line_numbers"></required>
8538
</capabilities>
8539
<parameters>
8540
<param id="klass">
8541
<jclass method="method"/>
8542
<description>
8543
The class to query.
8544
</description>
8545
</param>
8546
<param id="method">
8547
<jmethodID class="klass" native="error"/>
8548
<description>
8549
The method to query.
8550
</description>
8551
</param>
8552
<param id="entry_count_ptr">
8553
<outptr><jint/></outptr>
8554
<description>
8555
On return, points to the number of entries in the table
8556
</description>
8557
</param>
8558
<param id="table_ptr">
8559
<allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>
8560
<description>
8561
On return, points to the line number table pointer.
8562
</description>
8563
</param>
8564
</parameters>
8565
<errors>
8566
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
8567
Class information does not include line numbers.
8568
</error>
8569
</errors>
8570
</function>
8571
8572
<function id="GetMethodLocation" phase="start" num="71">
8573
<synopsis>Get Method Location</synopsis>
8574
<description>
8575
For the method indicated by <code>method</code>,
8576
return the beginning and ending addresses through
8577
<code>start_location_ptr</code> and <code>end_location_ptr</code>. In a
8578
conventional bytecode indexing scheme,
8579
<code>start_location_ptr</code> will always point to zero
8580
and <code>end_location_ptr</code>
8581
will always point to the bytecode count minus one.
8582
</description>
8583
<origin>jvmdi</origin>
8584
<capabilities>
8585
</capabilities>
8586
<parameters>
8587
<param id="klass">
8588
<jclass method="method"/>
8589
<description>
8590
The class to query.
8591
</description>
8592
</param>
8593
<param id="method">
8594
<jmethodID class="klass" native="error"/>
8595
<description>
8596
The method to query.
8597
</description>
8598
</param>
8599
<param id="start_location_ptr">
8600
<outptr><jlocation/></outptr>
8601
<description>
8602
On return, points to the first location, or
8603
<code>-1</code> if location information is not available.
8604
If the information is available and
8605
<functionlink id="GetJLocationFormat"></functionlink>
8606
returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>
8607
then this will always be zero.
8608
</description>
8609
</param>
8610
<param id="end_location_ptr">
8611
<outptr><jlocation/></outptr>
8612
<description>
8613
On return, points to the last location,
8614
or <code>-1</code> if location information is not available.
8615
</description>
8616
</param>
8617
</parameters>
8618
<errors>
8619
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
8620
Class information does not include method sizes.
8621
</error>
8622
</errors>
8623
</function>
8624
8625
<function id="GetLocalVariableTable" num="72">
8626
<synopsis>Get Local Variable Table</synopsis>
8627
<typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">
8628
<field id="start_location">
8629
<jlocation/>
8630
<description>
8631
The code array index where the local variable is first valid
8632
(that is, where it must have a value).
8633
</description>
8634
</field>
8635
<field id="length">
8636
<jint/>
8637
<description>
8638
The length of the valid section for this local variable.
8639
The last code array index where the local variable is valid
8640
is <code>start_location + length</code>.
8641
</description>
8642
</field>
8643
<field id="name">
8644
<allocfieldbuf><char/></allocfieldbuf>
8645
<description>
8646
The local variable name, encoded as a
8647
<internallink id="mUTF">modified UTF-8</internallink> string.
8648
</description>
8649
</field>
8650
<field id="signature">
8651
<allocfieldbuf><char/></allocfieldbuf>
8652
<description>
8653
The local variable's type signature, encoded as a
8654
<internallink id="mUTF">modified UTF-8</internallink> string.
8655
The signature format is the same as that defined in
8656
<vmspec chapter="4.3.2"/>.
8657
</description>
8658
</field>
8659
<field id="generic_signature">
8660
<allocfieldbuf><char/></allocfieldbuf>
8661
<description>
8662
The local variable's generic signature, encoded as a
8663
<internallink id="mUTF">modified UTF-8</internallink> string.
8664
The value of this field will be <code>NULL</code> for any local
8665
variable which does not have a generic type.
8666
</description>
8667
</field>
8668
<field id="slot">
8669
<jint/>
8670
<description>
8671
The local variable's slot. See <internallink id="local">Local Variables</internallink>.
8672
</description>
8673
</field>
8674
</typedef>
8675
<description>
8676
Return local variable information.
8677
</description>
8678
<origin>jvmdiClone</origin>
8679
<capabilities>
8680
<required id="can_access_local_variables"></required>
8681
</capabilities>
8682
<parameters>
8683
<param id="method">
8684
<jmethodID native="error"/>
8685
<description>
8686
The method to query.
8687
</description>
8688
</param>
8689
<param id="entry_count_ptr">
8690
<outptr><jint/></outptr>
8691
<description>
8692
On return, points to the number of entries in the table
8693
</description>
8694
</param>
8695
<param id="table_ptr">
8696
<allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>
8697
<description>
8698
On return, points to an array of local variable table entries.
8699
</description>
8700
</param>
8701
</parameters>
8702
<errors>
8703
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
8704
Class information does not include local variable
8705
information.
8706
</error>
8707
</errors>
8708
</function>
8709
8710
<function id="GetBytecodes" phase="start" num="75">
8711
<synopsis>Get Bytecodes</synopsis>
8712
<description>
8713
For the method indicated by <code>method</code>,
8714
return the bytecodes that implement the method. The number of
8715
bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes
8716
themselves are returned via <code>bytecodes_ptr</code>.
8717
</description>
8718
<origin>jvmdi</origin>
8719
<capabilities>
8720
<required id="can_get_bytecodes"></required>
8721
</capabilities>
8722
<parameters>
8723
<param id="klass">
8724
<jclass method="method"/>
8725
<description>
8726
The class to query.
8727
</description>
8728
</param>
8729
<param id="method">
8730
<jmethodID class="klass" native="error"/>
8731
<description>
8732
The method to query.
8733
</description>
8734
</param>
8735
<param id="bytecode_count_ptr">
8736
<outptr><jint/></outptr>
8737
<description>
8738
On return, points to the length of the bytecode array
8739
</description>
8740
</param>
8741
<param id="bytecodes_ptr">
8742
<allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>
8743
<description>
8744
On return, points to the pointer to the bytecode array
8745
</description>
8746
</param>
8747
</parameters>
8748
<errors>
8749
</errors>
8750
</function>
8751
8752
<function id="IsMethodNative" phase="start" num="76">
8753
<synopsis>Is Method Native</synopsis>
8754
<description>
8755
For the method indicated by <code>method</code>, return a
8756
value indicating whether the method is native via <code>is_native_ptr</code>
8757
</description>
8758
<origin>jvmdi</origin>
8759
<capabilities>
8760
</capabilities>
8761
<parameters>
8762
<param id="klass">
8763
<jclass method="method"/>
8764
<description>
8765
The class to query.
8766
</description>
8767
</param>
8768
<param id="method">
8769
<jmethodID class="klass"/>
8770
<description>
8771
The method to query.
8772
</description>
8773
</param>
8774
<param id="is_native_ptr">
8775
<outptr><jboolean/></outptr>
8776
<description>
8777
On return, points to the boolean result of this function.
8778
</description>
8779
</param>
8780
</parameters>
8781
<errors>
8782
</errors>
8783
</function>
8784
8785
<function id="IsMethodSynthetic" phase="start" num="77">
8786
<synopsis>Is Method Synthetic</synopsis>
8787
<description>
8788
For the method indicated by <code>method</code>, return a
8789
value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.
8790
Synthetic methods are generated by the compiler but not present in the
8791
original source code.
8792
</description>
8793
<origin>jvmdi</origin>
8794
<capabilities>
8795
<required id="can_get_synthetic_attribute"></required>
8796
</capabilities>
8797
<parameters>
8798
<param id="klass">
8799
<jclass method="method"/>
8800
<description>
8801
The class to query.
8802
</description>
8803
</param>
8804
<param id="method">
8805
<jmethodID class="klass"/>
8806
<description>
8807
The method to query.
8808
</description>
8809
</param>
8810
<param id="is_synthetic_ptr">
8811
<outptr><jboolean/></outptr>
8812
<description>
8813
On return, points to the boolean result of this function.
8814
</description>
8815
</param>
8816
</parameters>
8817
<errors>
8818
</errors>
8819
</function>
8820
8821
<function id="IsMethodObsolete" phase="start" num="91">
8822
<synopsis>Is Method Obsolete</synopsis>
8823
<description>
8824
Determine if a method ID refers to an
8825
<internallink id="obsoleteMethods">obsolete</internallink>
8826
method version.
8827
</description>
8828
<origin>jvmdi</origin>
8829
<capabilities>
8830
</capabilities>
8831
<parameters>
8832
<param id="klass">
8833
<jclass method="method"/>
8834
<description>
8835
The class to query.
8836
</description>
8837
</param>
8838
<param id="method">
8839
<jmethodID class="klass"/>
8840
<description>
8841
The method ID to query.
8842
</description>
8843
</param>
8844
<param id="is_obsolete_ptr">
8845
<outptr><jboolean/></outptr>
8846
<description>
8847
On return, points to the boolean result of this function.
8848
</description>
8849
</param>
8850
</parameters>
8851
<errors>
8852
</errors>
8853
</function>
8854
8855
<function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">
8856
<synopsis>Set Native Method Prefix</synopsis>
8857
<description>
8858
This function modifies the failure handling of
8859
native method resolution by allowing retry
8860
with a prefix applied to the name.
8861
When used with the
8862
<eventlink id="ClassFileLoadHook">ClassFileLoadHook
8863
event</eventlink>, it enables native methods to be
8864
<internallink id="bci">instrumented</internallink>.
8865
<p/>
8866
Since native methods cannot be directly instrumented
8867
(they have no bytecodes), they must be wrapped with
8868
a non-native method which can be instrumented.
8869
For example, if we had:
8870
<example>
8871
native boolean foo(int x);</example>
8872
<p/>
8873
We could transform the class file (with the
8874
ClassFileLoadHook event) so that this becomes:
8875
<example>
8876
boolean foo(int x) {
8877
<i>... record entry to foo ...</i>
8878
return wrapped_foo(x);
8879
}
8880
8881
native boolean wrapped_foo(int x);</example>
8882
<p/>
8883
Where foo becomes a wrapper for the actual native method
8884
with the appended prefix "wrapped_". Note that
8885
"wrapped_" would be a poor choice of prefix since it
8886
might conceivably form the name of an existing method
8887
thus something like "$$$MyAgentWrapped$$$_" would be
8888
better but would make these examples less readable.
8889
<p/>
8890
The wrapper will allow data to be collected on the native
8891
method call, but now the problem becomes linking up the
8892
wrapped method with the native implementation.
8893
That is, the method <code>wrapped_foo</code> needs to be
8894
resolved to the native implementation of <code>foo</code>,
8895
which might be:
8896
<example>
8897
Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>
8898
<p/>
8899
This function allows the prefix to be specified and the
8900
proper resolution to occur.
8901
Specifically, when the standard resolution fails, the
8902
resolution is retried taking the prefix into consideration.
8903
There are two ways that resolution occurs, explicit
8904
resolution with the JNI function <code>RegisterNatives</code>
8905
and the normal automatic resolution. For
8906
<code>RegisterNatives</code>, the VM will attempt this
8907
association:
8908
<example>
8909
method(foo) -> nativeImplementation(foo)</example>
8910
<p/>
8911
When this fails, the resolution will be retried with
8912
the specified prefix prepended to the method name,
8913
yielding the correct resolution:
8914
<example>
8915
method(wrapped_foo) -> nativeImplementation(foo)</example>
8916
<p/>
8917
For automatic resolution, the VM will attempt:
8918
<example>
8919
method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>
8920
<p/>
8921
When this fails, the resolution will be retried with
8922
the specified prefix deleted from the implementation name,
8923
yielding the correct resolution:
8924
<example>
8925
method(wrapped_foo) -> nativeImplementation(foo)</example>
8926
<p/>
8927
Note that since the prefix is only used when standard
8928
resolution fails, native methods can be wrapped selectively.
8929
<p/>
8930
Since each <jvmti/> environment is independent and
8931
can do its own transformation of the bytecodes, more
8932
than one layer of wrappers may be applied. Thus each
8933
environment needs its own prefix. Since transformations
8934
are applied in order, the prefixes, if applied, will
8935
be applied in the same order.
8936
The order of transformation application is described in
8937
the <eventlink id="ClassFileLoadHook"/> event.
8938
Thus if three environments applied
8939
wrappers, <code>foo</code> might become
8940
<code>$env3_$env2_$env1_foo</code>. But if, say,
8941
the second environment did not apply a wrapper to
8942
<code>foo</code> it would be just
8943
<code>$env3_$env1_foo</code>. To be able to
8944
efficiently determine the sequence of prefixes,
8945
an intermediate prefix is only applied if its non-native
8946
wrapper exists. Thus, in the last example, even though
8947
<code>$env1_foo</code> is not a native method, the
8948
<code>$env1_</code> prefix is applied since
8949
<code>$env1_foo</code> exists.
8950
<p/>
8951
Since the prefixes are used at resolution time
8952
and since resolution may be arbitrarily delayed, a
8953
native method prefix must remain set as long as there
8954
are corresponding prefixed native methods.
8955
</description>
8956
<origin>new</origin>
8957
<capabilities>
8958
<required id="can_set_native_method_prefix"></required>
8959
</capabilities>
8960
<parameters>
8961
<param id="prefix">
8962
<inbuf>
8963
<char/>
8964
<nullok>
8965
any existing prefix in this environment is cancelled
8966
</nullok>
8967
</inbuf>
8968
<description>
8969
The prefix to apply, encoded as a
8970
<internallink id="mUTF">modified UTF-8</internallink> string.
8971
</description>
8972
</param>
8973
</parameters>
8974
<errors>
8975
</errors>
8976
</function>
8977
8978
<function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">
8979
<synopsis>Set Native Method Prefixes</synopsis>
8980
<description>
8981
For a normal agent, <functionlink id="SetNativeMethodPrefix"/>
8982
will provide all needed native method prefixing.
8983
For a meta-agent that performs multiple independent class
8984
file transformations (for example as a proxy for another
8985
layer of agents) this function allows each transformation
8986
to have its own prefix.
8987
The prefixes are applied in the order supplied and are
8988
processed in the same manner as described for the
8989
application of prefixes from multiple <jvmti/> environments
8990
in <functionlink id="SetNativeMethodPrefix"/>.
8991
<p/>
8992
Any previous prefixes are replaced. Thus, calling this
8993
function with a <paramlink id="prefix_count"/> of <code>0</code>
8994
disables prefixing in this environment.
8995
<p/>
8996
<functionlink id="SetNativeMethodPrefix"/> and this function
8997
are the two ways to set the prefixes.
8998
Calling <code>SetNativeMethodPrefix</code> with
8999
a prefix is the same as calling this function with
9000
<paramlink id="prefix_count"/> of <code>1</code>.
9001
Calling <code>SetNativeMethodPrefix</code> with
9002
<code>NULL</code> is the same as calling this function with
9003
<paramlink id="prefix_count"/> of <code>0</code>.
9004
</description>
9005
<origin>new</origin>
9006
<capabilities>
9007
<required id="can_set_native_method_prefix"></required>
9008
</capabilities>
9009
<parameters>
9010
<param id="prefix_count">
9011
<jint min="0"/>
9012
<description>
9013
The number of prefixes to apply.
9014
</description>
9015
</param>
9016
<param id="prefixes">
9017
<agentbuf>
9018
<char/>
9019
</agentbuf>
9020
<description>
9021
The prefixes to apply for this environment, each encoded as a
9022
<internallink id="mUTF">modified UTF-8</internallink> string.
9023
</description>
9024
</param>
9025
</parameters>
9026
<errors>
9027
</errors>
9028
</function>
9029
9030
</category>
9031
9032
<category id="RawMonitors" label="Raw Monitor">
9033
9034
<function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">
9035
<synopsis>Create Raw Monitor</synopsis>
9036
<description>
9037
Create a raw monitor.
9038
</description>
9039
<origin>jvmdi</origin>
9040
<capabilities>
9041
</capabilities>
9042
<parameters>
9043
<param id="name">
9044
<inbuf><char/></inbuf>
9045
<description>
9046
A name to identify the monitor, encoded as a
9047
<internallink id="mUTF">modified UTF-8</internallink> string.
9048
</description>
9049
</param>
9050
<param id="monitor_ptr">
9051
<outptr><jrawMonitorID/></outptr>
9052
<description>
9053
On return, points to the created monitor.
9054
</description>
9055
</param>
9056
</parameters>
9057
<errors>
9058
</errors>
9059
</function>
9060
9061
<function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">
9062
<synopsis>Destroy Raw Monitor</synopsis>
9063
<description>
9064
Destroy the raw monitor.
9065
If the monitor being destroyed has been entered by this thread, it will be
9066
exited before it is destroyed.
9067
If the monitor being destroyed has been entered by another thread,
9068
an error will be returned and the monitor will not be destroyed.
9069
</description>
9070
<origin>jvmdi</origin>
9071
<capabilities>
9072
</capabilities>
9073
<parameters>
9074
<param id="monitor">
9075
<jrawMonitorID/>
9076
<description>
9077
The monitor
9078
</description>
9079
</param>
9080
</parameters>
9081
<errors>
9082
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9083
Not monitor owner
9084
</error>
9085
</errors>
9086
</function>
9087
9088
<function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">
9089
<synopsis>Raw Monitor Enter</synopsis>
9090
<description>
9091
Gain exclusive ownership of a raw monitor.
9092
The same thread may enter a monitor more then once.
9093
The thread must
9094
<functionlink id="RawMonitorExit">exit</functionlink>
9095
the monitor the same number of times as it is entered.
9096
If a monitor is entered during <code>OnLoad</code> (before attached threads exist)
9097
and has not exited when attached threads come into existence, the enter
9098
is considered to have occurred on the main thread.
9099
</description>
9100
<origin>jvmdi</origin>
9101
<capabilities>
9102
</capabilities>
9103
<parameters>
9104
<param id="monitor">
9105
<jrawMonitorID/>
9106
<description>
9107
The monitor
9108
</description>
9109
</param>
9110
</parameters>
9111
<errors>
9112
</errors>
9113
</function>
9114
9115
<function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">
9116
<synopsis>Raw Monitor Exit</synopsis>
9117
<description>
9118
Release exclusive ownership of a raw monitor.
9119
</description>
9120
<origin>jvmdi</origin>
9121
<capabilities>
9122
</capabilities>
9123
<parameters>
9124
<param id="monitor">
9125
<jrawMonitorID/>
9126
<description>
9127
The monitor
9128
</description>
9129
</param>
9130
</parameters>
9131
<errors>
9132
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9133
Not monitor owner
9134
</error>
9135
</errors>
9136
</function>
9137
9138
<function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">
9139
<synopsis>Raw Monitor Wait</synopsis>
9140
<description>
9141
Wait for notification of the raw monitor.
9142
<p/>
9143
Causes the current thread to wait until either another thread calls
9144
<functionlink id="RawMonitorNotify"/> or
9145
<functionlink id="RawMonitorNotifyAll"/>
9146
for the specified raw monitor, or the specified
9147
<paramlink id="millis">timeout</paramlink>
9148
has elapsed.
9149
</description>
9150
<origin>jvmdi</origin>
9151
<capabilities>
9152
</capabilities>
9153
<parameters>
9154
<param id="monitor">
9155
<jrawMonitorID/>
9156
<description>
9157
The monitor
9158
</description>
9159
</param>
9160
<param id="millis">
9161
<jlong/>
9162
<description>
9163
The timeout, in milliseconds. If the timeout is
9164
zero, then real time is not taken into consideration
9165
and the thread simply waits until notified.
9166
</description>
9167
</param>
9168
</parameters>
9169
<errors>
9170
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9171
Not monitor owner
9172
</error>
9173
<error id="JVMTI_ERROR_INTERRUPT">
9174
Wait was interrupted, try again
9175
</error>
9176
</errors>
9177
</function>
9178
9179
<function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">
9180
<synopsis>Raw Monitor Notify</synopsis>
9181
<description>
9182
Notify a single thread waiting on the raw monitor.
9183
</description>
9184
<origin>jvmdi</origin>
9185
<capabilities>
9186
</capabilities>
9187
<parameters>
9188
<param id="monitor">
9189
<jrawMonitorID/>
9190
<description>
9191
The monitor
9192
</description>
9193
</param>
9194
</parameters>
9195
<errors>
9196
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9197
Not monitor owner
9198
</error>
9199
</errors>
9200
</function>
9201
9202
<function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">
9203
<synopsis>Raw Monitor Notify All</synopsis>
9204
<description>
9205
Notify all threads waiting on the raw monitor.
9206
</description>
9207
<origin>jvmdi</origin>
9208
<capabilities>
9209
</capabilities>
9210
<parameters>
9211
<param id="monitor">
9212
<jrawMonitorID/>
9213
<description>
9214
The monitor
9215
</description>
9216
</param>
9217
</parameters>
9218
<errors>
9219
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9220
Not monitor owner
9221
</error>
9222
</errors>
9223
</function>
9224
9225
<elide>
9226
<function id="GetRawMonitorUse" num="118">
9227
<synopsis>Get Raw Monitor Use</synopsis>
9228
<description>
9229
The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
9230
are filled in with information about usage of the raw monitor.
9231
</description>
9232
<origin>new</origin>
9233
<capabilities>
9234
<required id="can_get_raw_monitor_usage"></required>
9235
</capabilities>
9236
<parameters>
9237
<param id="monitor">
9238
<jrawMonitorID/>
9239
<description>
9240
the raw monitor to query.
9241
</description>
9242
</param>
9243
<param id="info_ptr">
9244
<outptr><struct>jvmtiMonitorUsage</struct></outptr>
9245
<description>
9246
On return, filled with monitor information for the
9247
specified raw monitor.
9248
</description>
9249
</param>
9250
</parameters>
9251
<errors>
9252
</errors>
9253
</function>
9254
9255
<function id="GetRawMonitors" num="119">
9256
<synopsis>Get Raw Monitors</synopsis>
9257
<description>
9258
Return the list of raw monitors.
9259
<p/>
9260
Note: details about each monitor can be examined with
9261
<functionlink id="GetRawMonitorUse"></functionlink>.
9262
</description>
9263
<origin>new</origin>
9264
<capabilities>
9265
<required id="can_get_raw_monitor_usage"></required>
9266
</capabilities>
9267
<parameters>
9268
<param id="monitorCnt">
9269
<outptr><jint/></outptr>
9270
<description>
9271
On return, pointer to the number
9272
of monitors returned in <code>monitors_ptr</code>.
9273
</description>
9274
</param>
9275
<param id="monitors_ptr">
9276
<allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>
9277
<description>
9278
On return, pointer to the monitor list.
9279
</description>
9280
</param>
9281
</parameters>
9282
<errors>
9283
</errors>
9284
</function>
9285
</elide>
9286
</category>
9287
9288
<category id="jniIntercept" label="JNI Function Interception">
9289
9290
<intro>
9291
Provides the ability to intercept and resend
9292
Java Native Interface (JNI) function calls
9293
by manipulating the JNI function table.
9294
See <externallink id="jni/functions.html">JNI
9295
Functions</externallink> in the <i>Java Native Interface Specification</i>.
9296
<p/>
9297
The following example illustrates intercepting the
9298
<code>NewGlobalRef</code> JNI call in order to count reference
9299
creation.
9300
<example>
9301
JNIEnv original_jni_Functions;
9302
JNIEnv redirected_jni_Functions;
9303
int my_global_ref_count = 0;
9304
9305
jobject
9306
MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {
9307
++my_global_ref_count;
9308
return originalJNIFunctions-&gt;NewGlobalRef(env, lobj);
9309
}
9310
9311
void
9312
myInit() {
9313
jvmtiError err;
9314
9315
err = (*jvmti_env)-&gt;GetJNIFunctionTable(jvmti_env, &amp;original_jni_Functions);
9316
if (err != JVMTI_ERROR_NONE) {
9317
die();
9318
}
9319
err = (*jvmti_env)-&gt;GetJNIFunctionTable(jvmti_env, &amp;redirected_jni_Functions);
9320
if (err != JVMTI_ERROR_NONE) {
9321
die();
9322
}
9323
redirectedJNIFunctions-&gt;NewGlobalRef = MyNewGlobalRef;
9324
err = (*jvmti_env)-&gt;SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);
9325
if (err != JVMTI_ERROR_NONE) {
9326
die();
9327
}
9328
}
9329
</example>
9330
Sometime after <code>myInit</code> is called the user's JNI
9331
code is executed which makes the call to create a new global
9332
reference. Instead of going to the normal JNI implementation
9333
the call goes to <code>myNewGlobalRef</code>. Note that a
9334
copy of the original function table is kept so that the normal
9335
JNI function can be called after the data is collected.
9336
Note also that any JNI functions which are not overwritten
9337
will behave normally.
9338
<todo>
9339
check that the example compiles and executes.
9340
</todo>
9341
</intro>
9342
9343
<function id="SetJNIFunctionTable" phase="start" num="120">
9344
<synopsis>Set JNI Function Table</synopsis>
9345
<description>
9346
Set the JNI function table
9347
in all current and future JNI environments.
9348
As a result, all future JNI calls are directed to the specified functions.
9349
Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the
9350
function table to pass to this function.
9351
For this function to take effect the the updated table entries must be
9352
used by the JNI clients.
9353
Since the table is defined <code>const</code> some compilers may optimize
9354
away the access to the table, thus preventing this function from taking
9355
effect.
9356
The table is copied--changes to the local copy of the
9357
table have no effect.
9358
This function affects only the function table, all other aspects of the environment are
9359
unaffected.
9360
See the examples <internallink id="jniIntercept">above</internallink>.
9361
</description>
9362
<origin>new</origin>
9363
<capabilities>
9364
</capabilities>
9365
<parameters>
9366
<param id="function_table">
9367
<inptr>
9368
<struct>jniNativeInterface</struct>
9369
</inptr>
9370
<description>
9371
Points to the new JNI function table.
9372
</description>
9373
</param>
9374
</parameters>
9375
<errors>
9376
</errors>
9377
</function>
9378
9379
<function id="GetJNIFunctionTable" phase="start" num="121">
9380
<synopsis>Get JNI Function Table</synopsis>
9381
<description>
9382
Get the JNI function table.
9383
The JNI function table is copied into allocated memory.
9384
If <functionlink id="SetJNIFunctionTable"></functionlink>
9385
has been called, the modified (not the original) function
9386
table is returned.
9387
Only the function table is copied, no other aspects of the environment
9388
are copied.
9389
See the examples <internallink id="jniIntercept">above</internallink>.
9390
</description>
9391
<origin>new</origin>
9392
<capabilities>
9393
</capabilities>
9394
<parameters>
9395
<param id="function_table">
9396
<allocbuf>
9397
<struct>jniNativeInterface</struct>
9398
</allocbuf>
9399
<description>
9400
On return, <code>*function_table</code>
9401
points a newly allocated copy of the JNI function table.
9402
</description>
9403
</param>
9404
</parameters>
9405
<errors>
9406
</errors>
9407
</function>
9408
9409
</category>
9410
9411
<category id="eventManagement" label="Event Management">
9412
9413
<function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">
9414
<synopsis>Set Event Callbacks</synopsis>
9415
<description>
9416
Set the functions to be called for each event.
9417
The callbacks are specified by supplying a replacement function table.
9418
The function table is copied--changes to the local copy of the
9419
table have no effect.
9420
This is an atomic action, all callbacks are set at once.
9421
No events are sent before this function is called.
9422
When an entry is <code>NULL</code> or when the event is beyond
9423
<paramlink id="size_of_callbacks"></paramlink> no event is sent.
9424
Details on events are
9425
described <internallink id="EventSection">later</internallink> in this document.
9426
An event must be enabled and have a callback in order to be
9427
sent--the order in which this function and
9428
<functionlink id="SetEventNotificationMode"></functionlink>
9429
are called does not affect the result.
9430
</description>
9431
<origin>new</origin>
9432
<capabilities>
9433
</capabilities>
9434
<parameters>
9435
<param id="callbacks">
9436
<inptr>
9437
<struct>jvmtiEventCallbacks</struct>
9438
<nullok>remove the existing callbacks</nullok>
9439
</inptr>
9440
<description>
9441
The new event callbacks.
9442
</description>
9443
</param>
9444
<param id="size_of_callbacks">
9445
<jint min="0"/>
9446
<description>
9447
<code>sizeof(jvmtiEventCallbacks)</code>--for version
9448
compatibility.
9449
</description>
9450
</param>
9451
</parameters>
9452
<errors>
9453
</errors>
9454
</function>
9455
9456
<function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">
9457
<synopsis>Set Event Notification Mode</synopsis>
9458
<description>
9459
Control the generation of events.
9460
<constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">
9461
<constant id="JVMTI_ENABLE" num="1">
9462
If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,
9463
the event <paramlink id="event_type"></paramlink> will be enabled
9464
</constant>
9465
<constant id="JVMTI_DISABLE" num="0">
9466
If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,
9467
the event <paramlink id="event_type"></paramlink> will be disabled
9468
</constant>
9469
</constants>
9470
If <code>event_thread</code> is <code>NULL</code>,
9471
the event is enabled or disabled globally; otherwise, it is
9472
enabled or disabled for a particular thread.
9473
An event is generated for
9474
a particular thread if it is enabled either at the thread or global
9475
levels.
9476
<p/>
9477
See <internallink id="EventIndex">below</internallink> for information on specific events.
9478
<p/>
9479
The following events cannot be controlled at the thread
9480
level through this function.
9481
<ul>
9482
<li><eventlink id="VMInit"></eventlink></li>
9483
<li><eventlink id="VMStart"></eventlink></li>
9484
<li><eventlink id="VMDeath"></eventlink></li>
9485
<li><eventlink id="ThreadStart"></eventlink></li>
9486
<li><eventlink id="CompiledMethodLoad"></eventlink></li>
9487
<li><eventlink id="CompiledMethodUnload"></eventlink></li>
9488
<li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9489
<li><eventlink id="DataDumpRequest"></eventlink></li>
9490
</ul>
9491
<p/>
9492
Initially, no events are enabled at either the thread level
9493
or the global level.
9494
<p/>
9495
Any needed capabilities (see Event Enabling Capabilities below) must be possessed
9496
before calling this function.
9497
<p/>
9498
Details on events are
9499
described <internallink id="EventSection">below</internallink>.
9500
</description>
9501
<origin>jvmdiClone</origin>
9502
<eventcapabilities></eventcapabilities>
9503
<parameters>
9504
<param id="mode">
9505
<enum>jvmtiEventMode</enum>
9506
<description>
9507
<code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>
9508
</description>
9509
</param>
9510
<param id="event_type">
9511
<enum>jvmtiEvent</enum>
9512
<description>
9513
the event to control
9514
</description>
9515
</param>
9516
<param id="event_thread">
9517
<ptrtype>
9518
<jthread impl="noconvert"/>
9519
<nullok>event is controlled at the global level</nullok>
9520
</ptrtype>
9521
<description>
9522
The thread to control
9523
</description>
9524
</param>
9525
<param id="...">
9526
<varargs/>
9527
<description>
9528
for future expansion
9529
</description>
9530
</param>
9531
</parameters>
9532
<errors>
9533
<error id="JVMTI_ERROR_INVALID_THREAD">
9534
<paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread.
9535
</error>
9536
<error id="JVMTI_ERROR_THREAD_NOT_ALIVE">
9537
<paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead).
9538
</error>
9539
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9540
thread level control was attempted on events which do not
9541
permit thread level control.
9542
</error>
9543
<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9544
The Required Event Enabling Capability is not possessed.
9545
</error>
9546
</errors>
9547
</function>
9548
9549
<function id="GenerateEvents" num="123">
9550
<synopsis>Generate Events</synopsis>
9551
<description>
9552
Generate events to represent the current state of the VM.
9553
For example, if <paramlink id="event_type"/> is
9554
<code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,
9555
a <eventlink id="CompiledMethodLoad"></eventlink> event will be
9556
sent for each currently compiled method.
9557
Methods that were loaded and now have been unloaded are not sent.
9558
The history of what events have previously been sent does not
9559
effect what events are sent by this function--for example,
9560
all currently compiled methods
9561
will be sent each time this function is called.
9562
<p/>
9563
This function is useful when
9564
events may have been missed due to the agent attaching after program
9565
execution begins; this function generates the missed events.
9566
<p/>
9567
Attempts to execute Java programming language code or
9568
JNI functions may be paused until this function returns -
9569
so neither should be called from the thread sending the event.
9570
This function returns only after the missed events have been
9571
sent, processed and have returned.
9572
The event may be sent on a different thread than the thread
9573
on which the event occurred.
9574
The callback for the event must be set with
9575
<functionlink id="SetEventCallbacks"></functionlink>
9576
and the event must be enabled with
9577
<functionlink id="SetEventNotificationMode"></functionlink>
9578
or the events will not occur.
9579
If the VM no longer has the information to generate some or
9580
all of the requested events, the events are simply not sent -
9581
no error is returned.
9582
<p/>
9583
Only the following events are supported:
9584
<ul>
9585
<li><eventlink id="CompiledMethodLoad"></eventlink></li>
9586
<li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9587
</ul>
9588
</description>
9589
<origin>new</origin>
9590
<capabilities>
9591
<capability id="can_generate_compiled_method_load_events"></capability>
9592
</capabilities>
9593
<parameters>
9594
<param id="event_type">
9595
<enum>jvmtiEvent</enum>
9596
<description>
9597
The type of event to generate. Must be one of these:
9598
<ul>
9599
<li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>
9600
<li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>
9601
</ul>
9602
</description>
9603
</param>
9604
</parameters>
9605
<errors>
9606
<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9607
<paramlink id="event_type"/> is
9608
<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9609
and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>
9610
is <code>false</code>.
9611
</error>
9612
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9613
<paramlink id="event_type"/> is other than
9614
<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9615
or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.
9616
</error>
9617
</errors>
9618
</function>
9619
9620
</category>
9621
9622
<category id="extension" label="Extension Mechanism">
9623
9624
<intro>
9625
These functions
9626
allow a <jvmti/> implementation to provide functions and events
9627
beyond those defined in this specification.
9628
<p/>
9629
Both extension functions and extension events have parameters
9630
each of which has a 'type' and 'kind' chosen from the following tables:
9631
9632
<constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">
9633
<constant id="JVMTI_TYPE_JBYTE" num="101">
9634
Java programming language primitive type - <code>byte</code>.
9635
JNI type <code>jbyte</code>.
9636
</constant>
9637
<constant id="JVMTI_TYPE_JCHAR" num="102">
9638
Java programming language primitive type - <code>char</code>.
9639
JNI type <code>jchar</code>.
9640
</constant>
9641
<constant id="JVMTI_TYPE_JSHORT" num="103">
9642
Java programming language primitive type - <code>short</code>.
9643
JNI type <code>jshort</code>.
9644
</constant>
9645
<constant id="JVMTI_TYPE_JINT" num="104">
9646
Java programming language primitive type - <code>int</code>.
9647
JNI type <datalink id="jint"></datalink>.
9648
</constant>
9649
<constant id="JVMTI_TYPE_JLONG" num="105">
9650
Java programming language primitive type - <code>long</code>.
9651
JNI type <datalink id="jlong"></datalink>.
9652
</constant>
9653
<constant id="JVMTI_TYPE_JFLOAT" num="106">
9654
Java programming language primitive type - <code>float</code>.
9655
JNI type <datalink id="jfloat"></datalink>.
9656
</constant>
9657
<constant id="JVMTI_TYPE_JDOUBLE" num="107">
9658
Java programming language primitive type - <code>double</code>.
9659
JNI type <datalink id="jdouble"></datalink>.
9660
</constant>
9661
<constant id="JVMTI_TYPE_JBOOLEAN" num="108">
9662
Java programming language primitive type - <code>boolean</code>.
9663
JNI type <datalink id="jboolean"></datalink>.
9664
</constant>
9665
<constant id="JVMTI_TYPE_JOBJECT" num="109">
9666
Java programming language object type - <code>java.lang.Object</code>.
9667
JNI type <datalink id="jobject"></datalink>.
9668
Returned values are JNI local references and must be managed.
9669
</constant>
9670
<constant id="JVMTI_TYPE_JTHREAD" num="110">
9671
Java programming language object type - <code>java.lang.Thread</code>.
9672
<jvmti/> type <datalink id="jthread"></datalink>.
9673
Returned values are JNI local references and must be managed.
9674
</constant>
9675
<constant id="JVMTI_TYPE_JCLASS" num="111">
9676
Java programming language object type - <code>java.lang.Class</code>.
9677
JNI type <datalink id="jclass"></datalink>.
9678
Returned values are JNI local references and must be managed.
9679
</constant>
9680
<constant id="JVMTI_TYPE_JVALUE" num="112">
9681
Union of all Java programming language primitive and object types -
9682
JNI type <datalink id="jvalue"></datalink>.
9683
Returned values which represent object types are JNI local references and must be managed.
9684
</constant>
9685
<constant id="JVMTI_TYPE_JFIELDID" num="113">
9686
Java programming language field identifier -
9687
JNI type <datalink id="jfieldID"></datalink>.
9688
</constant>
9689
<constant id="JVMTI_TYPE_JMETHODID" num="114">
9690
Java programming language method identifier -
9691
JNI type <datalink id="jmethodID"></datalink>.
9692
</constant>
9693
<constant id="JVMTI_TYPE_CCHAR" num="115">
9694
C programming language type - <code>char</code>.
9695
</constant>
9696
<constant id="JVMTI_TYPE_CVOID" num="116">
9697
C programming language type - <code>void</code>.
9698
</constant>
9699
<constant id="JVMTI_TYPE_JNIENV" num="117">
9700
JNI environment - <code>JNIEnv</code>.
9701
Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.
9702
</constant>
9703
</constants>
9704
9705
<constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">
9706
<constant id="JVMTI_KIND_IN" num="91">
9707
Ingoing argument - <code>foo</code>.
9708
</constant>
9709
<constant id="JVMTI_KIND_IN_PTR" num="92">
9710
Ingoing pointer argument - <code>const foo*</code>.
9711
</constant>
9712
<constant id="JVMTI_KIND_IN_BUF" num="93">
9713
Ingoing array argument - <code>const foo*</code>.
9714
</constant>
9715
<constant id="JVMTI_KIND_ALLOC_BUF" num="94">
9716
Outgoing allocated array argument - <code>foo**</code>.
9717
Free with <code>Deallocate</code>.
9718
</constant>
9719
<constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">
9720
Outgoing allocated array of allocated arrays argument - <code>foo***</code>.
9721
Free with <code>Deallocate</code>.
9722
</constant>
9723
<constant id="JVMTI_KIND_OUT" num="96">
9724
Outgoing argument - <code>foo*</code>.
9725
</constant>
9726
<constant id="JVMTI_KIND_OUT_BUF" num="97">
9727
Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.
9728
Do not <code>Deallocate</code>.
9729
</constant>
9730
</constants>
9731
9732
</intro>
9733
9734
<typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">
9735
<field id="name">
9736
<allocfieldbuf><char/></allocfieldbuf>
9737
<description>
9738
The parameter name, encoded as a
9739
<internallink id="mUTF">modified UTF-8</internallink> string
9740
</description>
9741
</field>
9742
<field id="kind">
9743
<enum>jvmtiParamKind</enum>
9744
<description>
9745
The kind of the parameter - type modifiers
9746
</description>
9747
</field>
9748
<field id="base_type">
9749
<enum>jvmtiParamTypes</enum>
9750
<description>
9751
The base type of the parameter - modified by <code>kind</code>
9752
</description>
9753
</field>
9754
<field id="null_ok">
9755
<jboolean/>
9756
<description>
9757
Is a <code>NULL</code> argument permitted? Applies only to pointer and object types.
9758
</description>
9759
</field>
9760
</typedef>
9761
9762
<callback id="jvmtiExtensionFunction">
9763
<enum>jvmtiError</enum>
9764
<synopsis>Extension Function</synopsis>
9765
<description>
9766
This is the implementation-specific extension function.
9767
</description>
9768
<parameters>
9769
<param id="jvmti_env">
9770
<outptr>
9771
<struct>jvmtiEnv</struct>
9772
</outptr>
9773
<description>
9774
The <jvmti/> environment is the only fixed parameter for extension functions.
9775
</description>
9776
</param>
9777
<param id="...">
9778
<varargs/>
9779
<description>
9780
The extension function-specific parameters
9781
</description>
9782
</param>
9783
</parameters>
9784
</callback>
9785
9786
<function id="GetExtensionFunctions" phase="onload" num="124">
9787
<synopsis>Get Extension Functions</synopsis>
9788
9789
<typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">
9790
<field id="func">
9791
<ptrtype>
9792
<struct>jvmtiExtensionFunction</struct>
9793
</ptrtype>
9794
<description>
9795
The actual function to call
9796
</description>
9797
</field>
9798
<field id="id">
9799
<allocfieldbuf><char/></allocfieldbuf>
9800
<description>
9801
The identifier for the extension function, encoded as a
9802
<internallink id="mUTF">modified UTF-8</internallink> string.
9803
Uses package name conventions.
9804
For example, <code>com.sun.hotspot.bar</code>
9805
</description>
9806
</field>
9807
<field id="short_description">
9808
<allocfieldbuf><char/></allocfieldbuf>
9809
<description>
9810
A one sentence description of the function, encoded as a
9811
<internallink id="mUTF">modified UTF-8</internallink> string.
9812
</description>
9813
</field>
9814
<field id="param_count">
9815
<jint/>
9816
<description>
9817
The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
9818
</description>
9819
</field>
9820
<field id="params">
9821
<allocfieldbuf outcount="param_count">
9822
<struct>jvmtiParamInfo</struct>
9823
</allocfieldbuf>
9824
<description>
9825
Array of
9826
<fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
9827
parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
9828
</description>
9829
</field>
9830
<field id="error_count">
9831
<jint/>
9832
<description>
9833
The number of possible error returns (excluding universal errors)
9834
</description>
9835
</field>
9836
<field id="errors">
9837
<allocfieldbuf outcount="error_count">
9838
<enum>jvmtiError</enum>
9839
</allocfieldbuf>
9840
<description>
9841
Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
9842
possible errors
9843
</description>
9844
</field>
9845
</typedef>
9846
9847
<description>
9848
Returns the set of extension functions.
9849
</description>
9850
<origin>new</origin>
9851
<capabilities>
9852
</capabilities>
9853
<parameters>
9854
<param id="extension_count_ptr">
9855
<outptr><jint/></outptr>
9856
<description>
9857
On return, points to the number of extension functions
9858
</description>
9859
</param>
9860
<param id="extensions">
9861
<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>
9862
<description>
9863
Returns an array of extension function info, one per function
9864
</description>
9865
</param>
9866
</parameters>
9867
<errors>
9868
</errors>
9869
</function>
9870
9871
<function id="GetExtensionEvents" phase="onload" num="125">
9872
<synopsis>Get Extension Events</synopsis>
9873
9874
<typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">
9875
<field id="extension_event_index">
9876
<jint/>
9877
<description>
9878
The identifying index of the event
9879
</description>
9880
</field>
9881
<field id="id">
9882
<allocfieldbuf><char/></allocfieldbuf>
9883
<description>
9884
The identifier for the extension event, encoded as a
9885
<internallink id="mUTF">modified UTF-8</internallink> string.
9886
Uses package name conventions.
9887
For example, <code>com.sun.hotspot.bar</code>
9888
</description>
9889
</field>
9890
<field id="short_description">
9891
<allocfieldbuf><char/></allocfieldbuf>
9892
<description>
9893
A one sentence description of the event, encoded as a
9894
<internallink id="mUTF">modified UTF-8</internallink> string.
9895
</description>
9896
</field>
9897
<field id="param_count">
9898
<jint/>
9899
<description>
9900
The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
9901
</description>
9902
</field>
9903
<field id="params">
9904
<allocfieldbuf outcount="param_count">
9905
<struct>jvmtiParamInfo</struct>
9906
</allocfieldbuf>
9907
<description>
9908
Array of
9909
<fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>
9910
parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
9911
</description>
9912
</field>
9913
</typedef>
9914
9915
<description>
9916
Returns the set of extension events.
9917
</description>
9918
<origin>new</origin>
9919
<capabilities>
9920
</capabilities>
9921
<parameters>
9922
<param id="extension_count_ptr">
9923
<outptr><jint/></outptr>
9924
<description>
9925
On return, points to the number of extension events
9926
</description>
9927
</param>
9928
<param id="extensions">
9929
<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>
9930
<description>
9931
Returns an array of extension event info, one per event
9932
</description>
9933
</param>
9934
</parameters>
9935
<errors>
9936
</errors>
9937
</function>
9938
9939
<callback id="jvmtiExtensionEvent">
9940
<void/>
9941
<synopsis>Extension Event</synopsis>
9942
<description>
9943
This is the implementation-specific event.
9944
The event handler is set with
9945
<functionlink id="SetExtensionEventCallback"/>.
9946
<p/>
9947
Event handlers for extension events must be declared varargs to match this definition.
9948
Failure to do so could result in calling convention mismatch and undefined behavior
9949
on some platforms.
9950
<p/>
9951
For example, if the <code>jvmtiParamInfo</code>
9952
returned by <functionlink id="GetExtensionEvents"/> indicates that
9953
there is a <code>jint</code> parameter, the event handler should be
9954
declared:
9955
<example>
9956
void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
9957
</example>
9958
Note the terminal "<code>...</code>" which indicates varargs.
9959
The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
9960
the <code>va_*</code> syntax of the C programming language.
9961
</description>
9962
<parameters>
9963
<param id="jvmti_env">
9964
<outptr>
9965
<struct>jvmtiEnv</struct>
9966
</outptr>
9967
<description>
9968
The <jvmti/> environment is the only fixed parameter for extension events.
9969
</description>
9970
</param>
9971
<param id="...">
9972
<varargs/>
9973
<description>
9974
The extension event-specific parameters
9975
</description>
9976
</param>
9977
</parameters>
9978
</callback>
9979
9980
<function id="SetExtensionEventCallback" phase="onload" num="126">
9981
<synopsis>Set Extension Event Callback</synopsis>
9982
9983
<description>
9984
Sets the callback function for an extension event and
9985
enables the event. Or, if the callback is <code>NULL</code>, disables
9986
the event. Note that unlike standard events, setting
9987
the callback and enabling the event are a single operation.
9988
</description>
9989
<origin>new</origin>
9990
<capabilities>
9991
</capabilities>
9992
<parameters>
9993
<param id="extension_event_index">
9994
<jint/>
9995
<description>
9996
Identifies which callback to set.
9997
This index is the
9998
<fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>
9999
field of
10000
<datalink id="jvmtiExtensionEventInfo"/>.
10001
</description>
10002
</param>
10003
<param id="callback">
10004
<ptrtype>
10005
<struct>jvmtiExtensionEvent</struct>
10006
<nullok>disable the event</nullok>
10007
</ptrtype>
10008
<description>
10009
If <code>callback</code> is non-<code>NULL</code>,
10010
set <code>callback</code> to be the event callback function
10011
and enable the event.
10012
</description>
10013
</param>
10014
</parameters>
10015
<errors>
10016
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
10017
<paramlink id="extension_event_index"/> is not an
10018
<fieldlink id="extension_event_index"
10019
struct="jvmtiExtensionEventInfo"/>
10020
returned by
10021
<functionlink id="GetExtensionEvents"/>
10022
</error>
10023
</errors>
10024
</function>
10025
10026
</category>
10027
10028
<category id="capability" label="Capability">
10029
10030
<intro>
10031
The capabilities functions allow you to change the
10032
functionality available to <jvmti/>--that is,
10033
which <jvmti/>
10034
functions can be called, what events can be generated,
10035
and what functionality these events and functions can
10036
provide.
10037
<p/>
10038
The "Capabilities" section of each function and event describe which
10039
capabilities, if any, they are associated with. "Required Functionality"
10040
means it is available for use and no capabilities must be added to use it.
10041
"Optional Functionality" means the agent must possess the capability
10042
before it can be used.
10043
To possess a capability, the agent must
10044
<functionlink id="AddCapabilities">add the capability</functionlink>.
10045
"Optional Features" describe capabilities which,
10046
if added, extend the feature set.
10047
<p/>
10048
The potentially available capabilities of each <jvmti/> implementation are different.
10049
Depending on the implementation, a capability:
10050
<ul>
10051
<li>may never be added</li>
10052
<li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>
10053
<li>may be added only during the <code>OnLoad</code> phase</li>
10054
<li>may be possessed by only one environment at a time</li>
10055
<li>may be possessed by only one environment at a time,
10056
and only during the <code>OnLoad</code> phase</li>
10057
<li>and so on ...</li>
10058
</ul>
10059
Frequently, the addition of a capability may incur a cost in execution speed, start up
10060
time, and/or memory footprint. Note that the overhead of using a capability
10061
is completely different than the overhead of possessing a capability.
10062
Take single stepping as an example. When single stepping is on (that
10063
is, when the event is enabled and thus actively sending events)
10064
the overhead of sending and processing an event
10065
on each instruction is huge in any implementation.
10066
However, the overhead of possessing the capability may be small or large,
10067
depending on the implementation. Also, when and if a capability is potentially
10068
available depends on the implementation. Some examples:
10069
<ul>
10070
<li>One VM might perform all execution by compiling bytecodes into
10071
native code and be unable to generate single step instructions.
10072
In this implementation the capability can not be added.</li>
10073
<li>Another VM may be able to switch execution to a single stepping
10074
interpreter at any time. In this implementation, having the capability has no
10075
overhead and could be added at any time.</li>
10076
<li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted
10077
execution engine at start up, but be unable to switch between them.
10078
In this implementation the capability would need to be added
10079
during the <code>OnLoad</code> phase (before bytecode
10080
execution begins) and would have a large impact on execution speed
10081
even if single stepping was never used.</li>
10082
<li>Still another VM might be able to add an "is single stepping on" check
10083
into compiled bytecodes or a generated interpreter. Again in this implementation
10084
the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test
10085
and branch on each instruction) would be considerably less.</li>
10086
</ul>
10087
<p/>
10088
Each <jvmti/> <internallink id="environments">environment</internallink>
10089
has its own set of capabilities.
10090
Initially, that set is empty.
10091
Any desired capability must be added.
10092
If possible, capabilities should be added during the <code>OnLoad</code> phase. For most
10093
virtual machines certain capabilities require special set up for
10094
the virtual machine and this set up must happen
10095
during the <code>OnLoad</code> phase, before the virtual machine begins execution.
10096
Once a capability is added, it can
10097
only be removed if explicitly relinquished by the environment.
10098
<p/>
10099
The agent can,
10100
<functionlink id="GetPotentialCapabilities">determine what
10101
capabilities this VM can potentially provide</functionlink>,
10102
<functionlink id="AddCapabilities">add the capabilities
10103
to be used</functionlink>,
10104
<functionlink id="RelinquishCapabilities">release capabilities
10105
which are no longer needed</functionlink>, and
10106
<functionlink id="GetCapabilities">examine the currently available
10107
capabilities</functionlink>.
10108
</intro>
10109
10110
<intro id="capabilityExamples" label="Capability Examples">
10111
For example, a freshly started agent (in the <code>OnLoad</code> function)
10112
wants to enable all possible capabilities.
10113
Note that, in general, this is not advisable as the agent may suffer
10114
a performance penalty for functionality it is not using.
10115
The code might look like this in C:
10116
<example>
10117
jvmtiCapabilities capa;
10118
jvmtiError err;
10119
10120
err = (*jvmti)-&gt;GetPotentialCapabilities(jvmti, &amp;capa);
10121
if (err == JVMTI_ERROR_NONE) {
10122
err = (*jvmti)-&gt;AddCapabilities(jvmti, &amp;capa);
10123
</example>
10124
For example, if an agent wants to check if it can get
10125
the bytecodes of a method (that is, it wants to check
10126
if it previously added this capability and has not
10127
relinquished it), the code might
10128
look like this in C:
10129
<example>
10130
jvmtiCapabilities capa;
10131
jvmtiError err;
10132
10133
err = (*jvmti)-&gt;GetCapabilities(jvmti, &amp;capa);
10134
if (err == JVMTI_ERROR_NONE) {
10135
if (capa.can_get_bytecodes) { ... } }
10136
</example>
10137
</intro>
10138
10139
<capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">
10140
<description>
10141
The functions in this category use this capabilities structure
10142
which contains boolean flags corresponding to each capability:
10143
</description>
10144
<capabilityfield id="can_tag_objects">
10145
<description>
10146
Can set and get tags, as described in the
10147
<internallink id="Heap">Heap category</internallink>.
10148
</description>
10149
</capabilityfield>
10150
<capabilityfield id="can_generate_field_modification_events">
10151
<description>
10152
Can set watchpoints on field modification -
10153
<functionlink id="SetFieldModificationWatch"></functionlink>
10154
</description>
10155
</capabilityfield>
10156
<capabilityfield id="can_generate_field_access_events">
10157
<description>
10158
Can set watchpoints on field access -
10159
<functionlink id="SetFieldAccessWatch"></functionlink>
10160
</description>
10161
</capabilityfield>
10162
<capabilityfield id="can_get_bytecodes">
10163
<description>
10164
Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>
10165
</description>
10166
</capabilityfield>
10167
<capabilityfield id="can_get_synthetic_attribute">
10168
<description>
10169
Can test if a field or method is synthetic -
10170
<functionlink id="IsFieldSynthetic"></functionlink> and
10171
<functionlink id="IsMethodSynthetic"></functionlink>
10172
</description>
10173
</capabilityfield>
10174
<capabilityfield id="can_get_owned_monitor_info">
10175
<description>
10176
Can get information about ownership of monitors -
10177
<functionlink id="GetOwnedMonitorInfo"></functionlink>
10178
</description>
10179
</capabilityfield>
10180
<capabilityfield id="can_get_current_contended_monitor">
10181
<description>
10182
Can <functionlink id="GetCurrentContendedMonitor"></functionlink>
10183
</description>
10184
</capabilityfield>
10185
<capabilityfield id="can_get_monitor_info">
10186
<description>
10187
Can <functionlink id="GetObjectMonitorUsage"></functionlink>
10188
</description>
10189
</capabilityfield>
10190
<capabilityfield id="can_pop_frame">
10191
<description>
10192
Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>
10193
</description>
10194
</capabilityfield>
10195
<capabilityfield id="can_redefine_classes">
10196
<description>
10197
Can redefine classes with <functionlink id="RedefineClasses"/>.
10198
</description>
10199
</capabilityfield>
10200
<capabilityfield id="can_signal_thread">
10201
<description>
10202
Can send stop or interrupt to threads
10203
</description>
10204
</capabilityfield>
10205
<capabilityfield id="can_get_source_file_name">
10206
<description>
10207
Can get the source file name of a class
10208
</description>
10209
</capabilityfield>
10210
<capabilityfield id="can_get_line_numbers">
10211
<description>
10212
Can get the line number table of a method
10213
</description>
10214
</capabilityfield>
10215
<capabilityfield id="can_get_source_debug_extension">
10216
<description>
10217
Can get the source debug extension of a class
10218
</description>
10219
</capabilityfield>
10220
<capabilityfield id="can_access_local_variables">
10221
<description>
10222
Can set and get local variables
10223
</description>
10224
</capabilityfield>
10225
<capabilityfield id="can_maintain_original_method_order">
10226
<description>
10227
Can return methods in the order they occur in the class file
10228
</description>
10229
</capabilityfield>
10230
<capabilityfield id="can_generate_single_step_events">
10231
<description>
10232
Can get <eventlink id="SingleStep">single step</eventlink> events
10233
</description>
10234
</capabilityfield>
10235
<capabilityfield id="can_generate_exception_events">
10236
<description>
10237
Can get <eventlink id="Exception">exception thrown</eventlink> and
10238
<eventlink id="ExceptionCatch">exception catch</eventlink> events
10239
</description>
10240
</capabilityfield>
10241
<capabilityfield id="can_generate_frame_pop_events">
10242
<description>
10243
Can <functionlink id="NotifyFramePop">set</functionlink> and thus get
10244
<eventlink id="FramePop"></eventlink> events
10245
</description>
10246
</capabilityfield>
10247
<capabilityfield id="can_generate_breakpoint_events">
10248
<description>
10249
Can <functionlink id="SetBreakpoint">set</functionlink> and thus get
10250
<eventlink id="Breakpoint"></eventlink> events
10251
</description>
10252
</capabilityfield>
10253
<capabilityfield id="can_suspend">
10254
<description>
10255
Can suspend and resume threads
10256
</description>
10257
</capabilityfield>
10258
<capabilityfield id="can_redefine_any_class">
10259
<description>
10260
<functionlink id="RedefineClasses"/> can be called on any modifiable class.
10261
See <functionlink id="IsModifiableClass"/>.
10262
(<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
10263
must also be set)
10264
</description>
10265
</capabilityfield>
10266
<capabilityfield id="can_get_current_thread_cpu_time">
10267
<description>
10268
Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>
10269
current thread CPU time
10270
</description>
10271
</capabilityfield>
10272
<capabilityfield id="can_get_thread_cpu_time">
10273
<description>
10274
Can <functionlink id="GetThreadCpuTime">get</functionlink>
10275
thread CPU time
10276
</description>
10277
</capabilityfield>
10278
<capabilityfield id="can_generate_method_entry_events"
10279
disp1="can_generate" disp2="_method_entry_events"
10280
>
10281
<description>
10282
Can generate method entry events on entering a method
10283
</description>
10284
</capabilityfield>
10285
<capabilityfield id="can_generate_method_exit_events"
10286
disp1="can_generate" disp2="_method_exit_events"
10287
>
10288
<description>
10289
Can generate method exit events on leaving a method
10290
</description>
10291
</capabilityfield>
10292
<capabilityfield id="can_generate_all_class_hook_events"
10293
disp1="can_generate" disp2="_all_class_hook_events"
10294
>
10295
<description>
10296
Can generate ClassFileLoadHook events for every loaded class.
10297
</description>
10298
</capabilityfield>
10299
<capabilityfield id="can_generate_compiled_method_load_events"
10300
disp1="can_generate" disp2="_compiled_method_load_events"
10301
>
10302
<description>
10303
Can generate events when a method is compiled or unloaded
10304
</description>
10305
</capabilityfield>
10306
<capabilityfield id="can_generate_monitor_events"
10307
disp1="can_generate" disp2="_monitor_events"
10308
>
10309
<description>
10310
Can generate events on monitor activity
10311
</description>
10312
</capabilityfield>
10313
<capabilityfield id="can_generate_vm_object_alloc_events"
10314
disp1="can_generate" disp2="_vm_object_alloc_events"
10315
>
10316
<description>
10317
Can generate events on VM allocation of an object
10318
</description>
10319
</capabilityfield>
10320
<capabilityfield id="can_generate_native_method_bind_events"
10321
disp1="can_generate" disp2="_native_method_bind_events"
10322
>
10323
<description>
10324
Can generate events when a native method is bound to its
10325
implementation
10326
</description>
10327
</capabilityfield>
10328
<capabilityfield id="can_generate_garbage_collection_events"
10329
disp1="can_generate" disp2="_garbage_collection_events"
10330
>
10331
<description>
10332
Can generate events when garbage collection begins or ends
10333
</description>
10334
</capabilityfield>
10335
<capabilityfield id="can_generate_object_free_events"
10336
disp1="can_generate" disp2="_object_free_events"
10337
>
10338
<description>
10339
Can generate events when the garbage collector frees an object
10340
</description>
10341
</capabilityfield>
10342
<capabilityfield id="can_force_early_return" since="1.1">
10343
<description>
10344
Can return early from a method, as described in the
10345
<internallink id="ForceEarlyReturn">Force Early Return category</internallink>.
10346
</description>
10347
</capabilityfield>
10348
<capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">
10349
<description>
10350
Can get information about owned monitors with stack depth -
10351
<functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>
10352
</description>
10353
</capabilityfield>
10354
<capabilityfield id="can_get_constant_pool" since="1.1">
10355
<description>
10356
Can get the constant pool of a class -
10357
<functionlink id="GetConstantPool"></functionlink>
10358
</description>
10359
</capabilityfield>
10360
<capabilityfield id="can_set_native_method_prefix" since="1.1">
10361
<description>
10362
Can set prefix to be applied when native method cannot be resolved -
10363
<functionlink id="SetNativeMethodPrefix"/> and
10364
<functionlink id="SetNativeMethodPrefixes"/>
10365
</description>
10366
</capabilityfield>
10367
<capabilityfield id="can_retransform_classes" since="1.1">
10368
<description>
10369
Can retransform classes with <functionlink id="RetransformClasses"/>.
10370
In addition to the restrictions imposed by the specific
10371
implementation on this capability (see the
10372
<internallink id="capability">Capability</internallink> section),
10373
this capability must be set before the
10374
<eventlink id="ClassFileLoadHook"/> event is enabled for the
10375
first time in this environment.
10376
An environment that possesses this capability at the time that
10377
<code>ClassFileLoadHook</code> is enabled for the first time is
10378
said to be <i>retransformation capable</i>.
10379
An environment that does not possess this capability at the time that
10380
<code>ClassFileLoadHook</code> is enabled for the first time is
10381
said to be <i>retransformation incapable</i>.
10382
</description>
10383
</capabilityfield>
10384
<capabilityfield id="can_retransform_any_class" since="1.1">
10385
<description>
10386
<functionlink id="RetransformClasses"/> can be called on any modifiable class.
10387
See <functionlink id="IsModifiableClass"/>.
10388
(<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
10389
must also be set)
10390
</description>
10391
</capabilityfield>
10392
<capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">
10393
<description>
10394
Can generate events when the VM is unable to allocate memory from
10395
the <tm>Java</tm> platform heap.
10396
See <eventlink id="ResourceExhausted"/>.
10397
</description>
10398
</capabilityfield>
10399
<capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">
10400
<description>
10401
Can generate events when the VM is unable to create a thread.
10402
See <eventlink id="ResourceExhausted"/>.
10403
</description>
10404
</capabilityfield>
10405
<capabilityfield id="can_generate_early_vmstart" since="9">
10406
<description>
10407
Can generate the <code>VMStart</code> event early.
10408
See <eventlink id="VMStart"/>.
10409
</description>
10410
</capabilityfield>
10411
<capabilityfield id="can_generate_early_class_hook_events" since="9">
10412
<description>
10413
Can generate the <eventlink id="ClassFileLoadHook"/> events
10414
in the primordial phase. If this capability and
10415
<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
10416
<code>can_generate_all_class_hook_events</code></internallink>
10417
are enabled then the <eventlink id="ClassFileLoadHook"/> events
10418
can be posted for classes loaded in the primordial phase.
10419
See <eventlink id="ClassFileLoadHook"/>.
10420
</description>
10421
</capabilityfield>
10422
<capabilityfield id="can_generate_sampled_object_alloc_events" since="11">
10423
<description>
10424
Can generate sampled allocation events.
10425
If this capability is enabled then the heap sampling method
10426
<functionlink id="SetHeapSamplingInterval"></functionlink> can be
10427
called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.
10428
</description>
10429
</capabilityfield>
10430
</capabilitiestypedef>
10431
10432
<function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">
10433
<synopsis>Get Potential Capabilities</synopsis>
10434
<description>
10435
Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>
10436
features that can potentially be possessed by this environment
10437
at this time.
10438
The returned capabilities differ from the complete set of capabilities
10439
implemented by the VM in two cases: another environment possesses
10440
capabilities that can only be possessed by one environment, or the
10441
current <functionlink id="GetPhase">phase</functionlink> is live,
10442
and certain capabilities can only be added during the <code>OnLoad</code> phase.
10443
The <functionlink id="AddCapabilities"></functionlink> function
10444
may be used to set any or all or these capabilities.
10445
Currently possessed capabilities are included.
10446
<p/>
10447
Typically this function is used in the <code>OnLoad</code> function.
10448
Some virtual machines may allow a limited set of capabilities to be
10449
added in the live phase.
10450
In this case, the set of potentially available capabilities
10451
will likely differ from the <code>OnLoad</code> phase set.
10452
<p/>
10453
See the
10454
<internallink id="capabilityExamples">Capability Examples</internallink>.
10455
</description>
10456
<origin>new</origin>
10457
<capabilities>
10458
</capabilities>
10459
<parameters>
10460
<param id="capabilities_ptr">
10461
<outptr><struct>jvmtiCapabilities</struct></outptr>
10462
<description>
10463
On return, points to the <jvmti/> capabilities that may be added.
10464
</description>
10465
</param>
10466
</parameters>
10467
<errors>
10468
</errors>
10469
</function>
10470
10471
<elide>
10472
<function id="EstimateCostOfCapabilities" phase="onload" num="141">
10473
<synopsis>Estimate Cost Of Capabilities</synopsis>
10474
<description>
10475
<issue>There is strong opposition to this function. The concern is
10476
that it would be difficult or impossible to provide meaningful
10477
numbers, as the amount of impact is conditional on many factors
10478
that a single number could not represent. There is doubt that
10479
conditional implementations would be used or are even a good idea.
10480
The thought is that release documentation for the implementation
10481
would be the best means of exposing this information.
10482
Unless new arguments are presented, I intend to remove this
10483
function in the next revision.
10484
</issue>
10485
<p/>
10486
Return via the <paramlink id="time_impact_ptr"></paramlink> and
10487
<paramlink id="space_impact_ptr"></paramlink> an estimate of the impact
10488
of adding the capabilities pointed to by
10489
<paramlink id="capabilities_ptr"></paramlink>.
10490
The returned estimates are in percentage of additional overhead, thus
10491
a time impact of 100 mean the application might run
10492
at half the speed.
10493
The estimates are very rough approximations and are not guaranteed.
10494
Note also, that the estimates are of the impact of having the
10495
capability available--when and if it is used the impact may be
10496
much greater.
10497
Estimates can be for a single capability or for a set of
10498
capabilities. Note that the costs are not necessarily additive,
10499
adding support for one capability might make another available
10500
for free or conversely having two capabilities at once may
10501
have multiplicative impact.
10502
Estimates are relative to the current set of capabilities -
10503
that is, how much more impact given the currently possessed capabilities.
10504
<p/>
10505
Typically this function is used in the OnLoad function,
10506
some virtual machines may allow a limited set of capabilities to be
10507
added in the live phase.
10508
In this case, the set of potentially available capabilities
10509
will likely differ from the OnLoad phase set.
10510
<p/>
10511
See the
10512
<internallink id="capabilityExamples">Capability Examples</internallink>.
10513
</description>
10514
<origin>new</origin>
10515
<capabilities>
10516
</capabilities>
10517
<parameters>
10518
<param id="capabilities_ptr">
10519
<inptr><struct>jvmtiCapabilities</struct></inptr>
10520
<description>
10521
points to the <jvmti/> capabilities to evaluate.
10522
</description>
10523
</param>
10524
<param id="time_impact_ptr">
10525
<outptr><jint/></outptr>
10526
<description>
10527
On return, points to the estimated percentage increase in
10528
run time if this capability was added.
10529
</description>
10530
</param>
10531
<param id="space_impact_ptr">
10532
<outptr><jint/></outptr>
10533
<description>
10534
On return, points to the estimated percentage increase in
10535
memory space used if this capability was added.
10536
</description>
10537
</param>
10538
</parameters>
10539
<errors>
10540
<error id="JVMTI_ERROR_NOT_AVAILABLE">
10541
The desired capabilities are not even potentially available.
10542
</error>
10543
</errors>
10544
</function>
10545
</elide>
10546
10547
<function id="AddCapabilities" jkernel="yes" phase="onload" num="142">
10548
<synopsis>Add Capabilities</synopsis>
10549
<description>
10550
Set new capabilities by adding the capabilities
10551
whose values are set to one (<code>1</code>) in
10552
<code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10553
All previous capabilities are retained.
10554
Typically this function is used in the <code>OnLoad</code> function.
10555
Some virtual machines may allow a limited set of capabilities to be
10556
added in the live phase.
10557
<p/>
10558
See the
10559
<internallink id="capabilityExamples">Capability Examples</internallink>.
10560
</description>
10561
<origin>new</origin>
10562
<capabilities>
10563
</capabilities>
10564
<parameters>
10565
<param id="capabilities_ptr">
10566
<inptr><struct>jvmtiCapabilities</struct></inptr>
10567
<description>
10568
Points to the <jvmti/> capabilities to add.
10569
</description>
10570
</param>
10571
</parameters>
10572
<errors>
10573
<error id="JVMTI_ERROR_NOT_AVAILABLE">
10574
The desired capabilities are not even potentially available.
10575
</error>
10576
</errors>
10577
</function>
10578
10579
10580
<function id="RelinquishCapabilities" phase="onload" num="143">
10581
<synopsis>Relinquish Capabilities</synopsis>
10582
<description>
10583
Relinquish the capabilities
10584
whose values are set to one (<code>1</code>) in
10585
<code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10586
Some implementations may allow only one environment to have a capability
10587
(see the <internallink id="capability">capability introduction</internallink>).
10588
This function releases capabilities
10589
so that they may be used by other agents.
10590
All other capabilities are retained.
10591
The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.
10592
Attempting to relinquish a capability that the agent does not possess is not an error.
10593
<issue>
10594
It is possible for the agent to be actively using capabilities
10595
which are being relinquished. For example, a thread is currently
10596
suspended and can_suspend is being relinquished or an event is currently
10597
enabled and can_generate_whatever is being relinquished.
10598
There are three possible ways we could spec this:
10599
<ul>
10600
<li>relinquish automatically releases them</li>
10601
<li>relinquish checks and returns some error code if held</li>
10602
<li>it is the agent's responsibility and it is not checked</li>
10603
</ul>
10604
One of these should be chosen.
10605
</issue>
10606
</description>
10607
<origin>new</origin>
10608
<capabilities>
10609
</capabilities>
10610
<parameters>
10611
<param id="capabilities_ptr">
10612
<inptr><struct>jvmtiCapabilities</struct></inptr>
10613
<description>
10614
Points to the <jvmti/> capabilities to relinquish.
10615
</description>
10616
</param>
10617
</parameters>
10618
<errors>
10619
</errors>
10620
</function>
10621
10622
10623
10624
<function id="GetCapabilities" jkernel="yes" phase="any" num="89">
10625
<synopsis>Get Capabilities</synopsis>
10626
<description>
10627
Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>
10628
features which this environment currently possesses.
10629
Each possessed capability is indicated by a one (<code>1</code>) in the
10630
corresponding field of the <internallink id="jvmtiCapabilities">capabilities
10631
structure</internallink>.
10632
An environment does not possess a capability unless it has been successfully added with
10633
<functionlink id="AddCapabilities"/>.
10634
An environment only loses possession of a capability if it has been relinquished with
10635
<functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result
10636
of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which
10637
have been made.
10638
<p/>
10639
See the
10640
<internallink id="capabilityExamples">Capability Examples</internallink>.
10641
</description>
10642
<origin>jvmdiClone</origin>
10643
<capabilities>
10644
</capabilities>
10645
<parameters>
10646
<param id="capabilities_ptr">
10647
<outptr><struct>jvmtiCapabilities</struct></outptr>
10648
<description>
10649
On return, points to the <jvmti/> capabilities.
10650
</description>
10651
</param>
10652
</parameters>
10653
<errors>
10654
</errors>
10655
</function>
10656
10657
</category>
10658
10659
10660
<category id="timers" label="Timers">
10661
10662
<intro>
10663
These functions provide timing information.
10664
The resolution at which the time is updated is not specified.
10665
They provides nanosecond precision, but not necessarily nanosecond accuracy.
10666
Details about the timers, such as their maximum values, can be accessed with
10667
the timer information functions.
10668
</intro>
10669
10670
<typedef id="jvmtiTimerInfo" label="Timer Info">
10671
<description>
10672
The information function for each timer returns this data structure.
10673
</description>
10674
<field id="max_value">
10675
<jlong/>
10676
<description>
10677
The maximum value the timer can reach.
10678
After this value is reached the timer wraps back to zero.
10679
This is an unsigned value. If tested or printed as a jlong (signed value)
10680
it may appear to be a negative number.
10681
</description>
10682
</field>
10683
<field id="may_skip_forward">
10684
<jboolean/>
10685
<description>
10686
If true, the timer can be externally adjusted and as a result skip forward.
10687
If false, the timer value will never increase faster than real time.
10688
</description>
10689
</field>
10690
<field id="may_skip_backward">
10691
<jboolean/>
10692
<description>
10693
If true, the timer can be externally adjusted and as a result skip backward.
10694
If false, the timer value will be monotonically increasing.
10695
</description>
10696
</field>
10697
<field id="kind">
10698
<enum>jvmtiTimerKind</enum>
10699
<description>
10700
The kind of timer.
10701
On a platform that does not distinguish between user and system time, <datalink
10702
id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>
10703
is returned.
10704
</description>
10705
</field>
10706
<field id="reserved1">
10707
<jlong/>
10708
<description>
10709
Reserved for future use.
10710
</description>
10711
</field>
10712
<field id="reserved2">
10713
<jlong/>
10714
<description>
10715
Reserved for future use.
10716
</description>
10717
</field>
10718
</typedef>
10719
10720
<intro>
10721
Where the timer kind is --
10722
10723
<constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">
10724
<constant id="JVMTI_TIMER_USER_CPU" num="30">
10725
CPU time that a thread is in user mode.
10726
</constant>
10727
<constant id="JVMTI_TIMER_TOTAL_CPU" num="31">
10728
CPU time that a thread is in user or system mode.
10729
</constant>
10730
<constant id="JVMTI_TIMER_ELAPSED" num="32">
10731
Elapsed time.
10732
</constant>
10733
</constants>
10734
</intro>
10735
10736
<function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">
10737
<synopsis>Get Current Thread CPU Timer Information</synopsis>
10738
<description>
10739
Get information about the
10740
<functionlink id="GetCurrentThreadCpuTime"/> timer.
10741
The fields of the <datalink id="jvmtiTimerInfo"/> structure
10742
are filled in with details about the timer.
10743
This information is specific to the platform and the implementation of
10744
<functionlink id="GetCurrentThreadCpuTime"/> and thus
10745
does not vary by thread nor does it vary
10746
during a particular invocation of the VM.
10747
<p/>
10748
Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
10749
and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
10750
returned by <code>GetCurrentThreadCpuTimerInfo</code>
10751
and <functionlink id="GetThreadCpuTimerInfo"/>
10752
may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
10753
</description>
10754
<origin>new</origin>
10755
<capabilities>
10756
<required id="can_get_current_thread_cpu_time">
10757
Can get current thread CPU time.
10758
</required>
10759
</capabilities>
10760
<parameters>
10761
<param id="info_ptr">
10762
<outptr><struct>jvmtiTimerInfo</struct></outptr>
10763
<description>
10764
On return, filled with information describing the time
10765
returned by <functionlink id="GetCurrentThreadCpuTime"/>.
10766
</description>
10767
</param>
10768
</parameters>
10769
<errors>
10770
</errors>
10771
</function>
10772
10773
<function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">
10774
<synopsis>Get Current Thread CPU Time</synopsis>
10775
<description>
10776
Return the CPU time utilized by the current thread.
10777
<p/>
10778
Note that the <functionlink id="GetThreadCpuTime"/>
10779
function provides CPU time for any thread, including
10780
the current thread. <code>GetCurrentThreadCpuTime</code>
10781
exists to support platforms which cannot
10782
supply CPU time for threads other than the current
10783
thread or which have more accurate information for
10784
the current thread (see
10785
<functionlink id="GetCurrentThreadCpuTimerInfo"/> vs
10786
<functionlink id="GetThreadCpuTimerInfo"/>).
10787
On many platforms this call will be equivalent to:
10788
<example>
10789
GetThreadCpuTime(env, NULL, nanos_ptr)
10790
</example>
10791
</description>
10792
<origin>new</origin>
10793
<capabilities>
10794
<required id="can_get_current_thread_cpu_time">
10795
Can get current thread CPU time.
10796
<p/>
10797
If this capability is enabled after threads have started,
10798
the implementation may choose any time up
10799
to and including the time that the capability is enabled
10800
as the point where CPU time collection starts.
10801
<p/>
10802
This capability must be potentially available on any
10803
platform where
10804
<internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>
10805
is potentially available.
10806
</required>
10807
</capabilities>
10808
<parameters>
10809
<param id="nanos_ptr">
10810
<outptr><jlong/></outptr>
10811
<description>
10812
On return, points to the CPU time used by this thread
10813
in nanoseconds.
10814
This is an unsigned value. If tested or printed as a jlong (signed value)
10815
it may appear to be a negative number.
10816
</description>
10817
</param>
10818
</parameters>
10819
<errors>
10820
</errors>
10821
</function>
10822
10823
<function id="GetThreadCpuTimerInfo" num="136">
10824
<synopsis>Get Thread CPU Timer Information</synopsis>
10825
<description>
10826
Get information about the
10827
<functionlink id="GetThreadCpuTime"/> timer.
10828
The fields of the <datalink id="jvmtiTimerInfo"/> structure
10829
are filled in with details about the timer.
10830
This information is specific to the platform and the implementation of
10831
<functionlink id="GetThreadCpuTime"/> and thus
10832
does not vary by thread nor does it vary
10833
during a particular invocation of the VM.
10834
<p/>
10835
Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
10836
and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
10837
returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>
10838
and <code>GetThreadCpuTimerInfo</code>
10839
may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
10840
</description>
10841
<origin>new</origin>
10842
<capabilities>
10843
<required id="can_get_thread_cpu_time">
10844
Can get thread CPU time.
10845
</required>
10846
</capabilities>
10847
<parameters>
10848
<param id="info_ptr">
10849
<outptr><struct>jvmtiTimerInfo</struct></outptr>
10850
<description>
10851
On return, filled with information describing the time
10852
returned by <functionlink id="GetThreadCpuTime"/>.
10853
</description>
10854
</param>
10855
</parameters>
10856
<errors>
10857
</errors>
10858
</function>
10859
10860
<function id="GetThreadCpuTime" num="137">
10861
<synopsis>Get Thread CPU Time</synopsis>
10862
<description>
10863
Return the CPU time utilized by the specified thread.
10864
<p/>
10865
Get information about this timer with
10866
<functionlink id="GetThreadCpuTimerInfo"/>.
10867
</description>
10868
<origin>new</origin>
10869
<capabilities>
10870
<required id="can_get_thread_cpu_time">
10871
Can get thread CPU time.
10872
<p/>
10873
If this capability is enabled after threads have started,
10874
the implementation may choose any time up
10875
to and including the time that the capability is enabled
10876
as the point where CPU time collection starts.
10877
</required>
10878
</capabilities>
10879
<parameters>
10880
<param id="thread">
10881
<jthread null="current"/>
10882
<description>
10883
The thread to query.
10884
</description>
10885
</param>
10886
<param id="nanos_ptr">
10887
<outptr><jlong/></outptr>
10888
<description>
10889
On return, points to the CPU time used by the specified thread
10890
in nanoseconds.
10891
This is an unsigned value. If tested or printed as a jlong (signed value)
10892
it may appear to be a negative number.
10893
</description>
10894
</param>
10895
</parameters>
10896
<errors>
10897
</errors>
10898
</function>
10899
10900
<function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">
10901
<synopsis>Get Timer Information</synopsis>
10902
<description>
10903
Get information about the
10904
<functionlink id="GetTime"/> timer.
10905
The fields of the <datalink id="jvmtiTimerInfo"/> structure
10906
are filled in with details about the timer.
10907
This information will not change during a particular invocation of the VM.
10908
</description>
10909
<origin>new</origin>
10910
<capabilities>
10911
</capabilities>
10912
<parameters>
10913
<param id="info_ptr">
10914
<outptr><struct>jvmtiTimerInfo</struct></outptr>
10915
<description>
10916
On return, filled with information describing the time
10917
returned by <functionlink id="GetTime"/>.
10918
</description>
10919
</param>
10920
</parameters>
10921
<errors>
10922
</errors>
10923
</function>
10924
10925
<function id="GetTime" phase="any" callbacksafe="safe" num="139">
10926
<synopsis>Get Time</synopsis>
10927
<description>
10928
Return the current value of the system timer, in nanoseconds.
10929
<p/>
10930
The value returned represents nanoseconds since some fixed but
10931
arbitrary time (perhaps in the future, so values may be
10932
negative). This function provides nanosecond precision, but not
10933
necessarily nanosecond accuracy. No guarantees are made about
10934
how frequently values change.
10935
<p/>
10936
Get information about this timer with
10937
<functionlink id="GetTimerInfo"/>.
10938
</description>
10939
<origin>new</origin>
10940
<capabilities>
10941
</capabilities>
10942
<parameters>
10943
<param id="nanos_ptr">
10944
<outptr><jlong/></outptr>
10945
<description>
10946
On return, points to the time in nanoseconds.
10947
This is an unsigned value. If tested or printed as a jlong (signed value)
10948
it may appear to be a negative number.
10949
</description>
10950
</param>
10951
</parameters>
10952
<errors>
10953
</errors>
10954
</function>
10955
10956
<function id="GetAvailableProcessors" phase="any" num="144">
10957
<synopsis>Get Available Processors</synopsis>
10958
<description>
10959
Returns the number of processors available to the Java virtual machine.
10960
<p/>
10961
This value may change during a particular invocation of the virtual machine.
10962
Applications that are sensitive to the number of available processors should
10963
therefore occasionally poll this property.
10964
</description>
10965
<origin>new</origin>
10966
<capabilities>
10967
</capabilities>
10968
<parameters>
10969
<param id="processor_count_ptr">
10970
<outptr><jint/></outptr>
10971
<description>
10972
On return, points to the maximum number of processors available to the
10973
virtual machine; never smaller than one.
10974
</description>
10975
</param>
10976
</parameters>
10977
<errors>
10978
</errors>
10979
</function>
10980
10981
</category>
10982
10983
10984
<category id="classLoaderSearch" label="Class Loader Search">
10985
10986
<intro>
10987
These functions allow the agent to add to the locations that a class loader searches for a class.
10988
This is useful for installing instrumentation under the correct class loader.
10989
</intro>
10990
10991
<function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">
10992
<synopsis>Add To Bootstrap Class Loader Search</synopsis>
10993
<description>
10994
This function can be used to cause instrumentation classes to be defined by the
10995
bootstrap class loader. See <vmspec chapter="5.3.1"/>.
10996
After the bootstrap
10997
class loader unsuccessfully searches for a class, the specified platform-dependent
10998
search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in
10999
the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,
11000
the segments will be searched in the order that this function was called.
11001
<p/>
11002
In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11003
search path segment to be searched after the bootstrap class loader unsuccessfully searches
11004
for a class. The segment is typically a directory or JAR file.
11005
<p/>
11006
In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent
11007
path to a <externallink id="jar/jar.html">
11008
JAR file</externallink>. The agent should take care that the JAR file does not
11009
contain any classes or resources other than those to be defined by the bootstrap
11010
class loader for the purposes of instrumentation.
11011
<p/>
11012
<vmspec/> specifies that a subsequent attempt to resolve a symbolic
11013
reference that the Java virtual machine has previously unsuccessfully attempted
11014
to resolve always fails with the same error that was thrown as a result of the
11015
initial resolution attempt. Consequently, if the JAR file contains an entry
11016
that corresponds to a class for which the Java virtual machine has
11017
unsuccessfully attempted to resolve a reference, then subsequent attempts to
11018
resolve that reference will fail with the same error as the initial attempt.
11019
</description>
11020
<origin>new</origin>
11021
<capabilities>
11022
</capabilities>
11023
<parameters>
11024
<param id="segment">
11025
<inbuf><char/></inbuf>
11026
<description>
11027
The platform-dependent search path segment, encoded as a
11028
<internallink id="mUTF">modified UTF-8</internallink> string.
11029
</description>
11030
</param>
11031
</parameters>
11032
<errors>
11033
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11034
<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11035
existing JAR file is an invalid path.
11036
</error>
11037
</errors>
11038
</function>
11039
11040
<function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">
11041
<synopsis>Add To System Class Loader Search</synopsis>
11042
<description>
11043
This function can be used to cause instrumentation classes to be
11044
defined by the system class loader. See <vmspec chapter="5.3.2"/>.
11045
After the class loader unsuccessfully searches for a class, the specified platform-dependent search
11046
path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the
11047
<paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the
11048
segments will be searched in the order that this function was called.
11049
<p/>
11050
In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11051
search path segment to be searched after the system class loader unsuccessfully searches
11052
for a class. The segment is typically a directory or JAR file.
11053
<p/>
11054
In the live phase the <paramlink id="segment"/> is a platform-dependent path to a
11055
<externallink id="jar/jar.html">JAR file</externallink> to be
11056
searched after the system class loader unsuccessfully searches for a class. The agent should
11057
take care that the JAR file does not contain any classes or resources other than those to be
11058
defined by the system class loader for the purposes of instrumentation.
11059
<p/>
11060
In the live phase the system class loader supports adding a JAR file to be searched if
11061
the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>
11062
which takes a single parameter of type <code>java.lang.String</code>. The method is not required
11063
to have <code>public</code> access.
11064
<p/>
11065
<vmspec/> specifies that a subsequent attempt to resolve a symbolic
11066
reference that the Java virtual machine has previously unsuccessfully attempted
11067
to resolve always fails with the same error that was thrown as a result of the
11068
initial resolution attempt. Consequently, if the JAR file contains an entry
11069
that corresponds to a class for which the Java virtual machine has
11070
unsuccessfully attempted to resolve a reference, then subsequent attempts to
11071
resolve that reference will fail with the same error as the initial attempt.
11072
</description>
11073
<origin>new</origin>
11074
<capabilities>
11075
</capabilities>
11076
<parameters>
11077
<param id="segment">
11078
<inbuf><char/></inbuf>
11079
<description>
11080
The platform-dependent search path segment, encoded as a
11081
<internallink id="mUTF">modified UTF-8</internallink> string.
11082
</description>
11083
</param>
11084
</parameters>
11085
<errors>
11086
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11087
<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11088
existing JAR file is an invalid path.
11089
</error>
11090
<error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">
11091
Operation not supported by the system class loader.
11092
</error>
11093
</errors>
11094
</function>
11095
11096
</category>
11097
11098
11099
<category id="props" label="System Properties">
11100
11101
<intro>
11102
These functions get and set system properties.
11103
</intro>
11104
11105
<function id="GetSystemProperties" phase="onload" num="130">
11106
<synopsis>Get System Properties</synopsis>
11107
<description>
11108
The list of VM system property keys which may be used with
11109
<functionlink id="GetSystemProperty"/> is returned.
11110
It is strongly recommended that virtual machines provide the
11111
following property keys:
11112
<ul>
11113
<li><code>java.vm.vendor</code></li>
11114
<li><code>java.vm.version</code></li>
11115
<li><code>java.vm.name</code></li>
11116
<li><code>java.vm.info</code></li>
11117
<li><code>java.library.path</code></li>
11118
<li><code>java.class.path</code></li>
11119
</ul>
11120
Provides access to system properties defined by and used
11121
by the VM.
11122
Properties set on the command-line are included.
11123
This allows getting and setting of these properties
11124
before the VM even begins executing bytecodes.
11125
Since this is a VM view of system properties, the set of available
11126
properties will usually be different than that
11127
in <code>java.lang.System.getProperties</code>.
11128
JNI method invocation may be used to access
11129
<code>java.lang.System.getProperties</code>.
11130
<p/>
11131
The set of properties may grow during execution.
11132
</description>
11133
<origin>new</origin>
11134
<capabilities>
11135
</capabilities>
11136
<parameters>
11137
<param id="count_ptr">
11138
<outptr><jint/></outptr>
11139
<description>
11140
On return, points to the number of property keys returned.
11141
</description>
11142
</param>
11143
<param id="property_ptr">
11144
<allocallocbuf outcount="count_ptr"><char/></allocallocbuf>
11145
<description>
11146
On return, points to an array of property keys, encoded as
11147
<internallink id="mUTF">modified UTF-8</internallink> strings.
11148
</description>
11149
</param>
11150
</parameters>
11151
<errors>
11152
</errors>
11153
</function>
11154
11155
<function id="GetSystemProperty" phase="onload" num="131">
11156
<synopsis>Get System Property</synopsis>
11157
<description>
11158
Return a VM system property value given the property key.
11159
<p/>
11160
The function <functionlink id="GetSystemProperties"/>
11161
returns the set of property keys which may be used.
11162
The properties which can be retrieved may grow during
11163
execution.
11164
<p/>
11165
Since this is a VM view of system properties, the values
11166
of properties may differ from that returned by
11167
<code>java.lang.System.getProperty(String)</code>.
11168
A typical VM might copy the values of the VM system
11169
properties into the <code>Properties</code> held by
11170
<code>java.lang.System</code> during the initialization
11171
of that class. Thereafter any changes to the VM system
11172
properties (with <functionlink id="SetSystemProperty"/>)
11173
or the <code>java.lang.System</code> system properties
11174
(with <code>java.lang.System.setProperty(String,String)</code>)
11175
would cause the values to diverge.
11176
JNI method invocation may be used to access
11177
<code>java.lang.System.getProperty(String)</code>.
11178
</description>
11179
<origin>new</origin>
11180
<capabilities>
11181
</capabilities>
11182
<parameters>
11183
<param id="property">
11184
<inbuf><char/></inbuf>
11185
<description>
11186
The key of the property to retrieve, encoded as a
11187
<internallink id="mUTF">modified UTF-8</internallink> string.
11188
</description>
11189
</param>
11190
<param id="value_ptr">
11191
<allocbuf><char/></allocbuf>
11192
<description>
11193
On return, points to the property value, encoded as a
11194
<internallink id="mUTF">modified UTF-8</internallink> string.
11195
</description>
11196
</param>
11197
</parameters>
11198
<errors>
11199
<error id="JVMTI_ERROR_NOT_AVAILABLE">
11200
This property is not available.
11201
Use <functionlink id="GetSystemProperties"/> to find available properties.
11202
</error>
11203
</errors>
11204
</function>
11205
11206
<function id="SetSystemProperty" phase="onloadOnly" num="132">
11207
<synopsis>Set System Property</synopsis>
11208
<description>
11209
Set a VM system property value.
11210
<p/>
11211
The function <functionlink id="GetSystemProperties"/>
11212
returns the set of property keys, some of these may be settable.
11213
See <functionlink id="GetSystemProperty"/>.
11214
</description>
11215
<origin>new</origin>
11216
<capabilities>
11217
</capabilities>
11218
<parameters>
11219
<param id="property">
11220
<inbuf><char/></inbuf>
11221
<description>
11222
The key of the property, encoded as a
11223
<internallink id="mUTF">modified UTF-8</internallink> string.
11224
</description>
11225
</param>
11226
<param id="value_ptr">
11227
<inbuf>
11228
<char/>
11229
<nullok>
11230
do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>
11231
if the property is not writeable
11232
</nullok>
11233
</inbuf>
11234
<description>
11235
The property value to set, encoded as a
11236
<internallink id="mUTF">modified UTF-8</internallink> string.
11237
</description>
11238
</param>
11239
</parameters>
11240
<errors>
11241
<error id="JVMTI_ERROR_NOT_AVAILABLE">
11242
This property is not available or is not writeable.
11243
</error>
11244
</errors>
11245
</function>
11246
11247
</category>
11248
11249
<category id="general" label="General">
11250
11251
<intro>
11252
</intro>
11253
11254
<function id="GetPhase" jkernel="yes" phase="any" num="133">
11255
<synopsis>Get Phase</synopsis>
11256
<description>
11257
Return the current phase of VM execution.
11258
The phases proceed in sequence:
11259
<constants id="jvmtiPhase" label="Phases of execution" kind="enum">
11260
<constant id="JVMTI_PHASE_ONLOAD" num="1">
11261
<code>OnLoad</code> phase: while in the
11262
<internallink id="onload"><code>Agent_OnLoad</code></internallink>
11263
or, for statically linked agents, the <internallink id="onload">
11264
<code>Agent_OnLoad_&lt;agent-lib-name&gt;
11265
</code></internallink> function.
11266
</constant>
11267
<constant id="JVMTI_PHASE_PRIMORDIAL" num="2">
11268
Primordial phase: between return from <code>Agent_OnLoad</code>
11269
or <code>Agent_OnLoad_&lt;agent-lib-name&gt;</code> and the
11270
<code>VMStart</code> event.
11271
</constant>
11272
<constant id="JVMTI_PHASE_START" num="6">
11273
Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event
11274
is sent and until the <code>VMInit</code> event is sent.
11275
</constant>
11276
<constant id="JVMTI_PHASE_LIVE" num="4">
11277
Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent
11278
and until the <eventlink id="VMDeath"></eventlink> event returns.
11279
</constant>
11280
<constant id="JVMTI_PHASE_DEAD" num="8">
11281
Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after
11282
start-up failure.
11283
</constant>
11284
</constants>
11285
In the case of start-up failure the VM will proceed directly to the dead
11286
phase skipping intermediate phases and neither a <code>VMInit</code> nor
11287
<code>VMDeath</code> event will be sent.
11288
<p/>
11289
Most <jvmti/> functions operate only in the live phase.
11290
The following functions operate in either the <code>OnLoad</code> or live phases:
11291
<functionphaselist phase="onload"/>
11292
The following functions operate in only the <code>OnLoad</code> phase:
11293
<functionphaselist phase="onloadOnly"/>
11294
The following functions operate in the start or live phases:
11295
<functionphaselist phase="start"/>
11296
The following functions operate in any phase:
11297
<functionphaselist phase="any"/>
11298
JNI functions (except the Invocation API) must only be used in the start or live phases.
11299
<p/>
11300
Most <jvmti/> events are sent only in the live phase.
11301
The following events operate in others phases:
11302
<eventphaselist phase="start"/>
11303
<eventphaselist phase="any"/>
11304
</description>
11305
<origin>new</origin>
11306
<capabilities>
11307
</capabilities>
11308
<parameters>
11309
<param id="phase_ptr">
11310
<outptr><enum>jvmtiPhase</enum></outptr>
11311
<description>
11312
On return, points to the phase.
11313
</description>
11314
</param>
11315
</parameters>
11316
<errors>
11317
</errors>
11318
</function>
11319
11320
<function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">
11321
<synopsis>Dispose Environment</synopsis>
11322
<description>
11323
Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>
11324
(see <internallink id="environments"><jvmti/> Environments</internallink>).
11325
Dispose of any resources held by the environment.
11326
<issue>
11327
What resources are reclaimed? What is undone?
11328
Breakpoints,watchpoints removed?
11329
</issue>
11330
Threads suspended by this environment are not resumed by this call,
11331
this must be done explicitly by the agent.
11332
Memory allocated by this environment via calls to <jvmti/> functions
11333
is not released, this can be done explicitly by the agent
11334
by calling <functionlink id="Deallocate"/>.
11335
Raw monitors created by this environment are not destroyed,
11336
this can be done explicitly by the agent
11337
by calling <functionlink id="DestroyRawMonitor"/>.
11338
The state of threads waiting on raw monitors created by this environment
11339
are not affected.
11340
<p/>
11341
Any <functionlink id="SetNativeMethodPrefix">native method
11342
prefixes</functionlink> for this environment will be unset;
11343
the agent must remove any prefixed native methods before
11344
dispose is called.
11345
<p/>
11346
Any <internallink id="capability">capabilities</internallink>
11347
held by this environment are relinquished.
11348
<p/>
11349
Events enabled by this environment will no longer be sent, however
11350
event handlers currently running will continue to run. Caution must
11351
be exercised in the design of event handlers whose environment may
11352
be disposed and thus become invalid during their execution.
11353
<p/>
11354
This environment may not be used after this call.
11355
This call returns to the caller.
11356
</description>
11357
<origin>new</origin>
11358
<capabilities>
11359
</capabilities>
11360
<parameters>
11361
</parameters>
11362
<errors>
11363
</errors>
11364
</function>
11365
11366
<function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">
11367
<synopsis>Set Environment Local Storage</synopsis>
11368
<description>
11369
The VM stores a pointer value associated with each environment.
11370
This pointer value is called <i>environment-local storage</i>.
11371
This value is <code>NULL</code> unless set with this function.
11372
Agents can allocate memory in which they store environment specific
11373
information. By setting environment-local storage it can then be
11374
accessed with
11375
<functionlink id="GetEnvironmentLocalStorage"></functionlink>.
11376
<p/>
11377
Called by the agent to set the value of the <jvmti/>
11378
environment-local storage. <jvmti/> supplies to the agent a pointer-size
11379
environment-local storage that can be used to record per-environment
11380
information.
11381
</description>
11382
<origin>new</origin>
11383
<capabilities>
11384
</capabilities>
11385
<parameters>
11386
<param id="data">
11387
<inbuf>
11388
<void/>
11389
<nullok>value is set to <code>NULL</code></nullok>
11390
</inbuf>
11391
<description>
11392
The value to be entered into the environment-local storage.
11393
</description>
11394
</param>
11395
</parameters>
11396
<errors>
11397
</errors>
11398
</function>
11399
11400
<function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">
11401
<synopsis>Get Environment Local Storage</synopsis>
11402
<description>
11403
Called by the agent to get the value of the <jvmti/> environment-local
11404
storage.
11405
</description>
11406
<origin>new</origin>
11407
<capabilities>
11408
</capabilities>
11409
<parameters>
11410
<param id="data_ptr">
11411
<agentbuf><void/></agentbuf>
11412
<description>
11413
Pointer through which the value of the environment local
11414
storage is returned.
11415
If environment-local storage has not been set with
11416
<functionlink id="SetEnvironmentLocalStorage"></functionlink> returned
11417
pointer is <code>NULL</code>.
11418
</description>
11419
</param>
11420
</parameters>
11421
<errors>
11422
</errors>
11423
</function>
11424
11425
<function id="GetVersionNumber" jkernel="yes" phase="any" num="88">
11426
<synopsis>Get Version Number</synopsis>
11427
<description>
11428
Return the <jvmti/> version via <code>version_ptr</code>.
11429
The return value is the version identifier.
11430
The version identifier includes major, minor and micro
11431
version as well as the interface type.
11432
<constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">
11433
<constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">
11434
Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.
11435
</constant>
11436
<constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">
11437
Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.
11438
</constant>
11439
</constants>
11440
<constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">
11441
<constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">
11442
Mask to extract interface type.
11443
The value of the version returned by this function masked with
11444
<code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always
11445
<code>JVMTI_VERSION_INTERFACE_JVMTI</code>
11446
since this is a <jvmti/> function.
11447
</constant>
11448
<constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">
11449
Mask to extract major version number.
11450
</constant>
11451
<constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">
11452
Mask to extract minor version number.
11453
</constant>
11454
<constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">
11455
Mask to extract micro version number.
11456
</constant>
11457
</constants>
11458
<constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">
11459
<constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">
11460
Shift to extract major version number.
11461
</constant>
11462
<constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">
11463
Shift to extract minor version number.
11464
</constant>
11465
<constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">
11466
Shift to extract micro version number.
11467
</constant>
11468
</constants>
11469
</description>
11470
<origin>jvmdi</origin>
11471
<capabilities>
11472
</capabilities>
11473
<parameters>
11474
<param id="version_ptr">
11475
<outptr><jint/></outptr>
11476
<description>
11477
On return, points to the <jvmti/> version.
11478
</description>
11479
</param>
11480
</parameters>
11481
<errors>
11482
</errors>
11483
</function>
11484
11485
11486
<function id="GetErrorName" phase="any" num="128">
11487
<synopsis>Get Error Name</synopsis>
11488
<description>
11489
Return the symbolic name for an
11490
<internallink id="ErrorSection">error code</internallink>.
11491
<p/>
11492
For example
11493
<code>GetErrorName(env, JVMTI_ERROR_NONE, &amp;err_name)</code>
11494
would return in <code>err_name</code> the string
11495
<code>"JVMTI_ERROR_NONE"</code>.
11496
</description>
11497
<origin>new</origin>
11498
<capabilities>
11499
</capabilities>
11500
<parameters>
11501
<param id="error">
11502
<enum>jvmtiError</enum>
11503
<description>
11504
The error code.
11505
</description>
11506
</param>
11507
<param id="name_ptr">
11508
<allocbuf><char/></allocbuf>
11509
<description>
11510
On return, points to the error name.
11511
The name is encoded as a
11512
<internallink id="mUTF">modified UTF-8</internallink> string,
11513
but is restricted to the ASCII subset.
11514
</description>
11515
</param>
11516
</parameters>
11517
<errors>
11518
</errors>
11519
</function>
11520
11521
<function id="SetVerboseFlag" phase="any" num="150">
11522
<synopsis>Set Verbose Flag</synopsis>
11523
<description>
11524
<constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">
11525
<constant id="JVMTI_VERBOSE_OTHER" num="0">
11526
Verbose output other than the below.
11527
</constant>
11528
<constant id="JVMTI_VERBOSE_GC" num="1">
11529
Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.
11530
</constant>
11531
<constant id="JVMTI_VERBOSE_CLASS" num="2">
11532
Verbose class loading output, like that specified with <code>-verbose:class</code>.
11533
</constant>
11534
<constant id="JVMTI_VERBOSE_JNI" num="4">
11535
Verbose JNI output, like that specified with <code>-verbose:jni</code>.
11536
</constant>
11537
</constants>
11538
Control verbose output.
11539
This is the output which typically is sent to <code>stderr</code>.
11540
</description>
11541
<origin>new</origin>
11542
<capabilities>
11543
</capabilities>
11544
<parameters>
11545
<param id="flag">
11546
<enum>jvmtiVerboseFlag</enum>
11547
<description>
11548
Which verbose flag to set.
11549
</description>
11550
</param>
11551
<param id="value">
11552
<jboolean/>
11553
<description>
11554
New value of the flag.
11555
</description>
11556
</param>
11557
</parameters>
11558
<errors>
11559
</errors>
11560
</function>
11561
11562
11563
<function id="GetJLocationFormat" phase="any" num="129">
11564
<synopsis>Get JLocation Format</synopsis>
11565
<description>
11566
Although the greatest functionality is achieved with location information
11567
referencing the virtual machine bytecode index, the definition of
11568
<code>jlocation</code> has intentionally been left unconstrained to allow VM
11569
implementations that do not have this information.
11570
<p/>
11571
This function describes the representation of <code>jlocation</code> used in this VM.
11572
If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,
11573
<code>jlocation</code>s can
11574
be used as in indices into the array returned by
11575
<functionlink id="GetBytecodes"></functionlink>.
11576
<constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">
11577
<constant id="JVMTI_JLOCATION_JVMBCI" num="1">
11578
<code>jlocation</code> values represent virtual machine
11579
bytecode indices--that is, offsets into the
11580
virtual machine code for a method.
11581
</constant>
11582
<constant id="JVMTI_JLOCATION_MACHINEPC" num="2">
11583
<code>jlocation</code> values represent native machine
11584
program counter values.
11585
</constant>
11586
<constant id="JVMTI_JLOCATION_OTHER" num="0">
11587
<code>jlocation</code> values have some other representation.
11588
</constant>
11589
</constants>
11590
</description>
11591
<origin>new</origin>
11592
<capabilities>
11593
</capabilities>
11594
<parameters>
11595
<param id="format_ptr">
11596
<outptr><enum>jvmtiJlocationFormat</enum></outptr>
11597
<description>
11598
On return, points to the format identifier for <code>jlocation</code> values.
11599
</description>
11600
</param>
11601
</parameters>
11602
<errors>
11603
</errors>
11604
</function>
11605
11606
</category>
11607
11608
<category id="heap_monitoring" label="Heap Monitoring">
11609
<function id="SetHeapSamplingInterval" phase="onload" num="156" since="11">
11610
<synopsis>Set Heap Sampling Interval</synopsis>
11611
<description>
11612
Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated.
11613
Each thread keeps a counter of bytes allocated. The event will only be generated
11614
when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink>
11615
since the last sample.
11616
<p/>
11617
Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be
11618
generated by each allocation supported by the system once the new interval is taken into account.
11619
<p/>
11620
Note that updating the new sampling interval might take various number of allocations
11621
to provoke internal data structure updates. Therefore it is important to
11622
consider the sampling interval as an average. This includes the interval 0, where events
11623
might not be generated straight away for each allocation.
11624
</description>
11625
<origin>new</origin>
11626
<capabilities>
11627
<required id="can_generate_sampled_object_alloc_events"></required>
11628
</capabilities>
11629
<parameters>
11630
<param id="sampling_interval">
11631
<jint/>
11632
<description>
11633
The sampling interval in bytes. The sampler uses a statistical approach to
11634
generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of
11635
memory allocated by a given thread.
11636
<p/>
11637
Once the new sampling interval is taken into account, 0 as a sampling interval will generate
11638
a sample for every allocation.
11639
<p/>
11640
Note: The overhead of this feature is directly correlated with the sampling interval.
11641
A high sampling interval, such as 1024 bytes, will incur a high overhead.
11642
A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only
11643
be used with an understanding that it may impact performance.
11644
</description>
11645
</param>
11646
</parameters>
11647
<errors>
11648
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11649
<paramlink id="sampling_interval"></paramlink> is less than zero.
11650
</error>
11651
</errors>
11652
</function>
11653
</category>
11654
11655
</functionsection>
11656
11657
<errorsection label="Error Reference">
11658
<intro>
11659
Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.
11660
<p/>
11661
It is the responsibility of the agent to call <jvmti/> functions with
11662
valid parameters and in the proper context (calling thread is attached,
11663
phase is correct, etc.).
11664
Detecting some error conditions may be difficult, inefficient, or
11665
impossible for an implementation.
11666
The errors listed in
11667
<internallink id="reqerrors">Function Specific Required Errors</internallink>
11668
must be detected by the implementation.
11669
All other errors represent the recommended response to the error
11670
condition.
11671
</intro>
11672
11673
<errorcategory id="universal-error" label="Universal Errors">
11674
<intro>
11675
The following errors may be returned by any function
11676
</intro>
11677
11678
<errorid id="JVMTI_ERROR_NONE" num="0">
11679
No error has occurred. This is the error code that is returned
11680
on successful completion of the function.
11681
</errorid>
11682
<errorid id="JVMTI_ERROR_NULL_POINTER" num="100">
11683
Pointer is unexpectedly <code>NULL</code>.
11684
</errorid>
11685
<errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">
11686
The function attempted to allocate memory and no more memory was
11687
available for allocation.
11688
</errorid>
11689
<errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">
11690
The desired functionality has not been enabled in this virtual machine.
11691
</errorid>
11692
<errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">
11693
The thread being used to call this function is not attached
11694
to the virtual machine. Calls must be made from attached threads.
11695
See <code>AttachCurrentThread</code> in the JNI invocation API.
11696
</errorid>
11697
<errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">
11698
The <jvmti/> environment provided is no longer connected or is
11699
not an environment.
11700
</errorid>
11701
<errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">
11702
The desired functionality is not available in the current
11703
<functionlink id="GetPhase">phase</functionlink>.
11704
Always returned if the virtual machine has completed running.
11705
</errorid>
11706
<errorid id="JVMTI_ERROR_INTERNAL" num="113">
11707
An unexpected internal error has occurred.
11708
</errorid>
11709
</errorcategory>
11710
11711
<errorcategory id="reqerrors" label="Function Specific Required Errors">
11712
<intro>
11713
The following errors are returned by some <jvmti/> functions and must
11714
be returned by the implementation when the condition occurs.
11715
</intro>
11716
11717
<errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">
11718
Invalid priority.
11719
</errorid>
11720
<errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">
11721
Thread was not suspended.
11722
</errorid>
11723
<errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">
11724
Thread already suspended.
11725
</errorid>
11726
<errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">
11727
This operation requires the thread to be alive--that is,
11728
it must be started and not yet have died.
11729
</errorid>
11730
<errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">
11731
The class has been loaded but not yet prepared.
11732
</errorid>
11733
<errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">
11734
There are no Java programming language or JNI stack frames at the specified depth.
11735
</errorid>
11736
<errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">
11737
Information about the frame is not available (e.g. for native frames).
11738
</errorid>
11739
<errorid id="JVMTI_ERROR_DUPLICATE" num="40">
11740
Item already set.
11741
</errorid>
11742
<errorid id="JVMTI_ERROR_NOT_FOUND" num="41">
11743
Desired element (e.g. field or breakpoint) not found
11744
</errorid>
11745
<errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">
11746
This thread doesn't own the raw monitor.
11747
</errorid>
11748
<errorid id="JVMTI_ERROR_INTERRUPT" num="52">
11749
The call has been interrupted before completion.
11750
</errorid>
11751
<errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">
11752
The class cannot be modified.
11753
</errorid>
11754
<errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">
11755
The module cannot be modified.
11756
</errorid>
11757
<errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">
11758
The functionality is not available in this virtual machine.
11759
</errorid>
11760
<errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">
11761
The requested information is not available.
11762
</errorid>
11763
<errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">
11764
The specified event type ID is not recognized.
11765
</errorid>
11766
<errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">
11767
The requested information is not available for native method.
11768
</errorid>
11769
<errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">
11770
The class loader does not support this operation.
11771
</errorid>
11772
</errorcategory>
11773
11774
<errorcategory id="function-specific-errors" label="Function Specific Agent Errors">
11775
<intro>
11776
The following errors are returned by some <jvmti/> functions.
11777
They are returned in the event of invalid parameters passed by the
11778
agent or usage in an invalid context.
11779
An implementation is not required to detect these errors.
11780
</intro>
11781
11782
<errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">
11783
The passed thread is not a valid thread.
11784
</errorid>
11785
<errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">
11786
Invalid field.
11787
</errorid>
11788
<errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">
11789
Invalid module.
11790
</errorid>
11791
<errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">
11792
Invalid method.
11793
</errorid>
11794
<errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">
11795
Invalid location.
11796
</errorid>
11797
<errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">
11798
Invalid object.
11799
</errorid>
11800
<errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">
11801
Invalid class.
11802
</errorid>
11803
<errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">
11804
The variable is not an appropriate type for the function used.
11805
</errorid>
11806
<errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">
11807
Invalid slot.
11808
</errorid>
11809
<errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">
11810
The capability being used is false in this environment.
11811
</errorid>
11812
<errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">
11813
Thread group invalid.
11814
</errorid>
11815
<errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">
11816
Invalid raw monitor.
11817
</errorid>
11818
<errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">
11819
Illegal argument.
11820
</errorid>
11821
<errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">
11822
The state of the thread has been modified, and is now inconsistent.
11823
</errorid>
11824
<errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">
11825
A new class file has a version number not supported by this VM.
11826
</errorid>
11827
<errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">
11828
A new class file is malformed (the VM would return a <code>ClassFormatError</code>).
11829
</errorid>
11830
<errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">
11831
The new class file definitions would lead to a circular
11832
definition (the VM would return a <code>ClassCircularityError</code>).
11833
</errorid>
11834
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">
11835
A new class file would require adding a method.
11836
</errorid>
11837
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">
11838
A new class version changes a field.
11839
</errorid>
11840
<errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">
11841
The class bytes fail verification.
11842
</errorid>
11843
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">
11844
A direct superclass is different for the new class
11845
version, or the set of directly implemented
11846
interfaces is different.
11847
</errorid>
11848
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">
11849
A new class version does not declare a method
11850
declared in the old class version.
11851
</errorid>
11852
<errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">
11853
The class name defined in the new class file is
11854
different from the name in the old class object.
11855
</errorid>
11856
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">
11857
A new class version has different modifiers.
11858
</errorid>
11859
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">
11860
A method in the new class version has different modifiers
11861
than its counterpart in the old class version.
11862
</errorid>
11863
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72">
11864
A new class version has unsupported differences in class attributes.
11865
</errorid>
11866
</errorcategory>
11867
</errorsection>
11868
11869
<eventsection label="Events">
11870
<intro label="Handling Events" id="eventIntro">
11871
Agents can be informed of many events that occur in application
11872
programs.
11873
<p/>
11874
To handle events, designate a set of callback functions with
11875
<functionlink id="SetEventCallbacks"></functionlink>.
11876
For each event the corresponding callback function will be
11877
called.
11878
Arguments to the callback function provide additional
11879
information about the event.
11880
<p/>
11881
The callback function is usually called from within an application
11882
thread. The <jvmti/> implementation does not
11883
queue events in any way. This means
11884
that event callback functions must be written
11885
carefully. Here are some general guidelines. See
11886
the individual event descriptions for further
11887
suggestions.
11888
<p/>
11889
<ul>
11890
<li>Any exception thrown during the execution of an event callback can
11891
overwrite any current pending exception in the current application thread.
11892
Care must be taken to preserve a pending exception
11893
when an event callback makes a JNI call that might generate an exception.
11894
</li>
11895
<li>Event callback functions must be re-entrant. The <jvmti/> implementation does
11896
not queue events. If an agent needs to process events one at a time, it
11897
can use a raw monitor inside the
11898
event callback functions to serialize event processing.
11899
</li>
11900
<li>Event callback functions that execute JNI's FindClass function to load
11901
classes need to note that FindClass locates the class loader associated
11902
with the current native method. For the purposes of class loading, an
11903
event callback that includes a JNI environment as a parameter to the
11904
callback will treated as if it is a native call, where the native method
11905
is in the class of the event thread's current frame.
11906
</li>
11907
</ul>
11908
<p/>
11909
Some <jvmti/> events identify objects with JNI references.
11910
All references
11911
in <jvmti/> events are JNI local references and will become invalid
11912
after the event callback returns.
11913
Unless stated otherwise, memory referenced by pointers sent in event
11914
callbacks may not be referenced after the event callback returns.
11915
<p/>
11916
Except where stated otherwise, events are delivered on the thread
11917
that caused the event.
11918
Events are sent at the time they occur.
11919
The specification for each event includes the set of
11920
<functionlink id="GetPhase">phases</functionlink> in which it can be sent;
11921
if an event triggering activity occurs during another phase, no event
11922
is sent.
11923
<p/>
11924
A thread that generates an event does not change its execution status
11925
(for example, the event does not cause the thread to be suspended).
11926
If an agent wishes the event to result in suspension, then the agent
11927
is responsible for explicitly suspending the thread with
11928
<functionlink id="SuspendThread"></functionlink>.
11929
<p/>
11930
If an event is enabled in multiple environments, the event will be sent
11931
to each agent in the order that the environments were created.
11932
</intro>
11933
11934
<intro label="Enabling Events" id="enablingevents">
11935
All events are initially disabled. In order to receive any
11936
event:
11937
<ul>
11938
<li>
11939
If the event requires a capability, that capability must
11940
be added with
11941
<functionlink id="AddCapabilities"></functionlink>.
11942
</li>
11943
<li>
11944
A callback for the event must be set with
11945
<functionlink id="SetEventCallbacks"></functionlink>.
11946
</li>
11947
<li>
11948
The event must be enabled with
11949
<functionlink id="SetEventNotificationMode"></functionlink>.
11950
</li>
11951
</ul>
11952
</intro>
11953
11954
<intro label="Multiple Co-located Events" id="eventorder">
11955
In many situations it is possible for multiple events to occur
11956
at the same location in one thread. When this happens, all the events
11957
are reported through the event callbacks in the order specified in this section.
11958
<p/>
11959
If the current location is at the entry point of a method, the
11960
<eventlink id="MethodEntry"></eventlink> event is reported before
11961
any other event at the current location in the same thread.
11962
<p/>
11963
If an exception catch has been detected at the current location,
11964
either because it is the beginning of a catch clause or a native method
11965
that cleared a pending exception has returned, the
11966
<code>exceptionCatch</code> event is reported before
11967
any other event at the current location in the same thread.
11968
<p/>
11969
If a <code>singleStep</code> event or
11970
<code>breakpoint</code> event is triggered at the
11971
current location, the event is defined to occur
11972
immediately before the code at the current location is executed.
11973
These events are reported before any events which are triggered
11974
by the execution of code at the current location in the same
11975
thread (specifically:
11976
<code>exception</code>,
11977
<code>fieldAccess</code>, and
11978
<code>fieldModification</code>).
11979
If both a step and breakpoint event are triggered for the same thread and
11980
location, the step event is reported before the breakpoint event.
11981
<p/>
11982
If the current location is the exit point of a method (that is, the last
11983
location before returning to the caller), the
11984
<eventlink id="MethodExit"></eventlink> event and
11985
the <eventlink id="FramePop"></eventlink> event (if requested)
11986
are reported after all other events at the current location in the same
11987
thread. There is no specified ordering of these two events
11988
with respect to each other.
11989
<p/>
11990
Co-located events can be triggered during the processing of some other
11991
event by the agent at the same location in the same thread.
11992
If such an event, of type <i>y</i>, is triggered during the processing of
11993
an event of type <i>x</i>, and if <i>x</i>
11994
precedes <i>y</i> in the ordering specified above, the co-located event
11995
<i>y</i> is reported for the current thread and location. If <i>x</i> does not precede
11996
<i>y</i>, <i>y</i> is not reported for the current thread and location.
11997
For example, if a breakpoint is set at the current location
11998
during the processing of <eventlink id="SingleStep"></eventlink>,
11999
that breakpoint will be reported before the thread moves off the current
12000
location.
12001
<p/>The following events are never considered to be co-located with
12002
other events.
12003
<ul>
12004
<li><eventlink id="VMStart"></eventlink></li>
12005
<li><eventlink id="VMInit"></eventlink></li>
12006
<li><eventlink id="VMDeath"></eventlink></li>
12007
<li><eventlink id="ThreadStart"></eventlink></li>
12008
<li><eventlink id="ThreadEnd"></eventlink></li>
12009
<li><eventlink id="ClassLoad"></eventlink></li>
12010
<li><eventlink id="ClassPrepare"></eventlink></li>
12011
</ul>
12012
</intro>
12013
12014
<intro label="Event Callbacks" id="jvmtiEventCallbacks">
12015
The event callback structure below is used to specify the handler function
12016
for events. It is set with the
12017
<functionlink id="SetEventCallbacks"></functionlink> function.
12018
</intro>
12019
12020
<event label="Single Step"
12021
id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">
12022
<description>
12023
Single step events allow the agent to trace thread execution
12024
at the finest granularity allowed by the VM. A single step event is
12025
generated whenever a thread reaches a new location.
12026
Typically, single step events represent the completion of one VM
12027
instruction as defined in <vmspec/>. However, some implementations
12028
may define locations differently. In any case the
12029
<code>method</code> and <code>location</code>
12030
parameters uniquely identify the current location and allow
12031
the mapping to source file and line number when that information is
12032
available.
12033
<p/>
12034
No single step events are generated from within native methods.
12035
</description>
12036
<origin>jvmdi</origin>
12037
<capabilities>
12038
<required id="can_generate_single_step_events"></required>
12039
</capabilities>
12040
<parameters>
12041
<param id="jni_env">
12042
<outptr>
12043
<struct>JNIEnv</struct>
12044
</outptr>
12045
<description>
12046
The JNI environment of the event (current) thread
12047
</description>
12048
</param>
12049
<param id="thread">
12050
<jthread/>
12051
<description>
12052
Thread about to execution a new instruction
12053
</description>
12054
</param>
12055
<param id="klass">
12056
<jclass method="method"/>
12057
<description>
12058
Class of the method about to execute a new instruction
12059
</description>
12060
</param>
12061
<param id="method">
12062
<jmethodID class="klass"/>
12063
<description>
12064
Method about to execute a new instruction
12065
</description>
12066
</param>
12067
<param id="location">
12068
<jlocation/>
12069
<description>
12070
Location of the new instruction
12071
</description>
12072
</param>
12073
</parameters>
12074
</event>
12075
12076
<event label="Breakpoint"
12077
id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">
12078
<description>
12079
Breakpoint events are generated whenever a thread reaches a location
12080
designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.
12081
The <code>method</code> and <code>location</code>
12082
parameters uniquely identify the current location and allow
12083
the mapping to source file and line number when that information is
12084
available.
12085
</description>
12086
<origin>jvmdi</origin>
12087
<capabilities>
12088
<required id="can_generate_breakpoint_events"></required>
12089
</capabilities>
12090
<parameters>
12091
<param id="jni_env">
12092
<outptr>
12093
<struct>JNIEnv</struct>
12094
</outptr>
12095
<description>
12096
The JNI environment of the event (current) thread.
12097
</description>
12098
</param>
12099
<param id="thread">
12100
<jthread/>
12101
<description>
12102
Thread that hit the breakpoint
12103
</description>
12104
</param>
12105
<param id="klass">
12106
<jclass method="method"/>
12107
<description>
12108
Class of the method that hit the breakpoint
12109
</description>
12110
</param>
12111
<param id="method">
12112
<jmethodID class="klass"/>
12113
<description>
12114
Method that hit the breakpoint
12115
</description>
12116
</param>
12117
<param id="location">
12118
<jlocation/>
12119
<description>
12120
location of the breakpoint
12121
</description>
12122
</param>
12123
</parameters>
12124
</event>
12125
12126
<event label="Field Access"
12127
id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">
12128
<description>
12129
Field access events are generated whenever a thread accesses
12130
a field that was designated as a watchpoint
12131
with <functionlink id="SetFieldAccessWatch"></functionlink>.
12132
The <code>method</code> and <code>location</code>
12133
parameters uniquely identify the current location and allow
12134
the mapping to source file and line number when that information is
12135
available.
12136
</description>
12137
<origin>jvmdi</origin>
12138
<capabilities>
12139
<required id="can_generate_field_access_events"></required>
12140
</capabilities>
12141
<parameters>
12142
<param id="jni_env">
12143
<outptr>
12144
<struct>JNIEnv</struct>
12145
</outptr>
12146
<description>
12147
The JNI environment of the event (current) thread
12148
</description>
12149
</param>
12150
<param id="thread">
12151
<jthread/>
12152
<description>
12153
Thread accessing the field
12154
</description>
12155
</param>
12156
<param id="klass">
12157
<jclass method="method"/>
12158
<description>
12159
Class of the method where the access is occurring
12160
</description>
12161
</param>
12162
<param id="method">
12163
<jmethodID class="klass"/>
12164
<description>
12165
Method where the access is occurring
12166
</description>
12167
</param>
12168
<param id="location">
12169
<jlocation/>
12170
<description>
12171
Location where the access is occurring
12172
</description>
12173
</param>
12174
<param id="field_klass">
12175
<jclass field="field"/>
12176
<description>
12177
Class of the field being accessed
12178
</description>
12179
</param>
12180
<param id="object">
12181
<jobject/>
12182
<description>
12183
Object with the field being accessed if the field is an
12184
instance field; <code>NULL</code> otherwise
12185
</description>
12186
</param>
12187
<param id="field">
12188
<jfieldID class="field_klass"/>
12189
<description>
12190
Field being accessed
12191
</description>
12192
</param>
12193
</parameters>
12194
</event>
12195
12196
<event label="Field Modification"
12197
id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">
12198
<description>
12199
Field modification events are generated whenever a thread modifies
12200
a field that was designated as a watchpoint
12201
with <functionlink id="SetFieldModificationWatch"></functionlink>.
12202
The <code>method</code> and <code>location</code>
12203
parameters uniquely identify the current location and allow
12204
the mapping to source file and line number when that information is
12205
available.
12206
</description>
12207
<origin>jvmdi</origin>
12208
<capabilities>
12209
<required id="can_generate_field_modification_events"></required>
12210
</capabilities>
12211
<parameters>
12212
<param id="jni_env">
12213
<outptr>
12214
<struct>JNIEnv</struct>
12215
</outptr>
12216
<description>
12217
The JNI environment of the event (current) thread
12218
</description>
12219
</param>
12220
<param id="thread">
12221
<jthread/>
12222
<description>
12223
Thread modifying the field
12224
</description>
12225
</param>
12226
<param id="klass">
12227
<jclass method="method"/>
12228
<description>
12229
Class of the method where the modification is occurring
12230
</description>
12231
</param>
12232
<param id="method">
12233
<jmethodID class="klass"/>
12234
<description>
12235
Method where the modification is occurring
12236
</description>
12237
</param>
12238
<param id="location">
12239
<jlocation/>
12240
<description>
12241
Location where the modification is occurring
12242
</description>
12243
</param>
12244
<param id="field_klass">
12245
<jclass field="field"/>
12246
<description>
12247
Class of the field being modified
12248
</description>
12249
</param>
12250
<param id="object">
12251
<jobject/>
12252
<description>
12253
Object with the field being modified if the field is an
12254
instance field; <code>NULL</code> otherwise
12255
</description>
12256
</param>
12257
<param id="field">
12258
<jfieldID class="field_klass"/>
12259
<description>
12260
Field being modified
12261
</description>
12262
</param>
12263
<param id="signature_type">
12264
<char/>
12265
<description>
12266
Signature type of the new value
12267
</description>
12268
</param>
12269
<param id="new_value">
12270
<jvalue/>
12271
<description>
12272
The new value
12273
</description>
12274
</param>
12275
</parameters>
12276
</event>
12277
12278
<event label="Frame Pop"
12279
id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">
12280
<description>
12281
Frame pop events are generated upon exit from a single method
12282
in a single frame as specified
12283
in a call to <functionlink id="NotifyFramePop"></functionlink>.
12284
This is true whether termination is caused by
12285
executing its return instruction
12286
or by throwing an exception to its caller
12287
(see <paramlink id="was_popped_by_exception"></paramlink>).
12288
However, frame pops caused by the <functionlink id="PopFrame"/>
12289
function are not reported.
12290
<p/>
12291
The location reported by <functionlink id="GetFrameLocation"></functionlink>
12292
for the depth 0 identifies the executable location in the returning method,
12293
immediately prior to the return.
12294
</description>
12295
<origin>jvmdi</origin>
12296
<capabilities>
12297
<required id="can_generate_frame_pop_events"></required>
12298
</capabilities>
12299
<parameters>
12300
<param id="jni_env">
12301
<outptr>
12302
<struct>JNIEnv</struct>
12303
</outptr>
12304
<description>
12305
The JNI environment of the event (current) thread
12306
</description>
12307
</param>
12308
<param id="thread">
12309
<jthread/>
12310
<description>
12311
Thread that is popping the frame
12312
</description>
12313
</param>
12314
<param id="klass">
12315
<jclass method="method"/>
12316
<description>
12317
Class of the method being popped
12318
</description>
12319
</param>
12320
<param id="method">
12321
<jmethodID class="klass"/>
12322
<description>
12323
Method being popped
12324
</description>
12325
</param>
12326
<param id="was_popped_by_exception">
12327
<jboolean/>
12328
<description>
12329
True if frame was popped by a thrown exception.
12330
False if method exited through its return instruction.
12331
</description>
12332
</param>
12333
</parameters>
12334
</event>
12335
12336
<event label="Method Entry"
12337
id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">
12338
<description>
12339
Method entry events are generated upon entry of Java
12340
programming language methods (including native methods).
12341
<p/>
12342
The location reported by <functionlink id="GetFrameLocation"></functionlink>
12343
for the depth 0 identifies the initial executable location in the method.
12344
<p/>
12345
Enabling method
12346
entry or exit events will significantly degrade performance on many platforms and is thus
12347
not advised for performance critical usage (such as profiling).
12348
<internallink id="bci">Bytecode instrumentation</internallink> should be
12349
used in these cases.
12350
</description>
12351
<origin>jvmdi</origin>
12352
<capabilities>
12353
<required id="can_generate_method_entry_events"></required>
12354
</capabilities>
12355
<parameters>
12356
<param id="jni_env">
12357
<outptr>
12358
<struct>JNIEnv</struct>
12359
</outptr>
12360
<description>
12361
The JNI environment of the event (current) thread
12362
</description>
12363
</param>
12364
<param id="thread">
12365
<jthread/>
12366
<description>
12367
Thread entering the method
12368
</description>
12369
</param>
12370
<param id="klass">
12371
<jclass method="method"/>
12372
<description>
12373
Class of the method being entered
12374
</description>
12375
</param>
12376
<param id="method">
12377
<jmethodID class="klass"/>
12378
<description>
12379
Method being entered
12380
</description>
12381
</param>
12382
</parameters>
12383
</event>
12384
12385
<event label="Method Exit"
12386
id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">
12387
<description>
12388
Method exit events are generated upon exit from Java
12389
programming language methods (including native methods).
12390
This is true whether termination is caused by
12391
executing its return instruction
12392
or by throwing an exception to its caller
12393
(see <paramlink id="was_popped_by_exception"></paramlink>).
12394
<p/>
12395
The location reported by <functionlink id="GetFrameLocation"></functionlink>
12396
for the depth 0 identifies the executable location in the returning method
12397
immediately prior to the return.
12398
<p/>
12399
Enabling method
12400
entry or exit events will significantly degrade performance on many platforms and is thus
12401
not advised for performance critical usage (such as profiling).
12402
<internallink id="bci">Bytecode instrumentation</internallink> should be
12403
used in these cases.
12404
</description>
12405
<origin>jvmdi</origin>
12406
<capabilities>
12407
<required id="can_generate_method_exit_events"></required>
12408
</capabilities>
12409
<parameters>
12410
<param id="jni_env">
12411
<outptr>
12412
<struct>JNIEnv</struct>
12413
</outptr>
12414
<description>
12415
The JNI environment of the event (current) thread
12416
</description>
12417
</param>
12418
<param id="thread">
12419
<jthread/>
12420
<description>
12421
Thread exiting the method
12422
</description>
12423
</param>
12424
<param id="klass">
12425
<jclass method="method"/>
12426
<description>
12427
Class of the method being exited
12428
</description>
12429
</param>
12430
<param id="method">
12431
<jmethodID class="klass"/>
12432
<description>
12433
Method being exited
12434
</description>
12435
</param>
12436
<param id="was_popped_by_exception">
12437
<jboolean/>
12438
<description>
12439
True if frame was popped by a thrown exception.
12440
False if method exited through its return instruction.
12441
</description>
12442
</param>
12443
<param id="return_value">
12444
<jvalue/>
12445
<description>
12446
The return value of the method being exited.
12447
Undefined and should not be used if
12448
<paramlink id="was_popped_by_exception"></paramlink>
12449
is true.
12450
</description>
12451
</param>
12452
</parameters>
12453
</event>
12454
12455
<event label="Native Method Bind" phase="any"
12456
id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">
12457
<description>
12458
A Native Method Bind event is sent when a VM binds a
12459
Java programming language native method
12460
to the address of a function that implements the native method.
12461
This will occur when the native method is called for the first time
12462
and also occurs when the JNI function <code>RegisterNatives</code> is called.
12463
This event allows the bind to be redirected to an agent-specified
12464
proxy function.
12465
This event is not sent when the native method is unbound.
12466
Typically, this proxy function will need to be specific to a
12467
particular method or, to handle the general case, automatically
12468
generated assembly code, since after instrumentation code is
12469
executed the function at the original binding
12470
address will usually be invoked.
12471
The original binding can be restored or the redirection changed
12472
by use of the JNI function <code>RegisterNatives</code>.
12473
Some events may be sent during the primordial phase, JNI and
12474
most of <jvmti/> cannot be used at this time but the method and
12475
address can be saved for use later.
12476
</description>
12477
<origin>new</origin>
12478
<capabilities>
12479
<required id="can_generate_native_method_bind_events"></required>
12480
</capabilities>
12481
<parameters>
12482
<param id="jni_env">
12483
<outptr>
12484
<struct>JNIEnv</struct>
12485
</outptr>
12486
<description>
12487
The JNI environment of the event (current) thread
12488
Will be <code>NULL</code> if sent during the primordial
12489
<functionlink id="GetPhase">phase</functionlink>.
12490
</description>
12491
</param>
12492
<param id="thread">
12493
<jthread/>
12494
<description>
12495
Thread requesting the bind
12496
</description>
12497
</param>
12498
<param id="klass">
12499
<jclass method="method"/>
12500
<description>
12501
Class of the method being bound
12502
</description>
12503
</param>
12504
<param id="method">
12505
<jmethodID class="klass"/>
12506
<description>
12507
Native method being bound
12508
</description>
12509
</param>
12510
<param id="address">
12511
<outptr><void/></outptr>
12512
<description>
12513
The address the VM is about to bind to--that is, the
12514
address of the implementation of the native method
12515
</description>
12516
</param>
12517
<param id="new_address_ptr">
12518
<agentbuf><void/></agentbuf>
12519
<description>
12520
if the referenced address is changed (that is, if
12521
<code>*new_address_ptr</code> is set), the binding
12522
will instead be made to the supplied address.
12523
</description>
12524
</param>
12525
</parameters>
12526
</event>
12527
12528
<event label="Exception"
12529
id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">
12530
<description>
12531
Exception events are generated whenever an exception is first detected
12532
in a Java programming language method.
12533
Where "exception" means any <code>java.lang.Throwable</code>.
12534
The exception may have been thrown by a Java programming language or native
12535
method, but in the case of native methods, the event is not generated
12536
until the exception is first seen by a Java programming language method. If an exception is
12537
set and cleared in a native method (and thus is never visible to Java programming language code),
12538
no exception event is generated.
12539
<p/>
12540
The <code>method</code> and <code>location</code>
12541
parameters uniquely identify the current location
12542
(where the exception was detected) and allow
12543
the mapping to source file and line number when that information is
12544
available. The <code>exception</code> field identifies the thrown
12545
exception object. The <code>catch_method</code>
12546
and <code>catch_location</code> identify the location of the catch clause,
12547
if any, that handles the thrown exception. If there is no such catch clause,
12548
each field is set to 0. There is no guarantee that the thread will ever
12549
reach this catch clause. If there are native methods on the call stack
12550
between the throw location and the catch clause, the exception may
12551
be reset by one of those native methods.
12552
Similarly, exceptions that are reported as uncaught (<code>catch_klass</code>
12553
et al. set to 0) may in fact be caught by native code.
12554
Agents can check for these occurrences by monitoring
12555
<eventlink id="ExceptionCatch"></eventlink> events.
12556
Note that finally clauses are implemented as catch and re-throw. Therefore they
12557
will be reported in the catch location.
12558
</description>
12559
<origin>jvmdi</origin>
12560
<capabilities>
12561
<required id="can_generate_exception_events"></required>
12562
</capabilities>
12563
<parameters>
12564
<param id="jni_env">
12565
<outptr>
12566
<struct>JNIEnv</struct>
12567
</outptr>
12568
<description>
12569
The JNI environment of the event (current) thread
12570
</description>
12571
</param>
12572
<param id="thread">
12573
<jthread/>
12574
<description>
12575
Thread generating the exception
12576
</description>
12577
</param>
12578
<param id="klass">
12579
<jclass method="method"/>
12580
<description>
12581
Class generating the exception
12582
</description>
12583
</param>
12584
<param id="method">
12585
<jmethodID class="klass"/>
12586
<description>
12587
Method generating the exception
12588
</description>
12589
</param>
12590
<param id="location">
12591
<jlocation/>
12592
<description>
12593
Location where exception occurred
12594
</description>
12595
</param>
12596
<param id="exception">
12597
<jobject/>
12598
<description>
12599
The exception being thrown
12600
</description>
12601
</param>
12602
<param id="catch_klass">
12603
<jclass method="catch_method"/>
12604
<description>
12605
Class that will catch the exception, or <code>NULL</code> if no known catch
12606
</description>
12607
</param>
12608
<param id="catch_method">
12609
<jmethodID class="catch_klass"/>
12610
<description>
12611
Method that will catch the exception, or <code>NULL</code> if no known catch
12612
</description>
12613
</param>
12614
<param id="catch_location">
12615
<jlocation/>
12616
<description>
12617
location which will catch the exception or zero if no known catch
12618
</description>
12619
</param>
12620
</parameters>
12621
</event>
12622
12623
<event label="Exception Catch"
12624
id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">
12625
<description>
12626
Exception catch events are generated whenever a thrown exception is caught.
12627
Where "exception" means any <code>java.lang.Throwable</code>.
12628
If the exception is caught in a Java programming language method, the event is generated
12629
when the catch clause is reached. If the exception is caught in a native
12630
method, the event is generated as soon as control is returned to a Java programming language
12631
method. Exception catch events are generated for any exception for which
12632
a throw was detected in a Java programming language method.
12633
Note that finally clauses are implemented as catch and re-throw. Therefore they
12634
will generate exception catch events.
12635
<p/>
12636
The <code>method</code> and <code>location</code>
12637
parameters uniquely identify the current location
12638
and allow the mapping to source file and line number when that information is
12639
available. For exceptions caught in a Java programming language method, the
12640
<code>exception</code> object identifies the exception object. Exceptions
12641
caught in native methods are not necessarily available by the time the
12642
exception catch is reported, so the <code>exception</code> field is set
12643
to <code>NULL</code>.
12644
</description>
12645
<origin>jvmdi</origin>
12646
<capabilities>
12647
<required id="can_generate_exception_events"></required>
12648
</capabilities>
12649
<parameters>
12650
<param id="jni_env">
12651
<outptr>
12652
<struct>JNIEnv</struct>
12653
</outptr>
12654
<description>
12655
The JNI environment of the event (current) thread
12656
</description>
12657
</param>
12658
<param id="thread">
12659
<jthread/>
12660
<description>
12661
Thread catching the exception
12662
</description>
12663
</param>
12664
<param id="klass">
12665
<jclass method="method"/>
12666
<description>
12667
Class catching the exception
12668
</description>
12669
</param>
12670
<param id="method">
12671
<jmethodID class="klass"/>
12672
<description>
12673
Method catching the exception
12674
</description>
12675
</param>
12676
<param id="location">
12677
<jlocation/>
12678
<description>
12679
Location where exception is being caught
12680
</description>
12681
</param>
12682
<param id="exception">
12683
<jobject/>
12684
<description>
12685
Exception being caught
12686
</description>
12687
</param>
12688
</parameters>
12689
</event>
12690
12691
<event label="Thread Start"
12692
id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">
12693
<description>
12694
Thread start events are generated by a new thread before its initial
12695
method executes.
12696
<p/>
12697
A thread may be listed in the array returned by
12698
<functionlink id="GetAllThreads"></functionlink>
12699
before its thread start event is generated.
12700
It is possible for other events to be generated
12701
on a thread before its thread start event.
12702
<p/>
12703
The event is sent on the newly started <paramlink id="thread"></paramlink>.
12704
</description>
12705
<origin>jvmdi</origin>
12706
<capabilities>
12707
</capabilities>
12708
<parameters>
12709
<param id="jni_env">
12710
<outptr>
12711
<struct>JNIEnv</struct>
12712
</outptr>
12713
<description>
12714
The JNI environment of the event (current) thread.
12715
</description>
12716
</param>
12717
<param id="thread">
12718
<jthread/>
12719
<description>
12720
Thread starting
12721
</description>
12722
</param>
12723
</parameters>
12724
</event>
12725
12726
<event label="Thread End"
12727
id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">
12728
<description>
12729
Thread end events are generated by a terminating thread
12730
after its initial method has finished execution.
12731
<p/>
12732
A thread may be listed in the array returned by
12733
<functionlink id="GetAllThreads"></functionlink>
12734
after its thread end event is generated.
12735
No events are generated on a thread
12736
after its thread end event.
12737
<p/>
12738
The event is sent on the dying <paramlink id="thread"></paramlink>.
12739
</description>
12740
<origin>jvmdi</origin>
12741
<capabilities>
12742
</capabilities>
12743
<parameters>
12744
<param id="jni_env">
12745
<outptr>
12746
<struct>JNIEnv</struct>
12747
</outptr>
12748
<description>
12749
The JNI environment of the event (current) thread.
12750
</description>
12751
</param>
12752
<param id="thread">
12753
<jthread/>
12754
<description>
12755
Thread ending
12756
</description>
12757
</param>
12758
</parameters>
12759
</event>
12760
12761
<event label="Class Load"
12762
id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">
12763
<description>
12764
A class load event is generated
12765
<functionlink id="GetLoadedClasses">when a class or interface is created.</functionlink>.
12766
<p/>
12767
Array class creation does not generate a class load event.
12768
The creation of a primitive class (for example, java.lang.Integer.TYPE)
12769
does not generate a class load event.
12770
<p/>
12771
The order of class load events generated by a particular thread is guaranteed
12772
to match the order of class loading within that thread.
12773
<p/>
12774
This event is sent at an early stage in loading the class. As
12775
a result the class should be used carefully. Note, for example,
12776
that methods and fields are not yet loaded, so queries for methods,
12777
fields, subclasses, and so on will not give correct results.
12778
See "Loading of Classes and Interfaces" in the <i>Java Language
12779
Specification</i>. For most
12780
purposes the <eventlink id="ClassPrepare"></eventlink> event will
12781
be more useful.
12782
</description>
12783
<origin>jvmdi</origin>
12784
<capabilities>
12785
</capabilities>
12786
<parameters>
12787
<param id="jni_env">
12788
<outptr>
12789
<struct>JNIEnv</struct>
12790
</outptr>
12791
<description>
12792
The JNI environment of the event (current) thread
12793
</description>
12794
</param>
12795
<param id="thread">
12796
<jthread/>
12797
<description>
12798
Thread loading the class
12799
</description>
12800
</param>
12801
<param id="klass">
12802
<jclass/>
12803
<description>
12804
Class being loaded
12805
</description>
12806
</param>
12807
</parameters>
12808
</event>
12809
12810
<elide>
12811
<event label="Class Unload"
12812
id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">
12813
<description>
12814
A class unload event is generated when the class is about to be unloaded.
12815
Class unload events take place during garbage collection and must be
12816
handled extremely carefully. The garbage collector holds many locks
12817
and has suspended all other threads, so the event handler cannot depend
12818
on the ability to acquire any locks. The class unload event handler should
12819
do as little as possible, perhaps by queuing information to be processed
12820
later. In particular, the <code>jclass</code> should be used only in
12821
the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:
12822
<ul>
12823
<li><functionlink id="GetClassSignature"></functionlink></li>
12824
<li><functionlink id="GetSourceFileName"></functionlink></li>
12825
<li><functionlink id="IsInterface"></functionlink></li>
12826
<li><functionlink id="IsArrayClass"></functionlink></li>
12827
</ul>
12828
</description>
12829
<origin>jvmdi</origin>
12830
<capabilities>
12831
</capabilities>
12832
<parameters>
12833
<param id="jni_env">
12834
<outptr>
12835
<struct>JNIEnv</struct>
12836
</outptr>
12837
<description>
12838
The JNI environment of the event (current) thread
12839
</description>
12840
</param>
12841
<param id="thread">
12842
<jthread/>
12843
<description>
12844
Thread generating the class unload
12845
</description>
12846
</param>
12847
<param id="klass">
12848
<jclass/>
12849
<description>
12850
Class being unloaded
12851
</description>
12852
</param>
12853
</parameters>
12854
</event>
12855
</elide>
12856
12857
<event label="Class Prepare"
12858
id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">
12859
<description>
12860
A class prepare event is generated when class preparation is complete.
12861
At this point, class fields, methods, and implemented interfaces are
12862
available, and no code from the class has been executed. Since array
12863
classes never have fields or methods, class prepare events are not
12864
generated for them. Class prepare events are not generated for
12865
primitive classes (for example, <code>java.lang.Integer.TYPE</code>).
12866
</description>
12867
<origin>jvmdi</origin>
12868
<capabilities>
12869
</capabilities>
12870
<parameters>
12871
<param id="jni_env">
12872
<outptr>
12873
<struct>JNIEnv</struct>
12874
</outptr>
12875
<description>
12876
The JNI environment of the event (current) thread
12877
</description>
12878
</param>
12879
<param id="thread">
12880
<jthread/>
12881
<description>
12882
Thread generating the class prepare
12883
</description>
12884
</param>
12885
<param id="klass">
12886
<jclass/>
12887
<description>
12888
Class being prepared
12889
</description>
12890
</param>
12891
</parameters>
12892
</event>
12893
12894
<event label="Class File Load Hook" phase="any"
12895
id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">
12896
<description>
12897
This event is sent when the VM obtains class file data,
12898
but before it constructs
12899
the in-memory representation for that class.
12900
This event is also sent when the class is being modified by the
12901
<functionlink id="RetransformClasses"/> function or
12902
the <functionlink id="RedefineClasses"/> function,
12903
called in any <jvmti/> environment.
12904
The agent can instrument
12905
the existing class file data sent by the VM to include profiling/debugging hooks.
12906
See the description of
12907
<internallink id="bci">bytecode instrumentation</internallink>
12908
for usage information.
12909
<p/>
12910
When the capabilities
12911
<internallink id="jvmtiCapabilities.can_generate_early_class_hook_events">
12912
<code>can_generate_early_class_hook_events</code></internallink> and
12913
<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
12914
<code>can_generate_all_class_hook_events</code></internallink>
12915
are enabled then this event may be sent in the primordial phase.
12916
Otherwise, this event may be sent before the VM is initialized (the start
12917
<functionlink id="GetPhase">phase</functionlink>).
12918
Some classes might not be compatible
12919
with the function (eg. ROMized classes or implementation defined classes) and this event will
12920
not be generated for these classes.
12921
<p/>
12922
The agent must allocate the space for the modified
12923
class file data buffer
12924
using the memory allocation function
12925
<functionlink id="Allocate"></functionlink> because the
12926
VM is responsible for freeing the new class file data buffer
12927
using <functionlink id="Deallocate"></functionlink>.
12928
<p/>
12929
If the agent wishes to modify the class file, it must set
12930
<code>new_class_data</code> to point
12931
to the newly instrumented class file data buffer and set
12932
<code>new_class_data_len</code> to the length of that
12933
buffer before returning
12934
from this call. If no modification is desired, the agent simply
12935
does not set <code>new_class_data</code>. If multiple agents
12936
have enabled this event the results are chained. That is, if
12937
<code>new_class_data</code> has been set, it becomes the
12938
<code>class_data</code> for the next agent.
12939
<p/>
12940
When handling a class load in the live phase, then the
12941
<functionlink id="GetNamedModule"></functionlink>
12942
function can be used to map class loader and a package name to a module.
12943
When a class is being redefined or retransformed then
12944
<code>class_being_redefined</code> is non <code>NULL</code> and so
12945
the JNI <code>GetModule</code> function can also be used
12946
to obtain the Module.
12947
<p/>
12948
The order that this event is sent to each environment differs
12949
from other events.
12950
This event is sent to environments in the following order:
12951
<ul>
12952
<li><fieldlink id="can_retransform_classes"
12953
struct="jvmtiCapabilities">retransformation
12954
incapable</fieldlink>
12955
environments, in the
12956
order in which they were created
12957
</li>
12958
<li><fieldlink id="can_retransform_classes"
12959
struct="jvmtiCapabilities">retransformation
12960
capable</fieldlink>
12961
environments, in the
12962
order in which they were created
12963
</li>
12964
</ul>
12965
When triggered by <functionlink id="RetransformClasses"/>,
12966
this event is sent only to <fieldlink id="can_retransform_classes"
12967
struct="jvmtiCapabilities">retransformation
12968
capable</fieldlink>
12969
environments.
12970
</description>
12971
<origin>jvmpi</origin>
12972
<capabilities>
12973
<capability id="can_generate_all_class_hook_events"></capability>
12974
<capability id="can_generate_early_class_hook_events"></capability>
12975
</capabilities>
12976
<parameters>
12977
<param id="jni_env">
12978
<outptr>
12979
<struct>JNIEnv</struct>
12980
</outptr>
12981
<description>
12982
The JNI environment of the event (current) thread.
12983
</description>
12984
</param>
12985
<param id="class_being_redefined">
12986
<jclass/>
12987
<description>
12988
The class being
12989
<functionlink id="RedefineClasses">redefined</functionlink> or
12990
<functionlink id="RetransformClasses">retransformed</functionlink>.
12991
<code>NULL</code> if sent by class load.
12992
</description>
12993
</param>
12994
<param id="loader">
12995
<jobject/>
12996
<description>
12997
The class loader loading the class.
12998
<code>NULL</code> if the bootstrap class loader.
12999
</description>
13000
</param>
13001
<param id="name">
13002
<vmbuf><char/></vmbuf>
13003
<description>
13004
Name of class being loaded as a VM internal qualified name
13005
(for example, "java/util/List"), encoded as a
13006
<internallink id="mUTF">modified UTF-8</internallink> string.
13007
Note: if the class is defined with a <code>NULL</code> name or
13008
without a name specified, <code>name</code> will be <code>NULL</code>.
13009
</description>
13010
</param>
13011
<param id="protection_domain">
13012
<jobject/>
13013
<description>
13014
The <code>ProtectionDomain</code> of the class.
13015
</description>
13016
</param>
13017
<param id="class_data_len">
13018
<jint/>
13019
<description>
13020
Length of current class file data buffer.
13021
</description>
13022
</param>
13023
<param id="class_data">
13024
<vmbuf><uchar/></vmbuf>
13025
<description>
13026
Pointer to the current class file data buffer.
13027
</description>
13028
</param>
13029
<param id="new_class_data_len">
13030
<outptr><jint/></outptr>
13031
<description>
13032
Pointer to the length of the new class file data buffer.
13033
</description>
13034
</param>
13035
<param id="new_class_data">
13036
<agentbuf incount="new_class_data_len"><uchar/></agentbuf>
13037
<description>
13038
Pointer to the pointer to the instrumented class file data buffer.
13039
</description>
13040
</param>
13041
</parameters>
13042
</event>
13043
13044
<event label="VM Start Event"
13045
id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">
13046
<description>
13047
The VM start event signals the start of the VM.
13048
At this time JNI is live but the VM is not yet fully initialized.
13049
Once this event is generated, the agent is free to call any JNI function.
13050
This event signals the beginning of the start phase,
13051
<jvmti/> functions permitted in the start phase may be called.
13052
<p/>
13053
The timing of this event may depend on whether the agent has added the
13054
<internallink id="jvmtiCapabilities.can_generate_early_vmstart">
13055
<code>can_generate_early_vmstart</code></internallink> capability or not.
13056
If the capability has been added then the VM posts the event as early
13057
as possible. The VM is capable of executing bytecode but it may not have
13058
initialized to the point where it can load classes in modules other than
13059
<code>java.base</code>, or even arbitrary classes in <code>java.base</code>.
13060
Agents that do load-time instrumentation in this
13061
phase must take great care when instrumenting code that potentially
13062
executes in this phase. Extreme care should also be taken with JNI
13063
<code>FindClass</code> as it may not be possible to load classes and attempts
13064
to do so may result in unpredictable behavior, maybe even stability issues
13065
on some VM implementations.
13066
If the capability has not been added then the VM delays posting this
13067
event until it is capable of loading classes in modules other than
13068
<code>java.base</code> or the VM has completed its initialization.
13069
Agents that create more than one JVM TI environment, where the
13070
capability is added to some but not all environments, may observe the
13071
start phase beginning earlier in the JVM TI environments that possess
13072
the capability.
13073
<p/>
13074
In the case of VM start-up failure, this event will not be sent.
13075
</description>
13076
<origin>jvmdi</origin>
13077
<capabilities>
13078
</capabilities>
13079
<parameters>
13080
<param id="jni_env">
13081
<outptr>
13082
<struct>JNIEnv</struct>
13083
</outptr>
13084
<description>
13085
The JNI environment of the event (current) thread.
13086
</description>
13087
</param>
13088
</parameters>
13089
</event>
13090
13091
<event label="VM Initialization Event"
13092
id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">
13093
<description>
13094
The VM initialization event signals the completion of VM initialization. Once
13095
this event is generated, the agent is free to call any JNI or <jvmti/>
13096
function. The VM initialization event can be preceded by or can be concurrent
13097
with other events, but
13098
the preceding events should be handled carefully, if at all, because the
13099
VM has not completed its initialization. The thread start event for the
13100
main application thread is guaranteed not to occur until after the
13101
handler for the VM initialization event returns.
13102
<p/>
13103
In the case of VM start-up failure, this event will not be sent.
13104
</description>
13105
<origin>jvmdi</origin>
13106
<capabilities>
13107
</capabilities>
13108
<parameters>
13109
<param id="jni_env">
13110
<outptr>
13111
<struct>JNIEnv</struct>
13112
</outptr>
13113
<description>
13114
The JNI environment of the event (current) thread.
13115
</description>
13116
</param>
13117
<param id="thread">
13118
<jthread/>
13119
<description>
13120
The initial thread
13121
</description>
13122
</param>
13123
</parameters>
13124
</event>
13125
13126
<event label="VM Death Event"
13127
id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">
13128
<description>
13129
The VM death event notifies the agent of the termination of the VM.
13130
No events will occur after the VMDeath event.
13131
<p/>
13132
In the case of VM start-up failure, this event will not be sent.
13133
Note that <internallink id="onunload">Agent_OnUnload</internallink>
13134
will still be called in these cases.
13135
</description>
13136
<origin>jvmdi</origin>
13137
<capabilities>
13138
</capabilities>
13139
<parameters>
13140
<param id="jni_env">
13141
<outptr>
13142
<struct>JNIEnv</struct>
13143
</outptr>
13144
<description>
13145
The JNI environment of the event (current) thread
13146
</description>
13147
</param>
13148
</parameters>
13149
</event>
13150
13151
<event label="Compiled Method Load" phase="start"
13152
id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">
13153
<description>
13154
Sent when a method is compiled and loaded into memory by the VM.
13155
If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.
13156
If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,
13157
followed by a new <code>CompiledMethodLoad</code> event.
13158
Note that a single method may have multiple compiled forms, and that
13159
this event will be sent for each form.
13160
Note also that several methods may be inlined into a single
13161
address range, and that this event will be sent for each method.
13162
<p/>
13163
These events can be sent after their initial occurrence with
13164
<functionlink id="GenerateEvents"></functionlink>.
13165
</description>
13166
<origin>jvmpi</origin>
13167
<typedef id="jvmtiAddrLocationMap" label="Native address to location entry">
13168
<field id="start_address">
13169
<vmbuf><void/></vmbuf>
13170
<description>
13171
Starting native address of code corresponding to a location
13172
</description>
13173
</field>
13174
<field id="location">
13175
<jlocation/>
13176
<description>
13177
Corresponding location. See
13178
<functionlink id="GetJLocationFormat"></functionlink>
13179
for the meaning of location.
13180
</description>
13181
</field>
13182
</typedef>
13183
<capabilities>
13184
<required id="can_generate_compiled_method_load_events"></required>
13185
</capabilities>
13186
<parameters>
13187
<param id="klass">
13188
<jclass method="method"/>
13189
<description>
13190
Class of the method being compiled and loaded
13191
</description>
13192
</param>
13193
<param id="method">
13194
<jmethodID class="klass"/>
13195
<description>
13196
Method being compiled and loaded
13197
</description>
13198
</param>
13199
<param id="code_size">
13200
<jint/>
13201
<description>
13202
Size of compiled code
13203
</description>
13204
</param>
13205
<param id="code_addr">
13206
<vmbuf><void/></vmbuf>
13207
<description>
13208
Address where compiled method code is loaded
13209
</description>
13210
</param>
13211
<param id="map_length">
13212
<jint/>
13213
<description>
13214
Number of <typelink id="jvmtiAddrLocationMap"></typelink>
13215
entries in the address map.
13216
Zero if mapping information cannot be supplied.
13217
</description>
13218
</param>
13219
<param id="map">
13220
<vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>
13221
<description>
13222
Map from native addresses to location.
13223
The native address range of each entry is from
13224
<fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>
13225
to <code>start_address-1</code> of the next entry.
13226
<code>NULL</code> if mapping information cannot be supplied.
13227
</description>
13228
</param>
13229
<param id="compile_info">
13230
<vmbuf><void/></vmbuf>
13231
<description>
13232
VM-specific compilation information.
13233
The referenced compile information is managed by the VM
13234
and must not depend on the agent for collection.
13235
A VM implementation defines the content and lifetime
13236
of the information.
13237
</description>
13238
</param>
13239
</parameters>
13240
</event>
13241
13242
<event label="Compiled Method Unload" phase="start"
13243
id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">
13244
<description>
13245
Sent when a compiled method is unloaded from memory.
13246
This event might not be sent on the thread which performed the unload.
13247
This event may be sent sometime after the unload occurs, but
13248
will be sent before the memory is reused
13249
by a newly generated compiled method. This event may be sent after
13250
the class is unloaded.
13251
</description>
13252
<origin>jvmpi</origin>
13253
<capabilities>
13254
<required id="can_generate_compiled_method_load_events"></required>
13255
</capabilities>
13256
<parameters>
13257
<param id="klass">
13258
<jclass method="method"/>
13259
<description>
13260
Class of the compiled method being unloaded.
13261
</description>
13262
</param>
13263
<param id="method">
13264
<jmethodID class="klass"/>
13265
<description>
13266
Compiled method being unloaded.
13267
For identification of the compiled method only -- the class
13268
may be unloaded and therefore the method should not be used
13269
as an argument to further JNI or <jvmti/> functions.
13270
</description>
13271
</param>
13272
<param id="code_addr">
13273
<vmbuf><void/></vmbuf>
13274
<description>
13275
Address where compiled method code was loaded.
13276
For identification of the compiled method only --
13277
the space may have been reclaimed.
13278
</description>
13279
</param>
13280
</parameters>
13281
</event>
13282
13283
<event label="Dynamic Code Generated" phase="any"
13284
id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">
13285
<description>
13286
Sent when a component of the virtual machine is generated dynamically.
13287
This does not correspond to Java programming language code that is
13288
compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.
13289
This is for native code--for example, an interpreter that is generated
13290
differently depending on command-line options.
13291
<p/>
13292
Note that this event has no controlling capability.
13293
If a VM cannot generate these events, it simply does not send any.
13294
<p/>
13295
These events can be sent after their initial occurrence with
13296
<functionlink id="GenerateEvents"></functionlink>.
13297
</description>
13298
<origin>jvmpi</origin>
13299
<capabilities>
13300
</capabilities>
13301
<parameters>
13302
<param id="name">
13303
<vmbuf><char/></vmbuf>
13304
<description>
13305
Name of the code, encoded as a
13306
<internallink id="mUTF">modified UTF-8</internallink> string.
13307
Intended for display to an end-user.
13308
The name might not be unique.
13309
</description>
13310
</param>
13311
<param id="address">
13312
<vmbuf><void/></vmbuf>
13313
<description>
13314
Native address of the code
13315
</description>
13316
</param>
13317
<param id="length">
13318
<jint/>
13319
<description>
13320
Length in bytes of the code
13321
</description>
13322
</param>
13323
</parameters>
13324
</event>
13325
13326
<event label="Data Dump Request"
13327
id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">
13328
<description>
13329
Sent by the VM to request the agent to dump its data. This
13330
is just a hint and the agent need not react to this event.
13331
This is useful for processing command-line signals from users. For
13332
example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux
13333
causes the VM to send this event to the agent.
13334
</description>
13335
<origin>jvmpi</origin>
13336
<capabilities>
13337
</capabilities>
13338
<parameters>
13339
</parameters>
13340
</event>
13341
13342
<event label="Monitor Contended Enter"
13343
id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">
13344
<description>
13345
Sent when a thread is attempting to enter a Java programming language
13346
monitor already acquired by another thread.
13347
</description>
13348
<origin>jvmpi</origin>
13349
<capabilities>
13350
<required id="can_generate_monitor_events"></required>
13351
</capabilities>
13352
<parameters>
13353
<param id="jni_env">
13354
<outptr>
13355
<struct>JNIEnv</struct>
13356
</outptr>
13357
<description>
13358
The JNI environment of the event (current) thread
13359
</description>
13360
</param>
13361
<param id="thread">
13362
<jthread/>
13363
<description>
13364
JNI local reference to the thread
13365
attempting to enter the monitor
13366
</description>
13367
</param>
13368
<param id="object">
13369
<jobject/>
13370
<description>
13371
JNI local reference to the monitor
13372
</description>
13373
</param>
13374
</parameters>
13375
</event>
13376
13377
<event label="Monitor Contended Entered"
13378
id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">
13379
<description>
13380
Sent when a thread enters a Java programming language
13381
monitor after waiting for it to be released by another thread.
13382
</description>
13383
<origin>jvmpi</origin>
13384
<capabilities>
13385
<required id="can_generate_monitor_events"></required>
13386
</capabilities>
13387
<parameters>
13388
<param id="jni_env">
13389
<outptr>
13390
<struct>JNIEnv</struct>
13391
</outptr>
13392
<description>
13393
The JNI environment of the event (current) thread
13394
</description>
13395
</param>
13396
<param id="thread">
13397
<jthread/>
13398
<description>
13399
JNI local reference to the thread entering
13400
the monitor
13401
</description>
13402
</param>
13403
<param id="object">
13404
<jobject/>
13405
<description>
13406
JNI local reference to the monitor
13407
</description>
13408
</param>
13409
</parameters>
13410
</event>
13411
13412
<event label="Monitor Wait"
13413
id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">
13414
<description>
13415
Sent when a thread is about to wait on an object.
13416
</description>
13417
<origin>jvmpi</origin>
13418
<capabilities>
13419
<required id="can_generate_monitor_events"></required>
13420
</capabilities>
13421
<parameters>
13422
<param id="jni_env">
13423
<outptr>
13424
<struct>JNIEnv</struct>
13425
</outptr>
13426
<description>
13427
The JNI environment of the event (current) thread
13428
</description>
13429
</param>
13430
<param id="thread">
13431
<jthread/>
13432
<description>
13433
JNI local reference to the thread about to wait
13434
</description>
13435
</param>
13436
<param id="object">
13437
<jobject/>
13438
<description>
13439
JNI local reference to the monitor
13440
</description>
13441
</param>
13442
<param id="timeout">
13443
<jlong/>
13444
<description>
13445
The number of milliseconds the thread will wait
13446
</description>
13447
</param>
13448
</parameters>
13449
</event>
13450
13451
<event label="Monitor Waited"
13452
id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">
13453
<description>
13454
Sent when a thread finishes waiting on an object.
13455
</description>
13456
<origin>jvmpi</origin>
13457
<capabilities>
13458
<required id="can_generate_monitor_events"></required>
13459
</capabilities>
13460
<parameters>
13461
<param id="jni_env">
13462
<outptr>
13463
<struct>JNIEnv</struct>
13464
</outptr>
13465
<description>
13466
The JNI environment of the event (current) thread
13467
</description>
13468
</param>
13469
<param id="thread">
13470
<jthread/>
13471
<description>
13472
JNI local reference to the thread that was finished waiting
13473
</description>
13474
</param>
13475
<param id="object">
13476
<jobject/>
13477
<description>
13478
JNI local reference to the monitor.
13479
</description>
13480
</param>
13481
<param id="timed_out">
13482
<jboolean/>
13483
<description>
13484
True if the monitor timed out
13485
</description>
13486
</param>
13487
</parameters>
13488
</event>
13489
13490
<event label="Resource Exhausted"
13491
id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"
13492
since="1.1">
13493
<description>
13494
Sent when a VM resource needed by a running application has been exhausted.
13495
Except as required by the optional capabilities, the set of resources
13496
which report exhaustion is implementation dependent.
13497
<p/>
13498
The following bit flags define the properties of the resource exhaustion:
13499
<constants id="jvmtiResourceExhaustionFlags"
13500
label="Resource Exhaustion Flags"
13501
kind="bits"
13502
since="1.1">
13503
<constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">
13504
After this event returns, the VM will throw a
13505
<code>java.lang.OutOfMemoryError</code>.
13506
</constant>
13507
<constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">
13508
The VM was unable to allocate memory from the <tm>Java</tm>
13509
platform <i>heap</i>.
13510
The <i>heap</i> is the runtime
13511
data area from which memory for all class instances and
13512
arrays are allocated.
13513
</constant>
13514
<constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">
13515
The VM was unable to create a thread.
13516
</constant>
13517
</constants>
13518
</description>
13519
<origin>new</origin>
13520
<capabilities>
13521
<capability id="can_generate_resource_exhaustion_heap_events">
13522
Can generate events when the VM is unable to allocate memory from the
13523
<internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.
13524
</capability>
13525
<capability id="can_generate_resource_exhaustion_threads_events">
13526
Can generate events when the VM is unable to
13527
<internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create
13528
a thread</internallink>.
13529
</capability>
13530
</capabilities>
13531
<parameters>
13532
<param id="jni_env">
13533
<outptr>
13534
<struct>JNIEnv</struct>
13535
</outptr>
13536
<description>
13537
The JNI environment of the event (current) thread
13538
</description>
13539
</param>
13540
<param id="flags">
13541
<jint/>
13542
<description>
13543
Flags defining the properties of the of resource exhaustion
13544
as specified by the
13545
<internallink id="jvmtiResourceExhaustionFlags">Resource
13546
Exhaustion Flags</internallink>.
13547
</description>
13548
</param>
13549
<param id="reserved">
13550
<vmbuf><void/></vmbuf>
13551
<description>
13552
Reserved.
13553
</description>
13554
</param>
13555
<param id="description">
13556
<vmbuf><char/></vmbuf>
13557
<description>
13558
Description of the resource exhaustion, encoded as a
13559
<internallink id="mUTF">modified UTF-8</internallink> string.
13560
</description>
13561
</param>
13562
</parameters>
13563
</event>
13564
13565
<event label="VM Object Allocation"
13566
id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">
13567
<description>
13568
Sent when a method causes the virtual machine to directly allocate an
13569
Object visible to Java programming language code.
13570
Generally object allocation should be detected by instrumenting
13571
the bytecodes of allocating methods.
13572
Object allocation generated in native code by JNI function
13573
calls should be detected using
13574
<internallink id="jniIntercept">JNI function interception</internallink>.
13575
Some methods might not have associated bytecodes and are not
13576
native methods, they instead are executed directly by the
13577
VM. These methods should send this event.
13578
Virtual machines which are incapable of bytecode instrumentation
13579
for some or all of their methods can send this event.
13580
13581
Note that the <internallink
13582
id="SampledObjectAlloc">SampledObjectAlloc</internallink>
13583
event is triggered on all Java object allocations, including those
13584
caused by bytecode method execution, JNI method execution, and
13585
directly by VM methods.
13586
<p/>
13587
Typical examples where this event might be sent:
13588
<ul>
13589
<li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>
13590
<li>Methods not represented by bytecodes -- for example, VM intrinsics and
13591
J2ME preloaded classes</li>
13592
</ul>
13593
Cases where this event would not be generated:
13594
<ul>
13595
<li>Allocation due to bytecodes -- for example, the <code>new</code>
13596
and <code>newarray</code> VM instructions</li>
13597
<li>Allocation due to JNI function calls -- for example,
13598
<code>AllocObject</code></li>
13599
<li>Allocations during VM initialization</li>
13600
<li>VM internal objects</li>
13601
</ul>
13602
</description>
13603
<origin>new</origin>
13604
<capabilities>
13605
<required id="can_generate_vm_object_alloc_events"></required>
13606
</capabilities>
13607
<parameters>
13608
<param id="jni_env">
13609
<outptr>
13610
<struct>JNIEnv</struct>
13611
</outptr>
13612
<description>
13613
The JNI environment of the event (current) thread
13614
</description>
13615
</param>
13616
<param id="thread">
13617
<jthread/>
13618
<description>
13619
Thread allocating the object.
13620
</description>
13621
</param>
13622
<param id="object">
13623
<jobject/>
13624
<description>
13625
JNI local reference to the object that was allocated.
13626
</description>
13627
</param>
13628
<param id="object_klass">
13629
<jclass/>
13630
<description>
13631
JNI local reference to the class of the object.
13632
</description>
13633
</param>
13634
<param id="size">
13635
<jlong/>
13636
<description>
13637
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
13638
</description>
13639
</param>
13640
</parameters>
13641
</event>
13642
13643
<event label="Sampled Object Allocation"
13644
id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">
13645
<description>
13646
Sent when an allocated object is sampled.
13647
By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid
13648
pattern-based bias and provides an approximate overall average interval over long periods of
13649
sampling.
13650
<p/>
13651
Each thread tracks how many bytes it has allocated since it sent the last event.
13652
When the number of bytes exceeds the sampling interval, it will send another event.
13653
This implies that, on average, one object will be sampled every time a thread has
13654
allocated 512KB bytes since the last sample.
13655
<p/>
13656
Note that the sampler is pseudo-random: it will not sample every 512KB precisely.
13657
The goal of this is to ensure high quality sampling even if allocation is
13658
happening in a fixed pattern (i.e., the same set of objects are being allocated
13659
every 512KB).
13660
<p/>
13661
If another sampling interval is required, the user can call
13662
<functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value,
13663
representing the new sampling interval.
13664
<p/>
13665
This event is sent once the sampled allocation has been performed. It provides the object, stack trace
13666
of the allocation, the thread allocating, the size of allocation, and the object's class.
13667
<p/>
13668
A typical use case of this system is to determine where heap allocations originate.
13669
In conjunction with weak references and the function
13670
<functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which
13671
stack trace, and which are still live during the execution of the program.
13672
</description>
13673
<origin>new</origin>
13674
<capabilities>
13675
<required id="can_generate_sampled_object_alloc_events"></required>
13676
</capabilities>
13677
<parameters>
13678
<param id="jni_env">
13679
<outptr>
13680
<struct>JNIEnv</struct>
13681
</outptr>
13682
<description>
13683
The JNI environment of the event (current) thread.
13684
</description>
13685
</param>
13686
<param id="thread">
13687
<jthread/>
13688
<description>
13689
Thread allocating the object.
13690
</description>
13691
</param>
13692
<param id="object">
13693
<jobject/>
13694
<description>
13695
JNI local reference to the object that was allocated.
13696
</description>
13697
</param>
13698
<param id="object_klass">
13699
<jclass/>
13700
<description>
13701
JNI local reference to the class of the object
13702
</description>
13703
</param>
13704
<param id="size">
13705
<jlong/>
13706
<description>
13707
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
13708
</description>
13709
</param>
13710
</parameters>
13711
</event>
13712
13713
<event label="Object Free"
13714
id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">
13715
<description>
13716
An Object Free event is sent when the garbage collector frees an object.
13717
Events are only sent for tagged objects--see
13718
<internallink id="Heap">heap functions</internallink>.
13719
<p/>
13720
The event handler must not use JNI functions and
13721
must not use <jvmti/> functions except those which
13722
specifically allow such use (see the raw monitor, memory management,
13723
and environment local storage functions).
13724
</description>
13725
<origin>new</origin>
13726
<capabilities>
13727
<required id="can_generate_object_free_events"></required>
13728
</capabilities>
13729
<parameters>
13730
<param id="tag">
13731
<jlong/>
13732
<description>
13733
The freed object's tag
13734
</description>
13735
</param>
13736
</parameters>
13737
</event>
13738
13739
<event label="Garbage Collection Start"
13740
id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">
13741
<description>
13742
A Garbage Collection Start event is sent when a
13743
garbage collection pause begins.
13744
Only stop-the-world collections are reported--that is, collections during
13745
which all threads cease to modify the state of the Java virtual machine.
13746
This means that some collectors will never generate these events.
13747
This event is sent while the VM is still stopped, thus
13748
the event handler must not use JNI functions and
13749
must not use <jvmti/> functions except those which
13750
specifically allow such use (see the raw monitor, memory management,
13751
and environment local storage functions).
13752
<p/>
13753
This event is always sent as a matched pair with
13754
<eventlink id="GarbageCollectionFinish"/>
13755
(assuming both events are enabled) and no garbage collection
13756
events will occur between them.
13757
</description>
13758
<origin>new</origin>
13759
<capabilities>
13760
<required id="can_generate_garbage_collection_events"></required>
13761
</capabilities>
13762
<parameters>
13763
</parameters>
13764
</event>
13765
13766
<event label="Garbage Collection Finish"
13767
id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">
13768
<description>
13769
A Garbage Collection Finish event is sent when a
13770
garbage collection pause ends.
13771
This event is sent while the VM is still stopped, thus
13772
the event handler must not use JNI functions and
13773
must not use <jvmti/> functions except those which
13774
specifically allow such use (see the raw monitor, memory management,
13775
and environment local storage functions).
13776
<p/>
13777
Some agents may need to do post garbage collection operations that
13778
require the use of the disallowed <jvmti/> or JNI functions. For these
13779
cases an agent thread can be created which waits on a raw monitor,
13780
and the handler for the Garbage Collection Finish event simply
13781
notifies the raw monitor
13782
<p/>
13783
This event is always sent as a matched pair with
13784
<eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).
13785
<issue>
13786
The most important use of this event is to provide timing information,
13787
and thus additional information is not required. However,
13788
information about the collection which is "free" should be included -
13789
what that information is needs to be determined.
13790
</issue>
13791
</description>
13792
<origin>new</origin>
13793
<capabilities>
13794
<required id="can_generate_garbage_collection_events"></required>
13795
</capabilities>
13796
<parameters>
13797
</parameters>
13798
</event>
13799
13800
<elide>
13801
<event label="Verbose Output" phase="any"
13802
id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">
13803
<description>
13804
Send verbose messages as strings.
13805
<issue>
13806
This format is extremely fragile, as it can change with each
13807
platform, collector and version. Alternatives include:
13808
<ul>
13809
<li>building off Java programming language M and M APIs</li>
13810
<li>XML</li>
13811
<li>key/value pairs</li>
13812
<li>removing it</li>
13813
</ul>
13814
</issue>
13815
<issue>
13816
Though this seemed trivial to implement.
13817
In the RI it appears this will be quite complex.
13818
</issue>
13819
</description>
13820
<origin>new</origin>
13821
<capabilities>
13822
</capabilities>
13823
<parameters>
13824
<param id="flag">
13825
<enum>jvmtiVerboseFlag</enum>
13826
<description>
13827
Which verbose output is being sent.
13828
</description>
13829
</param>
13830
<param id="message">
13831
<vmbuf><char/></vmbuf>
13832
<description>
13833
Message text, encoded as a
13834
<internallink id="mUTF">modified UTF-8</internallink> string.
13835
</description>
13836
</param>
13837
</parameters>
13838
</event>
13839
</elide>
13840
13841
</eventsection>
13842
13843
<datasection>
13844
<intro>
13845
<jvmti/> extends the data types defined by JNI.
13846
</intro>
13847
<basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">
13848
<basetype id="jboolean">
13849
<description>
13850
Holds a Java programming language <code>boolean</code>.
13851
Unsigned 8 bits.
13852
</description>
13853
</basetype>
13854
<basetype id="jchar">
13855
<description>
13856
Holds a Java programming language <code>char</code>.
13857
Unsigned 16 bits.
13858
</description>
13859
</basetype>
13860
<basetype id="jint">
13861
<description>
13862
Holds a Java programming language <code>int</code>.
13863
Signed 32 bits.
13864
</description>
13865
</basetype>
13866
<basetype id="jlong">
13867
<description>
13868
Holds a Java programming language <code>long</code>.
13869
Signed 64 bits.
13870
</description>
13871
</basetype>
13872
<basetype id="jfloat">
13873
<description>
13874
Holds a Java programming language <code>float</code>.
13875
32 bits.
13876
</description>
13877
</basetype>
13878
<basetype id="jdouble">
13879
<description>
13880
Holds a Java programming language <code>double</code>.
13881
64 bits.
13882
</description>
13883
</basetype>
13884
<basetype id="jobject">
13885
<description>
13886
Holds a Java programming language object.
13887
</description>
13888
</basetype>
13889
<basetype id="jclass">
13890
<description>
13891
Holds a Java programming language class.
13892
</description>
13893
</basetype>
13894
<basetype id="jvalue">
13895
<description>
13896
Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java
13897
programming language value.
13898
</description>
13899
</basetype>
13900
<basetype id="jfieldID">
13901
<description>
13902
Identifies a Java programming language field.
13903
<code>jfieldID</code>s returned by <jvmti/> functions and events may be
13904
safely stored.
13905
</description>
13906
</basetype>
13907
<basetype id="jmethodID">
13908
<description>
13909
Identifies a Java programming language method, initializer, or constructor.
13910
<code>jmethodID</code>s returned by <jvmti/> functions and events may be
13911
safely stored. However, if the class is unloaded, they become invalid
13912
and must not be used.
13913
</description>
13914
</basetype>
13915
<basetype id="JNIEnv">
13916
<description>
13917
Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)
13918
is a JNI environment.
13919
</description>
13920
</basetype>
13921
</basetypes>
13922
13923
<basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">
13924
<basetype id="jvmtiEnv">
13925
<description>
13926
The <jvmti/> <internallink id="environments">environment</internallink> pointer.
13927
See the <internallink id="FunctionSection">Function Section</internallink>.
13928
<code>jvmtiEnv</code> points to the
13929
<internallink id="FunctionTable">function table</internallink> pointer.
13930
</description>
13931
</basetype>
13932
<basetype id="jthread">
13933
<definition>typedef jobject jthread;</definition>
13934
<description>
13935
Subtype of <datalink id="jobject"></datalink> that holds a thread.
13936
</description>
13937
</basetype>
13938
<basetype id="jthreadGroup">
13939
<definition>typedef jobject jthreadGroup;</definition>
13940
<description>
13941
Subtype of <datalink id="jobject"></datalink> that holds a thread group.
13942
</description>
13943
</basetype>
13944
<basetype id="jlocation">
13945
<definition>typedef jlong jlocation;</definition>
13946
<description>
13947
A 64 bit value, representing a monotonically increasing
13948
executable position within a method.
13949
<code>-1</code> indicates a native method.
13950
See <functionlink id="GetJLocationFormat"></functionlink> for the format on a
13951
given VM.
13952
</description>
13953
</basetype>
13954
<basetype id="jrawMonitorID">
13955
<definition>struct _jrawMonitorID;
13956
typedef struct _jrawMonitorID *jrawMonitorID;</definition>
13957
<description>
13958
A raw monitor.
13959
</description>
13960
</basetype>
13961
<basetype id="jvmtiError">
13962
<description>
13963
Holds an error return code.
13964
See the <internallink id="ErrorSection">Error section</internallink> for possible values.
13965
<example>
13966
typedef enum {
13967
JVMTI_ERROR_NONE = 0,
13968
JVMTI_ERROR_INVALID_THREAD = 10,
13969
...
13970
} jvmtiError;
13971
</example>
13972
</description>
13973
</basetype>
13974
<basetype id="jvmtiEvent">
13975
<description>
13976
An identifier for an event type.
13977
See the <internallink id="EventSection">Event section</internallink> for possible values.
13978
It is guaranteed that future versions of this specification will
13979
never assign zero as an event type identifier.
13980
<example>
13981
typedef enum {
13982
JVMTI_EVENT_SINGLE_STEP = 1,
13983
JVMTI_EVENT_BREAKPOINT = 2,
13984
...
13985
} jvmtiEvent;
13986
</example>
13987
</description>
13988
</basetype>
13989
<basetype id="jvmtiEventCallbacks" name="eventCallbacks">
13990
<description>
13991
The callbacks used for events.
13992
<example>
13993
typedef struct {
13994
jvmtiEventVMInit VMInit;
13995
jvmtiEventVMDeath VMDeath;
13996
...
13997
} jvmtiEventCallbacks;
13998
</example>
13999
See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>
14000
for the complete structure.
14001
<p/>
14002
Where, for example, the VM initialization callback is defined:
14003
<example>
14004
typedef void (JNICALL *jvmtiEventVMInit)
14005
(jvmtiEnv *jvmti_env,
14006
JNIEnv* jni_env,
14007
jthread thread);
14008
</example>
14009
See the individual events for the callback function definition.
14010
</description>
14011
</basetype>
14012
<basetype id="jniNativeInterface">
14013
<definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>
14014
<description>
14015
Typedef for the JNI function table <code>JNINativeInterface</code>
14016
defined in the
14017
<externallink id="jni/functions.html#interface-function-table">
14018
JNI Specification</externallink>.
14019
The JNI reference implementation defines this with an underscore.
14020
</description>
14021
</basetype>
14022
</basetypes>
14023
14024
</datasection>
14025
14026
<issuessection label="Issues">
14027
<intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">
14028
JVMDI requires that the agent suspend threads before calling
14029
certain sensitive functions. JVMPI requires garbage collection to be
14030
disabled before calling certain sensitive functions.
14031
It was suggested that rather than have this requirement, that
14032
VM place itself in a suitable state before performing an
14033
operation. This makes considerable sense since each VM
14034
knows its requirements and can most easily arrange a
14035
safe state.
14036
<p/>
14037
The ability to externally suspend/resume threads will, of
14038
course, remain. The ability to enable/disable garbage collection will not.
14039
<p/>
14040
This issue is resolved--suspend will not
14041
be required. The spec has been updated to reflect this.
14042
</intro>
14043
14044
<intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">
14045
There are a variety of approaches to sampling call stacks.
14046
The biggest bifurcation is between VM controlled and agent
14047
controlled.
14048
<p/>
14049
This issue is resolved--agent controlled
14050
sampling will be the approach.
14051
</intro>
14052
14053
<intro id="threadRepresentation" label="Resolved Issue: Thread Representation">
14054
JVMDI represents threads as jthread. JVMPI primarily
14055
uses JNIEnv* to represent threads.
14056
<p/>
14057
The Expert Group has chosen jthread as the representation
14058
for threads in <jvmti/>.
14059
JNIEnv* is sent by
14060
events since it is needed to JNI functions. JNIEnv, per the
14061
JNI spec, are not supposed to be used outside their thread.
14062
</intro>
14063
14064
<intro id="design" label="Resolved Issue: Method Representation">
14065
The JNI spec allows an implementation to depend on jclass/jmethodID
14066
pairs, rather than simply a jmethodID, to reference a method.
14067
JVMDI, for consistency, choose the same representation.
14068
JVMPI, however, specifies that a jmethodID alone maps to a
14069
method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store
14070
pointers in jmethodIDs, and as a result, a jmethodID is sufficient.
14071
In fact, any JVM implementation that supports JVMPI must have
14072
such a representation.
14073
<jvmti/> will use jmethodID as a unique representation of a method
14074
(no jclass is used).
14075
There should be efficiency gains, particularly in
14076
functionality like stack dumping, to this representation.
14077
<p/>
14078
Note that fields were not used in JVMPI and that the access profile
14079
of fields differs from methods--for implementation efficiency
14080
reasons, a jclass/jfieldID pair will still be needed for field
14081
reference.
14082
</intro>
14083
14084
<intro id="localReferenceIssue" label="Resolved Issue: Local References">
14085
Functions return local references.
14086
</intro>
14087
14088
<intro id="frameRep" label="Resolved Issue: Representation of frames">
14089
In JVMDI, a frame ID is used to represent a frame. Problem with this
14090
is that a VM must track when a frame becomes invalid, a far better
14091
approach, and the one used in <jvmti/>, is to reference frames by depth.
14092
</intro>
14093
14094
<intro id="requiredCapabilities" label="Issue: Required Capabilities">
14095
Currently, having a required capabilities means that the functionality
14096
is optional. Capabilities are useful even for required functionality
14097
since they can inform the VM is needed set-up. Thus, there should be
14098
a set of capabilities that a conformant implementation must provide
14099
(if requested during Agent_OnLoad).
14100
</intro>
14101
14102
<intro id="taghint" label="Proposal: add tag hint function">
14103
A hint of the percentage of objects that will be tagged would
14104
help the VM pick a good implementation.
14105
</intro>
14106
14107
<intro id="moreMonitorQueries" label="Request: More Monitor Quires">
14108
How difficult or easy would be to extend the monitor_info category to include
14109
<pre>
14110
- current number of monitors
14111
- enumeration of monitors
14112
- enumeration of threads waiting on a given monitor
14113
</pre>
14114
The reason for my question is the fact that current get_monitor_info support
14115
requires the agent to specify a given thread to get the info which is probably
14116
OK in the profiling/debugging space, while in the monitoring space the agent
14117
could be watching the monitor list and then decide which thread to ask for
14118
the info. You might ask why is this important for monitoring .... I think it
14119
can aid in the detection/prediction of application contention caused by hot-locks.
14120
</intro>
14121
</issuessection>
14122
14123
<changehistory id="ChangeHistory" update="09/05/07">
14124
<intro>
14125
The <jvmti/> specification is an evolving document with major, minor,
14126
and micro version numbers.
14127
A released version of the specification is uniquely identified
14128
by its major and minor version.
14129
The functions, events, and capabilities in this specification
14130
indicate a "Since" value which is the major and minor version in
14131
which it was introduced.
14132
The version of the specification implemented by the VM can
14133
be retrieved at runtime with the <functionlink id="GetVersionNumber"/>
14134
function.
14135
</intro>
14136
<change date="14 Nov 2002">
14137
Converted to XML document.
14138
</change>
14139
<change date="14 Nov 2002">
14140
Elided heap dump functions (for now) since what was there
14141
was wrong.
14142
</change>
14143
<change date="18 Nov 2002">
14144
Added detail throughout.
14145
</change>
14146
<change date="18 Nov 2002">
14147
Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.
14148
</change>
14149
<change date="19 Nov 2002">
14150
Added AsyncGetStackTrace.
14151
</change>
14152
<change date="19 Nov 2002">
14153
Added jframeID return to GetStackTrace.
14154
</change>
14155
<change date="19 Nov 2002">
14156
Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there
14157
since they are redundant with GetStackTrace.
14158
</change>
14159
<change date="19 Nov 2002">
14160
Elided ClearAllBreakpoints since it has always been redundant.
14161
</change>
14162
<change date="19 Nov 2002">
14163
Added GetSystemProperties.
14164
</change>
14165
<change date="19 Nov 2002">
14166
Changed the thread local storage functions to use jthread.
14167
</change>
14168
<change date="20 Nov 2002">
14169
Added GetJLocationFormat.
14170
</change>
14171
<change date="22 Nov 2002">
14172
Added events and introductory text.
14173
</change>
14174
<change date="22 Nov 2002">
14175
Cross reference type and constant definitions.
14176
</change>
14177
<change date="24 Nov 2002">
14178
Added DTD.
14179
</change>
14180
<change date="24 Nov 2002">
14181
Added capabilities function section.
14182
</change>
14183
<change date="29 Nov 2002">
14184
Assign capabilities to each function and event.
14185
</change>
14186
<change date="29 Nov 2002">
14187
Add <internallink id="jniIntercept">JNI interception functions</internallink>.
14188
</change>
14189
<change date="30 Nov 2002">
14190
Auto generate SetEventNotificationMode capabilities.
14191
</change>
14192
<change date="30 Nov 2002">
14193
Add <eventlink id="VMObjectAlloc"></eventlink> event.
14194
</change>
14195
<change date="30 Nov 2002">
14196
Add <eventlink id="DynamicCodeGenerated"></eventlink> event.
14197
</change>
14198
<change date="30 Nov 2002">
14199
Add const to declarations.
14200
</change>
14201
<change date="30 Nov 2002">
14202
Change method exit and frame pop to send on exception.
14203
</change>
14204
<change date="1 Dec 2002">
14205
Add ForceGarbageCollection.
14206
</change>
14207
<change date="2 Dec 2002">
14208
Redo Xrun section; clarify GetStackTrace and add example;
14209
Fix width problems; use "agent" consistently.
14210
</change>
14211
<change date="8 Dec 2002">
14212
Remove previous start-up intro.
14213
Add <internallink id="environments"><jvmti/> Environments</internallink>
14214
section.
14215
</change>
14216
<change date="8 Dec 2002">
14217
Add <functionlink id="DisposeEnvironment"></functionlink>.
14218
</change>
14219
<change date="9 Dec 2002">
14220
Numerous minor updates.
14221
</change>
14222
<change date="15 Dec 2002">
14223
Add heap profiling functions added:
14224
get/set annotation, iterate live objects/heap.
14225
Add heap profiling functions place holder added:
14226
heap roots.
14227
Heap profiling event added: object free.
14228
Heap profiling event redesigned: vm object allocation.
14229
Heap profiling event placeholders added: garbage collection start/finish.
14230
Native method bind event added.
14231
</change>
14232
<change date="19 Dec 2002">
14233
Revamp suspend/resume functions.
14234
Add origin information with jvmdi tag.
14235
Misc fixes.
14236
</change>
14237
<change date="24 Dec 2002">
14238
Add semantics to types.
14239
</change>
14240
<change date="27 Dec 2002">
14241
Add local reference section.
14242
Autogenerate parameter descriptions from types.
14243
</change>
14244
<change date="28 Dec 2002">
14245
Document that RunAgentThread sends threadStart.
14246
</change>
14247
<change date="29 Dec 2002">
14248
Remove redundant local ref and dealloc warning.
14249
Convert GetRawMonitorName to allocated buffer.
14250
Add GenerateEvents.
14251
</change>
14252
<change date="30 Dec 2002">
14253
Make raw monitors a type and rename to "jrawMonitorID".
14254
</change>
14255
<change date="1 Jan 2003">
14256
Include origin information.
14257
Clean-up JVMDI issue references.
14258
Remove Deallocate warnings which are now automatically generated.
14259
</change>
14260
<change date="2 Jan 2003">
14261
Fix representation issues for jthread.
14262
</change>
14263
<change date="3 Jan 2003">
14264
Make capabilities buffered out to 64 bits - and do it automatically.
14265
</change>
14266
<change date="4 Jan 2003">
14267
Make constants which are enumeration into enum types.
14268
Parameters now of enum type.
14269
Clean-up and index type section.
14270
Replace remaining datadef entities with callback.
14271
</change>
14272
<change date="7 Jan 2003">
14273
Correct GenerateEvents description.
14274
More internal semantics work.
14275
</change>
14276
<change date="9 Jan 2003">
14277
Replace previous GetSystemProperties with two functions
14278
which use allocated information instead fixed.
14279
Add SetSystemProperty.
14280
More internal semantics work.
14281
</change>
14282
<change date="12 Jan 2003">
14283
Add varargs to end of SetEventNotificationMode.
14284
</change>
14285
<change date="20 Jan 2003">
14286
Finish fixing spec to reflect that alloc sizes are jlong.
14287
</change>
14288
<change date="22 Jan 2003">
14289
Allow NULL as RunAgentThread arg.
14290
</change>
14291
<change date="22 Jan 2003">
14292
Fixed names to standardized naming convention
14293
Removed AsyncGetStackTrace.
14294
</change>
14295
<change date="29 Jan 2003">
14296
Since we are using jthread, removed GetThread.
14297
</change>
14298
<change date="31 Jan 2003">
14299
Change GetFieldName to allow NULLs like GetMethodName.
14300
</change>
14301
<change date="29 Feb 2003" version="v40">
14302
Rewrite the introductory text, adding sections on
14303
start-up, environments and bytecode instrumentation.
14304
Change the command line arguments per EG discussions.
14305
Add an introduction to the capabilities section.
14306
Add the extension mechanism category and functions.
14307
Mark for deletion, but clarified anyhow, SuspendAllThreads.
14308
Rename IterateOverLiveObjects to IterateOverReachableObjects and
14309
change the text accordingly.
14310
Clarify IterateOverHeap.
14311
Clarify CompiledMethodLoad.
14312
Discuss prerequisite state for Calling Functions.
14313
Clarify SetAllocationHooks.
14314
Added issues ("To be resolved:") through-out.
14315
And so on...
14316
</change>
14317
<change date="6 Mar 2003" version="v41">
14318
Remove struct from the call to GetOwnedMonitorInfo.
14319
Automatically generate most error documentation, remove
14320
(rather broken) hand written error doc.
14321
Better describe capability use (empty initial set).
14322
Add min value to jint params.
14323
Remove the capability can_access_thread_local_storage.
14324
Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
14325
same for *NOT_IMPLEMENTED.
14326
Description fixes.
14327
</change>
14328
<change date="8 Mar 2003" version="v42">
14329
Rename GetClassSignature to GetClassName.
14330
Rename IterateOverClassObjects to IterateOverInstancesOfClass.
14331
Remove GetMaxStack (operand stack isn't used in <jvmti/>).
14332
Description fixes: define launch-time, remove native frame pop
14333
from PopFrame, and assorted clarifications.
14334
</change>
14335
<change date="8 Mar 2003" version="v43">
14336
Fix minor editing problem.
14337
</change>
14338
<change date="10 Mar 2003" version="v44">
14339
Add phase information.
14340
Remap (compact) event numbers.
14341
</change>
14342
<change date="11 Mar 2003" version="v45">
14343
More phase information - allow "any".
14344
Elide raw monitor queries and events.
14345
Minor description fixes.
14346
</change>
14347
<change date="12 Mar 2003" version="v46">
14348
Add GetPhase.
14349
Use "phase" through document.
14350
Elide GetRawMonitorName.
14351
Elide GetObjectMonitors.
14352
</change>
14353
<change date="12 Mar 2003" version="v47">
14354
Fixes from link, XML, and spell checking.
14355
Auto-generate the callback structure.
14356
</change>
14357
<change date="13 Mar 2003" version="v48">
14358
One character XML fix.
14359
</change>
14360
<change date="13 Mar 2003" version="v49">
14361
Change function parameter names to be consistent with
14362
event parameters (fooBarBaz becomes foo_bar_baz).
14363
</change>
14364
<change date="14 Mar 2003" version="v50">
14365
Fix broken link. Fix thread markers.
14366
</change>
14367
<change date="14 Mar 2003" version="v51">
14368
Change constants so they are under 128 to workaround
14369
compiler problems.
14370
</change>
14371
<change date="23 Mar 2003" version="v52">
14372
Overhaul capabilities. Separate GetStackTrace into
14373
GetStackTrace and GetStackFrames.
14374
</change>
14375
<change date="8 Apr 2003" version="v54">
14376
Use depth instead of jframeID to reference frames.
14377
Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.
14378
Remove frame arg from events.
14379
</change>
14380
<change date="9 Apr 2003" version="v55">
14381
Remove GetObjectWithAnnotation since tests show bufferred approach more efficient.
14382
Add missing annotation_count to GetObjectsWithAnnotations
14383
</change>
14384
<change date="10 Apr 2003" version="v56">
14385
Remove confusing parenthetical statement in GetObjectsWithAnnotations
14386
</change>
14387
<change date="13 Apr 2003" version="v58">
14388
Replace jclass/jmethodID representation of method with simply jmethodID;
14389
Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.
14390
Replace can_access_frames with can_access_local_variables; remove from purely stack access.
14391
Use can_get_synthetic_attribute; fix description.
14392
Clarify that zero length arrays must be deallocated.
14393
Clarify RelinquishCapabilities.
14394
Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.
14395
</change>
14396
<change date="27 Apr 2003" version="v59">
14397
Remove lingering indirect references to OBSOLETE_METHOD_ID.
14398
</change>
14399
<change date="4 May 2003" version="v60">
14400
Allow DestroyRawMonitor during OnLoad.
14401
</change>
14402
<change date="7 May 2003" version="v61">
14403
Added not monitor owner error return to DestroyRawMonitor.
14404
</change>
14405
<change date="13 May 2003" version="v62">
14406
Clarify semantics of raw monitors.
14407
Change flags on <code>GetThreadStatus</code>.
14408
<code>GetClassLoader</code> return NULL for the bootstrap class loader.
14409
Add <code>GetClassName</code> issue.
14410
Define local variable signature.
14411
Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.
14412
Remove over specification in <code>GetObjectsWithAnnotations</code>.
14413
Elide <code>SetAllocationHooks</code>.
14414
Elide <code>SuspendAllThreads</code>.
14415
</change>
14416
<change date="14 May 2003" version="v63">
14417
Define the data type <code>jvmtiEventCallbacks</code>.
14418
Zero length allocations return NULL.
14419
Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.
14420
Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.
14421
</change>
14422
<change date="15 May 2003" version="v64">
14423
Better wording, per review.
14424
</change>
14425
<change date="15 May 2003" version="v65">
14426
First Alpha.
14427
Make jmethodID and jfieldID unique, jclass not used.
14428
</change>
14429
<change date="27 May 2003" version="v66">
14430
Fix minor XSLT errors.
14431
</change>
14432
<change date="13 June 2003" version="v67">
14433
Undo making jfieldID unique (jmethodID still is).
14434
</change>
14435
<change date="17 June 2003" version="v68">
14436
Changes per June 11th Expert Group meeting --
14437
Overhaul Heap functionality: single callback,
14438
remove GetHeapRoots, add reachable iterators,
14439
and rename "annotation" to "tag".
14440
NULL thread parameter on most functions is current
14441
thread.
14442
Add timers.
14443
Remove ForceExit.
14444
Add GetEnvironmentLocalStorage.
14445
Add verbose flag and event.
14446
Add AddToBootstrapClassLoaderSearch.
14447
Update ClassFileLoadHook.
14448
</change>
14449
<change date="18 June 2003" version="v69">
14450
Clean up issues sections.
14451
Rename GetClassName back to GetClassSignature and
14452
fix description.
14453
Add generic signature to GetClassSignature,
14454
GetFieldSignature, GetMethodSignature, and
14455
GetLocalVariableTable.
14456
Elide EstimateCostOfCapabilities.
14457
Clarify that the system property functions operate
14458
on the VM view of system properties.
14459
Clarify Agent_OnLoad.
14460
Remove "const" from JNIEnv* in events.
14461
Add metadata accessors.
14462
</change>
14463
<change date="18 June 2003" version="v70">
14464
Add start_depth to GetStackTrace.
14465
Move system properties to a new category.
14466
Add GetObjectSize.
14467
Remove "X" from command line flags.
14468
XML, HTML, and spell check corrections.
14469
</change>
14470
<change date="19 June 2003" version="v71">
14471
Fix JVMTI_HEAP_ROOT_THREAD to be 6.
14472
Make each synopsis match the function name.
14473
Fix unclear wording.
14474
</change>
14475
<change date="26 June 2003" version="v72">
14476
SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value
14477
to be set to NULL.
14478
NotifyFramePop, GetFrameLocationm and all the local variable operations
14479
needed to have their wording about frames fixed.
14480
Grammar and clarity need to be fixed throughout.
14481
Capitalization and puntuation need to be consistent.
14482
Need micro version number and masks for accessing major, minor, and micro.
14483
The error code lists should indicate which must be returned by
14484
an implementation.
14485
The command line properties should be visible in the properties functions.
14486
Disallow popping from the current thread.
14487
Allow implementations to return opaque frame error when they cannot pop.
14488
The NativeMethodBind event should be sent during any phase.
14489
The DynamicCodeGenerated event should be sent during any phase.
14490
The following functions should be allowed to operate before VMInit:
14491
Set/GetEnvironmentLocalStorage
14492
GetMethodDeclaringClass
14493
GetClassSignature
14494
GetClassModifiers
14495
IsInterface
14496
IsArrayClass
14497
GetMethodName
14498
GetMethodModifiers
14499
GetMaxLocals
14500
GetArgumentsSize
14501
GetLineNumberTable
14502
GetMethodLocation
14503
IsMethodNative
14504
IsMethodSynthetic.
14505
Other changes (to XSL):
14506
Argument description should show asterisk after not before pointers.
14507
NotifyFramePop, GetFrameLocationm and all the local variable operations
14508
should hsve the NO_MORE_FRAMES error added.
14509
Not alive threads should have a different error return than invalid thread.
14510
</change>
14511
<change date="7 July 2003" version="v73">
14512
VerboseOutput event was missing message parameter.
14513
Minor fix-ups.
14514
</change>
14515
<change date="14 July 2003" version="v74">
14516
Technical Publications Department corrections.
14517
Allow thread and environment local storage to be set to NULL.
14518
</change>
14519
<change date="23 July 2003" version="v75">
14520
Use new Agent_OnLoad rather than overloaded JVM_OnLoad.
14521
Add JNICALL to callbacks (XSL).
14522
Document JNICALL requirement for both events and callbacks (XSL).
14523
Restrict RedefineClasses to methods and attributes.
14524
Elide the VerboseOutput event.
14525
VMObjectAlloc: restrict when event is sent and remove method parameter.
14526
Finish loose ends from Tech Pubs edit.
14527
</change>
14528
<change date="24 July 2003" version="v76">
14529
Change ClassFileLoadHook event to send the class instead of a boolean of redefine.
14530
</change>
14531
<change date="24 July 2003" version="v77">
14532
XML fixes.
14533
Minor text clarifications and corrections.
14534
</change>
14535
<change date="24 July 2003" version="v78">
14536
Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.
14537
Clarify that stack frames are JVM Spec frames.
14538
Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,
14539
and can_get_source_debug_extension.
14540
PopFrame cannot have a native calling method.
14541
Removed incorrect statement in GetClassloaderClasses
14542
(see <vmspec chapter="4.4"/>).
14543
</change>
14544
<change date="24 July 2003" version="v79">
14545
XML and text fixes.
14546
Move stack frame description into Stack Frame category.
14547
</change>
14548
<change date="26 July 2003" version="v80">
14549
Allow NULL (means bootstrap loader) for GetClassloaderClasses.
14550
Add new heap reference kinds for references from classes.
14551
Add timer information struct and query functions.
14552
Add AvailableProcessors.
14553
Rename GetOtherThreadCpuTime to GetThreadCpuTime.
14554
Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE
14555
to SetEventNotification mode.
14556
Add initial thread to the VM_INIT event.
14557
Remove platform assumptions from AddToBootstrapClassLoaderSearch.
14558
</change>
14559
<change date="26 July 2003" version="v81">
14560
Grammar and clarity changes per review.
14561
</change>
14562
<change date="27 July 2003" version="v82">
14563
More grammar and clarity changes per review.
14564
Add Agent_OnUnload.
14565
</change>
14566
<change date="28 July 2003" version="v83">
14567
Change return type of Agent_OnUnload to void.
14568
</change>
14569
<change date="28 July 2003" version="v84">
14570
Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.
14571
</change>
14572
<change date="28 July 2003" version="v85">
14573
Steal java.lang.Runtime.availableProcessors() wording for
14574
AvailableProcessors().
14575
Guarantee that zero will never be an event ID.
14576
Remove some issues which are no longer issues.
14577
Per review, rename and more completely document the timer
14578
information functions.
14579
</change>
14580
<change date="29 July 2003" version="v86">
14581
Non-spec visible change to XML controlled implementation:
14582
SetThreadLocalStorage must run in VM mode.
14583
</change>
14584
<change date="5 August 2003" version="0.1.87">
14585
Add GetErrorName.
14586
Add varargs warning to jvmtiExtensionEvent.
14587
Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.
14588
Remove unused can_get_exception_info capability.
14589
Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.
14590
Fix jvmtiExtensionFunctionInfo.func declared type.
14591
Extension function returns error code.
14592
Use new version numbering.
14593
</change>
14594
<change date="5 August 2003" version="0.2.88">
14595
Remove the ClassUnload event.
14596
</change>
14597
<change date="8 August 2003" version="0.2.89">
14598
Heap reference iterator callbacks return an enum that
14599
allows outgoing object references to be ignored.
14600
Allow JNIEnv as a param type to extension events/functions.
14601
</change>
14602
<change date="15 August 2003" version="0.2.90">
14603
Fix a typo.
14604
</change>
14605
<change date="2 September 2003" version="0.2.91">
14606
Remove all metadata functions: GetClassMetadata,
14607
GetFieldMetadata, and GetMethodMetadata.
14608
</change>
14609
<change date="1 October 2003" version="0.2.92">
14610
Mark the functions Allocate. Deallocate, RawMonitor*,
14611
SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage
14612
as safe for use in heap callbacks and GC events.
14613
</change>
14614
<change date="24 November 2003" version="0.2.93">
14615
Add pass through opaque user data pointer to heap iterate
14616
functions and callbacks.
14617
In the CompiledMethodUnload event, send the code address.
14618
Add GarbageCollectionOccurred event.
14619
Add constant pool reference kind.
14620
Mark the functions CreateRawMonitor and DestroyRawMonitor
14621
as safe for use in heap callbacks and GC events.
14622
Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,
14623
GetThreadCpuTimerInfo, IterateOverReachableObjects,
14624
IterateOverObjectsReachableFromObject, GetTime and
14625
JVMTI_ERROR_NULL_POINTER.
14626
Add missing errors to: GenerateEvents and
14627
AddToBootstrapClassLoaderSearch.
14628
Fix description of ClassFileLoadHook name parameter.
14629
In heap callbacks and GC/ObjectFree events, specify
14630
that only explicitly allowed functions can be called.
14631
Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,
14632
GetTimerInfo, and GetTime during callback.
14633
Allow calling SetTag/GetTag during the onload phase.
14634
SetEventNotificationMode, add: error attempted inappropriate
14635
thread level control.
14636
Remove jvmtiExceptionHandlerEntry.
14637
Fix handling of native methods on the stack --
14638
location_ptr param of GetFrameLocation, remove
14639
JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,
14640
jvmtiFrameInfo.location, and jlocation.
14641
Remove typo (from JVMPI) implying that the MonitorWaited
14642
event is sent on sleep.
14643
</change>
14644
<change date="25 November 2003" version="0.2.94">
14645
Clarifications and typos.
14646
</change>
14647
<change date="3 December 2003" version="0.2.95">
14648
Allow NULL user_data in heap iterators.
14649
</change>
14650
<change date="28 January 2004" version="0.2.97">
14651
Add GetThreadState, deprecate GetThreadStatus.
14652
</change>
14653
<change date="29 January 2004" version="0.2.98">
14654
INVALID_SLOT and TYPE_MISMATCH errors should be optional.
14655
</change>
14656
<change date="12 February 2004" version="0.2.102">
14657
Remove MonitorContendedExit.
14658
Added JNIEnv parameter to VMObjectAlloc.
14659
Clarified definition of class_tag and referrer_index
14660
parameters to heap callbacks.
14661
</change>
14662
<change date="16 Febuary 2004" version="0.2.103">
14663
Document JAVA_TOOL_OPTIONS.
14664
</change>
14665
<change date="17 Febuary 2004" version="0.2.105">
14666
Divide start phase into primordial and start.
14667
Add VMStart event
14668
Change phase associations of functions and events.
14669
</change>
14670
<change date="18 Febuary 2004" version="0.3.6">
14671
Elide deprecated GetThreadStatus.
14672
Bump minor version, subtract 100 from micro version
14673
</change>
14674
<change date="18 Febuary 2004" version="0.3.7">
14675
Document that timer nanosecond values are unsigned.
14676
Clarify text having to do with native methods.
14677
</change>
14678
<change date="19 Febuary 2004" version="0.3.8">
14679
Fix typos.
14680
Remove elided deprecated GetThreadStatus.
14681
</change>
14682
<change date="23 Febuary 2004" version="0.3.9">
14683
Require NotifyFramePop to act on suspended threads.
14684
</change>
14685
<change date="24 Febuary 2004" version="0.3.10">
14686
Add capabilities
14687
(<internallink id="jvmtiCapabilities.can_redefine_any_class"
14688
><code>can_redefine_any_class</code></internallink>
14689
and
14690
<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"
14691
><code>can_generate_all_class_hook_events</code></internallink>)
14692
and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)
14693
which allow some classes to be unmodifiable.
14694
</change>
14695
<change date="28 Febuary 2004" version="0.3.11">
14696
Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.
14697
</change>
14698
<change date="8 March 2004" version="0.3.12">
14699
Clarified CompiledMethodUnload so that it is clear the event
14700
may be posted after the class has been unloaded.
14701
</change>
14702
<change date="5 March 2004" version="0.3.13">
14703
Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.
14704
</change>
14705
<change date="13 March 2004" version="0.3.14">
14706
Added guideline for the use of the JNI FindClass function in event
14707
callback functions.
14708
</change>
14709
<change date="15 March 2004" version="0.3.15">
14710
Add GetAllStackTraces and GetThreadListStackTraces.
14711
</change>
14712
<change date="19 March 2004" version="0.3.16">
14713
ClassLoad and ClassPrepare events can be posted during start phase.
14714
</change>
14715
<change date="25 March 2004" version="0.3.17">
14716
Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,
14717
GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.
14718
</change>
14719
<change date="29 March 2004" version="0.3.18">
14720
Return the timer kind in the timer information structure.
14721
</change>
14722
<change date="31 March 2004" version="0.3.19">
14723
Spec clarifications:
14724
JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.
14725
ForceGarbageCollection does not run finalizers.
14726
The context of the specification is the Java platform.
14727
Warn about early instrumentation.
14728
</change>
14729
<change date="1 April 2004" version="0.3.20">
14730
Refinements to the above clarifications and
14731
Clarify that an error returned by Agent_OnLoad terminates the VM.
14732
</change>
14733
<change date="1 April 2004" version="0.3.21">
14734
Array class creation does not generate a class load event.
14735
</change>
14736
<change date="7 April 2004" version="0.3.22">
14737
Align thread state hierarchy more closely with java.lang.Thread.State.
14738
</change>
14739
<change date="12 April 2004" version="0.3.23">
14740
Clarify the documentation of thread state.
14741
</change>
14742
<change date="19 April 2004" version="0.3.24">
14743
Remove GarbageCollectionOccurred event -- can be done by agent.
14744
</change>
14745
<change date="22 April 2004" version="0.3.25">
14746
Define "command-line option".
14747
</change>
14748
<change date="29 April 2004" version="0.3.26">
14749
Describe the intended use of bytecode instrumentation.
14750
Fix description of extension event first parameter.
14751
</change>
14752
<change date="30 April 2004" version="0.3.27">
14753
Clarification and typos.
14754
</change>
14755
<change date="18 May 2004" version="0.3.28">
14756
Remove DataDumpRequest event.
14757
</change>
14758
<change date="18 May 2004" version="0.3.29">
14759
Clarify RawMonitorWait with zero timeout.
14760
Clarify thread state after RunAgentThread.
14761
</change>
14762
<change date="24 May 2004" version="0.3.30">
14763
Clean-up: fix bad/old links, etc.
14764
</change>
14765
<change date="30 May 2004" version="0.3.31">
14766
Clarifications including:
14767
All character strings are modified UTF-8.
14768
Agent thread visibiity.
14769
Meaning of obsolete method version.
14770
Thread invoking heap callbacks,
14771
</change>
14772
<change date="1 June 2004" version="1.0.32">
14773
Bump major.minor version numbers to "1.0".
14774
</change>
14775
<change date="2 June 2004" version="1.0.33">
14776
Clarify interaction between ForceGarbageCollection
14777
and ObjectFree.
14778
</change>
14779
<change date="6 June 2004" version="1.0.34">
14780
Restrict AddToBootstrapClassLoaderSearch and
14781
SetSystemProperty to the OnLoad phase only.
14782
</change>
14783
<change date="11 June 2004" version="1.0.35">
14784
Fix typo in SetTag.
14785
</change>
14786
<change date="18 June 2004" version="1.0.36">
14787
Fix trademarks.
14788
Add missing parameter in example GetThreadState usage.
14789
</change>
14790
<change date="4 August 2004" version="1.0.37">
14791
Copyright updates.
14792
</change>
14793
<change date="5 November 2004" version="1.0.38">
14794
Add missing function table layout.
14795
Add missing description of C++ member function format of functions.
14796
Clarify that name in CFLH can be NULL.
14797
Released as part of <tm>J2SE</tm> 5.0.
14798
</change>
14799
<change date="24 April 2005" version="1.1.47">
14800
Bump major.minor version numbers to "1.1".
14801
Add ForceEarlyReturn* functions.
14802
Add GetOwnedMonitorStackDepthInfo function.
14803
Add GetCurrentThread function.
14804
Add "since" version marker.
14805
Add AddToSystemClassLoaderSearch.
14806
Allow AddToBootstrapClassLoaderSearch be used in live phase.
14807
Fix historic rubbish in the descriptions of the heap_object_callback
14808
parameter of IterateOverHeap and IterateOverInstancesOfClass functions;
14809
disallow NULL for this parameter.
14810
Clarify, correct and make consistent: wording about current thread,
14811
opaque frames and insufficient number of frames in PopFrame.
14812
Consistently use "current frame" rather than "topmost".
14813
Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*
14814
by making them compatible with those in ForceEarlyReturn*.
14815
Many other clarifications and wording clean ups.
14816
</change>
14817
<change date="25 April 2005" version="1.1.48">
14818
Add GetConstantPool.
14819
Switch references to the first edition of the VM Spec, to the seconds edition.
14820
</change>
14821
<change date="26 April 2005" version="1.1.49">
14822
Clarify minor/major version order in GetConstantPool.
14823
</change>
14824
<change date="26 April 2005" version="1.1.50">
14825
Add SetNativeMethodPrefix and SetNativeMethodPrefixes.
14826
Reassign GetOwnedMonitorStackDepthInfo to position 153.
14827
Break out Class Loader Search in its own documentation category.
14828
Deal with overly long lines in XML source.
14829
</change>
14830
<change date="29 April 2005" version="1.1.51">
14831
Allow agents be started in the live phase.
14832
Added paragraph about deploying agents.
14833
</change>
14834
<change date="30 April 2005" version="1.1.52">
14835
Add specification description to SetNativeMethodPrefix(es).
14836
Better define the conditions on GetConstantPool.
14837
</change>
14838
<change date="30 April 2005" version="1.1.53">
14839
Break out the GetClassVersionNumber function from GetConstantPool.
14840
Clean-up the references to the VM Spec.
14841
</change>
14842
<change date="1 May 2005" version="1.1.54">
14843
Allow SetNativeMethodPrefix(es) in any phase.
14844
Add clarifications about the impact of redefinition on GetConstantPool.
14845
</change>
14846
<change date="2 May 2005" version="1.1.56">
14847
Various clarifications to SetNativeMethodPrefix(es).
14848
</change>
14849
<change date="2 May 2005" version="1.1.57">
14850
Add missing performance warning to the method entry event.
14851
</change>
14852
<change date="5 May 2005" version="1.1.58">
14853
Remove internal JVMDI support.
14854
</change>
14855
<change date="8 May 2005" version="1.1.59">
14856
Add <functionlink id="RetransformClasses"/>.
14857
Revamp the bytecode instrumentation documentation.
14858
Change <functionlink id="IsMethodObsolete"/> to no longer
14859
require the can_redefine_classes capability.
14860
</change>
14861
<change date="11 May 2005" version="1.1.63">
14862
Clarifications for retransformation.
14863
</change>
14864
<change date="11 May 2005" version="1.1.64">
14865
Clarifications for retransformation, per review.
14866
Lock "retransformation (in)capable" at class load enable time.
14867
</change>
14868
<change date="4 June 2005" version="1.1.67">
14869
Add new heap functionity which supports reporting primitive values,
14870
allows setting the referrer tag, and has more powerful filtering:
14871
FollowReferences, IterateThroughHeap, and their associated
14872
callbacks, structs, enums, and constants.
14873
</change>
14874
<change date="4 June 2005" version="1.1.68">
14875
Clarification.
14876
</change>
14877
<change date="6 June 2005" version="1.1.69">
14878
FollowReferences, IterateThroughHeap: Put callbacks in a struct;
14879
Add missing error codes; reduce bits in the visit control flags.
14880
</change>
14881
<change date="14 June 2005" version="1.1.70">
14882
More on new heap functionity: spec clean-up per review.
14883
</change>
14884
<change date="15 June 2005" version="1.1.71">
14885
More on new heap functionity: Rename old heap section to Heap (1.0).
14886
</change>
14887
<change date="21 June 2005" version="1.1.72">
14888
Fix typos.
14889
</change>
14890
<change date="27 June 2005" version="1.1.73">
14891
Make referrer info structure a union.
14892
</change>
14893
<change date="9 September 2005" version="1.1.74">
14894
In new heap functions:
14895
Add missing superclass reference kind.
14896
Use a single scheme for computing field indexes.
14897
Remove outdated references to struct based referrer info.
14898
</change>
14899
<change date="12 September 2005" version="1.1.75">
14900
Don't callback during FollowReferences on frivolous java.lang.Object superclass.
14901
</change>
14902
<change date="13 September 2005" version="1.1.76">
14903
In string primitive callback, length now Unicode length.
14904
In array and string primitive callbacks, value now "const".
14905
Note possible compiler impacts on setting JNI function table.
14906
</change>
14907
<change date="13 September 2005" version="1.1.77">
14908
GetClassVersionNumbers() and GetConstantPool() should return
14909
error on array or primitive class.
14910
</change>
14911
<change date="14 September 2005" version="1.1.78">
14912
Grammar fixes.
14913
</change>
14914
<change date="26 September 2005" version="1.1.79">
14915
Add IsModifiableClass query.
14916
</change>
14917
<change date="9 February 2006" version="1.1.81">
14918
Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.
14919
</change>
14920
<change date="13 February 2006" version="1.1.82">
14921
Doc fixes: update can_redefine_any_class to include retransform.
14922
Clarify that exception events cover all Throwables.
14923
In GetStackTrace, no test is done for start_depth too big if start_depth is zero,
14924
Clarify fields reported in Primitive Field Callback -- static vs instance.
14925
Repair confusing names of heap types, including callback names.
14926
Require consistent usage of stack depth in the face of thread launch methods.
14927
Note incompatibility of <jvmti/> memory management with other systems.
14928
</change>
14929
<change date="14 February 2006" version="1.1.85">
14930
Fix typos and missing renames.
14931
</change>
14932
<change date="13 March 2006" version="1.1.86">
14933
Clarify that jmethodIDs and jfieldIDs can be saved.
14934
Clarify that Iterate Over Instances Of Class includes subclasses.
14935
</change>
14936
<change date="14 March 2006" version="1.1.87">
14937
Better phrasing.
14938
</change>
14939
<change date="16 March 2006" version="1.1.88">
14940
Match the referrer_index for static fields in Object Reference Callback
14941
with the Reference Implementation (and all other known implementations);
14942
that is, make it match the definition for instance fields.
14943
In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover
14944
an invalid thread in the list; and specify that not started threads
14945
return empty stacks.
14946
</change>
14947
<change date="17 March 2006" version="1.1.89">
14948
Typo.
14949
</change>
14950
<change date="25 March 2006" version="1.1.90">
14951
Typo.
14952
</change>
14953
<change date="6 April 2006" version="1.1.91">
14954
Remove restrictions on AddToBootstrapClassLoaderSearch and
14955
AddToSystemClassLoaderSearch.
14956
</change>
14957
<change date="1 May 2006" version="1.1.93">
14958
Changed spec to return -1 for monitor stack depth for the
14959
implementation which can not determine stack depth.
14960
</change>
14961
<change date="3 May 2006" version="1.1.94">
14962
Corrections for readability and accuracy courtesy of Alan Pratt of IBM.
14963
List the object relationships reported in FollowReferences.
14964
</change>
14965
<change date="5 May 2006" version="1.1.95">
14966
Clarify the object relationships reported in FollowReferences.
14967
</change>
14968
<change date="28 June 2006" version="1.1.98">
14969
Clarify DisposeEnvironment; add warning.
14970
Fix typos in SetLocalXXX "retrieve" => "set".
14971
Clarify that native method prefixes must remain set while used.
14972
Clarify that exactly one Agent_OnXXX is called per agent.
14973
Clarify that library loading is independent from start-up.
14974
Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.
14975
</change>
14976
<change date="31 July 2006" version="1.1.99">
14977
Clarify the interaction between functions and exceptions.
14978
Clarify and give examples of field indices.
14979
Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.
14980
Update links to point to Java 6.
14981
</change>
14982
<change date="6 August 2006" version="1.1.102">
14983
Add ResourceExhaustedEvent.
14984
</change>
14985
<change date="11 October 2012" version="1.2.2">
14986
Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.
14987
</change>
14988
<change date="19 June 2013" version="1.2.3">
14989
Added support for statically linked agents.
14990
</change>
14991
<change date="13 October 2016" version="9.0.0">
14992
Support for modules:
14993
- The majorversion is 9 now
14994
- The ClassFileLoadHook events are not sent during the primordial phase anymore.
14995
- Allow CompiledMethodLoad events at start phase
14996
- Add new capabilities:
14997
- can_generate_early_vmstart
14998
- can_generate_early_class_hook_events
14999
- Add new functions:
15000
- GetAllModules
15001
- AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides
15002
- IsModifiableModule
15003
Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to
15004
disallow some implementation defined classes.
15005
</change>
15006
<change date="12 February 2017" version="9.0.0">
15007
Minor update for GetCurrentThread function:
15008
- The function may return NULL in the start phase if the
15009
can_generate_early_vmstart capability is enabled.
15010
</change>
15011
<change date="7 February 2018" version="11.0.0">
15012
Minor update for new class file NestHost and NestMembers attributes:
15013
- Specify that RedefineClasses and RetransformClasses are not allowed
15014
to change the class file NestHost and NestMembers attributes.
15015
- Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED
15016
that can be returned by RedefineClasses and RetransformClasses.
15017
</change>
15018
<change date="20 May 2019" version="13.0.0">
15019
Minor spec update for the capability "can_redefine_any_class".
15020
It now says:
15021
"RedefineClasses can be called on any modifiable class. See IsModifiableClass.
15022
(can_redefine_classes must also be set)"
15023
</change>
15024
<change date="5 June 2019" version="13.0.0">
15025
Minor PopFrame spec update:
15026
- The specified thread must be suspended or must be the current thread.
15027
(It was not allowed to be the current thread before.)
15028
</change>
15029
<change date="10 October 2019" version="14.0.0">
15030
Minor update for new class file Record attribute:
15031
- Specify that RedefineClasses and RetransformClasses are not allowed
15032
to change the class file Record attribute.
15033
</change>
15034
<change date="13 May 2020" version="15.0.0">
15035
Minor update for new class file PermittedSubclasses attribute:
15036
- Specify that RedefineClasses and RetransformClasses are not allowed
15037
to change the class file PermittedSubclasses attribute.
15038
</change>
15039
<change date="15 January 2021" version="17.0.0">
15040
Minor clarification in the section "Agent Shutdown" that says the
15041
implementation may choose to not call the Agent_OnUnload function
15042
if the Agent_OnAttach/Agent_OnAttach_L function reported an error.
15043
</change>
15044
<change date="8 June 2021" version="17.0.0">
15045
Minor update to deprecate Heap functions 1.0.
15046
</change>
15047
</changehistory>
15048
15049
</specification>
15050
<!-- Keep this comment at the end of the file
15051
Local variables:
15052
mode: sgml
15053
sgml-omittag:t
15054
sgml-shorttag:t
15055
sgml-namecase-general:t
15056
sgml-general-insert-case:lower
15057
sgml-minimize-attributes:nil
15058
sgml-always-quote-attributes:t
15059
sgml-indent-step:2
15060
sgml-indent-data:t
15061
sgml-parent-document:nil
15062
sgml-exposed-tags:nil
15063
sgml-local-catalogs:nil
15064
sgml-local-ecat-files:nil
15065
End:
15066
-->
15067
15068