Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/prims/jvmti.xml
41145 views
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>
3
<!--
4
Copyright (c) 2002, 2020, 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 and have been superseded by more
4967
</b>
4968
<internallink id="Heap"><b>powerful and flexible versions</b></internallink>
4969
<b>
4970
which:
4971
</b>
4972
<ul>
4973
<li>
4974
<b>
4975
Allow access to primitive values (the value of Strings, arrays,
4976
and primitive fields)
4977
</b>
4978
</li>
4979
<li>
4980
<b>
4981
Allow the tag of the referrer to be set, thus enabling more
4982
efficient localized reference graph building
4983
</b>
4984
</li>
4985
<li>
4986
<b>
4987
Provide more extensive filtering abilities
4988
</b>
4989
</li>
4990
<li>
4991
<b>
4992
Are extensible, allowing their abilities to grow in future versions of <jvmti/>
4993
</b>
4994
</li>
4995
</ul>
4996
<p/>
4997
<b>Please use the </b>
4998
<internallink id="Heap"><b>current Heap functions</b></internallink>.
4999
<p/>
5000
<constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum">
5001
<constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1">
5002
Tagged objects only.
5003
</constant>
5004
<constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2">
5005
Untagged objects only.
5006
</constant>
5007
<constant id="JVMTI_HEAP_OBJECT_EITHER" num="3">
5008
Either tagged or untagged objects.
5009
</constant>
5010
</constants>
5011
5012
<constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum">
5013
<constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1">
5014
JNI global reference.
5015
</constant>
5016
<constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2">
5017
System class.
5018
</constant>
5019
<constant id="JVMTI_HEAP_ROOT_MONITOR" num="3">
5020
Monitor.
5021
</constant>
5022
<constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4">
5023
Stack local.
5024
</constant>
5025
<constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5">
5026
JNI local reference.
5027
</constant>
5028
<constant id="JVMTI_HEAP_ROOT_THREAD" num="6">
5029
Thread.
5030
</constant>
5031
<constant id="JVMTI_HEAP_ROOT_OTHER" num="7">
5032
Other.
5033
</constant>
5034
</constants>
5035
5036
<constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum">
5037
<constant id="JVMTI_REFERENCE_CLASS" num="1">
5038
Reference from an object to its class.
5039
</constant>
5040
<constant id="JVMTI_REFERENCE_FIELD" num="2">
5041
Reference from an object to the value of one of its instance fields.
5042
For references of this kind the <code>referrer_index</code>
5043
parameter to the <internallink id="jvmtiObjectReferenceCallback">
5044
jvmtiObjectReferenceCallback</internallink> is the index of the
5045
the instance field. The index is based on the order of all the
5046
object's fields. This includes all fields of the directly declared
5047
static and instance fields in the class, and includes all fields (both
5048
public and private) fields declared in superclasses and superinterfaces.
5049
The index is thus calculated by summing the index of the field in the directly
5050
declared class (see <functionlink id="GetClassFields"/>), with the total
5051
number of fields (both public and private) declared in all superclasses
5052
and superinterfaces. The index starts at zero.
5053
</constant>
5054
<constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3">
5055
Reference from an array to one of its elements.
5056
For references of this kind the <code>referrer_index</code>
5057
parameter to the <internallink id="jvmtiObjectReferenceCallback">
5058
jvmtiObjectReferenceCallback</internallink> is the array index.
5059
</constant>
5060
<constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4">
5061
Reference from a class to its class loader.
5062
</constant>
5063
<constant id="JVMTI_REFERENCE_SIGNERS" num="5">
5064
Reference from a class to its signers array.
5065
</constant>
5066
<constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6">
5067
Reference from a class to its protection domain.
5068
</constant>
5069
<constant id="JVMTI_REFERENCE_INTERFACE" num="7">
5070
Reference from a class to one of its interfaces.
5071
</constant>
5072
<constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8">
5073
Reference from a class to the value of one of its static fields.
5074
For references of this kind the <code>referrer_index</code>
5075
parameter to the <internallink id="jvmtiObjectReferenceCallback">
5076
jvmtiObjectReferenceCallback</internallink> is the index of the
5077
the static field. The index is based on the order of all the
5078
object's fields. This includes all fields of the directly declared
5079
static and instance fields in the class, and includes all fields (both
5080
public and private) fields declared in superclasses and superinterfaces.
5081
The index is thus calculated by summing the index of the field in the directly
5082
declared class (see <functionlink id="GetClassFields"/>), with the total
5083
number of fields (both public and private) declared in all superclasses
5084
and superinterfaces. The index starts at zero.
5085
Note: this definition differs from that in the <jvmti/> 1.0 Specification.
5086
<rationale>No known implementations used the 1.0 definition.</rationale>
5087
</constant>
5088
<constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9">
5089
Reference from a class to a resolved entry in the constant pool.
5090
For references of this kind the <code>referrer_index</code>
5091
parameter to the <internallink id="jvmtiObjectReferenceCallback">
5092
jvmtiObjectReferenceCallback</internallink> is the index into
5093
constant pool table of the class, starting at 1. See
5094
<vmspec chapter="4.4"/>.
5095
</constant>
5096
</constants>
5097
5098
<constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum">
5099
<constant id="JVMTI_ITERATION_CONTINUE" num="1">
5100
Continue the iteration.
5101
If this is a reference iteration, follow the references of this object.
5102
</constant>
5103
<constant id="JVMTI_ITERATION_IGNORE" num="2">
5104
Continue the iteration.
5105
If this is a reference iteration, ignore the references of this object.
5106
</constant>
5107
<constant id="JVMTI_ITERATION_ABORT" num="0">
5108
Abort the iteration.
5109
</constant>
5110
</constants>
5111
</intro>
5112
5113
<callback id="jvmtiHeapObjectCallback">
5114
<enum>jvmtiIterationControl</enum>
5115
<synopsis>Heap Object Callback</synopsis>
5116
<description>
5117
Agent supplied callback function.
5118
Describes (but does not pass in) an object in the heap.
5119
<p/>
5120
Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5121
or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5122
<p/>
5123
See the <internallink id="heapCallbacks">heap callback
5124
function restrictions</internallink>.
5125
</description>
5126
<parameters>
5127
<param id="class_tag">
5128
<jlong/>
5129
<description>
5130
The tag of the class of object (zero if the class is not tagged).
5131
If the object represents a runtime class,
5132
the <code>class_tag</code> is the tag
5133
associated with <code>java.lang.Class</code>
5134
(zero if <code>java.lang.Class</code> is not tagged).
5135
</description>
5136
</param>
5137
<param id="size">
5138
<jlong/>
5139
<description>
5140
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5141
</description>
5142
</param>
5143
<param id="tag_ptr">
5144
<outptr><jlong/></outptr>
5145
<description>
5146
The object tag value, or zero if the object is not tagged.
5147
To set the tag value to be associated with the object
5148
the agent sets the <code>jlong</code> pointed to by the parameter.
5149
</description>
5150
</param>
5151
<param id="user_data">
5152
<outptr><void/></outptr>
5153
<description>
5154
The user supplied data that was passed into the iteration function.
5155
</description>
5156
</param>
5157
</parameters>
5158
</callback>
5159
5160
<callback id="jvmtiHeapRootCallback">
5161
<enum>jvmtiIterationControl</enum>
5162
<synopsis>Heap Root Object Callback</synopsis>
5163
<description>
5164
Agent supplied callback function.
5165
Describes (but does not pass in) an object that is a root for the purposes
5166
of garbage collection.
5167
<p/>
5168
Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5169
<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5170
references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5171
<p/>
5172
See the <internallink id="heapCallbacks">heap callback
5173
function restrictions</internallink>.
5174
</description>
5175
<parameters>
5176
<param id="root_kind">
5177
<enum>jvmtiHeapRootKind</enum>
5178
<description>
5179
The kind of heap root.
5180
</description>
5181
</param>
5182
<param id="class_tag">
5183
<jlong/>
5184
<description>
5185
The tag of the class of object (zero if the class is not tagged).
5186
If the object represents a runtime class, the <code>class_tag</code> is the tag
5187
associated with <code>java.lang.Class</code>
5188
(zero if <code>java.lang.Class</code> is not tagged).
5189
</description>
5190
</param>
5191
<param id="size">
5192
<jlong/>
5193
<description>
5194
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5195
</description>
5196
</param>
5197
<param id="tag_ptr">
5198
<outptr><jlong/></outptr>
5199
<description>
5200
The object tag value, or zero if the object is not tagged.
5201
To set the tag value to be associated with the object
5202
the agent sets the <code>jlong</code> pointed to by the parameter.
5203
</description>
5204
</param>
5205
<param id="user_data">
5206
<outptr><void/></outptr>
5207
<description>
5208
The user supplied data that was passed into the iteration function.
5209
</description>
5210
</param>
5211
</parameters>
5212
</callback>
5213
5214
<callback id="jvmtiStackReferenceCallback">
5215
<enum>jvmtiIterationControl</enum>
5216
<synopsis>Stack Reference Object Callback</synopsis>
5217
<description>
5218
Agent supplied callback function.
5219
Describes (but does not pass in) an object on the stack that is a root for
5220
the purposes of garbage collection.
5221
<p/>
5222
Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5223
<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5224
references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5225
<p/>
5226
See the <internallink id="heapCallbacks">heap callback
5227
function restrictions</internallink>.
5228
</description>
5229
<parameters>
5230
<param id="root_kind">
5231
<enum>jvmtiHeapRootKind</enum>
5232
<description>
5233
The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5234
<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>).
5235
</description>
5236
</param>
5237
<param id="class_tag">
5238
<jlong/>
5239
<description>
5240
The tag of the class of object (zero if the class is not tagged).
5241
If the object represents a runtime class, the <code>class_tag</code> is the tag
5242
associated with <code>java.lang.Class</code>
5243
(zero if <code>java.lang.Class</code> is not tagged).
5244
</description>
5245
</param>
5246
<param id="size">
5247
<jlong/>
5248
<description>
5249
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5250
</description>
5251
</param>
5252
<param id="tag_ptr">
5253
<outptr><jlong/></outptr>
5254
<description>
5255
The object tag value, or zero if the object is not tagged.
5256
To set the tag value to be associated with the object
5257
the agent sets the <code>jlong</code> pointed to by the parameter.
5258
</description>
5259
</param>
5260
<param id="thread_tag">
5261
<jlong/>
5262
<description>
5263
The tag of the thread corresponding to this stack, zero if not tagged.
5264
</description>
5265
</param>
5266
<param id="depth">
5267
<jint/>
5268
<description>
5269
The depth of the frame.
5270
</description>
5271
</param>
5272
<param id="method">
5273
<jmethodID/>
5274
<description>
5275
The method executing in this frame.
5276
</description>
5277
</param>
5278
<param id="slot">
5279
<jint/>
5280
<description>
5281
The slot number.
5282
</description>
5283
</param>
5284
<param id="user_data">
5285
<outptr><void/></outptr>
5286
<description>
5287
The user supplied data that was passed into the iteration function.
5288
</description>
5289
</param>
5290
</parameters>
5291
</callback>
5292
5293
<callback id="jvmtiObjectReferenceCallback">
5294
<enum>jvmtiIterationControl</enum>
5295
<synopsis>Object Reference Callback</synopsis>
5296
<description>
5297
Agent supplied callback function.
5298
Describes a reference from an object (the referrer) to another object
5299
(the referree).
5300
<p/>
5301
Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5302
<code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5303
references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5304
<p/>
5305
See the <internallink id="heapCallbacks">heap callback
5306
function restrictions</internallink>.
5307
</description>
5308
<parameters>
5309
<param id="reference_kind">
5310
<enum>jvmtiObjectReferenceKind</enum>
5311
<description>
5312
The type of reference.
5313
</description>
5314
</param>
5315
<param id="class_tag">
5316
<jlong/>
5317
<description>
5318
The tag of the class of referree object (zero if the class is not tagged).
5319
If the referree object represents a runtime class,
5320
the <code>class_tag</code> is the tag
5321
associated with <code>java.lang.Class</code>
5322
(zero if <code>java.lang.Class</code> is not tagged).
5323
</description>
5324
</param>
5325
<param id="size">
5326
<jlong/>
5327
<description>
5328
Size of the referree object (in bytes).
5329
See <functionlink id="GetObjectSize"/>.
5330
</description>
5331
</param>
5332
<param id="tag_ptr">
5333
<outptr><jlong/></outptr>
5334
<description>
5335
The referree object tag value, or zero if the object is not
5336
tagged.
5337
To set the tag value to be associated with the object
5338
the agent sets the <code>jlong</code> pointed to by the parameter.
5339
</description>
5340
</param>
5341
<param id="referrer_tag">
5342
<jlong/>
5343
<description>
5344
The tag of the referrer object, or zero if the referrer
5345
object is not tagged.
5346
</description>
5347
</param>
5348
<param id="referrer_index">
5349
<jint/>
5350
<description>
5351
For references of type <code>JVMTI_REFERENCE_FIELD</code> or
5352
<code>JVMTI_REFERENCE_STATIC_FIELD</code> the index
5353
of the field in the referrer object. The index is based on the
5354
order of all the object's fields - see <internallink
5355
id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink>
5356
or <internallink
5357
id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD
5358
</internallink> for further description.
5359
<p/>
5360
For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code>
5361
the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT">
5362
JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description.
5363
<p/>
5364
For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code>
5365
the index into the constant pool of the class - see
5366
<internallink id="JVMTI_REFERENCE_CONSTANT_POOL">
5367
JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further
5368
description.
5369
<p/>
5370
For references of other kinds the <code>referrer_index</code> is
5371
<code>-1</code>.
5372
</description>
5373
</param>
5374
<param id="user_data">
5375
<outptr><void/></outptr>
5376
<description>
5377
The user supplied data that was passed into the iteration function.
5378
</description>
5379
</param>
5380
</parameters>
5381
</callback>
5382
5383
<function id="IterateOverObjectsReachableFromObject" num="109">
5384
<synopsis>Iterate Over Objects Reachable From Object</synopsis>
5385
<description>
5386
This function iterates over all objects that are directly
5387
and indirectly reachable from the specified object.
5388
For each object <i>A</i> (known
5389
as the referrer) with a reference to object <i>B</i> the specified
5390
callback function is called to describe the object reference.
5391
The callback is called exactly once for each reference from a referrer;
5392
this is true even if there are reference cycles or multiple paths to
5393
the referrer.
5394
There may be more than one reference between a referrer and a referree,
5395
These may be distinguished by the
5396
<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5397
<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5398
The callback for an object will always occur after the callback for
5399
its referrer.
5400
<p/>
5401
See <functionlink id="FollowReferences"/> for the object
5402
references which are reported.
5403
<p/>
5404
During the execution of this function the state of the heap
5405
does not change: no objects are allocated, no objects are
5406
garbage collected, and the state of objects (including
5407
held values) does not change.
5408
As a result, threads executing Java
5409
programming language code, threads attempting to resume the
5410
execution of Java programming language code, and threads
5411
attempting to execute JNI functions are typically stalled.
5412
</description>
5413
<origin>new</origin>
5414
<capabilities>
5415
<required id="can_tag_objects"></required>
5416
</capabilities>
5417
<parameters>
5418
<param id="object">
5419
<jobject/>
5420
<description>
5421
The object
5422
</description>
5423
</param>
5424
<param id="object_reference_callback">
5425
<ptrtype>
5426
<struct>jvmtiObjectReferenceCallback</struct>
5427
</ptrtype>
5428
<description>
5429
The callback to be called to describe each
5430
object reference.
5431
</description>
5432
</param>
5433
<param id="user_data">
5434
<inbuf>
5435
<void/>
5436
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
5437
</inbuf>
5438
<description>
5439
User supplied data to be passed to the callback.
5440
</description>
5441
</param>
5442
</parameters>
5443
<errors>
5444
</errors>
5445
</function>
5446
5447
<function id="IterateOverReachableObjects" num="110">
5448
<synopsis>Iterate Over Reachable Objects</synopsis>
5449
<description>
5450
This function iterates over the root objects and all objects that
5451
are directly and indirectly reachable from the root objects.
5452
The root objects comprise the set of system classes,
5453
JNI globals, references from thread stacks, and other objects used as roots
5454
for the purposes of garbage collection.
5455
<p/>
5456
For each root the <paramlink id="heap_root_callback"></paramlink>
5457
or <paramlink id="stack_ref_callback"></paramlink> callback is called.
5458
An object can be a root object for more than one reason and in that case
5459
the appropriate callback is called for each reason.
5460
<p/>
5461
For each object reference the <paramlink id="object_ref_callback"></paramlink>
5462
callback function is called to describe the object reference.
5463
The callback is called exactly once for each reference from a referrer;
5464
this is true even if there are reference cycles or multiple paths to
5465
the referrer.
5466
There may be more than one reference between a referrer and a referree,
5467
These may be distinguished by the
5468
<datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5469
<datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5470
The callback for an object will always occur after the callback for
5471
its referrer.
5472
<p/>
5473
See <functionlink id="FollowReferences"/> for the object
5474
references which are reported.
5475
<p/>
5476
Roots are always reported to the profiler before any object references
5477
are reported. In other words, the <paramlink id="object_ref_callback"></paramlink>
5478
callback will not be called until the appropriate callback has been called
5479
for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is
5480
specified as <code>NULL</code> then this function returns after
5481
reporting the root objects to the profiler.
5482
<p/>
5483
During the execution of this function the state of the heap
5484
does not change: no objects are allocated, no objects are
5485
garbage collected, and the state of objects (including
5486
held values) does not change.
5487
As a result, threads executing Java
5488
programming language code, threads attempting to resume the
5489
execution of Java programming language code, and threads
5490
attempting to execute JNI functions are typically stalled.
5491
</description>
5492
<origin>new</origin>
5493
<capabilities>
5494
<required id="can_tag_objects"></required>
5495
</capabilities>
5496
<parameters>
5497
<param id="heap_root_callback">
5498
<ptrtype>
5499
<struct>jvmtiHeapRootCallback</struct>
5500
<nullok>do not report heap roots</nullok>
5501
</ptrtype>
5502
<description>
5503
The callback function to be called for each heap root of type
5504
<code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>,
5505
<code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>,
5506
<code>JVMTI_HEAP_ROOT_MONITOR</code>,
5507
<code>JVMTI_HEAP_ROOT_THREAD</code>, or
5508
<code>JVMTI_HEAP_ROOT_OTHER</code>.
5509
</description>
5510
</param>
5511
<param id="stack_ref_callback">
5512
<ptrtype>
5513
<struct>jvmtiStackReferenceCallback</struct>
5514
<nullok>do not report stack references</nullok>
5515
</ptrtype>
5516
<description>
5517
The callback function to be called for each heap root of
5518
<code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5519
<code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>.
5520
</description>
5521
</param>
5522
<param id="object_ref_callback">
5523
<ptrtype>
5524
<struct>jvmtiObjectReferenceCallback</struct>
5525
<nullok>do not follow references from the root objects</nullok>
5526
</ptrtype>
5527
<description>
5528
The callback function to be called for each object reference.
5529
</description>
5530
</param>
5531
<param id="user_data">
5532
<inbuf>
5533
<void/>
5534
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
5535
</inbuf>
5536
<description>
5537
User supplied data to be passed to the callback.
5538
</description>
5539
</param>
5540
</parameters>
5541
<errors>
5542
</errors>
5543
</function>
5544
5545
<function id="IterateOverHeap" num="111">
5546
<synopsis>Iterate Over Heap</synopsis>
5547
<description>
5548
Iterate over all objects in the heap. This includes both reachable and
5549
unreachable objects.
5550
<p/>
5551
The <paramlink id="object_filter"></paramlink> parameter indicates the
5552
objects for which the callback function is called. If this parameter
5553
is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5554
called for every object that is tagged. If the parameter is
5555
<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5556
for objects that are not tagged. If the parameter
5557
is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5558
called for every object in the heap, irrespective of whether it is
5559
tagged or not.
5560
<p/>
5561
During the execution of this function the state of the heap
5562
does not change: no objects are allocated, no objects are
5563
garbage collected, and the state of objects (including
5564
held values) does not change.
5565
As a result, threads executing Java
5566
programming language code, threads attempting to resume the
5567
execution of Java programming language code, and threads
5568
attempting to execute JNI functions are typically stalled.
5569
</description>
5570
<origin>new</origin>
5571
<capabilities>
5572
<required id="can_tag_objects"></required>
5573
</capabilities>
5574
<parameters>
5575
<param id="object_filter">
5576
<enum>jvmtiHeapObjectFilter</enum>
5577
<description>
5578
Indicates the objects for which the callback function is called.
5579
</description>
5580
</param>
5581
<param id="heap_object_callback">
5582
<ptrtype>
5583
<struct>jvmtiHeapObjectCallback</struct>
5584
</ptrtype>
5585
<description>
5586
The iterator function to be called for each
5587
object matching the <paramlink id="object_filter"/>.
5588
</description>
5589
</param>
5590
<param id="user_data">
5591
<inbuf>
5592
<void/>
5593
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
5594
</inbuf>
5595
<description>
5596
User supplied data to be passed to the callback.
5597
</description>
5598
</param>
5599
</parameters>
5600
<errors>
5601
</errors>
5602
</function>
5603
5604
<function id="IterateOverInstancesOfClass" num="112">
5605
<synopsis>Iterate Over Instances Of Class</synopsis>
5606
<description>
5607
Iterate over all objects in the heap that are instances of the specified class.
5608
This includes direct instances of the specified class and
5609
instances of all subclasses of the specified class.
5610
This includes both reachable and unreachable objects.
5611
<p/>
5612
The <paramlink id="object_filter"></paramlink> parameter indicates the
5613
objects for which the callback function is called. If this parameter
5614
is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5615
called for every object that is tagged. If the parameter is
5616
<code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5617
called for objects that are not tagged. If the parameter
5618
is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5619
called for every object in the heap, irrespective of whether it is
5620
tagged or not.
5621
<p/>
5622
During the execution of this function the state of the heap
5623
does not change: no objects are allocated, no objects are
5624
garbage collected, and the state of objects (including
5625
held values) does not change.
5626
As a result, threads executing Java
5627
programming language code, threads attempting to resume the
5628
execution of Java programming language code, and threads
5629
attempting to execute JNI functions are typically stalled.
5630
</description>
5631
<origin>new</origin>
5632
<capabilities>
5633
<required id="can_tag_objects"></required>
5634
</capabilities>
5635
<parameters>
5636
<param id="klass">
5637
<jclass/>
5638
<description>
5639
Iterate over objects of this class only.
5640
</description>
5641
</param>
5642
<param id="object_filter">
5643
<enum>jvmtiHeapObjectFilter</enum>
5644
<description>
5645
Indicates the objects for which the callback function is called.
5646
</description>
5647
</param>
5648
<param id="heap_object_callback">
5649
<ptrtype>
5650
<struct>jvmtiHeapObjectCallback</struct>
5651
</ptrtype>
5652
<description>
5653
The iterator function to be called for each
5654
<paramlink id="klass"/> instance matching
5655
the <paramlink id="object_filter"/>.
5656
</description>
5657
</param>
5658
<param id="user_data">
5659
<inbuf>
5660
<void/>
5661
<nullok><code>NULL</code> is passed as the user supplied data</nullok>
5662
</inbuf>
5663
<description>
5664
User supplied data to be passed to the callback.
5665
</description>
5666
</param>
5667
</parameters>
5668
<errors>
5669
</errors>
5670
</function>
5671
5672
</category>
5673
5674
<category id="local" label="Local Variable">
5675
5676
<intro>
5677
These functions are used to retrieve or set the value of a local variable.
5678
The variable is identified by the depth of the frame containing its
5679
value and the variable's slot number within that frame.
5680
The mapping of variables to
5681
slot numbers can be obtained with the function
5682
<functionlink id="GetLocalVariableTable"></functionlink>.
5683
</intro>
5684
5685
<function id="GetLocalObject" num="21">
5686
<synopsis>Get Local Variable - Object</synopsis>
5687
<description>
5688
This function can be used to retrieve the value of a local
5689
variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
5690
</description>
5691
<origin>jvmdi</origin>
5692
<capabilities>
5693
<required id="can_access_local_variables"></required>
5694
</capabilities>
5695
<parameters>
5696
<param id="thread">
5697
<jthread null="current" frame="frame"/>
5698
<description>
5699
The thread of the frame containing the variable's value.
5700
</description>
5701
</param>
5702
<param id="depth">
5703
<jframeID thread="thread"/>
5704
<description>
5705
The depth of the frame containing the variable's value.
5706
</description>
5707
</param>
5708
<param id="slot">
5709
<jint/>
5710
<description>
5711
The variable's slot number.
5712
</description>
5713
</param>
5714
<param id="value_ptr">
5715
<outptr><jobject/></outptr>
5716
<description>
5717
On return, points to the variable's value.
5718
</description>
5719
</param>
5720
</parameters>
5721
<errors>
5722
<error id="JVMTI_ERROR_INVALID_SLOT">
5723
Invalid <code>slot</code>.
5724
</error>
5725
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5726
The variable type is not
5727
<code>Object</code> or a subclass of <code>Object</code>.
5728
</error>
5729
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5730
Not a visible frame
5731
</error>
5732
</errors>
5733
</function>
5734
5735
<function id="GetLocalInstance" num="155" since="1.2">
5736
<synopsis>Get Local Instance</synopsis>
5737
<description>
5738
This function can be used to retrieve the value of the local object
5739
variable at slot 0 (the "<code>this</code>" object) from non-static
5740
frames. This function can retrieve the "<code>this</code>" object from
5741
native method frames, whereas <code>GetLocalObject()</code> would
5742
return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases.
5743
</description>
5744
<origin>new</origin>
5745
<capabilities>
5746
<required id="can_access_local_variables"></required>
5747
</capabilities>
5748
<parameters>
5749
<param id="thread">
5750
<jthread null="current" frame="frame"/>
5751
<description>
5752
The thread of the frame containing the variable's value.
5753
</description>
5754
</param>
5755
<param id="depth">
5756
<jframeID thread="thread"/>
5757
<description>
5758
The depth of the frame containing the variable's value.
5759
</description>
5760
</param>
5761
<param id="value_ptr">
5762
<outptr><jobject/></outptr>
5763
<description>
5764
On return, points to the variable's value.
5765
</description>
5766
</param>
5767
</parameters>
5768
<errors>
5769
<error id="JVMTI_ERROR_INVALID_SLOT">
5770
If the specified frame is a static method frame.
5771
</error>
5772
</errors>
5773
</function>
5774
<function id="GetLocalInt" num="22">
5775
<synopsis>Get Local Variable - Int</synopsis>
5776
<description>
5777
This function can be used to retrieve the value of a local
5778
variable whose type is <code>int</code>,
5779
<code>short</code>, <code>char</code>, <code>byte</code>, or
5780
<code>boolean</code>.
5781
</description>
5782
<origin>jvmdi</origin>
5783
<capabilities>
5784
<required id="can_access_local_variables"></required>
5785
</capabilities>
5786
<parameters>
5787
<param id="thread">
5788
<jthread null="current" frame="frame"/>
5789
<description>
5790
The thread of the frame containing the variable's value.
5791
</description>
5792
</param>
5793
<param id="depth">
5794
<jframeID thread="thread"/>
5795
<description>
5796
The depth of the frame containing the variable's value.
5797
</description>
5798
</param>
5799
<param id="slot">
5800
<jint/>
5801
<description>
5802
The variable's slot number.
5803
</description>
5804
</param>
5805
<param id="value_ptr">
5806
<outptr><jint/></outptr>
5807
<description>
5808
On return, points to the variable's value.
5809
</description>
5810
</param>
5811
</parameters>
5812
<errors>
5813
<error id="JVMTI_ERROR_INVALID_SLOT">
5814
Invalid <code>slot</code>.
5815
</error>
5816
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5817
The variable type is not
5818
<code>int</code>, <code>short</code>,
5819
<code>char</code>, <code>byte</code>, or
5820
<code>boolean</code>.
5821
</error>
5822
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5823
Not a visible frame
5824
</error>
5825
</errors>
5826
</function>
5827
5828
<function id="GetLocalLong" num="23">
5829
<synopsis>Get Local Variable - Long</synopsis>
5830
<description>
5831
This function can be used to retrieve the value of a local
5832
variable whose type is <code>long</code>.
5833
</description>
5834
<origin>jvmdi</origin>
5835
<capabilities>
5836
<required id="can_access_local_variables"></required>
5837
</capabilities>
5838
<parameters>
5839
<param id="thread">
5840
<jthread null="current" frame="frame"/>
5841
<description>
5842
The thread of the frame containing the variable's value.
5843
</description>
5844
</param>
5845
<param id="depth">
5846
<jframeID thread="thread"/>
5847
<description>
5848
The depth of the frame containing the variable's value.
5849
</description>
5850
</param>
5851
<param id="slot">
5852
<jint/>
5853
<description>
5854
The variable's slot number.
5855
</description>
5856
</param>
5857
<param id="value_ptr">
5858
<outptr><jlong/></outptr>
5859
<description>
5860
On return, points to the variable's value.
5861
</description>
5862
</param>
5863
</parameters>
5864
<errors>
5865
<error id="JVMTI_ERROR_INVALID_SLOT">
5866
Invalid <code>slot</code>.
5867
</error>
5868
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5869
The variable type is not <code>long</code>.
5870
</error>
5871
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5872
Not a visible frame
5873
</error>
5874
</errors>
5875
</function>
5876
5877
<function id="GetLocalFloat" num="24">
5878
<synopsis>Get Local Variable - Float</synopsis>
5879
<description>
5880
This function can be used to retrieve the value of a local
5881
variable whose type is <code>float</code>.
5882
</description>
5883
<origin>jvmdi</origin>
5884
<capabilities>
5885
<required id="can_access_local_variables"></required>
5886
</capabilities>
5887
<parameters>
5888
<param id="thread">
5889
<jthread null="current" frame="frame"/>
5890
<description>
5891
The thread of the frame containing the variable's value.
5892
</description>
5893
</param>
5894
<param id="depth">
5895
<jframeID thread="thread"/>
5896
<description>
5897
The depth of the frame containing the variable's value.
5898
</description>
5899
</param>
5900
<param id="slot">
5901
<jint/>
5902
<description>
5903
The variable's slot number.
5904
</description>
5905
</param>
5906
<param id="value_ptr">
5907
<outptr><jfloat/></outptr>
5908
<description>
5909
On return, points to the variable's value.
5910
</description>
5911
</param>
5912
</parameters>
5913
<errors>
5914
<error id="JVMTI_ERROR_INVALID_SLOT">
5915
Invalid <code>slot</code>.
5916
</error>
5917
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5918
The variable type is not <code>float</code>.
5919
</error>
5920
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5921
Not a visible frame
5922
</error>
5923
</errors>
5924
</function>
5925
5926
<function id="GetLocalDouble" num="25">
5927
<synopsis>Get Local Variable - Double</synopsis>
5928
<description>
5929
This function can be used to retrieve the value of a local
5930
variable whose type is <code>long</code>.
5931
</description>
5932
<origin>jvmdi</origin>
5933
<capabilities>
5934
<required id="can_access_local_variables"></required>
5935
</capabilities>
5936
<parameters>
5937
<param id="thread">
5938
<jthread null="current" frame="frame"/>
5939
<description>
5940
The thread of the frame containing the variable's value.
5941
</description>
5942
</param>
5943
<param id="depth">
5944
<jframeID thread="thread"/>
5945
<description>
5946
The depth of the frame containing the variable's value.
5947
</description>
5948
</param>
5949
<param id="slot">
5950
<jint/>
5951
<description>
5952
The variable's slot number.
5953
</description>
5954
</param>
5955
<param id="value_ptr">
5956
<outptr><jdouble/></outptr>
5957
<description>
5958
On return, points to the variable's value.
5959
</description>
5960
</param>
5961
</parameters>
5962
<errors>
5963
<error id="JVMTI_ERROR_INVALID_SLOT">
5964
Invalid <code>slot</code>.
5965
</error>
5966
<error id="JVMTI_ERROR_TYPE_MISMATCH">
5967
The variable type is not <code>double</code>.
5968
</error>
5969
<error id="JVMTI_ERROR_OPAQUE_FRAME">
5970
Not a visible frame
5971
</error>
5972
</errors>
5973
</function>
5974
5975
<function id="SetLocalObject" num="26">
5976
<synopsis>Set Local Variable - Object</synopsis>
5977
<description>
5978
This function can be used to set the value of a local
5979
variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
5980
</description>
5981
<origin>jvmdi</origin>
5982
<capabilities>
5983
<required id="can_access_local_variables"></required>
5984
</capabilities>
5985
<parameters>
5986
<param id="thread">
5987
<jthread null="current" frame="frame"/>
5988
<description>
5989
The thread of the frame containing the variable's value.
5990
</description>
5991
</param>
5992
<param id="depth">
5993
<jframeID thread="thread"/>
5994
<description>
5995
The depth of the frame containing the variable's value.
5996
</description>
5997
</param>
5998
<param id="slot">
5999
<jint/>
6000
<description>
6001
The variable's slot number.
6002
</description>
6003
</param>
6004
<param id="value">
6005
<jobject/>
6006
<description>
6007
The new value for the variable.
6008
</description>
6009
</param>
6010
</parameters>
6011
<errors>
6012
<error id="JVMTI_ERROR_INVALID_SLOT">
6013
Invalid <code>slot</code>.
6014
</error>
6015
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6016
The variable type is not
6017
<code>Object</code> or a subclass of <code>Object</code>.
6018
</error>
6019
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6020
The supplied <paramlink id="value"/> is not compatible
6021
with the variable type.
6022
</error>
6023
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6024
Not a visible frame
6025
</error>
6026
</errors>
6027
</function>
6028
6029
<function id="SetLocalInt" num="27">
6030
<synopsis>Set Local Variable - Int</synopsis>
6031
<description>
6032
This function can be used to set the value of a local
6033
variable whose type is <code>int</code>,
6034
<code>short</code>, <code>char</code>, <code>byte</code>, or
6035
<code>boolean</code>.
6036
</description>
6037
<origin>jvmdi</origin>
6038
<capabilities>
6039
<required id="can_access_local_variables"></required>
6040
</capabilities>
6041
<parameters>
6042
<param id="thread">
6043
<jthread null="current" frame="frame"/>
6044
<description>
6045
The thread of the frame containing the variable's value.
6046
</description>
6047
</param>
6048
<param id="depth">
6049
<jframeID thread="thread"/>
6050
<description>
6051
The depth of the frame containing the variable's value.
6052
</description>
6053
</param>
6054
<param id="slot">
6055
<jint/>
6056
<description>
6057
The variable's slot number.
6058
</description>
6059
</param>
6060
<param id="value">
6061
<jint/>
6062
<description>
6063
The new value for the variable.
6064
</description>
6065
</param>
6066
</parameters>
6067
<errors>
6068
<error id="JVMTI_ERROR_INVALID_SLOT">
6069
Invalid <code>slot</code>.
6070
</error>
6071
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6072
The variable type is not
6073
<code>int</code>, <code>short</code>,
6074
<code>char</code>, <code>byte</code>, or
6075
<code>boolean</code>.
6076
</error>
6077
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6078
Not a visible frame
6079
</error>
6080
</errors>
6081
</function>
6082
6083
<function id="SetLocalLong" num="28">
6084
<synopsis>Set Local Variable - Long</synopsis>
6085
<description>
6086
This function can be used to set the value of a local
6087
variable whose type is <code>long</code>.
6088
</description>
6089
<origin>jvmdi</origin>
6090
<capabilities>
6091
<required id="can_access_local_variables"></required>
6092
</capabilities>
6093
<parameters>
6094
<param id="thread">
6095
<jthread null="current" frame="frame"/>
6096
<description>
6097
The thread of the frame containing the variable's value.
6098
</description>
6099
</param>
6100
<param id="depth">
6101
<jframeID thread="thread"/>
6102
<description>
6103
The depth of the frame containing the variable's value.
6104
</description>
6105
</param>
6106
<param id="slot">
6107
<jint/>
6108
<description>
6109
The variable's slot number.
6110
</description>
6111
</param>
6112
<param id="value">
6113
<jlong/>
6114
<description>
6115
The new value for the variable.
6116
</description>
6117
</param>
6118
</parameters>
6119
<errors>
6120
<error id="JVMTI_ERROR_INVALID_SLOT">
6121
Invalid <code>slot</code>.
6122
</error>
6123
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6124
The variable type is not <code>long</code>.
6125
</error>
6126
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6127
Not a visible frame
6128
</error>
6129
</errors>
6130
</function>
6131
6132
<function id="SetLocalFloat" num="29">
6133
<synopsis>Set Local Variable - Float</synopsis>
6134
<description>
6135
This function can be used to set the value of a local
6136
variable whose type is <code>float</code>.
6137
</description>
6138
<origin>jvmdi</origin>
6139
<capabilities>
6140
<required id="can_access_local_variables"></required>
6141
</capabilities>
6142
<parameters>
6143
<param id="thread">
6144
<jthread null="current" frame="frame"/>
6145
<description>
6146
The thread of the frame containing the variable's value.
6147
</description>
6148
</param>
6149
<param id="depth">
6150
<jframeID thread="thread"/>
6151
<description>
6152
The depth of the frame containing the variable's value.
6153
</description>
6154
</param>
6155
<param id="slot">
6156
<jint/>
6157
<description>
6158
The variable's slot number.
6159
</description>
6160
</param>
6161
<param id="value">
6162
<jfloat/>
6163
<description>
6164
The new value for the variable.
6165
</description>
6166
</param>
6167
</parameters>
6168
<errors>
6169
<error id="JVMTI_ERROR_INVALID_SLOT">
6170
Invalid <code>slot</code>.
6171
</error>
6172
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6173
The variable type is not <code>float</code>.
6174
</error>
6175
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6176
Not a visible frame
6177
</error>
6178
</errors>
6179
</function>
6180
6181
<function id="SetLocalDouble" num="30">
6182
<synopsis>Set Local Variable - Double</synopsis>
6183
<description>
6184
This function can be used to set the value of a local
6185
variable whose type is <code>double</code>.
6186
</description>
6187
<origin>jvmdi</origin>
6188
<capabilities>
6189
<required id="can_access_local_variables"></required>
6190
</capabilities>
6191
<parameters>
6192
<param id="thread">
6193
<jthread null="current" frame="frame"/>
6194
<description>
6195
The thread of the frame containing the variable's value.
6196
</description>
6197
</param>
6198
<param id="depth">
6199
<jframeID thread="thread"/>
6200
<description>
6201
The depth of the frame containing the variable's value.
6202
</description>
6203
</param>
6204
<param id="slot">
6205
<jint/>
6206
<description>
6207
The variable's slot number.
6208
</description>
6209
</param>
6210
<param id="value">
6211
<jdouble/>
6212
<description>
6213
The new value for the variable.
6214
</description>
6215
</param>
6216
</parameters>
6217
<errors>
6218
<error id="JVMTI_ERROR_INVALID_SLOT">
6219
Invalid <code>slot</code>.
6220
</error>
6221
<error id="JVMTI_ERROR_TYPE_MISMATCH">
6222
The variable type is not <code>double</code>.
6223
</error>
6224
<error id="JVMTI_ERROR_OPAQUE_FRAME">
6225
Not a visible frame
6226
</error>
6227
</errors>
6228
</function>
6229
</category>
6230
6231
<category id="breakpointCategory" label="Breakpoint">
6232
6233
<intro>
6234
</intro>
6235
6236
<function id="SetBreakpoint" num="38">
6237
<synopsis>Set Breakpoint</synopsis>
6238
<description>
6239
Set a breakpoint at the instruction indicated by
6240
<code>method</code> and <code>location</code>.
6241
An instruction can only have one breakpoint.
6242
<p/>
6243
Whenever the designated instruction is about to be executed, a
6244
<eventlink id="Breakpoint"></eventlink> event is generated.
6245
</description>
6246
<origin>jvmdi</origin>
6247
<capabilities>
6248
<required id="can_generate_breakpoint_events"></required>
6249
</capabilities>
6250
<parameters>
6251
<param id="klass">
6252
<jclass method="method"/>
6253
<description>
6254
The class in which to set the breakpoint
6255
</description>
6256
</param>
6257
<param id="method">
6258
<jmethodID class="klass"/>
6259
<description>
6260
The method in which to set the breakpoint
6261
</description>
6262
</param>
6263
<param id="location">
6264
<jlocation/>
6265
<description>
6266
the index of the instruction at which to set the breakpoint
6267
6268
</description>
6269
</param>
6270
</parameters>
6271
<errors>
6272
<error id="JVMTI_ERROR_DUPLICATE">
6273
The designated bytecode already has a breakpoint.
6274
</error>
6275
</errors>
6276
</function>
6277
6278
<function id="ClearBreakpoint" num="39">
6279
<synopsis>Clear Breakpoint</synopsis>
6280
<description>
6281
Clear the breakpoint at the bytecode indicated by
6282
<code>method</code> and <code>location</code>.
6283
</description>
6284
<origin>jvmdi</origin>
6285
<capabilities>
6286
<required id="can_generate_breakpoint_events"></required>
6287
</capabilities>
6288
<parameters>
6289
<param id="klass">
6290
<jclass method="method"/>
6291
<description>
6292
The class in which to clear the breakpoint
6293
</description>
6294
</param>
6295
<param id="method">
6296
<jmethodID class="klass"/>
6297
<description>
6298
The method in which to clear the breakpoint
6299
</description>
6300
</param>
6301
<param id="location">
6302
<jlocation/>
6303
<description>
6304
the index of the instruction at which to clear the breakpoint
6305
</description>
6306
</param>
6307
</parameters>
6308
<errors>
6309
<error id="JVMTI_ERROR_NOT_FOUND">
6310
There's no breakpoint at the designated bytecode.
6311
</error>
6312
</errors>
6313
</function>
6314
6315
</category>
6316
6317
<category id="fieldWatch" label="Watched Field">
6318
6319
<intro>
6320
</intro>
6321
6322
<function id="SetFieldAccessWatch" num="41">
6323
<synopsis>Set Field Access Watch</synopsis>
6324
<description>
6325
Generate a <eventlink id="FieldAccess"></eventlink> event
6326
when the field specified
6327
by <code>klass</code> and
6328
<code>field</code> is about to be accessed.
6329
An event will be generated for each access of the field
6330
until it is canceled with
6331
<functionlink id="ClearFieldAccessWatch"></functionlink>.
6332
Field accesses from Java programming language code or from JNI code are watched,
6333
fields modified by other means are not watched.
6334
Note that <jvmti/> users should be aware that their own field accesses
6335
will trigger the watch.
6336
A field can only have one field access watch set.
6337
Modification of a field is not considered an access--use
6338
<functionlink id="SetFieldModificationWatch"></functionlink>
6339
to monitor modifications.
6340
</description>
6341
<origin>jvmdi</origin>
6342
<capabilities>
6343
<required id="can_generate_field_access_events"></required>
6344
</capabilities>
6345
<parameters>
6346
<param id="klass">
6347
<jclass field="field"/>
6348
<description>
6349
The class containing the field to watch
6350
</description>
6351
</param>
6352
<param id="field">
6353
<jfieldID class="klass"/>
6354
<description>
6355
The field to watch
6356
6357
</description>
6358
</param>
6359
</parameters>
6360
<errors>
6361
<error id="JVMTI_ERROR_DUPLICATE">
6362
The designated field is already being watched for accesses.
6363
</error>
6364
</errors>
6365
</function>
6366
6367
<function id="ClearFieldAccessWatch" num="42">
6368
<synopsis>Clear Field Access Watch</synopsis>
6369
<description>
6370
Cancel a field access watch previously set by
6371
<functionlink id="SetFieldAccessWatch"></functionlink>, on the
6372
field specified
6373
by <code>klass</code> and
6374
<code>field</code>.
6375
</description>
6376
<origin>jvmdi</origin>
6377
<capabilities>
6378
<required id="can_generate_field_access_events"></required>
6379
</capabilities>
6380
<parameters>
6381
<param id="klass">
6382
<jclass field="field"/>
6383
<description>
6384
The class containing the field to watch
6385
</description>
6386
</param>
6387
<param id="field">
6388
<jfieldID class="klass"/>
6389
<description>
6390
The field to watch
6391
6392
</description>
6393
</param>
6394
</parameters>
6395
<errors>
6396
<error id="JVMTI_ERROR_NOT_FOUND">
6397
The designated field is not being watched for accesses.
6398
</error>
6399
</errors>
6400
</function>
6401
6402
<function id="SetFieldModificationWatch" num="43">
6403
<synopsis>Set Field Modification Watch</synopsis>
6404
<description>
6405
Generate a <eventlink id="FieldModification"></eventlink> event
6406
when the field specified
6407
by <code>klass</code> and
6408
<code>field</code> is about to be modified.
6409
An event will be generated for each modification of the field
6410
until it is canceled with
6411
<functionlink id="ClearFieldModificationWatch"></functionlink>.
6412
Field modifications from Java programming language code or from JNI code are watched,
6413
fields modified by other means are not watched.
6414
Note that <jvmti/> users should be aware that their own field modifications
6415
will trigger the watch.
6416
A field can only have one field modification watch set.
6417
</description>
6418
<origin>jvmdi</origin>
6419
<capabilities>
6420
<required id="can_generate_field_modification_events"></required>
6421
</capabilities>
6422
<parameters>
6423
<param id="klass">
6424
<jclass field="field"/>
6425
<description>
6426
The class containing the field to watch
6427
</description>
6428
</param>
6429
<param id="field">
6430
<jfieldID class="klass"/>
6431
<description>
6432
The field to watch
6433
6434
</description>
6435
</param>
6436
</parameters>
6437
<errors>
6438
<error id="JVMTI_ERROR_DUPLICATE">
6439
The designated field is already being watched for modifications.
6440
</error>
6441
</errors>
6442
</function>
6443
6444
<function id="ClearFieldModificationWatch" num="44">
6445
<synopsis>Clear Field Modification Watch</synopsis>
6446
<description>
6447
6448
Cancel a field modification watch previously set by
6449
<functionlink id="SetFieldModificationWatch"></functionlink>, on the
6450
field specified
6451
by <code>klass</code> and
6452
<code>field</code>.
6453
</description>
6454
<origin>jvmdi</origin>
6455
<capabilities>
6456
<required id="can_generate_field_modification_events"></required>
6457
</capabilities>
6458
<parameters>
6459
<param id="klass">
6460
<jclass field="field"/>
6461
<description>
6462
The class containing the field to watch
6463
</description>
6464
</param>
6465
<param id="field">
6466
<jfieldID class="klass"/>
6467
<description>
6468
The field to watch
6469
6470
</description>
6471
</param>
6472
</parameters>
6473
<errors>
6474
<error id="JVMTI_ERROR_NOT_FOUND">
6475
The designated field is not being watched for modifications.
6476
</error>
6477
</errors>
6478
</function>
6479
</category>
6480
6481
<category id="module" label="Module">
6482
6483
<intro>
6484
</intro>
6485
6486
<function id="GetAllModules" num="3" since="9">
6487
<synopsis>Get All Modules</synopsis>
6488
<description>
6489
Return an array of all modules loaded in the virtual machine.
6490
The array includes the unnamed module for each class loader.
6491
The number of modules in the array is returned via
6492
<code>module_count_ptr</code>, and the array itself via
6493
<code>modules_ptr</code>.
6494
<p/>
6495
</description>
6496
<origin>new</origin>
6497
<capabilities>
6498
</capabilities>
6499
<parameters>
6500
<param id="module_count_ptr">
6501
<outptr><jint/></outptr>
6502
<description>
6503
On return, points to the number of returned modules.
6504
</description>
6505
</param>
6506
<param id="modules_ptr">
6507
<allocbuf outcount="module_count_ptr"><jobject/></allocbuf>
6508
<description>
6509
On return, points to an array of references, one
6510
for each module.
6511
</description>
6512
</param>
6513
</parameters>
6514
<errors>
6515
</errors>
6516
</function>
6517
6518
<function id="GetNamedModule" num="40" since="9">
6519
<synopsis>Get Named Module</synopsis>
6520
<description>
6521
Return the <code>java.lang.Module</code> object for a named
6522
module defined to a class loader that contains a given package.
6523
The module is returned via <code>module_ptr</code>.
6524
<p/>
6525
If a named module is defined to the class loader and it
6526
contains the package then that named module is returned,
6527
otherwise <code>NULL</code> is returned.
6528
<p/>
6529
</description>
6530
<origin>new</origin>
6531
<capabilities>
6532
</capabilities>
6533
<parameters>
6534
<param id="class_loader">
6535
<ptrtype>
6536
<jobject/>
6537
<nullok>the bootstrap loader is assumed</nullok>
6538
</ptrtype>
6539
<description>
6540
A class loader.
6541
If the <code>class_loader</code> is not <code>NULL</code>
6542
or a subclass of <code>java.lang.ClassLoader</code>
6543
this function returns
6544
<errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>.
6545
</description>
6546
</param>
6547
<param id="package_name">
6548
<inbuf><char/></inbuf>
6549
<description>
6550
The name of the package, encoded as a
6551
<internallink id="mUTF">modified UTF-8</internallink> string.
6552
The package name is in internal form (JVMS 4.2.1);
6553
identifiers are separated by forward slashes rather than periods.
6554
</description>
6555
</param>
6556
<param id="module_ptr">
6557
<outptr><jobject/></outptr>
6558
<description>
6559
On return, points to a <code>java.lang.Module</code> object
6560
or points to <code>NULL</code>.
6561
</description>
6562
</param>
6563
</parameters>
6564
<errors>
6565
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6566
If class loader is not <code>NULL</code> and is not a class loader object.
6567
</error>
6568
</errors>
6569
</function>
6570
6571
<function id="AddModuleReads" num="94" since="9">
6572
<synopsis>Add Module Reads</synopsis>
6573
<description>
6574
Update a module to read another module. This function is a no-op
6575
when <paramlink id="module"></paramlink> is an unnamed module.
6576
This function facilitates the instrumentation of code
6577
in named modules where that instrumentation requires
6578
expanding the set of modules that a module reads.
6579
</description>
6580
<origin>new</origin>
6581
<capabilities>
6582
</capabilities>
6583
<parameters>
6584
<param id="module">
6585
<ptrtype><jobject/></ptrtype>
6586
<description>
6587
The module to update.
6588
</description>
6589
</param>
6590
<param id="to_module">
6591
<ptrtype><jobject/></ptrtype>
6592
<description>
6593
The additional module to read.
6594
</description>
6595
</param>
6596
</parameters>
6597
<errors>
6598
<error id="JVMTI_ERROR_INVALID_MODULE">
6599
If <paramlink id="module"></paramlink> is not a module object.
6600
</error>
6601
<error id="JVMTI_ERROR_INVALID_MODULE">
6602
If <paramlink id="to_module"></paramlink> is not a module object.
6603
</error>
6604
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6605
if the module cannot be modified.
6606
See <functionlink id="IsModifiableModule"/>.
6607
</error>
6608
</errors>
6609
</function>
6610
6611
<function id="AddModuleExports" num="95" since="9">
6612
<synopsis>Add Module Exports</synopsis>
6613
<description>
6614
Update a module to export a package to another module.
6615
This function is a no-op when <paramlink id="module"></paramlink>
6616
is an unnamed module or an open module.
6617
This function facilitates the instrumentation of code
6618
in named modules where that instrumentation requires
6619
expanding the set of packages that a module exports.
6620
</description>
6621
<origin>new</origin>
6622
<capabilities>
6623
</capabilities>
6624
<parameters>
6625
<param id="module">
6626
<ptrtype><jobject/></ptrtype>
6627
<description>
6628
The module to update.
6629
</description>
6630
</param>
6631
<param id="pkg_name">
6632
<inbuf><char/></inbuf>
6633
<description>
6634
The exported package name.
6635
</description>
6636
</param>
6637
<param id="to_module">
6638
<ptrtype><jobject/></ptrtype>
6639
<description>
6640
The module the package is exported to.
6641
If the <code>to_module</code> is not a subclass of
6642
<code>java.lang.Module</code> this function returns
6643
<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6644
</description>
6645
</param>
6646
</parameters>
6647
<errors>
6648
<error id="JVMTI_ERROR_INVALID_MODULE">
6649
If <paramlink id="module"></paramlink> is not a module object.
6650
</error>
6651
<error id="JVMTI_ERROR_INVALID_MODULE">
6652
If <paramlink id="to_module"></paramlink> is not a module object.
6653
</error>
6654
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6655
If the package <paramlink id="pkg_name"></paramlink>
6656
does not belong to the module.
6657
</error>
6658
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6659
if the module cannot be modified.
6660
See <functionlink id="IsModifiableModule"/>.
6661
</error>
6662
</errors>
6663
</function>
6664
6665
<function id="AddModuleOpens" num="96" since="9">
6666
<synopsis>Add Module Opens</synopsis>
6667
<description>
6668
Update a module to open a package to another module.
6669
This function is a no-op when <paramlink id="module"></paramlink>
6670
is an unnamed module or an open module.
6671
This function facilitates the instrumentation of code
6672
in modules where that instrumentation requires
6673
expanding the set of packages that a module opens to
6674
other modules.
6675
</description>
6676
<origin>new</origin>
6677
<capabilities>
6678
</capabilities>
6679
<parameters>
6680
<param id="module">
6681
<ptrtype><jobject/></ptrtype>
6682
<description>
6683
The module to update.
6684
</description>
6685
</param>
6686
<param id="pkg_name">
6687
<inbuf><char/></inbuf>
6688
<description>
6689
The package name of the package to open.
6690
</description>
6691
</param>
6692
<param id="to_module">
6693
<ptrtype><jobject/></ptrtype>
6694
<description>
6695
The module with the package to open.
6696
If the <code>to_module</code> is not a subclass of
6697
<code>java.lang.Module</code> this function returns
6698
<errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6699
</description>
6700
</param>
6701
</parameters>
6702
<errors>
6703
<error id="JVMTI_ERROR_INVALID_MODULE">
6704
If <paramlink id="module"></paramlink> is not a module object.
6705
</error>
6706
<error id="JVMTI_ERROR_INVALID_MODULE">
6707
If <paramlink id="to_module"></paramlink> is not a module object.
6708
</error>
6709
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6710
If the package <paramlink id="pkg_name"></paramlink>
6711
does not belong to the module.
6712
</error>
6713
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6714
if the module cannot be modified.
6715
See <functionlink id="IsModifiableModule"/>.
6716
</error>
6717
</errors>
6718
</function>
6719
6720
<function id="AddModuleUses" num="97" since="9">
6721
<synopsis>Add Module Uses</synopsis>
6722
<description>
6723
Updates a module to add a service to the set of services that
6724
a module uses. This function is a no-op when the module
6725
is an unnamed module.
6726
This function facilitates the instrumentation of code
6727
in named modules where that instrumentation requires
6728
expanding the set of services that a module is using.
6729
</description>
6730
<origin>new</origin>
6731
<capabilities>
6732
</capabilities>
6733
<parameters>
6734
<param id="module">
6735
<ptrtype><jobject/></ptrtype>
6736
<description>
6737
The module to update.
6738
</description>
6739
</param>
6740
<param id="service">
6741
<ptrtype><jclass/></ptrtype>
6742
<description>
6743
The service to use.
6744
</description>
6745
</param>
6746
</parameters>
6747
<errors>
6748
<error id="JVMTI_ERROR_INVALID_MODULE">
6749
If <paramlink id="module"></paramlink> is not a module object.
6750
</error>
6751
<error id="JVMTI_ERROR_INVALID_CLASS">
6752
If <paramlink id="service"></paramlink> is not a class object.
6753
</error>
6754
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6755
if the module cannot be modified.
6756
See <functionlink id="IsModifiableModule"/>.
6757
</error>
6758
</errors>
6759
</function>
6760
6761
<function id="AddModuleProvides" num="98" since="9">
6762
<synopsis>Add Module Provides</synopsis>
6763
<description>
6764
Updates a module to add a service to the set of services that
6765
a module provides. This function is a no-op when the module
6766
is an unnamed module.
6767
This function facilitates the instrumentation of code
6768
in named modules where that instrumentation requires
6769
changes to the services that are provided.
6770
</description>
6771
<origin>new</origin>
6772
<capabilities>
6773
</capabilities>
6774
<parameters>
6775
<param id="module">
6776
<ptrtype><jobject/></ptrtype>
6777
<description>
6778
The module to update.
6779
</description>
6780
</param>
6781
<param id="service">
6782
<ptrtype><jclass/></ptrtype>
6783
<description>
6784
The service to provide.
6785
</description>
6786
</param>
6787
<param id="impl_class">
6788
<ptrtype><jclass/></ptrtype>
6789
<description>
6790
The implementation class for the provided service.
6791
</description>
6792
</param>
6793
</parameters>
6794
<errors>
6795
<error id="JVMTI_ERROR_INVALID_MODULE">
6796
If <paramlink id="module"></paramlink> is not a module object.
6797
</error>
6798
<error id="JVMTI_ERROR_INVALID_CLASS">
6799
If <paramlink id="service"></paramlink> is not a class object.
6800
</error>
6801
<error id="JVMTI_ERROR_INVALID_CLASS">
6802
If <paramlink id="impl_class"></paramlink> is not a class object.
6803
</error>
6804
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6805
if the module cannot be modified.
6806
See <functionlink id="IsModifiableModule"/>.
6807
</error>
6808
</errors>
6809
</function>
6810
6811
<function id="IsModifiableModule" num="99" since="9">
6812
<synopsis>Is Modifiable Module</synopsis>
6813
<description>
6814
Determines whether a module is modifiable.
6815
If a module is modifiable then this module can be updated with
6816
<functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
6817
<functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
6818
and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
6819
then the module can not be updated with these functions. The result of
6820
this function is always <code>JNI_TRUE</code> when called to determine
6821
if an unnamed module is modifiable.
6822
</description>
6823
<origin>new</origin>
6824
<capabilities>
6825
</capabilities>
6826
<parameters>
6827
<param id="module">
6828
<ptrtype><jobject/></ptrtype>
6829
<description>
6830
The module to query.
6831
</description>
6832
</param>
6833
<param id="is_modifiable_module_ptr">
6834
<outptr><jboolean/></outptr>
6835
<description>
6836
On return, points to the boolean result of this function.
6837
</description>
6838
</param>
6839
</parameters>
6840
<errors>
6841
<error id="JVMTI_ERROR_INVALID_MODULE">
6842
If <paramlink id="module"></paramlink> is not a module object.
6843
</error>
6844
</errors>
6845
</function>
6846
6847
</category>
6848
6849
<category id="class" label="Class">
6850
<function id="GetLoadedClasses" jkernel="yes" num="78">
6851
<synopsis>Get Loaded Classes</synopsis>
6852
<description>
6853
Return an array of all classes loaded in the virtual machine.
6854
The number of classes in the array is returned via
6855
<code>class_count_ptr</code>, and the array itself via
6856
<code>classes_ptr</code>.
6857
<p/>
6858
A class or interface creation can be triggered by one of the following:
6859
<ul>
6860
<li>By loading and deriving a class from a <code>class</code> file representation
6861
using a class loader (see <vmspec chapter="5.3"/>).</li>
6862
<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>
6863
that creates a hidden class or interface from a <code>class</code> file representation.</li>
6864
<li>By invoking methods in certain Java SE Platform APIs such as reflection.</li>
6865
</ul>
6866
<p/>
6867
An array class is created directly by the Java virtual machine. The creation
6868
can be triggered by using class loaders or by invoking methods in certain
6869
Java SE Platform APIs such as reflection.
6870
<p/>
6871
The returned list includes all classes and interfaces, including
6872
<externallink id="../api/java.base/java/lang/Class.html#isHidden()">
6873
hidden classes or interfaces</externallink>,
6874
and also array classes of all types
6875
(including arrays of primitive types).
6876
Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are
6877
<i>not</i> included in the returned list.
6878
</description>
6879
<origin>jvmdi</origin>
6880
<capabilities>
6881
</capabilities>
6882
<parameters>
6883
<param id="class_count_ptr">
6884
<outptr><jint/></outptr>
6885
<description>
6886
On return, points to the number of classes.
6887
</description>
6888
</param>
6889
<param id="classes_ptr">
6890
<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
6891
<description>
6892
On return, points to an array of references, one
6893
for each class.
6894
</description>
6895
</param>
6896
</parameters>
6897
<errors>
6898
</errors>
6899
</function>
6900
6901
<function id="GetClassLoaderClasses" jkernel="yes" num="79">
6902
<synopsis>Get Classloader Classes</synopsis>
6903
<description>
6904
Returns an array of all classes which this class loader
6905
can find by name via
6906
<externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>,
6907
<externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage.
6908
That is, all classes for which <code>initiating_loader</code>
6909
has been recorded as an initiating loader.
6910
Each class in the returned array was created by this class loader,
6911
either by defining it directly or by delegation to another class loader.
6912
See <vmspec chapter="5.3"/>.
6913
<p/>
6914
The returned list does not include
6915
<externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden
6916
classes or interfaces</externallink> or array classes whose
6917
element type is a hidden class or interface as they cannot be discovered
6918
by any class loader.
6919
<p/>
6920
The number of classes in the array is returned via
6921
<code>class_count_ptr</code>, and the array itself via
6922
<code>classes_ptr</code>.
6923
<p/>
6924
See <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>.
6925
</description>
6926
<origin>jvmdi</origin>
6927
<capabilities>
6928
</capabilities>
6929
<parameters>
6930
<param id="initiating_loader">
6931
<ptrtype>
6932
<jobject/>
6933
<nullok>the classes initiated by the bootstrap loader will be returned</nullok>
6934
</ptrtype>
6935
<description>
6936
An initiating class loader.
6937
</description>
6938
</param>
6939
<param id="class_count_ptr">
6940
<outptr><jint/></outptr>
6941
<description>
6942
On return, points to the number of classes.
6943
</description>
6944
</param>
6945
<param id="classes_ptr">
6946
<allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
6947
<description>
6948
On return, points to an array of references, one
6949
for each class.
6950
</description>
6951
</param>
6952
</parameters>
6953
<errors>
6954
</errors>
6955
</function>
6956
6957
<function id="GetClassSignature" phase="start" num="48">
6958
<synopsis>Get Class Signature</synopsis>
6959
<description>
6960
Return the name and the generic signature of the class indicated by <code>klass</code>.
6961
<p/>
6962
If the class is a class or interface, then:
6963
<ul>
6964
<li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
6965
then the returned name is the <externallink id="jni/types.html#type-signatures">
6966
JNI type signature</externallink>.
6967
For example, java.util.List is "Ljava/util/List;"
6968
</li>
6969
<li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
6970
then the returned name is a string of the form:
6971
<code>"L" + N + "." + S + ";"</code>
6972
where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1)
6973
indicated by the <code>class</code> file passed to
6974
<externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte[],boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>,
6975
and <code>S</code> is an unqualified name.
6976
The returned name is not a type descriptor and does not conform to JVMS 4.3.2.
6977
For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;"
6978
</li>
6979
</ul>
6980
<p/>
6981
If the class indicated by <code>klass</code> represents an array class, then
6982
the returned name is a string consisting of one or more "<code>[</code>" characters
6983
representing the depth of the array nesting, followed by the class signature
6984
of the element type. For example the class signature of java.lang.String[] is
6985
"[Ljava/lang/String;" and that of int[] is "[I".
6986
<p/>
6987
If the class indicated by <code>klass</code> represents primitive type or <code>void</code>,
6988
then the returned name is the <externallink id="jni/types.html#type-signatures">
6989
type signature character of the corresponding primitive type</externallink>.
6990
For example, java.lang.Integer.TYPE is "I".
6991
</description>
6992
<origin>jvmdiClone</origin>
6993
<capabilities>
6994
</capabilities>
6995
<parameters>
6996
<param id="klass">
6997
<jclass/>
6998
<description>
6999
The class to query.
7000
</description>
7001
</param>
7002
<param id="signature_ptr">
7003
<allocbuf>
7004
<char/>
7005
<nullok>the signature is not returned</nullok>
7006
</allocbuf>
7007
<description>
7008
On return, points to the JNI type signature of the class, encoded as a
7009
<internallink id="mUTF">modified UTF-8</internallink> string.
7010
</description>
7011
</param>
7012
<param id="generic_ptr">
7013
<allocbuf>
7014
<char/>
7015
<nullok>the generic signature is not returned</nullok>
7016
</allocbuf>
7017
<description>
7018
On return, points to the generic signature of the class, encoded as a
7019
<internallink id="mUTF">modified UTF-8</internallink> string.
7020
If there is no generic signature attribute for the class, then,
7021
on return, points to <code>NULL</code>.
7022
</description>
7023
</param>
7024
</parameters>
7025
<errors>
7026
</errors>
7027
</function>
7028
7029
<function id="GetClassStatus" phase="start" num="49">
7030
<synopsis>Get Class Status</synopsis>
7031
<description>
7032
Get the status of the class. Zero or more of the following bits can be
7033
set.
7034
<constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits">
7035
<constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1">
7036
Class bytecodes have been verified
7037
</constant>
7038
<constant id="JVMTI_CLASS_STATUS_PREPARED" num="2">
7039
Class preparation is complete
7040
</constant>
7041
<constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4">
7042
Class initialization is complete. Static initializer has been run.
7043
</constant>
7044
<constant id="JVMTI_CLASS_STATUS_ERROR" num="8">
7045
Error during initialization makes class unusable
7046
</constant>
7047
<constant id="JVMTI_CLASS_STATUS_ARRAY" num="16">
7048
Class is an array. If set, all other bits are zero.
7049
</constant>
7050
<constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32">
7051
Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>).
7052
If set, all other bits are zero.
7053
</constant>
7054
</constants>
7055
</description>
7056
<origin>jvmdi</origin>
7057
<capabilities>
7058
</capabilities>
7059
<parameters>
7060
<param id="klass">
7061
<jclass/>
7062
<description>
7063
The class to query.
7064
</description>
7065
</param>
7066
<param id="status_ptr">
7067
<outptr><jint/></outptr>
7068
<description>
7069
On return, points to the current state of this class as one or
7070
more of the <internallink id="jvmtiClassStatus">class status flags</internallink>.
7071
</description>
7072
</param>
7073
</parameters>
7074
<errors>
7075
</errors>
7076
</function>
7077
7078
<function id="GetSourceFileName" phase="start" num="50">
7079
<synopsis>Get Source File Name</synopsis>
7080
<description>
7081
For the class indicated by <code>klass</code>, return the source file
7082
name via <code>source_name_ptr</code>. The returned string
7083
is a file name only and never contains a directory name.
7084
<p/>
7085
For primitive classes (for example, <code>java.lang.Integer.TYPE</code>)
7086
and for arrays this function returns
7087
<errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>.
7088
</description>
7089
<origin>jvmdi</origin>
7090
<capabilities>
7091
<required id="can_get_source_file_name"></required>
7092
</capabilities>
7093
<parameters>
7094
<param id="klass">
7095
<jclass/>
7096
<description>
7097
The class to query.
7098
</description>
7099
</param>
7100
<param id="source_name_ptr">
7101
<allocbuf><char/></allocbuf>
7102
<description>
7103
On return, points to the class's source file name, encoded as a
7104
<internallink id="mUTF">modified UTF-8</internallink> string.
7105
</description>
7106
</param>
7107
</parameters>
7108
<errors>
7109
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
7110
Class information does not include a source file name. This includes
7111
cases where the class is an array class or primitive class.
7112
</error>
7113
</errors>
7114
</function>
7115
7116
<function id="GetClassModifiers" phase="start" num="51">
7117
<synopsis>Get Class Modifiers</synopsis>
7118
<description>
7119
For the class indicated by <code>klass</code>, return the access
7120
flags
7121
via <code>modifiers_ptr</code>.
7122
Access flags are defined in <vmspec chapter="4"/>.
7123
<p/>
7124
If the class is an array class, then its public, private, and protected
7125
modifiers are the same as those of its component type. For arrays of
7126
primitives, this component type is represented by one of the primitive
7127
classes (for example, <code>java.lang.Integer.TYPE</code>).
7128
<p/>
7129
If the class is a primitive class, its public modifier is always true,
7130
and its protected and private modifiers are always false.
7131
<p/>
7132
If the class is an array class or a primitive class then its final
7133
modifier is always true and its interface modifier is always false.
7134
The values of its other modifiers are not determined by this specification.
7135
7136
</description>
7137
<origin>jvmdi</origin>
7138
<capabilities>
7139
</capabilities>
7140
<parameters>
7141
<param id="klass">
7142
<jclass/>
7143
<description>
7144
The class to query.
7145
</description>
7146
</param>
7147
<param id="modifiers_ptr">
7148
<outptr><jint/></outptr>
7149
<description>
7150
On return, points to the current access flags of this class.
7151
7152
</description>
7153
</param>
7154
</parameters>
7155
<errors>
7156
</errors>
7157
</function>
7158
7159
<function id="GetClassMethods" phase="start" num="52">
7160
<synopsis>Get Class Methods</synopsis>
7161
<description>
7162
For the class indicated by <code>klass</code>, return a count of
7163
methods via <code>method_count_ptr</code> and a list of
7164
method IDs via <code>methods_ptr</code>. The method list contains
7165
constructors and static initializers as well as true methods.
7166
Only directly declared methods are returned (not inherited methods).
7167
An empty method list is returned for array classes and primitive classes
7168
(for example, <code>java.lang.Integer.TYPE</code>).
7169
</description>
7170
<origin>jvmdi</origin>
7171
<capabilities>
7172
<capability id="can_maintain_original_method_order"/>
7173
</capabilities>
7174
<parameters>
7175
<param id="klass">
7176
<jclass/>
7177
<description>
7178
The class to query.
7179
</description>
7180
</param>
7181
<param id="method_count_ptr">
7182
<outptr><jint/></outptr>
7183
<description>
7184
On return, points to the number of methods declared in this class.
7185
</description>
7186
</param>
7187
<param id="methods_ptr">
7188
<allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>
7189
<description>
7190
On return, points to the method ID array.
7191
</description>
7192
</param>
7193
</parameters>
7194
<errors>
7195
<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7196
<paramlink id="klass"></paramlink> is not prepared.
7197
</error>
7198
</errors>
7199
</function>
7200
7201
<function id="GetClassFields" phase="start" num="53">
7202
<synopsis>Get Class Fields</synopsis>
7203
<description>
7204
For the class indicated by <code>klass</code>, return a count of fields
7205
via <code>field_count_ptr</code> and a list of field IDs via
7206
<code>fields_ptr</code>.
7207
Only directly declared fields are returned (not inherited fields).
7208
Fields are returned in the order they occur in the class file.
7209
An empty field list is returned for array classes and primitive classes
7210
(for example, <code>java.lang.Integer.TYPE</code>).
7211
Use JNI to determine the length of an array.
7212
</description>
7213
<origin>jvmdi</origin>
7214
<capabilities>
7215
</capabilities>
7216
<parameters>
7217
<param id="klass">
7218
<jclass/>
7219
<description>
7220
The class to query.
7221
</description>
7222
</param>
7223
<param id="field_count_ptr">
7224
<outptr><jint/></outptr>
7225
<description>
7226
On return, points to the number of fields declared in this class.
7227
</description>
7228
</param>
7229
<param id="fields_ptr">
7230
<allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>
7231
<description>
7232
On return, points to the field ID array.
7233
</description>
7234
</param>
7235
</parameters>
7236
<errors>
7237
<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7238
<paramlink id="klass"></paramlink> is not prepared.
7239
</error>
7240
</errors>
7241
</function>
7242
7243
<function id="GetImplementedInterfaces" phase="start" num="54">
7244
<synopsis>Get Implemented Interfaces</synopsis>
7245
<description>
7246
Return the direct super-interfaces of this class. For a class, this
7247
function returns the interfaces declared in its <code>implements</code>
7248
clause. For an interface, this function returns the interfaces declared in
7249
its <code>extends</code> clause.
7250
An empty interface list is returned for array classes and primitive classes
7251
(for example, <code>java.lang.Integer.TYPE</code>).
7252
</description>
7253
<origin>jvmdi</origin>
7254
<capabilities>
7255
</capabilities>
7256
<parameters>
7257
<param id="klass">
7258
<jclass/>
7259
<description>
7260
The class to query.
7261
</description>
7262
</param>
7263
<param id="interface_count_ptr">
7264
<outptr><jint/></outptr>
7265
<description>
7266
On return, points to the number of interfaces.
7267
</description>
7268
</param>
7269
<param id="interfaces_ptr">
7270
<allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>
7271
<description>
7272
On return, points to the interface array.
7273
</description>
7274
</param>
7275
</parameters>
7276
<errors>
7277
<error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7278
<paramlink id="klass"></paramlink> is not prepared.
7279
</error>
7280
</errors>
7281
</function>
7282
7283
<function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">
7284
<synopsis>Get Class Version Numbers</synopsis>
7285
<description>
7286
For the class indicated by <code>klass</code>,
7287
return the minor and major version numbers,
7288
as defined in
7289
<vmspec chapter="4"/>.
7290
</description>
7291
<origin>new</origin>
7292
<capabilities>
7293
</capabilities>
7294
<parameters>
7295
<param id="klass">
7296
<jclass/>
7297
<description>
7298
The class to query.
7299
</description>
7300
</param>
7301
<param id="minor_version_ptr">
7302
<outptr><jint/></outptr>
7303
<description>
7304
On return, points to the value of the
7305
<code>minor_version</code> item of the
7306
Class File Format.
7307
Note: to be consistent with the Class File Format,
7308
the minor version number is the first parameter.
7309
</description>
7310
</param>
7311
<param id="major_version_ptr">
7312
<outptr><jint/></outptr>
7313
<description>
7314
On return, points to the value of the
7315
<code>major_version</code> item of the
7316
Class File Format.
7317
</description>
7318
</param>
7319
</parameters>
7320
<errors>
7321
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
7322
The class is a primitive or array class.
7323
</error>
7324
</errors>
7325
</function>
7326
7327
<function id="GetConstantPool" phase="start" num="146" since="1.1">
7328
<synopsis>Get Constant Pool</synopsis>
7329
<description>
7330
For the class indicated by <code>klass</code>,
7331
return the raw bytes of the constant pool in the format of the
7332
<code>constant_pool</code> item of
7333
<vmspec chapter="4"/>.
7334
The format of the constant pool may differ between versions
7335
of the Class File Format, so, the
7336
<functionlink id="GetClassVersionNumbers">minor and major
7337
class version numbers</functionlink> should be checked for
7338
compatibility.
7339
<p/>
7340
The returned constant pool might not have the same layout or
7341
contents as the constant pool in the defining class file.
7342
The constant pool returned by GetConstantPool() may have
7343
more or fewer entries than the defining constant pool.
7344
Entries may be in a different order.
7345
The constant pool returned by GetConstantPool() will match the
7346
constant pool used by
7347
<functionlink id="GetBytecodes">GetBytecodes()</functionlink>.
7348
That is, the bytecodes returned by GetBytecodes() will have
7349
constant pool indices which refer to constant pool entries returned
7350
by GetConstantPool().
7351
Note that since <functionlink id="RetransformClasses"/>
7352
and <functionlink id="RedefineClasses"/> can change
7353
the constant pool, the constant pool returned by this function
7354
can change accordingly. Thus, the correspondence between
7355
GetConstantPool() and GetBytecodes() does not hold if there
7356
is an intervening class retransformation or redefinition.
7357
The value of a constant pool entry used by a given bytecode will
7358
match that of the defining class file (even if the indices don't match).
7359
Constant pool entries which are not used directly or indirectly by
7360
bytecodes (for example, UTF-8 strings associated with annotations) are
7361
not required to exist in the returned constant pool.
7362
</description>
7363
<origin>new</origin>
7364
<capabilities>
7365
<required id="can_get_constant_pool"></required>
7366
</capabilities>
7367
<parameters>
7368
<param id="klass">
7369
<jclass/>
7370
<description>
7371
The class to query.
7372
</description>
7373
</param>
7374
<param id="constant_pool_count_ptr">
7375
<outptr><jint/></outptr>
7376
<description>
7377
On return, points to the number of entries
7378
in the constant pool table plus one.
7379
This corresponds to the <code>constant_pool_count</code>
7380
item of the Class File Format.
7381
</description>
7382
</param>
7383
<param id="constant_pool_byte_count_ptr">
7384
<outptr><jint/></outptr>
7385
<description>
7386
On return, points to the number of bytes
7387
in the returned raw constant pool.
7388
</description>
7389
</param>
7390
<param id="constant_pool_bytes_ptr">
7391
<allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>
7392
<description>
7393
On return, points to the raw constant pool, that is the bytes
7394
defined by the <code>constant_pool</code> item of the
7395
Class File Format
7396
</description>
7397
</param>
7398
</parameters>
7399
<errors>
7400
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
7401
The class is a primitive or array class.
7402
</error>
7403
</errors>
7404
</function>
7405
7406
<function id="IsInterface" phase="start" num="55">
7407
<synopsis>Is Interface</synopsis>
7408
<description>
7409
Determines whether a class object reference represents an interface.
7410
The <code>jboolean</code> result is
7411
<code>JNI_TRUE</code> if the "class" is actually an interface,
7412
<code>JNI_FALSE</code> otherwise.
7413
</description>
7414
<origin>jvmdi</origin>
7415
<capabilities>
7416
</capabilities>
7417
<parameters>
7418
<param id="klass">
7419
<jclass/>
7420
<description>
7421
The class to query.
7422
</description>
7423
</param>
7424
<param id="is_interface_ptr">
7425
<outptr><jboolean/></outptr>
7426
<description>
7427
On return, points to the boolean result of this function.
7428
7429
</description>
7430
</param>
7431
</parameters>
7432
<errors>
7433
</errors>
7434
</function>
7435
7436
<function id="IsArrayClass" phase="start" num="56">
7437
<synopsis>Is Array Class</synopsis>
7438
<description>
7439
Determines whether a class object reference represents an array.
7440
The <code>jboolean</code> result is
7441
<code>JNI_TRUE</code> if the class is an array,
7442
<code>JNI_FALSE</code> otherwise.
7443
</description>
7444
<origin>jvmdi</origin>
7445
<capabilities>
7446
</capabilities>
7447
<parameters>
7448
<param id="klass">
7449
<jclass/>
7450
<description>
7451
The class to query.
7452
</description>
7453
</param>
7454
<param id="is_array_class_ptr">
7455
<outptr><jboolean/></outptr>
7456
<description>
7457
On return, points to the boolean result of this function.
7458
7459
</description>
7460
</param>
7461
</parameters>
7462
<errors>
7463
</errors>
7464
</function>
7465
7466
<function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">
7467
<synopsis>Is Modifiable Class</synopsis>
7468
<description>
7469
Determines whether a class is modifiable.
7470
If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>
7471
returns <code>JNI_TRUE</code>) the class can be
7472
redefined with <functionlink id="RedefineClasses"/> (assuming
7473
the agent possesses the
7474
<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
7475
capability) or
7476
retransformed with <functionlink id="RetransformClasses"/> (assuming
7477
the agent possesses the
7478
<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
7479
capability).
7480
If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>
7481
returns <code>JNI_FALSE</code>) the class can be neither
7482
redefined nor retransformed.
7483
<p/>
7484
Primitive classes (for example, <code>java.lang.Integer.TYPE</code>),
7485
array classes, and some implementation defined classes are never modifiable.
7486
<p/>
7487
</description>
7488
<origin>new</origin>
7489
<capabilities>
7490
<capability id="can_redefine_any_class">
7491
If possessed then all classes (except primitive, array, and some implementation defined
7492
classes) are modifiable with <functionlink id="RedefineClasses"/>.
7493
</capability>
7494
<capability id="can_retransform_any_class">
7495
If possessed then all classes (except primitive, array, and some implementation defined
7496
classes) are modifiable with <functionlink id="RetransformClasses"/>.
7497
</capability>
7498
<capability id="can_redefine_classes">
7499
No effect on the result of the function.
7500
But must additionally be possessed to modify the class with
7501
<functionlink id="RedefineClasses"/>.
7502
</capability>
7503
<capability id="can_retransform_classes">
7504
No effect on the result of the function.
7505
But must additionally be possessed to modify the class with
7506
<functionlink id="RetransformClasses"/>.
7507
</capability>
7508
</capabilities>
7509
<parameters>
7510
<param id="klass">
7511
<jclass/>
7512
<description>
7513
The class to query.
7514
</description>
7515
</param>
7516
<param id="is_modifiable_class_ptr">
7517
<outptr><jboolean/></outptr>
7518
<description>
7519
On return, points to the boolean result of this function.
7520
</description>
7521
</param>
7522
</parameters>
7523
<errors>
7524
</errors>
7525
</function>
7526
7527
<function id="GetClassLoader" phase="start" num="57">
7528
<synopsis>Get Class Loader</synopsis>
7529
<description>
7530
For the class indicated by <code>klass</code>, return via
7531
<code>classloader_ptr</code> a reference to the class loader for the
7532
class.
7533
</description>
7534
<origin>jvmdi</origin>
7535
<capabilities>
7536
</capabilities>
7537
<parameters>
7538
<param id="klass">
7539
<jclass/>
7540
<description>
7541
The class to query.
7542
</description>
7543
</param>
7544
<param id="classloader_ptr">
7545
<outptr><jobject/></outptr>
7546
<description>
7547
On return, points to the class loader that loaded
7548
this class.
7549
If the class was not created by a class loader
7550
or if the class loader is the bootstrap class loader,
7551
points to <code>NULL</code>.
7552
</description>
7553
</param>
7554
</parameters>
7555
<errors>
7556
</errors>
7557
7558
</function>
7559
7560
<function id="GetSourceDebugExtension" phase="start" num="90">
7561
<synopsis>Get Source Debug Extension</synopsis>
7562
<description>
7563
For the class indicated by <code>klass</code>, return the debug
7564
extension via <code>source_debug_extension_ptr</code>.
7565
The returned string
7566
contains exactly the debug extension information present in the
7567
class file of <code>klass</code>.
7568
</description>
7569
<origin>jvmdi</origin>
7570
<capabilities>
7571
<required id="can_get_source_debug_extension"></required>
7572
</capabilities>
7573
<parameters>
7574
<param id="klass">
7575
<jclass/>
7576
<description>
7577
The class to query.
7578
</description>
7579
</param>
7580
<param id="source_debug_extension_ptr">
7581
<allocbuf><char/></allocbuf>
7582
<description>
7583
On return, points to the class's debug extension, encoded as a
7584
<internallink id="mUTF">modified UTF-8</internallink> string.
7585
</description>
7586
</param>
7587
</parameters>
7588
<errors>
7589
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
7590
Class information does not include a debug extension.
7591
</error>
7592
</errors>
7593
</function>
7594
7595
<function id="RetransformClasses" jkernel="yes" num="152" since="1.1">
7596
<synopsis>Retransform Classes</synopsis>
7597
<description>
7598
This function facilitates the
7599
<internallink id="bci">bytecode instrumentation</internallink>
7600
of already loaded classes.
7601
To replace the class definition without reference to the existing
7602
bytecodes, as one might do when recompiling from source for
7603
fix-and-continue debugging, <functionlink id="RedefineClasses"/>
7604
function should be used instead.
7605
<p/>
7606
When classes are initially loaded or when they are
7607
<functionlink id="RedefineClasses">redefined</functionlink>,
7608
the initial class file bytes can be transformed with the
7609
<eventlink id="ClassFileLoadHook"/> event.
7610
This function reruns the transformation process
7611
(whether or not a transformation has previously occurred).
7612
This retransformation follows these steps:
7613
<ul>
7614
<li>starting from the initial class file bytes
7615
</li>
7616
<li>for each <fieldlink id="can_retransform_classes"
7617
struct="jvmtiCapabilities">retransformation
7618
incapable</fieldlink>
7619
agent which received a
7620
<code>ClassFileLoadHook</code> event during the previous
7621
load or redefine, the bytes it returned
7622
(via the <code>new_class_data</code> parameter)
7623
are reused as the output of the transformation;
7624
note that this is equivalent to reapplying
7625
the previous transformation, unaltered. except that
7626
the <code>ClassFileLoadHook</code> event
7627
is <b>not</b> sent to these agents
7628
</li>
7629
<li>for each <fieldlink id="can_retransform_classes"
7630
struct="jvmtiCapabilities">retransformation
7631
capable</fieldlink>
7632
agent, the <code>ClassFileLoadHook</code> event is sent,
7633
allowing a new transformation to be applied
7634
</li>
7635
<li>the transformed class file bytes are installed as the new
7636
definition of the class
7637
</li>
7638
</ul>
7639
See the <eventlink id="ClassFileLoadHook"/> event for more details.
7640
<p/>
7641
The initial class file bytes represent the bytes passed to
7642
<code>ClassLoader.defineClass</code>
7643
or <code>RedefineClasses</code> (before any transformations
7644
were applied), however they may not exactly match them.
7645
The constant pool may differ in ways described in
7646
<functionlink id="GetConstantPool"/>.
7647
Constant pool indices in the bytecodes of methods will correspond.
7648
Some attributes may not be present.
7649
Where order is not meaningful, for example the order of methods,
7650
order may not be preserved.
7651
<p/>
7652
Retransformation can cause new versions of methods to be installed.
7653
Old method versions may become
7654
<internallink id="obsoleteMethods">obsolete</internallink>
7655
The new method version will be used on new invokes.
7656
If a method has active stack frames, those active frames continue to
7657
run the bytecodes of the original method version.
7658
<p/>
7659
This function does not cause any initialization except that which
7660
would occur under the customary JVM semantics.
7661
In other words, retransforming a class does not cause its initializers to be
7662
run. The values of static fields will remain as they were
7663
prior to the call.
7664
<p/>
7665
Threads need not be suspended.
7666
<p/>
7667
All breakpoints in the class are cleared.
7668
<p/>
7669
All attributes are updated.
7670
<p/>
7671
Instances of the retransformed class are not affected -- fields retain their
7672
previous values.
7673
<functionlink id="GetTag">Tags</functionlink> on the instances are
7674
also unaffected.
7675
<p/>
7676
In response to this call, no events other than the
7677
<eventlink id="ClassFileLoadHook"/> event
7678
will be sent.
7679
<p/>
7680
The retransformation may change method bodies, the constant pool and attributes
7681
(unless explicitly prohibited).
7682
The retransformation must not add, remove or rename fields or methods, change the
7683
signatures of methods, change modifiers, or change inheritance.
7684
The retransformation must not change the <code>NestHost</code>,
7685
<code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
7686
attributes.
7687
These restrictions may be lifted in future versions.
7688
See the error return description below for information on error codes
7689
returned if an unsupported retransformation is attempted.
7690
The class file bytes are not verified or installed until they have passed
7691
through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
7692
returned error code reflects the result of the transformations.
7693
If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
7694
none of the classes to be retransformed will have a new definition installed.
7695
When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
7696
all of the classes to be retransformed will have their new definitions installed.
7697
</description>
7698
<origin>new</origin>
7699
<capabilities>
7700
<required id="can_retransform_classes"></required>
7701
<capability id="can_retransform_any_class"></capability>
7702
</capabilities>
7703
<parameters>
7704
<param id="class_count">
7705
<jint min="0"/>
7706
<description>
7707
The number of classes to be retransformed.
7708
</description>
7709
</param>
7710
<param id="classes">
7711
<inbuf incount="class_count"><jclass/></inbuf>
7712
<description>
7713
The array of classes to be retransformed.
7714
</description>
7715
</param>
7716
</parameters>
7717
<errors>
7718
<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
7719
One of the <paramlink id="classes"/> cannot be modified.
7720
See <functionlink id="IsModifiableClass"/>.
7721
</error>
7722
<error id="JVMTI_ERROR_INVALID_CLASS">
7723
One of the <paramlink id="classes"/> is not a valid class.
7724
</error>
7725
<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
7726
A retransformed class file has a version number not supported by this VM.
7727
</error>
7728
<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
7729
A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).
7730
</error>
7731
<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
7732
The retransformed class file definitions would lead to a circular definition
7733
(the VM would return a <code>ClassCircularityError</code>).
7734
</error>
7735
<error id="JVMTI_ERROR_FAILS_VERIFICATION">
7736
The retransformed class file bytes fail verification.
7737
</error>
7738
<error id="JVMTI_ERROR_NAMES_DONT_MATCH">
7739
The class name defined in a retransformed class file is
7740
different from the name in the old class object.
7741
</error>
7742
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
7743
A retransformed class file would require adding a method.
7744
</error>
7745
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
7746
A retransformed class file changes a field.
7747
</error>
7748
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
7749
A direct superclass is different for a retransformed class file,
7750
or the set of directly implemented
7751
interfaces is different.
7752
</error>
7753
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
7754
A retransformed class file does not declare a method
7755
declared in the old class version.
7756
</error>
7757
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
7758
A retransformed class file has unsupported differences in class attributes.
7759
</error>
7760
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
7761
A retransformed class file has different class modifiers.
7762
</error>
7763
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
7764
A method in the retransformed class file has different modifiers
7765
than its counterpart in the old class version.
7766
</error>
7767
</errors>
7768
</function>
7769
7770
<function id="RedefineClasses" jkernel="yes" num="87">
7771
<synopsis>Redefine Classes</synopsis>
7772
<typedef id="jvmtiClassDefinition" label="Class redefinition description">
7773
<field id="klass">
7774
<jclass/>
7775
<description>
7776
Class object for this class
7777
</description>
7778
</field>
7779
<field id="class_byte_count">
7780
<jint/>
7781
<description>
7782
Number of bytes defining class (below)
7783
</description>
7784
</field>
7785
<field id="class_bytes">
7786
<inbuf incount="class_byte_count"><uchar/></inbuf>
7787
<description>
7788
Bytes defining class (in <vmspec chapter="4"/>)
7789
</description>
7790
</field>
7791
</typedef>
7792
<description>
7793
All classes given are redefined according to the definitions
7794
supplied.
7795
This function is used to replace the definition of a class
7796
with a new definition, as might be needed in fix-and-continue
7797
debugging.
7798
Where the existing class file bytes are to be transformed, for
7799
example in
7800
<internallink id="bci">bytecode instrumentation</internallink>,
7801
<functionlink id="RetransformClasses"/> should be used.
7802
<p/>
7803
Redefinition can cause new versions of methods to be installed.
7804
Old method versions may become
7805
<internallink id="obsoleteMethods">obsolete</internallink>
7806
The new method version will be used on new invokes.
7807
If a method has active stack frames, those active frames continue to
7808
run the bytecodes of the original method version.
7809
If resetting of stack frames is desired, use
7810
<functionlink id="PopFrame"></functionlink>
7811
to pop frames with obsolete method versions.
7812
<p/>
7813
This function does not cause any initialization except that which
7814
would occur under the customary JVM semantics.
7815
In other words, redefining a class does not cause its initializers to be
7816
run. The values of static fields will remain as they were
7817
prior to the call.
7818
<p/>
7819
Threads need not be suspended.
7820
<p/>
7821
All breakpoints in the class are cleared.
7822
<p/>
7823
All attributes are updated.
7824
<p/>
7825
Instances of the redefined class are not affected -- fields retain their
7826
previous values.
7827
<functionlink id="GetTag">Tags</functionlink> on the instances are
7828
also unaffected.
7829
<p/>
7830
In response to this call, the <jvmti/> event
7831
<eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>
7832
will be sent (if enabled), but no other <jvmti/> events will be sent.
7833
<p/>
7834
The redefinition may change method bodies, the constant pool and attributes
7835
(unless explicitly prohibited).
7836
The redefinition must not add, remove or rename fields or methods, change the
7837
signatures of methods, change modifiers, or change inheritance.
7838
The redefinition must not change the <code>NestHost</code>,
7839
<code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
7840
attributes.
7841
These restrictions may be lifted in future versions.
7842
See the error return description below for information on error codes
7843
returned if an unsupported redefinition is attempted.
7844
The class file bytes are not verified or installed until they have passed
7845
through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
7846
returned error code reflects the result of the transformations applied
7847
to the bytes passed into <paramlink id="class_definitions"/>.
7848
If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
7849
none of the classes to be redefined will have a new definition installed.
7850
When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
7851
all of the classes to be redefined will have their new definitions installed.
7852
</description>
7853
<origin>jvmdi</origin>
7854
<capabilities>
7855
<required id="can_redefine_classes"></required>
7856
<capability id="can_redefine_any_class"></capability>
7857
</capabilities>
7858
<parameters>
7859
<param id="class_count">
7860
<jint min="0"/>
7861
<description>
7862
The number of classes specified in <code>class_definitions</code>
7863
</description>
7864
</param>
7865
<param id="class_definitions">
7866
<inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>
7867
<description>
7868
The array of new class definitions
7869
</description>
7870
</param>
7871
</parameters>
7872
<errors>
7873
<error id="JVMTI_ERROR_NULL_POINTER">
7874
One of <code>class_bytes</code> is <code>NULL</code>.
7875
</error>
7876
<error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
7877
An element of <code>class_definitions</code> cannot be modified.
7878
See <functionlink id="IsModifiableClass"/>.
7879
</error>
7880
<error id="JVMTI_ERROR_INVALID_CLASS">
7881
An element of <code>class_definitions</code> is not a valid class.
7882
</error>
7883
<error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
7884
A new class file has a version number not supported by this VM.
7885
</error>
7886
<error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
7887
A new class file is malformed (The VM would return a <code>ClassFormatError</code>).
7888
</error>
7889
<error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
7890
The new class file definitions would lead to a circular definition
7891
(the VM would return a <code>ClassCircularityError</code>).
7892
</error>
7893
<error id="JVMTI_ERROR_FAILS_VERIFICATION">
7894
The class bytes fail verification.
7895
</error>
7896
<error id="JVMTI_ERROR_NAMES_DONT_MATCH">
7897
The class name defined in a new class file is
7898
different from the name in the old class object.
7899
</error>
7900
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
7901
A new class file would require adding a method.
7902
</error>
7903
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
7904
A new class version changes a field.
7905
</error>
7906
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
7907
A direct superclass is different for a new class
7908
version, or the set of directly implemented
7909
interfaces is different.
7910
</error>
7911
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
7912
A new class version does not declare a method
7913
declared in the old class version.
7914
</error>
7915
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
7916
A new class version has unsupported differences in class attributes.
7917
</error>
7918
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
7919
A new class version has different modifiers.
7920
</error>
7921
<error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
7922
A method in the new class version has different modifiers
7923
than its counterpart in the old class version.
7924
</error>
7925
<error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7926
A module cannot be modified.
7927
See <functionlink id="IsModifiableModule"/>.
7928
</error>
7929
</errors>
7930
</function>
7931
7932
</category>
7933
7934
<category id="object" label="Object">
7935
7936
<function id="GetObjectSize" jkernel="yes" phase="start" num="154">
7937
<synopsis>Get Object Size</synopsis>
7938
<description>
7939
For the object indicated by <code>object</code>,
7940
return via <code>size_ptr</code> the size of the object.
7941
This size is an implementation-specific approximation of
7942
the amount of storage consumed by this object.
7943
It may include some or all of the object's overhead, and thus
7944
is useful for comparison within an implementation but not
7945
between implementations.
7946
The estimate may change during a single invocation of the JVM.
7947
</description>
7948
<origin>new</origin>
7949
<capabilities>
7950
</capabilities>
7951
<parameters>
7952
<param id="object">
7953
<jobject/>
7954
<description>
7955
The object to query.
7956
</description>
7957
</param>
7958
<param id="size_ptr">
7959
<outptr><jlong/></outptr>
7960
<description>
7961
On return, points to the object's size in bytes.
7962
</description>
7963
</param>
7964
</parameters>
7965
<errors>
7966
</errors>
7967
</function>
7968
7969
<function id="GetObjectHashCode" phase="start" num="58">
7970
<synopsis>Get Object Hash Code</synopsis>
7971
<description>
7972
For the object indicated by <code>object</code>,
7973
return via <code>hash_code_ptr</code> a hash code.
7974
This hash code could be used to maintain a hash table of object references,
7975
however, on some implementations this can cause significant performance
7976
impacts--in most cases
7977
<internallink id="Heap">tags</internallink>
7978
will be a more efficient means of associating information with objects.
7979
This function guarantees
7980
the same hash code value for a particular object throughout its life
7981
</description>
7982
<origin>jvmdi</origin>
7983
<capabilities>
7984
</capabilities>
7985
<parameters>
7986
<param id="object">
7987
<jobject/>
7988
<description>
7989
The object to query.
7990
</description>
7991
</param>
7992
<param id="hash_code_ptr">
7993
<outptr><jint/></outptr>
7994
<description>
7995
On return, points to the object's hash code.
7996
</description>
7997
</param>
7998
</parameters>
7999
<errors>
8000
</errors>
8001
</function>
8002
8003
<function id="GetObjectMonitorUsage" num="59">
8004
<synopsis>Get Object Monitor Usage</synopsis>
8005
<typedef id="jvmtiMonitorUsage" label="Object monitor usage information">
8006
<field id="owner">
8007
<jthread/>
8008
<description>
8009
The thread owning this monitor, or <code>NULL</code> if unused
8010
</description>
8011
</field>
8012
<field id="entry_count">
8013
<jint/>
8014
<description>
8015
The number of times the owning thread has entered the monitor
8016
</description>
8017
</field>
8018
<field id="waiter_count">
8019
<jint/>
8020
<description>
8021
The number of threads waiting to own this monitor
8022
</description>
8023
</field>
8024
<field id="waiters">
8025
<allocfieldbuf><jthread/></allocfieldbuf>
8026
<description>
8027
The <code>waiter_count</code> waiting threads
8028
</description>
8029
</field>
8030
<field id="notify_waiter_count">
8031
<jint/>
8032
<description>
8033
The number of threads waiting to be notified by this monitor
8034
</description>
8035
</field>
8036
<field id="notify_waiters">
8037
<allocfieldbuf><jthread/></allocfieldbuf>
8038
<description>
8039
The <code>notify_waiter_count</code> threads waiting to be notified
8040
</description>
8041
</field>
8042
</typedef>
8043
<description>
8044
Get information about the object's monitor.
8045
The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
8046
are filled in with information about usage of the monitor.
8047
<todo>
8048
Decide and then clarify suspend requirements.
8049
</todo>
8050
</description>
8051
<origin>jvmdi</origin>
8052
<capabilities>
8053
<required id="can_get_monitor_info"></required>
8054
</capabilities>
8055
<parameters>
8056
<param id="object">
8057
<jobject/>
8058
<description>
8059
The object to query.
8060
</description>
8061
</param>
8062
<param id="info_ptr">
8063
<outptr><struct>jvmtiMonitorUsage</struct></outptr>
8064
<description>
8065
On return, filled with monitor information for the
8066
specified object.
8067
</description>
8068
</param>
8069
</parameters>
8070
<errors>
8071
</errors>
8072
</function>
8073
8074
<elide>
8075
<function id="GetObjectMonitors" num="116">
8076
<synopsis>Get Object Monitors</synopsis>
8077
<description>
8078
Return the list of object monitors.
8079
<p/>
8080
Note: details about each monitor can be examined with
8081
<functionlink id="GetObjectMonitorUsage"></functionlink>.
8082
</description>
8083
<origin>new</origin>
8084
<capabilities>
8085
<required id="can_get_monitor_info"></required>
8086
</capabilities>
8087
<parameters>
8088
<param id="monitorCnt">
8089
<outptr><jint/></outptr>
8090
<description>
8091
On return, pointer to the number
8092
of monitors returned in <code>monitors_ptr</code>.
8093
</description>
8094
</param>
8095
<param id="monitors_ptr">
8096
<allocbuf outcount="monitorCnt"><jobject/></allocbuf>
8097
<description>
8098
On return, pointer to the monitor list.
8099
</description>
8100
</param>
8101
</parameters>
8102
<errors>
8103
</errors>
8104
</function>
8105
</elide>
8106
8107
</category>
8108
8109
<category id="fieldCategory" label="Field">
8110
8111
<intro>
8112
</intro>
8113
8114
<function id="GetFieldName" phase="start" num="60">
8115
<synopsis>Get Field Name (and Signature)</synopsis>
8116
<description>
8117
For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,
8118
return the field name via <paramlink id="name_ptr"/> and field signature via
8119
<paramlink id="signature_ptr"/>.
8120
<p/>
8121
Field signatures are defined in the
8122
<externallink id="jni/index.html">JNI Specification</externallink>
8123
and are referred to as <code>field descriptors</code> in
8124
<vmspec chapter="4.3.2"/>.
8125
</description>
8126
<origin>jvmdiClone</origin>
8127
<capabilities>
8128
</capabilities>
8129
<parameters>
8130
<param id="klass">
8131
<jclass field="field"/>
8132
<description>
8133
The class of the field to query.
8134
</description>
8135
</param>
8136
<param id="field">
8137
<jfieldID class="klass"/>
8138
<description>
8139
The field to query.
8140
</description>
8141
</param>
8142
<param id="name_ptr">
8143
<allocbuf>
8144
<char/>
8145
<nullok>the name is not returned</nullok>
8146
</allocbuf>
8147
<description>
8148
On return, points to the field name, encoded as a
8149
<internallink id="mUTF">modified UTF-8</internallink> string.
8150
</description>
8151
</param>
8152
<param id="signature_ptr">
8153
<allocbuf>
8154
<char/>
8155
<nullok>the signature is not returned</nullok>
8156
</allocbuf>
8157
<description>
8158
On return, points to the field signature, encoded as a
8159
<internallink id="mUTF">modified UTF-8</internallink> string.
8160
</description>
8161
</param>
8162
<param id="generic_ptr">
8163
<allocbuf>
8164
<char/>
8165
<nullok>the generic signature is not returned</nullok>
8166
</allocbuf>
8167
<description>
8168
On return, points to the generic signature of the field, encoded as a
8169
<internallink id="mUTF">modified UTF-8</internallink> string.
8170
If there is no generic signature attribute for the field, then,
8171
on return, points to <code>NULL</code>.
8172
</description>
8173
</param>
8174
</parameters>
8175
<errors>
8176
</errors>
8177
</function>
8178
8179
<function id="GetFieldDeclaringClass" phase="start" num="61">
8180
<synopsis>Get Field Declaring Class</synopsis>
8181
<description>
8182
For the field indicated by <code>klass</code> and <code>field</code>
8183
return the class that defined it via <code>declaring_class_ptr</code>.
8184
The declaring class will either be <code>klass</code>, a superclass, or
8185
an implemented interface.
8186
</description>
8187
<origin>jvmdi</origin>
8188
<capabilities>
8189
</capabilities>
8190
<parameters>
8191
<param id="klass">
8192
<jclass field="field"/>
8193
<description>
8194
The class to query.
8195
</description>
8196
</param>
8197
<param id="field">
8198
<jfieldID class="klass"/>
8199
<description>
8200
The field to query.
8201
</description>
8202
</param>
8203
<param id="declaring_class_ptr">
8204
<outptr><jclass/></outptr>
8205
<description>
8206
On return, points to the declaring class
8207
</description>
8208
</param>
8209
</parameters>
8210
<errors>
8211
</errors>
8212
</function>
8213
8214
<function id="GetFieldModifiers" phase="start" num="62">
8215
<synopsis>Get Field Modifiers</synopsis>
8216
<description>
8217
For the field indicated by <code>klass</code> and <code>field</code>
8218
return the access flags via <code>modifiers_ptr</code>.
8219
Access flags are defined in <vmspec chapter="4"/>.
8220
</description>
8221
<origin>jvmdi</origin>
8222
<capabilities>
8223
</capabilities>
8224
<parameters>
8225
<param id="klass">
8226
<jclass field="field"/>
8227
<description>
8228
The class to query.
8229
</description>
8230
</param>
8231
<param id="field">
8232
<jfieldID class="klass"/>
8233
<description>
8234
The field to query.
8235
</description>
8236
</param>
8237
<param id="modifiers_ptr">
8238
<outptr><jint/></outptr>
8239
<description>
8240
On return, points to the access flags.
8241
</description>
8242
</param>
8243
</parameters>
8244
<errors>
8245
</errors>
8246
</function>
8247
8248
<function id="IsFieldSynthetic" phase="start" num="63">
8249
<synopsis>Is Field Synthetic</synopsis>
8250
<description>
8251
For the field indicated by <code>klass</code> and <code>field</code>, return a
8252
value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.
8253
Synthetic fields are generated by the compiler but not present in the
8254
original source code.
8255
</description>
8256
<origin>jvmdi</origin>
8257
<capabilities>
8258
<required id="can_get_synthetic_attribute"></required>
8259
</capabilities>
8260
<parameters>
8261
<param id="klass">
8262
<jclass field="field"/>
8263
<description>
8264
The class of the field to query.
8265
</description>
8266
</param>
8267
<param id="field">
8268
<jfieldID class="klass"/>
8269
<description>
8270
The field to query.
8271
</description>
8272
</param>
8273
<param id="is_synthetic_ptr">
8274
<outptr><jboolean/></outptr>
8275
<description>
8276
On return, points to the boolean result of this function.
8277
</description>
8278
</param>
8279
</parameters>
8280
<errors>
8281
</errors>
8282
</function>
8283
8284
</category>
8285
8286
<category id="method" label="Method">
8287
8288
<intro>
8289
These functions provide information about a method (represented as a
8290
<typelink id="jmethodID"/>) and set how methods are processed.
8291
</intro>
8292
8293
<intro id="obsoleteMethods" label="Obsolete Methods">
8294
The functions <functionlink id="RetransformClasses"/> and
8295
<functionlink id="RedefineClasses"/> can cause new versions
8296
of methods to be installed.
8297
An original version of a method is considered equivalent
8298
to the new version if:
8299
<ul>
8300
<li>their bytecodes are the same except for indices into the
8301
constant pool and </li>
8302
<li>the referenced constants are equal.</li>
8303
</ul>
8304
An original method version which is not equivalent to the
8305
new method version is called obsolete and is assigned a new method ID;
8306
the original method ID now refers to the new method version.
8307
A method ID can be tested for obsolescence with
8308
<functionlink id="IsMethodObsolete"/>.
8309
</intro>
8310
8311
<function id="GetMethodName" phase="start" num="64">
8312
<synopsis>Get Method Name (and Signature)</synopsis>
8313
<description>
8314
For the method indicated by <code>method</code>,
8315
return the method name via <code>name_ptr</code> and method signature via
8316
<code>signature_ptr</code>.
8317
<p/>
8318
Method signatures are defined in the
8319
<externallink id="jni/index.html">JNI Specification</externallink>
8320
and are referred to as <code>method descriptors</code> in
8321
<vmspec chapter="4.3.3"/>.
8322
Note this is different
8323
than method signatures as defined in the <i>Java Language Specification</i>.
8324
</description>
8325
<origin>jvmdiClone</origin>
8326
<capabilities>
8327
</capabilities>
8328
<parameters>
8329
<param id="method">
8330
<jmethodID/>
8331
<description>
8332
The method to query.
8333
</description>
8334
</param>
8335
<param id="name_ptr">
8336
<allocbuf>
8337
<char/>
8338
<nullok>the name is not returned</nullok>
8339
</allocbuf>
8340
<description>
8341
On return, points to the method name, encoded as a
8342
<internallink id="mUTF">modified UTF-8</internallink> string.
8343
</description>
8344
</param>
8345
<param id="signature_ptr">
8346
<allocbuf>
8347
<char/>
8348
<nullok>the signature is not returned</nullok>
8349
</allocbuf>
8350
<description>
8351
On return, points to the method signature, encoded as a
8352
<internallink id="mUTF">modified UTF-8</internallink> string.
8353
</description>
8354
</param>
8355
<param id="generic_ptr">
8356
<allocbuf>
8357
<char/>
8358
<nullok>the generic signature is not returned</nullok>
8359
</allocbuf>
8360
<description>
8361
On return, points to the generic signature of the method, encoded as a
8362
<internallink id="mUTF">modified UTF-8</internallink> string.
8363
If there is no generic signature attribute for the method, then,
8364
on return, points to <code>NULL</code>.
8365
</description>
8366
</param>
8367
</parameters>
8368
<errors>
8369
</errors>
8370
</function>
8371
8372
<function id="GetMethodDeclaringClass" phase="start" num="65">
8373
<synopsis>Get Method Declaring Class</synopsis>
8374
<description>
8375
For the method indicated by <code>method</code>,
8376
return the class that defined it via <code>declaring_class_ptr</code>.
8377
</description>
8378
<origin>jvmdi</origin>
8379
<capabilities>
8380
</capabilities>
8381
<parameters>
8382
<param id="klass">
8383
<jclass method="method"/>
8384
<description>
8385
The class to query.
8386
</description>
8387
</param>
8388
<param id="method">
8389
<jmethodID class="klass"/>
8390
<description>
8391
The method to query.
8392
</description>
8393
</param>
8394
<param id="declaring_class_ptr">
8395
<outptr><jclass/></outptr>
8396
<description>
8397
On return, points to the declaring class
8398
</description>
8399
</param>
8400
</parameters>
8401
<errors>
8402
</errors>
8403
</function>
8404
8405
<function id="GetMethodModifiers" phase="start" num="66">
8406
<synopsis>Get Method Modifiers</synopsis>
8407
<description>
8408
For the method indicated by <code>method</code>,
8409
return the access flags via <code>modifiers_ptr</code>.
8410
Access flags are defined in <vmspec chapter="4"/>.
8411
</description>
8412
<origin>jvmdi</origin>
8413
<capabilities>
8414
</capabilities>
8415
<parameters>
8416
<param id="klass">
8417
<jclass method="method"/>
8418
<description>
8419
The class to query.
8420
</description>
8421
</param>
8422
<param id="method">
8423
<jmethodID class="klass"/>
8424
<description>
8425
The method to query.
8426
</description>
8427
</param>
8428
<param id="modifiers_ptr">
8429
<outptr><jint/></outptr>
8430
<description>
8431
On return, points to the access flags.
8432
</description>
8433
</param>
8434
</parameters>
8435
<errors>
8436
</errors>
8437
</function>
8438
8439
<function id="GetMaxLocals" phase="start" num="68">
8440
<synopsis>Get Max Locals</synopsis>
8441
<description>
8442
For the method indicated by <code>method</code>,
8443
return the number of local variable slots used by the method,
8444
including the local variables used to pass parameters to the
8445
method on its invocation.
8446
<p/>
8447
See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.
8448
</description>
8449
<origin>jvmdi</origin>
8450
<capabilities>
8451
</capabilities>
8452
<parameters>
8453
<param id="klass">
8454
<jclass method="method"/>
8455
<description>
8456
The class to query.
8457
</description>
8458
</param>
8459
<param id="method">
8460
<jmethodID class="klass" native="error"/>
8461
<description>
8462
The method to query.
8463
</description>
8464
</param>
8465
<param id="max_ptr">
8466
<outptr><jint/></outptr>
8467
<description>
8468
On return, points to the maximum number of local slots
8469
</description>
8470
</param>
8471
</parameters>
8472
<errors>
8473
</errors>
8474
</function>
8475
8476
<function id="GetArgumentsSize" phase="start" num="69">
8477
<synopsis>Get Arguments Size</synopsis>
8478
<description>
8479
For the method indicated by <code>method</code>,
8480
return via <code>max_ptr</code> the number of local variable slots used
8481
by the method's arguments.
8482
Note that two-word arguments use two slots.
8483
</description>
8484
<origin>jvmdi</origin>
8485
<capabilities>
8486
</capabilities>
8487
<parameters>
8488
<param id="klass">
8489
<jclass method="method"/>
8490
<description>
8491
The class to query.
8492
</description>
8493
</param>
8494
<param id="method">
8495
<jmethodID class="klass" native="error"/>
8496
<description>
8497
The method to query.
8498
</description>
8499
</param>
8500
<param id="size_ptr">
8501
<outptr><jint/></outptr>
8502
<description>
8503
On return, points to the number of argument slots
8504
</description>
8505
</param>
8506
</parameters>
8507
<errors>
8508
</errors>
8509
</function>
8510
8511
<function id="GetLineNumberTable" phase="start" num="70">
8512
<synopsis>Get Line Number Table</synopsis>
8513
<typedef id="jvmtiLineNumberEntry" label="Line number table entry">
8514
<field id="start_location">
8515
<jlocation/>
8516
<description>
8517
the <datalink id="jlocation"></datalink> where the line begins
8518
</description>
8519
</field>
8520
<field id="line_number">
8521
<jint/>
8522
<description>
8523
the line number
8524
</description>
8525
</field>
8526
</typedef>
8527
<description>
8528
For the method indicated by <code>method</code>,
8529
return a table of source line number entries. The size of the table is
8530
returned via <code>entry_count_ptr</code> and the table itself is
8531
returned via <code>table_ptr</code>.
8532
</description>
8533
<origin>jvmdi</origin>
8534
<capabilities>
8535
<required id="can_get_line_numbers"></required>
8536
</capabilities>
8537
<parameters>
8538
<param id="klass">
8539
<jclass method="method"/>
8540
<description>
8541
The class to query.
8542
</description>
8543
</param>
8544
<param id="method">
8545
<jmethodID class="klass" native="error"/>
8546
<description>
8547
The method to query.
8548
</description>
8549
</param>
8550
<param id="entry_count_ptr">
8551
<outptr><jint/></outptr>
8552
<description>
8553
On return, points to the number of entries in the table
8554
</description>
8555
</param>
8556
<param id="table_ptr">
8557
<allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>
8558
<description>
8559
On return, points to the line number table pointer.
8560
</description>
8561
</param>
8562
</parameters>
8563
<errors>
8564
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
8565
Class information does not include line numbers.
8566
</error>
8567
</errors>
8568
</function>
8569
8570
<function id="GetMethodLocation" phase="start" num="71">
8571
<synopsis>Get Method Location</synopsis>
8572
<description>
8573
For the method indicated by <code>method</code>,
8574
return the beginning and ending addresses through
8575
<code>start_location_ptr</code> and <code>end_location_ptr</code>. In a
8576
conventional bytecode indexing scheme,
8577
<code>start_location_ptr</code> will always point to zero
8578
and <code>end_location_ptr</code>
8579
will always point to the bytecode count minus one.
8580
</description>
8581
<origin>jvmdi</origin>
8582
<capabilities>
8583
</capabilities>
8584
<parameters>
8585
<param id="klass">
8586
<jclass method="method"/>
8587
<description>
8588
The class to query.
8589
</description>
8590
</param>
8591
<param id="method">
8592
<jmethodID class="klass" native="error"/>
8593
<description>
8594
The method to query.
8595
</description>
8596
</param>
8597
<param id="start_location_ptr">
8598
<outptr><jlocation/></outptr>
8599
<description>
8600
On return, points to the first location, or
8601
<code>-1</code> if location information is not available.
8602
If the information is available and
8603
<functionlink id="GetJLocationFormat"></functionlink>
8604
returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>
8605
then this will always be zero.
8606
</description>
8607
</param>
8608
<param id="end_location_ptr">
8609
<outptr><jlocation/></outptr>
8610
<description>
8611
On return, points to the last location,
8612
or <code>-1</code> if location information is not available.
8613
</description>
8614
</param>
8615
</parameters>
8616
<errors>
8617
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
8618
Class information does not include method sizes.
8619
</error>
8620
</errors>
8621
</function>
8622
8623
<function id="GetLocalVariableTable" num="72">
8624
<synopsis>Get Local Variable Table</synopsis>
8625
<typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">
8626
<field id="start_location">
8627
<jlocation/>
8628
<description>
8629
The code array index where the local variable is first valid
8630
(that is, where it must have a value).
8631
</description>
8632
</field>
8633
<field id="length">
8634
<jint/>
8635
<description>
8636
The length of the valid section for this local variable.
8637
The last code array index where the local variable is valid
8638
is <code>start_location + length</code>.
8639
</description>
8640
</field>
8641
<field id="name">
8642
<allocfieldbuf><char/></allocfieldbuf>
8643
<description>
8644
The local variable name, encoded as a
8645
<internallink id="mUTF">modified UTF-8</internallink> string.
8646
</description>
8647
</field>
8648
<field id="signature">
8649
<allocfieldbuf><char/></allocfieldbuf>
8650
<description>
8651
The local variable's type signature, encoded as a
8652
<internallink id="mUTF">modified UTF-8</internallink> string.
8653
The signature format is the same as that defined in
8654
<vmspec chapter="4.3.2"/>.
8655
</description>
8656
</field>
8657
<field id="generic_signature">
8658
<allocfieldbuf><char/></allocfieldbuf>
8659
<description>
8660
The local variable's generic signature, encoded as a
8661
<internallink id="mUTF">modified UTF-8</internallink> string.
8662
The value of this field will be <code>NULL</code> for any local
8663
variable which does not have a generic type.
8664
</description>
8665
</field>
8666
<field id="slot">
8667
<jint/>
8668
<description>
8669
The local variable's slot. See <internallink id="local">Local Variables</internallink>.
8670
</description>
8671
</field>
8672
</typedef>
8673
<description>
8674
Return local variable information.
8675
</description>
8676
<origin>jvmdiClone</origin>
8677
<capabilities>
8678
<required id="can_access_local_variables"></required>
8679
</capabilities>
8680
<parameters>
8681
<param id="method">
8682
<jmethodID native="error"/>
8683
<description>
8684
The method to query.
8685
</description>
8686
</param>
8687
<param id="entry_count_ptr">
8688
<outptr><jint/></outptr>
8689
<description>
8690
On return, points to the number of entries in the table
8691
</description>
8692
</param>
8693
<param id="table_ptr">
8694
<allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>
8695
<description>
8696
On return, points to an array of local variable table entries.
8697
</description>
8698
</param>
8699
</parameters>
8700
<errors>
8701
<error id="JVMTI_ERROR_ABSENT_INFORMATION">
8702
Class information does not include local variable
8703
information.
8704
</error>
8705
</errors>
8706
</function>
8707
8708
<function id="GetBytecodes" phase="start" num="75">
8709
<synopsis>Get Bytecodes</synopsis>
8710
<description>
8711
For the method indicated by <code>method</code>,
8712
return the bytecodes that implement the method. The number of
8713
bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes
8714
themselves are returned via <code>bytecodes_ptr</code>.
8715
</description>
8716
<origin>jvmdi</origin>
8717
<capabilities>
8718
<required id="can_get_bytecodes"></required>
8719
</capabilities>
8720
<parameters>
8721
<param id="klass">
8722
<jclass method="method"/>
8723
<description>
8724
The class to query.
8725
</description>
8726
</param>
8727
<param id="method">
8728
<jmethodID class="klass" native="error"/>
8729
<description>
8730
The method to query.
8731
</description>
8732
</param>
8733
<param id="bytecode_count_ptr">
8734
<outptr><jint/></outptr>
8735
<description>
8736
On return, points to the length of the bytecode array
8737
</description>
8738
</param>
8739
<param id="bytecodes_ptr">
8740
<allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>
8741
<description>
8742
On return, points to the pointer to the bytecode array
8743
</description>
8744
</param>
8745
</parameters>
8746
<errors>
8747
</errors>
8748
</function>
8749
8750
<function id="IsMethodNative" phase="start" num="76">
8751
<synopsis>Is Method Native</synopsis>
8752
<description>
8753
For the method indicated by <code>method</code>, return a
8754
value indicating whether the method is native via <code>is_native_ptr</code>
8755
</description>
8756
<origin>jvmdi</origin>
8757
<capabilities>
8758
</capabilities>
8759
<parameters>
8760
<param id="klass">
8761
<jclass method="method"/>
8762
<description>
8763
The class to query.
8764
</description>
8765
</param>
8766
<param id="method">
8767
<jmethodID class="klass"/>
8768
<description>
8769
The method to query.
8770
</description>
8771
</param>
8772
<param id="is_native_ptr">
8773
<outptr><jboolean/></outptr>
8774
<description>
8775
On return, points to the boolean result of this function.
8776
</description>
8777
</param>
8778
</parameters>
8779
<errors>
8780
</errors>
8781
</function>
8782
8783
<function id="IsMethodSynthetic" phase="start" num="77">
8784
<synopsis>Is Method Synthetic</synopsis>
8785
<description>
8786
For the method indicated by <code>method</code>, return a
8787
value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.
8788
Synthetic methods are generated by the compiler but not present in the
8789
original source code.
8790
</description>
8791
<origin>jvmdi</origin>
8792
<capabilities>
8793
<required id="can_get_synthetic_attribute"></required>
8794
</capabilities>
8795
<parameters>
8796
<param id="klass">
8797
<jclass method="method"/>
8798
<description>
8799
The class to query.
8800
</description>
8801
</param>
8802
<param id="method">
8803
<jmethodID class="klass"/>
8804
<description>
8805
The method to query.
8806
</description>
8807
</param>
8808
<param id="is_synthetic_ptr">
8809
<outptr><jboolean/></outptr>
8810
<description>
8811
On return, points to the boolean result of this function.
8812
</description>
8813
</param>
8814
</parameters>
8815
<errors>
8816
</errors>
8817
</function>
8818
8819
<function id="IsMethodObsolete" phase="start" num="91">
8820
<synopsis>Is Method Obsolete</synopsis>
8821
<description>
8822
Determine if a method ID refers to an
8823
<internallink id="obsoleteMethods">obsolete</internallink>
8824
method version.
8825
</description>
8826
<origin>jvmdi</origin>
8827
<capabilities>
8828
</capabilities>
8829
<parameters>
8830
<param id="klass">
8831
<jclass method="method"/>
8832
<description>
8833
The class to query.
8834
</description>
8835
</param>
8836
<param id="method">
8837
<jmethodID class="klass"/>
8838
<description>
8839
The method ID to query.
8840
</description>
8841
</param>
8842
<param id="is_obsolete_ptr">
8843
<outptr><jboolean/></outptr>
8844
<description>
8845
On return, points to the boolean result of this function.
8846
</description>
8847
</param>
8848
</parameters>
8849
<errors>
8850
</errors>
8851
</function>
8852
8853
<function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">
8854
<synopsis>Set Native Method Prefix</synopsis>
8855
<description>
8856
This function modifies the failure handling of
8857
native method resolution by allowing retry
8858
with a prefix applied to the name.
8859
When used with the
8860
<eventlink id="ClassFileLoadHook">ClassFileLoadHook
8861
event</eventlink>, it enables native methods to be
8862
<internallink id="bci">instrumented</internallink>.
8863
<p/>
8864
Since native methods cannot be directly instrumented
8865
(they have no bytecodes), they must be wrapped with
8866
a non-native method which can be instrumented.
8867
For example, if we had:
8868
<example>
8869
native boolean foo(int x);</example>
8870
<p/>
8871
We could transform the class file (with the
8872
ClassFileLoadHook event) so that this becomes:
8873
<example>
8874
boolean foo(int x) {
8875
<i>... record entry to foo ...</i>
8876
return wrapped_foo(x);
8877
}
8878
8879
native boolean wrapped_foo(int x);</example>
8880
<p/>
8881
Where foo becomes a wrapper for the actual native method
8882
with the appended prefix "wrapped_". Note that
8883
"wrapped_" would be a poor choice of prefix since it
8884
might conceivably form the name of an existing method
8885
thus something like "$$$MyAgentWrapped$$$_" would be
8886
better but would make these examples less readable.
8887
<p/>
8888
The wrapper will allow data to be collected on the native
8889
method call, but now the problem becomes linking up the
8890
wrapped method with the native implementation.
8891
That is, the method <code>wrapped_foo</code> needs to be
8892
resolved to the native implementation of <code>foo</code>,
8893
which might be:
8894
<example>
8895
Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>
8896
<p/>
8897
This function allows the prefix to be specified and the
8898
proper resolution to occur.
8899
Specifically, when the standard resolution fails, the
8900
resolution is retried taking the prefix into consideration.
8901
There are two ways that resolution occurs, explicit
8902
resolution with the JNI function <code>RegisterNatives</code>
8903
and the normal automatic resolution. For
8904
<code>RegisterNatives</code>, the VM will attempt this
8905
association:
8906
<example>
8907
method(foo) -> nativeImplementation(foo)</example>
8908
<p/>
8909
When this fails, the resolution will be retried with
8910
the specified prefix prepended to the method name,
8911
yielding the correct resolution:
8912
<example>
8913
method(wrapped_foo) -> nativeImplementation(foo)</example>
8914
<p/>
8915
For automatic resolution, the VM will attempt:
8916
<example>
8917
method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>
8918
<p/>
8919
When this fails, the resolution will be retried with
8920
the specified prefix deleted from the implementation name,
8921
yielding the correct resolution:
8922
<example>
8923
method(wrapped_foo) -> nativeImplementation(foo)</example>
8924
<p/>
8925
Note that since the prefix is only used when standard
8926
resolution fails, native methods can be wrapped selectively.
8927
<p/>
8928
Since each <jvmti/> environment is independent and
8929
can do its own transformation of the bytecodes, more
8930
than one layer of wrappers may be applied. Thus each
8931
environment needs its own prefix. Since transformations
8932
are applied in order, the prefixes, if applied, will
8933
be applied in the same order.
8934
The order of transformation application is described in
8935
the <eventlink id="ClassFileLoadHook"/> event.
8936
Thus if three environments applied
8937
wrappers, <code>foo</code> might become
8938
<code>$env3_$env2_$env1_foo</code>. But if, say,
8939
the second environment did not apply a wrapper to
8940
<code>foo</code> it would be just
8941
<code>$env3_$env1_foo</code>. To be able to
8942
efficiently determine the sequence of prefixes,
8943
an intermediate prefix is only applied if its non-native
8944
wrapper exists. Thus, in the last example, even though
8945
<code>$env1_foo</code> is not a native method, the
8946
<code>$env1_</code> prefix is applied since
8947
<code>$env1_foo</code> exists.
8948
<p/>
8949
Since the prefixes are used at resolution time
8950
and since resolution may be arbitrarily delayed, a
8951
native method prefix must remain set as long as there
8952
are corresponding prefixed native methods.
8953
</description>
8954
<origin>new</origin>
8955
<capabilities>
8956
<required id="can_set_native_method_prefix"></required>
8957
</capabilities>
8958
<parameters>
8959
<param id="prefix">
8960
<inbuf>
8961
<char/>
8962
<nullok>
8963
any existing prefix in this environment is cancelled
8964
</nullok>
8965
</inbuf>
8966
<description>
8967
The prefix to apply, encoded as a
8968
<internallink id="mUTF">modified UTF-8</internallink> string.
8969
</description>
8970
</param>
8971
</parameters>
8972
<errors>
8973
</errors>
8974
</function>
8975
8976
<function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">
8977
<synopsis>Set Native Method Prefixes</synopsis>
8978
<description>
8979
For a normal agent, <functionlink id="SetNativeMethodPrefix"/>
8980
will provide all needed native method prefixing.
8981
For a meta-agent that performs multiple independent class
8982
file transformations (for example as a proxy for another
8983
layer of agents) this function allows each transformation
8984
to have its own prefix.
8985
The prefixes are applied in the order supplied and are
8986
processed in the same manner as described for the
8987
application of prefixes from multiple <jvmti/> environments
8988
in <functionlink id="SetNativeMethodPrefix"/>.
8989
<p/>
8990
Any previous prefixes are replaced. Thus, calling this
8991
function with a <paramlink id="prefix_count"/> of <code>0</code>
8992
disables prefixing in this environment.
8993
<p/>
8994
<functionlink id="SetNativeMethodPrefix"/> and this function
8995
are the two ways to set the prefixes.
8996
Calling <code>SetNativeMethodPrefix</code> with
8997
a prefix is the same as calling this function with
8998
<paramlink id="prefix_count"/> of <code>1</code>.
8999
Calling <code>SetNativeMethodPrefix</code> with
9000
<code>NULL</code> is the same as calling this function with
9001
<paramlink id="prefix_count"/> of <code>0</code>.
9002
</description>
9003
<origin>new</origin>
9004
<capabilities>
9005
<required id="can_set_native_method_prefix"></required>
9006
</capabilities>
9007
<parameters>
9008
<param id="prefix_count">
9009
<jint min="0"/>
9010
<description>
9011
The number of prefixes to apply.
9012
</description>
9013
</param>
9014
<param id="prefixes">
9015
<agentbuf>
9016
<char/>
9017
</agentbuf>
9018
<description>
9019
The prefixes to apply for this environment, each encoded as a
9020
<internallink id="mUTF">modified UTF-8</internallink> string.
9021
</description>
9022
</param>
9023
</parameters>
9024
<errors>
9025
</errors>
9026
</function>
9027
9028
</category>
9029
9030
<category id="RawMonitors" label="Raw Monitor">
9031
9032
<function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">
9033
<synopsis>Create Raw Monitor</synopsis>
9034
<description>
9035
Create a raw monitor.
9036
</description>
9037
<origin>jvmdi</origin>
9038
<capabilities>
9039
</capabilities>
9040
<parameters>
9041
<param id="name">
9042
<inbuf><char/></inbuf>
9043
<description>
9044
A name to identify the monitor, encoded as a
9045
<internallink id="mUTF">modified UTF-8</internallink> string.
9046
</description>
9047
</param>
9048
<param id="monitor_ptr">
9049
<outptr><jrawMonitorID/></outptr>
9050
<description>
9051
On return, points to the created monitor.
9052
</description>
9053
</param>
9054
</parameters>
9055
<errors>
9056
</errors>
9057
</function>
9058
9059
<function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">
9060
<synopsis>Destroy Raw Monitor</synopsis>
9061
<description>
9062
Destroy the raw monitor.
9063
If the monitor being destroyed has been entered by this thread, it will be
9064
exited before it is destroyed.
9065
If the monitor being destroyed has been entered by another thread,
9066
an error will be returned and the monitor will not be destroyed.
9067
</description>
9068
<origin>jvmdi</origin>
9069
<capabilities>
9070
</capabilities>
9071
<parameters>
9072
<param id="monitor">
9073
<jrawMonitorID/>
9074
<description>
9075
The monitor
9076
</description>
9077
</param>
9078
</parameters>
9079
<errors>
9080
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9081
Not monitor owner
9082
</error>
9083
</errors>
9084
</function>
9085
9086
<function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">
9087
<synopsis>Raw Monitor Enter</synopsis>
9088
<description>
9089
Gain exclusive ownership of a raw monitor.
9090
The same thread may enter a monitor more then once.
9091
The thread must
9092
<functionlink id="RawMonitorExit">exit</functionlink>
9093
the monitor the same number of times as it is entered.
9094
If a monitor is entered during <code>OnLoad</code> (before attached threads exist)
9095
and has not exited when attached threads come into existence, the enter
9096
is considered to have occurred on the main thread.
9097
</description>
9098
<origin>jvmdi</origin>
9099
<capabilities>
9100
</capabilities>
9101
<parameters>
9102
<param id="monitor">
9103
<jrawMonitorID/>
9104
<description>
9105
The monitor
9106
</description>
9107
</param>
9108
</parameters>
9109
<errors>
9110
</errors>
9111
</function>
9112
9113
<function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">
9114
<synopsis>Raw Monitor Exit</synopsis>
9115
<description>
9116
Release exclusive ownership of a raw monitor.
9117
</description>
9118
<origin>jvmdi</origin>
9119
<capabilities>
9120
</capabilities>
9121
<parameters>
9122
<param id="monitor">
9123
<jrawMonitorID/>
9124
<description>
9125
The monitor
9126
</description>
9127
</param>
9128
</parameters>
9129
<errors>
9130
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9131
Not monitor owner
9132
</error>
9133
</errors>
9134
</function>
9135
9136
<function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">
9137
<synopsis>Raw Monitor Wait</synopsis>
9138
<description>
9139
Wait for notification of the raw monitor.
9140
<p/>
9141
Causes the current thread to wait until either another thread calls
9142
<functionlink id="RawMonitorNotify"/> or
9143
<functionlink id="RawMonitorNotifyAll"/>
9144
for the specified raw monitor, or the specified
9145
<paramlink id="millis">timeout</paramlink>
9146
has elapsed.
9147
</description>
9148
<origin>jvmdi</origin>
9149
<capabilities>
9150
</capabilities>
9151
<parameters>
9152
<param id="monitor">
9153
<jrawMonitorID/>
9154
<description>
9155
The monitor
9156
</description>
9157
</param>
9158
<param id="millis">
9159
<jlong/>
9160
<description>
9161
The timeout, in milliseconds. If the timeout is
9162
zero, then real time is not taken into consideration
9163
and the thread simply waits until notified.
9164
</description>
9165
</param>
9166
</parameters>
9167
<errors>
9168
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9169
Not monitor owner
9170
</error>
9171
<error id="JVMTI_ERROR_INTERRUPT">
9172
Wait was interrupted, try again
9173
</error>
9174
</errors>
9175
</function>
9176
9177
<function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">
9178
<synopsis>Raw Monitor Notify</synopsis>
9179
<description>
9180
Notify a single thread waiting on the raw monitor.
9181
</description>
9182
<origin>jvmdi</origin>
9183
<capabilities>
9184
</capabilities>
9185
<parameters>
9186
<param id="monitor">
9187
<jrawMonitorID/>
9188
<description>
9189
The monitor
9190
</description>
9191
</param>
9192
</parameters>
9193
<errors>
9194
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9195
Not monitor owner
9196
</error>
9197
</errors>
9198
</function>
9199
9200
<function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">
9201
<synopsis>Raw Monitor Notify All</synopsis>
9202
<description>
9203
Notify all threads waiting on the raw monitor.
9204
</description>
9205
<origin>jvmdi</origin>
9206
<capabilities>
9207
</capabilities>
9208
<parameters>
9209
<param id="monitor">
9210
<jrawMonitorID/>
9211
<description>
9212
The monitor
9213
</description>
9214
</param>
9215
</parameters>
9216
<errors>
9217
<error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9218
Not monitor owner
9219
</error>
9220
</errors>
9221
</function>
9222
9223
<elide>
9224
<function id="GetRawMonitorUse" num="118">
9225
<synopsis>Get Raw Monitor Use</synopsis>
9226
<description>
9227
The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
9228
are filled in with information about usage of the raw monitor.
9229
</description>
9230
<origin>new</origin>
9231
<capabilities>
9232
<required id="can_get_raw_monitor_usage"></required>
9233
</capabilities>
9234
<parameters>
9235
<param id="monitor">
9236
<jrawMonitorID/>
9237
<description>
9238
the raw monitor to query.
9239
</description>
9240
</param>
9241
<param id="info_ptr">
9242
<outptr><struct>jvmtiMonitorUsage</struct></outptr>
9243
<description>
9244
On return, filled with monitor information for the
9245
specified raw monitor.
9246
</description>
9247
</param>
9248
</parameters>
9249
<errors>
9250
</errors>
9251
</function>
9252
9253
<function id="GetRawMonitors" num="119">
9254
<synopsis>Get Raw Monitors</synopsis>
9255
<description>
9256
Return the list of raw monitors.
9257
<p/>
9258
Note: details about each monitor can be examined with
9259
<functionlink id="GetRawMonitorUse"></functionlink>.
9260
</description>
9261
<origin>new</origin>
9262
<capabilities>
9263
<required id="can_get_raw_monitor_usage"></required>
9264
</capabilities>
9265
<parameters>
9266
<param id="monitorCnt">
9267
<outptr><jint/></outptr>
9268
<description>
9269
On return, pointer to the number
9270
of monitors returned in <code>monitors_ptr</code>.
9271
</description>
9272
</param>
9273
<param id="monitors_ptr">
9274
<allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>
9275
<description>
9276
On return, pointer to the monitor list.
9277
</description>
9278
</param>
9279
</parameters>
9280
<errors>
9281
</errors>
9282
</function>
9283
</elide>
9284
</category>
9285
9286
<category id="jniIntercept" label="JNI Function Interception">
9287
9288
<intro>
9289
Provides the ability to intercept and resend
9290
Java Native Interface (JNI) function calls
9291
by manipulating the JNI function table.
9292
See <externallink id="jni/functions.html">JNI
9293
Functions</externallink> in the <i>Java Native Interface Specification</i>.
9294
<p/>
9295
The following example illustrates intercepting the
9296
<code>NewGlobalRef</code> JNI call in order to count reference
9297
creation.
9298
<example>
9299
JNIEnv original_jni_Functions;
9300
JNIEnv redirected_jni_Functions;
9301
int my_global_ref_count = 0;
9302
9303
jobject
9304
MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {
9305
++my_global_ref_count;
9306
return originalJNIFunctions-&gt;NewGlobalRef(env, lobj);
9307
}
9308
9309
void
9310
myInit() {
9311
jvmtiError err;
9312
9313
err = (*jvmti_env)-&gt;GetJNIFunctionTable(jvmti_env, &amp;original_jni_Functions);
9314
if (err != JVMTI_ERROR_NONE) {
9315
die();
9316
}
9317
err = (*jvmti_env)-&gt;GetJNIFunctionTable(jvmti_env, &amp;redirected_jni_Functions);
9318
if (err != JVMTI_ERROR_NONE) {
9319
die();
9320
}
9321
redirectedJNIFunctions-&gt;NewGlobalRef = MyNewGlobalRef;
9322
err = (*jvmti_env)-&gt;SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);
9323
if (err != JVMTI_ERROR_NONE) {
9324
die();
9325
}
9326
}
9327
</example>
9328
Sometime after <code>myInit</code> is called the user's JNI
9329
code is executed which makes the call to create a new global
9330
reference. Instead of going to the normal JNI implementation
9331
the call goes to <code>myNewGlobalRef</code>. Note that a
9332
copy of the original function table is kept so that the normal
9333
JNI function can be called after the data is collected.
9334
Note also that any JNI functions which are not overwritten
9335
will behave normally.
9336
<todo>
9337
check that the example compiles and executes.
9338
</todo>
9339
</intro>
9340
9341
<function id="SetJNIFunctionTable" phase="start" num="120">
9342
<synopsis>Set JNI Function Table</synopsis>
9343
<description>
9344
Set the JNI function table
9345
in all current and future JNI environments.
9346
As a result, all future JNI calls are directed to the specified functions.
9347
Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the
9348
function table to pass to this function.
9349
For this function to take effect the the updated table entries must be
9350
used by the JNI clients.
9351
Since the table is defined <code>const</code> some compilers may optimize
9352
away the access to the table, thus preventing this function from taking
9353
effect.
9354
The table is copied--changes to the local copy of the
9355
table have no effect.
9356
This function affects only the function table, all other aspects of the environment are
9357
unaffected.
9358
See the examples <internallink id="jniIntercept">above</internallink>.
9359
</description>
9360
<origin>new</origin>
9361
<capabilities>
9362
</capabilities>
9363
<parameters>
9364
<param id="function_table">
9365
<inptr>
9366
<struct>jniNativeInterface</struct>
9367
</inptr>
9368
<description>
9369
Points to the new JNI function table.
9370
</description>
9371
</param>
9372
</parameters>
9373
<errors>
9374
</errors>
9375
</function>
9376
9377
<function id="GetJNIFunctionTable" phase="start" num="121">
9378
<synopsis>Get JNI Function Table</synopsis>
9379
<description>
9380
Get the JNI function table.
9381
The JNI function table is copied into allocated memory.
9382
If <functionlink id="SetJNIFunctionTable"></functionlink>
9383
has been called, the modified (not the original) function
9384
table is returned.
9385
Only the function table is copied, no other aspects of the environment
9386
are copied.
9387
See the examples <internallink id="jniIntercept">above</internallink>.
9388
</description>
9389
<origin>new</origin>
9390
<capabilities>
9391
</capabilities>
9392
<parameters>
9393
<param id="function_table">
9394
<allocbuf>
9395
<struct>jniNativeInterface</struct>
9396
</allocbuf>
9397
<description>
9398
On return, <code>*function_table</code>
9399
points a newly allocated copy of the JNI function table.
9400
</description>
9401
</param>
9402
</parameters>
9403
<errors>
9404
</errors>
9405
</function>
9406
9407
</category>
9408
9409
<category id="eventManagement" label="Event Management">
9410
9411
<function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">
9412
<synopsis>Set Event Callbacks</synopsis>
9413
<description>
9414
Set the functions to be called for each event.
9415
The callbacks are specified by supplying a replacement function table.
9416
The function table is copied--changes to the local copy of the
9417
table have no effect.
9418
This is an atomic action, all callbacks are set at once.
9419
No events are sent before this function is called.
9420
When an entry is <code>NULL</code> or when the event is beyond
9421
<paramlink id="size_of_callbacks"></paramlink> no event is sent.
9422
Details on events are
9423
described <internallink id="EventSection">later</internallink> in this document.
9424
An event must be enabled and have a callback in order to be
9425
sent--the order in which this function and
9426
<functionlink id="SetEventNotificationMode"></functionlink>
9427
are called does not affect the result.
9428
</description>
9429
<origin>new</origin>
9430
<capabilities>
9431
</capabilities>
9432
<parameters>
9433
<param id="callbacks">
9434
<inptr>
9435
<struct>jvmtiEventCallbacks</struct>
9436
<nullok>remove the existing callbacks</nullok>
9437
</inptr>
9438
<description>
9439
The new event callbacks.
9440
</description>
9441
</param>
9442
<param id="size_of_callbacks">
9443
<jint min="0"/>
9444
<description>
9445
<code>sizeof(jvmtiEventCallbacks)</code>--for version
9446
compatibility.
9447
</description>
9448
</param>
9449
</parameters>
9450
<errors>
9451
</errors>
9452
</function>
9453
9454
<function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">
9455
<synopsis>Set Event Notification Mode</synopsis>
9456
<description>
9457
Control the generation of events.
9458
<constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">
9459
<constant id="JVMTI_ENABLE" num="1">
9460
If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,
9461
the event <paramlink id="event_type"></paramlink> will be enabled
9462
</constant>
9463
<constant id="JVMTI_DISABLE" num="0">
9464
If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,
9465
the event <paramlink id="event_type"></paramlink> will be disabled
9466
</constant>
9467
</constants>
9468
If <code>event_thread</code> is <code>NULL</code>,
9469
the event is enabled or disabled globally; otherwise, it is
9470
enabled or disabled for a particular thread.
9471
An event is generated for
9472
a particular thread if it is enabled either at the thread or global
9473
levels.
9474
<p/>
9475
See <internallink id="EventIndex">below</internallink> for information on specific events.
9476
<p/>
9477
The following events cannot be controlled at the thread
9478
level through this function.
9479
<ul>
9480
<li><eventlink id="VMInit"></eventlink></li>
9481
<li><eventlink id="VMStart"></eventlink></li>
9482
<li><eventlink id="VMDeath"></eventlink></li>
9483
<li><eventlink id="ThreadStart"></eventlink></li>
9484
<li><eventlink id="CompiledMethodLoad"></eventlink></li>
9485
<li><eventlink id="CompiledMethodUnload"></eventlink></li>
9486
<li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9487
<li><eventlink id="DataDumpRequest"></eventlink></li>
9488
</ul>
9489
<p/>
9490
Initially, no events are enabled at either the thread level
9491
or the global level.
9492
<p/>
9493
Any needed capabilities (see Event Enabling Capabilities below) must be possessed
9494
before calling this function.
9495
<p/>
9496
Details on events are
9497
described <internallink id="EventSection">below</internallink>.
9498
</description>
9499
<origin>jvmdiClone</origin>
9500
<eventcapabilities></eventcapabilities>
9501
<parameters>
9502
<param id="mode">
9503
<enum>jvmtiEventMode</enum>
9504
<description>
9505
<code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>
9506
</description>
9507
</param>
9508
<param id="event_type">
9509
<enum>jvmtiEvent</enum>
9510
<description>
9511
the event to control
9512
</description>
9513
</param>
9514
<param id="event_thread">
9515
<ptrtype>
9516
<jthread impl="noconvert"/>
9517
<nullok>event is controlled at the global level</nullok>
9518
</ptrtype>
9519
<description>
9520
The thread to control
9521
</description>
9522
</param>
9523
<param id="...">
9524
<varargs/>
9525
<description>
9526
for future expansion
9527
</description>
9528
</param>
9529
</parameters>
9530
<errors>
9531
<error id="JVMTI_ERROR_INVALID_THREAD">
9532
<paramlink id="event_thread"/> is non-<code>NULL</code> and is not a valid thread.
9533
</error>
9534
<error id="JVMTI_ERROR_THREAD_NOT_ALIVE">
9535
<paramlink id="event_thread"/> is non-<code>NULL</code> and is not live (has not been started or is now dead).
9536
</error>
9537
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9538
thread level control was attempted on events which do not
9539
permit thread level control.
9540
</error>
9541
<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9542
The Required Event Enabling Capability is not possessed.
9543
</error>
9544
</errors>
9545
</function>
9546
9547
<function id="GenerateEvents" num="123">
9548
<synopsis>Generate Events</synopsis>
9549
<description>
9550
Generate events to represent the current state of the VM.
9551
For example, if <paramlink id="event_type"/> is
9552
<code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,
9553
a <eventlink id="CompiledMethodLoad"></eventlink> event will be
9554
sent for each currently compiled method.
9555
Methods that were loaded and now have been unloaded are not sent.
9556
The history of what events have previously been sent does not
9557
effect what events are sent by this function--for example,
9558
all currently compiled methods
9559
will be sent each time this function is called.
9560
<p/>
9561
This function is useful when
9562
events may have been missed due to the agent attaching after program
9563
execution begins; this function generates the missed events.
9564
<p/>
9565
Attempts to execute Java programming language code or
9566
JNI functions may be paused until this function returns -
9567
so neither should be called from the thread sending the event.
9568
This function returns only after the missed events have been
9569
sent, processed and have returned.
9570
The event may be sent on a different thread than the thread
9571
on which the event occurred.
9572
The callback for the event must be set with
9573
<functionlink id="SetEventCallbacks"></functionlink>
9574
and the event must be enabled with
9575
<functionlink id="SetEventNotificationMode"></functionlink>
9576
or the events will not occur.
9577
If the VM no longer has the information to generate some or
9578
all of the requested events, the events are simply not sent -
9579
no error is returned.
9580
<p/>
9581
Only the following events are supported:
9582
<ul>
9583
<li><eventlink id="CompiledMethodLoad"></eventlink></li>
9584
<li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9585
</ul>
9586
</description>
9587
<origin>new</origin>
9588
<capabilities>
9589
<capability id="can_generate_compiled_method_load_events"></capability>
9590
</capabilities>
9591
<parameters>
9592
<param id="event_type">
9593
<enum>jvmtiEvent</enum>
9594
<description>
9595
The type of event to generate. Must be one of these:
9596
<ul>
9597
<li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>
9598
<li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>
9599
</ul>
9600
</description>
9601
</param>
9602
</parameters>
9603
<errors>
9604
<error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9605
<paramlink id="event_type"/> is
9606
<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9607
and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>
9608
is <code>false</code>.
9609
</error>
9610
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9611
<paramlink id="event_type"/> is other than
9612
<eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9613
or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.
9614
</error>
9615
</errors>
9616
</function>
9617
9618
</category>
9619
9620
<category id="extension" label="Extension Mechanism">
9621
9622
<intro>
9623
These functions
9624
allow a <jvmti/> implementation to provide functions and events
9625
beyond those defined in this specification.
9626
<p/>
9627
Both extension functions and extension events have parameters
9628
each of which has a 'type' and 'kind' chosen from the following tables:
9629
9630
<constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">
9631
<constant id="JVMTI_TYPE_JBYTE" num="101">
9632
Java programming language primitive type - <code>byte</code>.
9633
JNI type <code>jbyte</code>.
9634
</constant>
9635
<constant id="JVMTI_TYPE_JCHAR" num="102">
9636
Java programming language primitive type - <code>char</code>.
9637
JNI type <code>jchar</code>.
9638
</constant>
9639
<constant id="JVMTI_TYPE_JSHORT" num="103">
9640
Java programming language primitive type - <code>short</code>.
9641
JNI type <code>jshort</code>.
9642
</constant>
9643
<constant id="JVMTI_TYPE_JINT" num="104">
9644
Java programming language primitive type - <code>int</code>.
9645
JNI type <datalink id="jint"></datalink>.
9646
</constant>
9647
<constant id="JVMTI_TYPE_JLONG" num="105">
9648
Java programming language primitive type - <code>long</code>.
9649
JNI type <datalink id="jlong"></datalink>.
9650
</constant>
9651
<constant id="JVMTI_TYPE_JFLOAT" num="106">
9652
Java programming language primitive type - <code>float</code>.
9653
JNI type <datalink id="jfloat"></datalink>.
9654
</constant>
9655
<constant id="JVMTI_TYPE_JDOUBLE" num="107">
9656
Java programming language primitive type - <code>double</code>.
9657
JNI type <datalink id="jdouble"></datalink>.
9658
</constant>
9659
<constant id="JVMTI_TYPE_JBOOLEAN" num="108">
9660
Java programming language primitive type - <code>boolean</code>.
9661
JNI type <datalink id="jboolean"></datalink>.
9662
</constant>
9663
<constant id="JVMTI_TYPE_JOBJECT" num="109">
9664
Java programming language object type - <code>java.lang.Object</code>.
9665
JNI type <datalink id="jobject"></datalink>.
9666
Returned values are JNI local references and must be managed.
9667
</constant>
9668
<constant id="JVMTI_TYPE_JTHREAD" num="110">
9669
Java programming language object type - <code>java.lang.Thread</code>.
9670
<jvmti/> type <datalink id="jthread"></datalink>.
9671
Returned values are JNI local references and must be managed.
9672
</constant>
9673
<constant id="JVMTI_TYPE_JCLASS" num="111">
9674
Java programming language object type - <code>java.lang.Class</code>.
9675
JNI type <datalink id="jclass"></datalink>.
9676
Returned values are JNI local references and must be managed.
9677
</constant>
9678
<constant id="JVMTI_TYPE_JVALUE" num="112">
9679
Union of all Java programming language primitive and object types -
9680
JNI type <datalink id="jvalue"></datalink>.
9681
Returned values which represent object types are JNI local references and must be managed.
9682
</constant>
9683
<constant id="JVMTI_TYPE_JFIELDID" num="113">
9684
Java programming language field identifier -
9685
JNI type <datalink id="jfieldID"></datalink>.
9686
</constant>
9687
<constant id="JVMTI_TYPE_JMETHODID" num="114">
9688
Java programming language method identifier -
9689
JNI type <datalink id="jmethodID"></datalink>.
9690
</constant>
9691
<constant id="JVMTI_TYPE_CCHAR" num="115">
9692
C programming language type - <code>char</code>.
9693
</constant>
9694
<constant id="JVMTI_TYPE_CVOID" num="116">
9695
C programming language type - <code>void</code>.
9696
</constant>
9697
<constant id="JVMTI_TYPE_JNIENV" num="117">
9698
JNI environment - <code>JNIEnv</code>.
9699
Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.
9700
</constant>
9701
</constants>
9702
9703
<constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">
9704
<constant id="JVMTI_KIND_IN" num="91">
9705
Ingoing argument - <code>foo</code>.
9706
</constant>
9707
<constant id="JVMTI_KIND_IN_PTR" num="92">
9708
Ingoing pointer argument - <code>const foo*</code>.
9709
</constant>
9710
<constant id="JVMTI_KIND_IN_BUF" num="93">
9711
Ingoing array argument - <code>const foo*</code>.
9712
</constant>
9713
<constant id="JVMTI_KIND_ALLOC_BUF" num="94">
9714
Outgoing allocated array argument - <code>foo**</code>.
9715
Free with <code>Deallocate</code>.
9716
</constant>
9717
<constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">
9718
Outgoing allocated array of allocated arrays argument - <code>foo***</code>.
9719
Free with <code>Deallocate</code>.
9720
</constant>
9721
<constant id="JVMTI_KIND_OUT" num="96">
9722
Outgoing argument - <code>foo*</code>.
9723
</constant>
9724
<constant id="JVMTI_KIND_OUT_BUF" num="97">
9725
Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.
9726
Do not <code>Deallocate</code>.
9727
</constant>
9728
</constants>
9729
9730
</intro>
9731
9732
<typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">
9733
<field id="name">
9734
<allocfieldbuf><char/></allocfieldbuf>
9735
<description>
9736
The parameter name, encoded as a
9737
<internallink id="mUTF">modified UTF-8</internallink> string
9738
</description>
9739
</field>
9740
<field id="kind">
9741
<enum>jvmtiParamKind</enum>
9742
<description>
9743
The kind of the parameter - type modifiers
9744
</description>
9745
</field>
9746
<field id="base_type">
9747
<enum>jvmtiParamTypes</enum>
9748
<description>
9749
The base type of the parameter - modified by <code>kind</code>
9750
</description>
9751
</field>
9752
<field id="null_ok">
9753
<jboolean/>
9754
<description>
9755
Is a <code>NULL</code> argument permitted? Applies only to pointer and object types.
9756
</description>
9757
</field>
9758
</typedef>
9759
9760
<callback id="jvmtiExtensionFunction">
9761
<enum>jvmtiError</enum>
9762
<synopsis>Extension Function</synopsis>
9763
<description>
9764
This is the implementation-specific extension function.
9765
</description>
9766
<parameters>
9767
<param id="jvmti_env">
9768
<outptr>
9769
<struct>jvmtiEnv</struct>
9770
</outptr>
9771
<description>
9772
The <jvmti/> environment is the only fixed parameter for extension functions.
9773
</description>
9774
</param>
9775
<param id="...">
9776
<varargs/>
9777
<description>
9778
The extension function-specific parameters
9779
</description>
9780
</param>
9781
</parameters>
9782
</callback>
9783
9784
<function id="GetExtensionFunctions" phase="onload" num="124">
9785
<synopsis>Get Extension Functions</synopsis>
9786
9787
<typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">
9788
<field id="func">
9789
<ptrtype>
9790
<struct>jvmtiExtensionFunction</struct>
9791
</ptrtype>
9792
<description>
9793
The actual function to call
9794
</description>
9795
</field>
9796
<field id="id">
9797
<allocfieldbuf><char/></allocfieldbuf>
9798
<description>
9799
The identifier for the extension function, encoded as a
9800
<internallink id="mUTF">modified UTF-8</internallink> string.
9801
Uses package name conventions.
9802
For example, <code>com.sun.hotspot.bar</code>
9803
</description>
9804
</field>
9805
<field id="short_description">
9806
<allocfieldbuf><char/></allocfieldbuf>
9807
<description>
9808
A one sentence description of the function, encoded as a
9809
<internallink id="mUTF">modified UTF-8</internallink> string.
9810
</description>
9811
</field>
9812
<field id="param_count">
9813
<jint/>
9814
<description>
9815
The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
9816
</description>
9817
</field>
9818
<field id="params">
9819
<allocfieldbuf outcount="param_count">
9820
<struct>jvmtiParamInfo</struct>
9821
</allocfieldbuf>
9822
<description>
9823
Array of
9824
<fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
9825
parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
9826
</description>
9827
</field>
9828
<field id="error_count">
9829
<jint/>
9830
<description>
9831
The number of possible error returns (excluding universal errors)
9832
</description>
9833
</field>
9834
<field id="errors">
9835
<allocfieldbuf outcount="error_count">
9836
<enum>jvmtiError</enum>
9837
</allocfieldbuf>
9838
<description>
9839
Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
9840
possible errors
9841
</description>
9842
</field>
9843
</typedef>
9844
9845
<description>
9846
Returns the set of extension functions.
9847
</description>
9848
<origin>new</origin>
9849
<capabilities>
9850
</capabilities>
9851
<parameters>
9852
<param id="extension_count_ptr">
9853
<outptr><jint/></outptr>
9854
<description>
9855
On return, points to the number of extension functions
9856
</description>
9857
</param>
9858
<param id="extensions">
9859
<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>
9860
<description>
9861
Returns an array of extension function info, one per function
9862
</description>
9863
</param>
9864
</parameters>
9865
<errors>
9866
</errors>
9867
</function>
9868
9869
<function id="GetExtensionEvents" phase="onload" num="125">
9870
<synopsis>Get Extension Events</synopsis>
9871
9872
<typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">
9873
<field id="extension_event_index">
9874
<jint/>
9875
<description>
9876
The identifying index of the event
9877
</description>
9878
</field>
9879
<field id="id">
9880
<allocfieldbuf><char/></allocfieldbuf>
9881
<description>
9882
The identifier for the extension event, encoded as a
9883
<internallink id="mUTF">modified UTF-8</internallink> string.
9884
Uses package name conventions.
9885
For example, <code>com.sun.hotspot.bar</code>
9886
</description>
9887
</field>
9888
<field id="short_description">
9889
<allocfieldbuf><char/></allocfieldbuf>
9890
<description>
9891
A one sentence description of the event, encoded as a
9892
<internallink id="mUTF">modified UTF-8</internallink> string.
9893
</description>
9894
</field>
9895
<field id="param_count">
9896
<jint/>
9897
<description>
9898
The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
9899
</description>
9900
</field>
9901
<field id="params">
9902
<allocfieldbuf outcount="param_count">
9903
<struct>jvmtiParamInfo</struct>
9904
</allocfieldbuf>
9905
<description>
9906
Array of
9907
<fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>
9908
parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
9909
</description>
9910
</field>
9911
</typedef>
9912
9913
<description>
9914
Returns the set of extension events.
9915
</description>
9916
<origin>new</origin>
9917
<capabilities>
9918
</capabilities>
9919
<parameters>
9920
<param id="extension_count_ptr">
9921
<outptr><jint/></outptr>
9922
<description>
9923
On return, points to the number of extension events
9924
</description>
9925
</param>
9926
<param id="extensions">
9927
<allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>
9928
<description>
9929
Returns an array of extension event info, one per event
9930
</description>
9931
</param>
9932
</parameters>
9933
<errors>
9934
</errors>
9935
</function>
9936
9937
<callback id="jvmtiExtensionEvent">
9938
<void/>
9939
<synopsis>Extension Event</synopsis>
9940
<description>
9941
This is the implementation-specific event.
9942
The event handler is set with
9943
<functionlink id="SetExtensionEventCallback"/>.
9944
<p/>
9945
Event handlers for extension events must be declared varargs to match this definition.
9946
Failure to do so could result in calling convention mismatch and undefined behavior
9947
on some platforms.
9948
<p/>
9949
For example, if the <code>jvmtiParamInfo</code>
9950
returned by <functionlink id="GetExtensionEvents"/> indicates that
9951
there is a <code>jint</code> parameter, the event handler should be
9952
declared:
9953
<example>
9954
void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
9955
</example>
9956
Note the terminal "<code>...</code>" which indicates varargs.
9957
The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
9958
the <code>va_*</code> syntax of the C programming language.
9959
</description>
9960
<parameters>
9961
<param id="jvmti_env">
9962
<outptr>
9963
<struct>jvmtiEnv</struct>
9964
</outptr>
9965
<description>
9966
The <jvmti/> environment is the only fixed parameter for extension events.
9967
</description>
9968
</param>
9969
<param id="...">
9970
<varargs/>
9971
<description>
9972
The extension event-specific parameters
9973
</description>
9974
</param>
9975
</parameters>
9976
</callback>
9977
9978
<function id="SetExtensionEventCallback" phase="onload" num="126">
9979
<synopsis>Set Extension Event Callback</synopsis>
9980
9981
<description>
9982
Sets the callback function for an extension event and
9983
enables the event. Or, if the callback is <code>NULL</code>, disables
9984
the event. Note that unlike standard events, setting
9985
the callback and enabling the event are a single operation.
9986
</description>
9987
<origin>new</origin>
9988
<capabilities>
9989
</capabilities>
9990
<parameters>
9991
<param id="extension_event_index">
9992
<jint/>
9993
<description>
9994
Identifies which callback to set.
9995
This index is the
9996
<fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>
9997
field of
9998
<datalink id="jvmtiExtensionEventInfo"/>.
9999
</description>
10000
</param>
10001
<param id="callback">
10002
<ptrtype>
10003
<struct>jvmtiExtensionEvent</struct>
10004
<nullok>disable the event</nullok>
10005
</ptrtype>
10006
<description>
10007
If <code>callback</code> is non-<code>NULL</code>,
10008
set <code>callback</code> to be the event callback function
10009
and enable the event.
10010
</description>
10011
</param>
10012
</parameters>
10013
<errors>
10014
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
10015
<paramlink id="extension_event_index"/> is not an
10016
<fieldlink id="extension_event_index"
10017
struct="jvmtiExtensionEventInfo"/>
10018
returned by
10019
<functionlink id="GetExtensionEvents"/>
10020
</error>
10021
</errors>
10022
</function>
10023
10024
</category>
10025
10026
<category id="capability" label="Capability">
10027
10028
<intro>
10029
The capabilities functions allow you to change the
10030
functionality available to <jvmti/>--that is,
10031
which <jvmti/>
10032
functions can be called, what events can be generated,
10033
and what functionality these events and functions can
10034
provide.
10035
<p/>
10036
The "Capabilities" section of each function and event describe which
10037
capabilities, if any, they are associated with. "Required Functionality"
10038
means it is available for use and no capabilities must be added to use it.
10039
"Optional Functionality" means the agent must possess the capability
10040
before it can be used.
10041
To possess a capability, the agent must
10042
<functionlink id="AddCapabilities">add the capability</functionlink>.
10043
"Optional Features" describe capabilities which,
10044
if added, extend the feature set.
10045
<p/>
10046
The potentially available capabilities of each <jvmti/> implementation are different.
10047
Depending on the implementation, a capability:
10048
<ul>
10049
<li>may never be added</li>
10050
<li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>
10051
<li>may be added only during the <code>OnLoad</code> phase</li>
10052
<li>may be possessed by only one environment at a time</li>
10053
<li>may be possessed by only one environment at a time,
10054
and only during the <code>OnLoad</code> phase</li>
10055
<li>and so on ...</li>
10056
</ul>
10057
Frequently, the addition of a capability may incur a cost in execution speed, start up
10058
time, and/or memory footprint. Note that the overhead of using a capability
10059
is completely different than the overhead of possessing a capability.
10060
Take single stepping as an example. When single stepping is on (that
10061
is, when the event is enabled and thus actively sending events)
10062
the overhead of sending and processing an event
10063
on each instruction is huge in any implementation.
10064
However, the overhead of possessing the capability may be small or large,
10065
depending on the implementation. Also, when and if a capability is potentially
10066
available depends on the implementation. Some examples:
10067
<ul>
10068
<li>One VM might perform all execution by compiling bytecodes into
10069
native code and be unable to generate single step instructions.
10070
In this implementation the capability can not be added.</li>
10071
<li>Another VM may be able to switch execution to a single stepping
10072
interpreter at any time. In this implementation, having the capability has no
10073
overhead and could be added at any time.</li>
10074
<li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted
10075
execution engine at start up, but be unable to switch between them.
10076
In this implementation the capability would need to be added
10077
during the <code>OnLoad</code> phase (before bytecode
10078
execution begins) and would have a large impact on execution speed
10079
even if single stepping was never used.</li>
10080
<li>Still another VM might be able to add an "is single stepping on" check
10081
into compiled bytecodes or a generated interpreter. Again in this implementation
10082
the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test
10083
and branch on each instruction) would be considerably less.</li>
10084
</ul>
10085
<p/>
10086
Each <jvmti/> <internallink id="environments">environment</internallink>
10087
has its own set of capabilities.
10088
Initially, that set is empty.
10089
Any desired capability must be added.
10090
If possible, capabilities should be added during the <code>OnLoad</code> phase. For most
10091
virtual machines certain capabilities require special set up for
10092
the virtual machine and this set up must happen
10093
during the <code>OnLoad</code> phase, before the virtual machine begins execution.
10094
Once a capability is added, it can
10095
only be removed if explicitly relinquished by the environment.
10096
<p/>
10097
The agent can,
10098
<functionlink id="GetPotentialCapabilities">determine what
10099
capabilities this VM can potentially provide</functionlink>,
10100
<functionlink id="AddCapabilities">add the capabilities
10101
to be used</functionlink>,
10102
<functionlink id="RelinquishCapabilities">release capabilities
10103
which are no longer needed</functionlink>, and
10104
<functionlink id="GetCapabilities">examine the currently available
10105
capabilities</functionlink>.
10106
</intro>
10107
10108
<intro id="capabilityExamples" label="Capability Examples">
10109
For example, a freshly started agent (in the <code>OnLoad</code> function)
10110
wants to enable all possible capabilities.
10111
Note that, in general, this is not advisable as the agent may suffer
10112
a performance penalty for functionality it is not using.
10113
The code might look like this in C:
10114
<example>
10115
jvmtiCapabilities capa;
10116
jvmtiError err;
10117
10118
err = (*jvmti)-&gt;GetPotentialCapabilities(jvmti, &amp;capa);
10119
if (err == JVMTI_ERROR_NONE) {
10120
err = (*jvmti)-&gt;AddCapabilities(jvmti, &amp;capa);
10121
</example>
10122
For example, if an agent wants to check if it can get
10123
the bytecodes of a method (that is, it wants to check
10124
if it previously added this capability and has not
10125
relinquished it), the code might
10126
look like this in C:
10127
<example>
10128
jvmtiCapabilities capa;
10129
jvmtiError err;
10130
10131
err = (*jvmti)-&gt;GetCapabilities(jvmti, &amp;capa);
10132
if (err == JVMTI_ERROR_NONE) {
10133
if (capa.can_get_bytecodes) { ... } }
10134
</example>
10135
</intro>
10136
10137
<capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">
10138
<description>
10139
The functions in this category use this capabilities structure
10140
which contains boolean flags corresponding to each capability:
10141
</description>
10142
<capabilityfield id="can_tag_objects">
10143
<description>
10144
Can set and get tags, as described in the
10145
<internallink id="Heap">Heap category</internallink>.
10146
</description>
10147
</capabilityfield>
10148
<capabilityfield id="can_generate_field_modification_events">
10149
<description>
10150
Can set watchpoints on field modification -
10151
<functionlink id="SetFieldModificationWatch"></functionlink>
10152
</description>
10153
</capabilityfield>
10154
<capabilityfield id="can_generate_field_access_events">
10155
<description>
10156
Can set watchpoints on field access -
10157
<functionlink id="SetFieldAccessWatch"></functionlink>
10158
</description>
10159
</capabilityfield>
10160
<capabilityfield id="can_get_bytecodes">
10161
<description>
10162
Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>
10163
</description>
10164
</capabilityfield>
10165
<capabilityfield id="can_get_synthetic_attribute">
10166
<description>
10167
Can test if a field or method is synthetic -
10168
<functionlink id="IsFieldSynthetic"></functionlink> and
10169
<functionlink id="IsMethodSynthetic"></functionlink>
10170
</description>
10171
</capabilityfield>
10172
<capabilityfield id="can_get_owned_monitor_info">
10173
<description>
10174
Can get information about ownership of monitors -
10175
<functionlink id="GetOwnedMonitorInfo"></functionlink>
10176
</description>
10177
</capabilityfield>
10178
<capabilityfield id="can_get_current_contended_monitor">
10179
<description>
10180
Can <functionlink id="GetCurrentContendedMonitor"></functionlink>
10181
</description>
10182
</capabilityfield>
10183
<capabilityfield id="can_get_monitor_info">
10184
<description>
10185
Can <functionlink id="GetObjectMonitorUsage"></functionlink>
10186
</description>
10187
</capabilityfield>
10188
<capabilityfield id="can_pop_frame">
10189
<description>
10190
Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>
10191
</description>
10192
</capabilityfield>
10193
<capabilityfield id="can_redefine_classes">
10194
<description>
10195
Can redefine classes with <functionlink id="RedefineClasses"/>.
10196
</description>
10197
</capabilityfield>
10198
<capabilityfield id="can_signal_thread">
10199
<description>
10200
Can send stop or interrupt to threads
10201
</description>
10202
</capabilityfield>
10203
<capabilityfield id="can_get_source_file_name">
10204
<description>
10205
Can get the source file name of a class
10206
</description>
10207
</capabilityfield>
10208
<capabilityfield id="can_get_line_numbers">
10209
<description>
10210
Can get the line number table of a method
10211
</description>
10212
</capabilityfield>
10213
<capabilityfield id="can_get_source_debug_extension">
10214
<description>
10215
Can get the source debug extension of a class
10216
</description>
10217
</capabilityfield>
10218
<capabilityfield id="can_access_local_variables">
10219
<description>
10220
Can set and get local variables
10221
</description>
10222
</capabilityfield>
10223
<capabilityfield id="can_maintain_original_method_order">
10224
<description>
10225
Can return methods in the order they occur in the class file
10226
</description>
10227
</capabilityfield>
10228
<capabilityfield id="can_generate_single_step_events">
10229
<description>
10230
Can get <eventlink id="SingleStep">single step</eventlink> events
10231
</description>
10232
</capabilityfield>
10233
<capabilityfield id="can_generate_exception_events">
10234
<description>
10235
Can get <eventlink id="Exception">exception thrown</eventlink> and
10236
<eventlink id="ExceptionCatch">exception catch</eventlink> events
10237
</description>
10238
</capabilityfield>
10239
<capabilityfield id="can_generate_frame_pop_events">
10240
<description>
10241
Can <functionlink id="NotifyFramePop">set</functionlink> and thus get
10242
<eventlink id="FramePop"></eventlink> events
10243
</description>
10244
</capabilityfield>
10245
<capabilityfield id="can_generate_breakpoint_events">
10246
<description>
10247
Can <functionlink id="SetBreakpoint">set</functionlink> and thus get
10248
<eventlink id="Breakpoint"></eventlink> events
10249
</description>
10250
</capabilityfield>
10251
<capabilityfield id="can_suspend">
10252
<description>
10253
Can suspend and resume threads
10254
</description>
10255
</capabilityfield>
10256
<capabilityfield id="can_redefine_any_class">
10257
<description>
10258
<functionlink id="RedefineClasses"/> can be called on any modifiable class.
10259
See <functionlink id="IsModifiableClass"/>.
10260
(<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
10261
must also be set)
10262
</description>
10263
</capabilityfield>
10264
<capabilityfield id="can_get_current_thread_cpu_time">
10265
<description>
10266
Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>
10267
current thread CPU time
10268
</description>
10269
</capabilityfield>
10270
<capabilityfield id="can_get_thread_cpu_time">
10271
<description>
10272
Can <functionlink id="GetThreadCpuTime">get</functionlink>
10273
thread CPU time
10274
</description>
10275
</capabilityfield>
10276
<capabilityfield id="can_generate_method_entry_events"
10277
disp1="can_generate" disp2="_method_entry_events"
10278
>
10279
<description>
10280
Can generate method entry events on entering a method
10281
</description>
10282
</capabilityfield>
10283
<capabilityfield id="can_generate_method_exit_events"
10284
disp1="can_generate" disp2="_method_exit_events"
10285
>
10286
<description>
10287
Can generate method exit events on leaving a method
10288
</description>
10289
</capabilityfield>
10290
<capabilityfield id="can_generate_all_class_hook_events"
10291
disp1="can_generate" disp2="_all_class_hook_events"
10292
>
10293
<description>
10294
Can generate ClassFileLoadHook events for every loaded class.
10295
</description>
10296
</capabilityfield>
10297
<capabilityfield id="can_generate_compiled_method_load_events"
10298
disp1="can_generate" disp2="_compiled_method_load_events"
10299
>
10300
<description>
10301
Can generate events when a method is compiled or unloaded
10302
</description>
10303
</capabilityfield>
10304
<capabilityfield id="can_generate_monitor_events"
10305
disp1="can_generate" disp2="_monitor_events"
10306
>
10307
<description>
10308
Can generate events on monitor activity
10309
</description>
10310
</capabilityfield>
10311
<capabilityfield id="can_generate_vm_object_alloc_events"
10312
disp1="can_generate" disp2="_vm_object_alloc_events"
10313
>
10314
<description>
10315
Can generate events on VM allocation of an object
10316
</description>
10317
</capabilityfield>
10318
<capabilityfield id="can_generate_native_method_bind_events"
10319
disp1="can_generate" disp2="_native_method_bind_events"
10320
>
10321
<description>
10322
Can generate events when a native method is bound to its
10323
implementation
10324
</description>
10325
</capabilityfield>
10326
<capabilityfield id="can_generate_garbage_collection_events"
10327
disp1="can_generate" disp2="_garbage_collection_events"
10328
>
10329
<description>
10330
Can generate events when garbage collection begins or ends
10331
</description>
10332
</capabilityfield>
10333
<capabilityfield id="can_generate_object_free_events"
10334
disp1="can_generate" disp2="_object_free_events"
10335
>
10336
<description>
10337
Can generate events when the garbage collector frees an object
10338
</description>
10339
</capabilityfield>
10340
<capabilityfield id="can_force_early_return" since="1.1">
10341
<description>
10342
Can return early from a method, as described in the
10343
<internallink id="ForceEarlyReturn">Force Early Return category</internallink>.
10344
</description>
10345
</capabilityfield>
10346
<capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">
10347
<description>
10348
Can get information about owned monitors with stack depth -
10349
<functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>
10350
</description>
10351
</capabilityfield>
10352
<capabilityfield id="can_get_constant_pool" since="1.1">
10353
<description>
10354
Can get the constant pool of a class -
10355
<functionlink id="GetConstantPool"></functionlink>
10356
</description>
10357
</capabilityfield>
10358
<capabilityfield id="can_set_native_method_prefix" since="1.1">
10359
<description>
10360
Can set prefix to be applied when native method cannot be resolved -
10361
<functionlink id="SetNativeMethodPrefix"/> and
10362
<functionlink id="SetNativeMethodPrefixes"/>
10363
</description>
10364
</capabilityfield>
10365
<capabilityfield id="can_retransform_classes" since="1.1">
10366
<description>
10367
Can retransform classes with <functionlink id="RetransformClasses"/>.
10368
In addition to the restrictions imposed by the specific
10369
implementation on this capability (see the
10370
<internallink id="capability">Capability</internallink> section),
10371
this capability must be set before the
10372
<eventlink id="ClassFileLoadHook"/> event is enabled for the
10373
first time in this environment.
10374
An environment that possesses this capability at the time that
10375
<code>ClassFileLoadHook</code> is enabled for the first time is
10376
said to be <i>retransformation capable</i>.
10377
An environment that does not possess this capability at the time that
10378
<code>ClassFileLoadHook</code> is enabled for the first time is
10379
said to be <i>retransformation incapable</i>.
10380
</description>
10381
</capabilityfield>
10382
<capabilityfield id="can_retransform_any_class" since="1.1">
10383
<description>
10384
<functionlink id="RetransformClasses"/> can be called on any modifiable class.
10385
See <functionlink id="IsModifiableClass"/>.
10386
(<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
10387
must also be set)
10388
</description>
10389
</capabilityfield>
10390
<capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">
10391
<description>
10392
Can generate events when the VM is unable to allocate memory from
10393
the <tm>Java</tm> platform heap.
10394
See <eventlink id="ResourceExhausted"/>.
10395
</description>
10396
</capabilityfield>
10397
<capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">
10398
<description>
10399
Can generate events when the VM is unable to create a thread.
10400
See <eventlink id="ResourceExhausted"/>.
10401
</description>
10402
</capabilityfield>
10403
<capabilityfield id="can_generate_early_vmstart" since="9">
10404
<description>
10405
Can generate the <code>VMStart</code> event early.
10406
See <eventlink id="VMStart"/>.
10407
</description>
10408
</capabilityfield>
10409
<capabilityfield id="can_generate_early_class_hook_events" since="9">
10410
<description>
10411
Can generate the <eventlink id="ClassFileLoadHook"/> events
10412
in the primordial phase. If this capability and
10413
<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
10414
<code>can_generate_all_class_hook_events</code></internallink>
10415
are enabled then the <eventlink id="ClassFileLoadHook"/> events
10416
can be posted for classes loaded in the primordial phase.
10417
See <eventlink id="ClassFileLoadHook"/>.
10418
</description>
10419
</capabilityfield>
10420
<capabilityfield id="can_generate_sampled_object_alloc_events" since="11">
10421
<description>
10422
Can generate sampled allocation events.
10423
If this capability is enabled then the heap sampling method
10424
<functionlink id="SetHeapSamplingInterval"></functionlink> can be
10425
called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.
10426
</description>
10427
</capabilityfield>
10428
</capabilitiestypedef>
10429
10430
<function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">
10431
<synopsis>Get Potential Capabilities</synopsis>
10432
<description>
10433
Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>
10434
features that can potentially be possessed by this environment
10435
at this time.
10436
The returned capabilities differ from the complete set of capabilities
10437
implemented by the VM in two cases: another environment possesses
10438
capabilities that can only be possessed by one environment, or the
10439
current <functionlink id="GetPhase">phase</functionlink> is live,
10440
and certain capabilities can only be added during the <code>OnLoad</code> phase.
10441
The <functionlink id="AddCapabilities"></functionlink> function
10442
may be used to set any or all or these capabilities.
10443
Currently possessed capabilities are included.
10444
<p/>
10445
Typically this function is used in the <code>OnLoad</code> function.
10446
Some virtual machines may allow a limited set of capabilities to be
10447
added in the live phase.
10448
In this case, the set of potentially available capabilities
10449
will likely differ from the <code>OnLoad</code> phase set.
10450
<p/>
10451
See the
10452
<internallink id="capabilityExamples">Capability Examples</internallink>.
10453
</description>
10454
<origin>new</origin>
10455
<capabilities>
10456
</capabilities>
10457
<parameters>
10458
<param id="capabilities_ptr">
10459
<outptr><struct>jvmtiCapabilities</struct></outptr>
10460
<description>
10461
On return, points to the <jvmti/> capabilities that may be added.
10462
</description>
10463
</param>
10464
</parameters>
10465
<errors>
10466
</errors>
10467
</function>
10468
10469
<elide>
10470
<function id="EstimateCostOfCapabilities" phase="onload" num="141">
10471
<synopsis>Estimate Cost Of Capabilities</synopsis>
10472
<description>
10473
<issue>There is strong opposition to this function. The concern is
10474
that it would be difficult or impossible to provide meaningful
10475
numbers, as the amount of impact is conditional on many factors
10476
that a single number could not represent. There is doubt that
10477
conditional implementations would be used or are even a good idea.
10478
The thought is that release documentation for the implementation
10479
would be the best means of exposing this information.
10480
Unless new arguments are presented, I intend to remove this
10481
function in the next revision.
10482
</issue>
10483
<p/>
10484
Return via the <paramlink id="time_impact_ptr"></paramlink> and
10485
<paramlink id="space_impact_ptr"></paramlink> an estimate of the impact
10486
of adding the capabilities pointed to by
10487
<paramlink id="capabilities_ptr"></paramlink>.
10488
The returned estimates are in percentage of additional overhead, thus
10489
a time impact of 100 mean the application might run
10490
at half the speed.
10491
The estimates are very rough approximations and are not guaranteed.
10492
Note also, that the estimates are of the impact of having the
10493
capability available--when and if it is used the impact may be
10494
much greater.
10495
Estimates can be for a single capability or for a set of
10496
capabilities. Note that the costs are not necessarily additive,
10497
adding support for one capability might make another available
10498
for free or conversely having two capabilities at once may
10499
have multiplicative impact.
10500
Estimates are relative to the current set of capabilities -
10501
that is, how much more impact given the currently possessed capabilities.
10502
<p/>
10503
Typically this function is used in the OnLoad function,
10504
some virtual machines may allow a limited set of capabilities to be
10505
added in the live phase.
10506
In this case, the set of potentially available capabilities
10507
will likely differ from the OnLoad phase set.
10508
<p/>
10509
See the
10510
<internallink id="capabilityExamples">Capability Examples</internallink>.
10511
</description>
10512
<origin>new</origin>
10513
<capabilities>
10514
</capabilities>
10515
<parameters>
10516
<param id="capabilities_ptr">
10517
<inptr><struct>jvmtiCapabilities</struct></inptr>
10518
<description>
10519
points to the <jvmti/> capabilities to evaluate.
10520
</description>
10521
</param>
10522
<param id="time_impact_ptr">
10523
<outptr><jint/></outptr>
10524
<description>
10525
On return, points to the estimated percentage increase in
10526
run time if this capability was added.
10527
</description>
10528
</param>
10529
<param id="space_impact_ptr">
10530
<outptr><jint/></outptr>
10531
<description>
10532
On return, points to the estimated percentage increase in
10533
memory space used if this capability was added.
10534
</description>
10535
</param>
10536
</parameters>
10537
<errors>
10538
<error id="JVMTI_ERROR_NOT_AVAILABLE">
10539
The desired capabilities are not even potentially available.
10540
</error>
10541
</errors>
10542
</function>
10543
</elide>
10544
10545
<function id="AddCapabilities" jkernel="yes" phase="onload" num="142">
10546
<synopsis>Add Capabilities</synopsis>
10547
<description>
10548
Set new capabilities by adding the capabilities
10549
whose values are set to one (<code>1</code>) in
10550
<code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10551
All previous capabilities are retained.
10552
Typically this function is used in the <code>OnLoad</code> function.
10553
Some virtual machines may allow a limited set of capabilities to be
10554
added in the live phase.
10555
<p/>
10556
See the
10557
<internallink id="capabilityExamples">Capability Examples</internallink>.
10558
</description>
10559
<origin>new</origin>
10560
<capabilities>
10561
</capabilities>
10562
<parameters>
10563
<param id="capabilities_ptr">
10564
<inptr><struct>jvmtiCapabilities</struct></inptr>
10565
<description>
10566
Points to the <jvmti/> capabilities to add.
10567
</description>
10568
</param>
10569
</parameters>
10570
<errors>
10571
<error id="JVMTI_ERROR_NOT_AVAILABLE">
10572
The desired capabilities are not even potentially available.
10573
</error>
10574
</errors>
10575
</function>
10576
10577
10578
<function id="RelinquishCapabilities" phase="onload" num="143">
10579
<synopsis>Relinquish Capabilities</synopsis>
10580
<description>
10581
Relinquish the capabilities
10582
whose values are set to one (<code>1</code>) in
10583
<code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10584
Some implementations may allow only one environment to have a capability
10585
(see the <internallink id="capability">capability introduction</internallink>).
10586
This function releases capabilities
10587
so that they may be used by other agents.
10588
All other capabilities are retained.
10589
The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.
10590
Attempting to relinquish a capability that the agent does not possess is not an error.
10591
<issue>
10592
It is possible for the agent to be actively using capabilities
10593
which are being relinquished. For example, a thread is currently
10594
suspended and can_suspend is being relinquished or an event is currently
10595
enabled and can_generate_whatever is being relinquished.
10596
There are three possible ways we could spec this:
10597
<ul>
10598
<li>relinquish automatically releases them</li>
10599
<li>relinquish checks and returns some error code if held</li>
10600
<li>it is the agent's responsibility and it is not checked</li>
10601
</ul>
10602
One of these should be chosen.
10603
</issue>
10604
</description>
10605
<origin>new</origin>
10606
<capabilities>
10607
</capabilities>
10608
<parameters>
10609
<param id="capabilities_ptr">
10610
<inptr><struct>jvmtiCapabilities</struct></inptr>
10611
<description>
10612
Points to the <jvmti/> capabilities to relinquish.
10613
</description>
10614
</param>
10615
</parameters>
10616
<errors>
10617
</errors>
10618
</function>
10619
10620
10621
10622
<function id="GetCapabilities" jkernel="yes" phase="any" num="89">
10623
<synopsis>Get Capabilities</synopsis>
10624
<description>
10625
Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>
10626
features which this environment currently possesses.
10627
Each possessed capability is indicated by a one (<code>1</code>) in the
10628
corresponding field of the <internallink id="jvmtiCapabilities">capabilities
10629
structure</internallink>.
10630
An environment does not possess a capability unless it has been successfully added with
10631
<functionlink id="AddCapabilities"/>.
10632
An environment only loses possession of a capability if it has been relinquished with
10633
<functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result
10634
of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which
10635
have been made.
10636
<p/>
10637
See the
10638
<internallink id="capabilityExamples">Capability Examples</internallink>.
10639
</description>
10640
<origin>jvmdiClone</origin>
10641
<capabilities>
10642
</capabilities>
10643
<parameters>
10644
<param id="capabilities_ptr">
10645
<outptr><struct>jvmtiCapabilities</struct></outptr>
10646
<description>
10647
On return, points to the <jvmti/> capabilities.
10648
</description>
10649
</param>
10650
</parameters>
10651
<errors>
10652
</errors>
10653
</function>
10654
10655
</category>
10656
10657
10658
<category id="timers" label="Timers">
10659
10660
<intro>
10661
These functions provide timing information.
10662
The resolution at which the time is updated is not specified.
10663
They provides nanosecond precision, but not necessarily nanosecond accuracy.
10664
Details about the timers, such as their maximum values, can be accessed with
10665
the timer information functions.
10666
</intro>
10667
10668
<typedef id="jvmtiTimerInfo" label="Timer Info">
10669
<description>
10670
The information function for each timer returns this data structure.
10671
</description>
10672
<field id="max_value">
10673
<jlong/>
10674
<description>
10675
The maximum value the timer can reach.
10676
After this value is reached the timer wraps back to zero.
10677
This is an unsigned value. If tested or printed as a jlong (signed value)
10678
it may appear to be a negative number.
10679
</description>
10680
</field>
10681
<field id="may_skip_forward">
10682
<jboolean/>
10683
<description>
10684
If true, the timer can be externally adjusted and as a result skip forward.
10685
If false, the timer value will never increase faster than real time.
10686
</description>
10687
</field>
10688
<field id="may_skip_backward">
10689
<jboolean/>
10690
<description>
10691
If true, the timer can be externally adjusted and as a result skip backward.
10692
If false, the timer value will be monotonically increasing.
10693
</description>
10694
</field>
10695
<field id="kind">
10696
<enum>jvmtiTimerKind</enum>
10697
<description>
10698
The kind of timer.
10699
On a platform that does not distinguish between user and system time, <datalink
10700
id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>
10701
is returned.
10702
</description>
10703
</field>
10704
<field id="reserved1">
10705
<jlong/>
10706
<description>
10707
Reserved for future use.
10708
</description>
10709
</field>
10710
<field id="reserved2">
10711
<jlong/>
10712
<description>
10713
Reserved for future use.
10714
</description>
10715
</field>
10716
</typedef>
10717
10718
<intro>
10719
Where the timer kind is --
10720
10721
<constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">
10722
<constant id="JVMTI_TIMER_USER_CPU" num="30">
10723
CPU time that a thread is in user mode.
10724
</constant>
10725
<constant id="JVMTI_TIMER_TOTAL_CPU" num="31">
10726
CPU time that a thread is in user or system mode.
10727
</constant>
10728
<constant id="JVMTI_TIMER_ELAPSED" num="32">
10729
Elapsed time.
10730
</constant>
10731
</constants>
10732
</intro>
10733
10734
<function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">
10735
<synopsis>Get Current Thread CPU Timer Information</synopsis>
10736
<description>
10737
Get information about the
10738
<functionlink id="GetCurrentThreadCpuTime"/> timer.
10739
The fields of the <datalink id="jvmtiTimerInfo"/> structure
10740
are filled in with details about the timer.
10741
This information is specific to the platform and the implementation of
10742
<functionlink id="GetCurrentThreadCpuTime"/> and thus
10743
does not vary by thread nor does it vary
10744
during a particular invocation of the VM.
10745
<p/>
10746
Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
10747
and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
10748
returned by <code>GetCurrentThreadCpuTimerInfo</code>
10749
and <functionlink id="GetThreadCpuTimerInfo"/>
10750
may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
10751
</description>
10752
<origin>new</origin>
10753
<capabilities>
10754
<required id="can_get_current_thread_cpu_time">
10755
Can get current thread CPU time.
10756
</required>
10757
</capabilities>
10758
<parameters>
10759
<param id="info_ptr">
10760
<outptr><struct>jvmtiTimerInfo</struct></outptr>
10761
<description>
10762
On return, filled with information describing the time
10763
returned by <functionlink id="GetCurrentThreadCpuTime"/>.
10764
</description>
10765
</param>
10766
</parameters>
10767
<errors>
10768
</errors>
10769
</function>
10770
10771
<function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">
10772
<synopsis>Get Current Thread CPU Time</synopsis>
10773
<description>
10774
Return the CPU time utilized by the current thread.
10775
<p/>
10776
Note that the <functionlink id="GetThreadCpuTime"/>
10777
function provides CPU time for any thread, including
10778
the current thread. <code>GetCurrentThreadCpuTime</code>
10779
exists to support platforms which cannot
10780
supply CPU time for threads other than the current
10781
thread or which have more accurate information for
10782
the current thread (see
10783
<functionlink id="GetCurrentThreadCpuTimerInfo"/> vs
10784
<functionlink id="GetThreadCpuTimerInfo"/>).
10785
On many platforms this call will be equivalent to:
10786
<example>
10787
GetThreadCpuTime(env, NULL, nanos_ptr)
10788
</example>
10789
</description>
10790
<origin>new</origin>
10791
<capabilities>
10792
<required id="can_get_current_thread_cpu_time">
10793
Can get current thread CPU time.
10794
<p/>
10795
If this capability is enabled after threads have started,
10796
the implementation may choose any time up
10797
to and including the time that the capability is enabled
10798
as the point where CPU time collection starts.
10799
<p/>
10800
This capability must be potentially available on any
10801
platform where
10802
<internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>
10803
is potentially available.
10804
</required>
10805
</capabilities>
10806
<parameters>
10807
<param id="nanos_ptr">
10808
<outptr><jlong/></outptr>
10809
<description>
10810
On return, points to the CPU time used by this thread
10811
in nanoseconds.
10812
This is an unsigned value. If tested or printed as a jlong (signed value)
10813
it may appear to be a negative number.
10814
</description>
10815
</param>
10816
</parameters>
10817
<errors>
10818
</errors>
10819
</function>
10820
10821
<function id="GetThreadCpuTimerInfo" num="136">
10822
<synopsis>Get Thread CPU Timer Information</synopsis>
10823
<description>
10824
Get information about the
10825
<functionlink id="GetThreadCpuTime"/> timer.
10826
The fields of the <datalink id="jvmtiTimerInfo"/> structure
10827
are filled in with details about the timer.
10828
This information is specific to the platform and the implementation of
10829
<functionlink id="GetThreadCpuTime"/> and thus
10830
does not vary by thread nor does it vary
10831
during a particular invocation of the VM.
10832
<p/>
10833
Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
10834
and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
10835
returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>
10836
and <code>GetThreadCpuTimerInfo</code>
10837
may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
10838
</description>
10839
<origin>new</origin>
10840
<capabilities>
10841
<required id="can_get_thread_cpu_time">
10842
Can get thread CPU time.
10843
</required>
10844
</capabilities>
10845
<parameters>
10846
<param id="info_ptr">
10847
<outptr><struct>jvmtiTimerInfo</struct></outptr>
10848
<description>
10849
On return, filled with information describing the time
10850
returned by <functionlink id="GetThreadCpuTime"/>.
10851
</description>
10852
</param>
10853
</parameters>
10854
<errors>
10855
</errors>
10856
</function>
10857
10858
<function id="GetThreadCpuTime" num="137">
10859
<synopsis>Get Thread CPU Time</synopsis>
10860
<description>
10861
Return the CPU time utilized by the specified thread.
10862
<p/>
10863
Get information about this timer with
10864
<functionlink id="GetThreadCpuTimerInfo"/>.
10865
</description>
10866
<origin>new</origin>
10867
<capabilities>
10868
<required id="can_get_thread_cpu_time">
10869
Can get thread CPU time.
10870
<p/>
10871
If this capability is enabled after threads have started,
10872
the implementation may choose any time up
10873
to and including the time that the capability is enabled
10874
as the point where CPU time collection starts.
10875
</required>
10876
</capabilities>
10877
<parameters>
10878
<param id="thread">
10879
<jthread null="current"/>
10880
<description>
10881
The thread to query.
10882
</description>
10883
</param>
10884
<param id="nanos_ptr">
10885
<outptr><jlong/></outptr>
10886
<description>
10887
On return, points to the CPU time used by the specified thread
10888
in nanoseconds.
10889
This is an unsigned value. If tested or printed as a jlong (signed value)
10890
it may appear to be a negative number.
10891
</description>
10892
</param>
10893
</parameters>
10894
<errors>
10895
</errors>
10896
</function>
10897
10898
<function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">
10899
<synopsis>Get Timer Information</synopsis>
10900
<description>
10901
Get information about the
10902
<functionlink id="GetTime"/> timer.
10903
The fields of the <datalink id="jvmtiTimerInfo"/> structure
10904
are filled in with details about the timer.
10905
This information will not change during a particular invocation of the VM.
10906
</description>
10907
<origin>new</origin>
10908
<capabilities>
10909
</capabilities>
10910
<parameters>
10911
<param id="info_ptr">
10912
<outptr><struct>jvmtiTimerInfo</struct></outptr>
10913
<description>
10914
On return, filled with information describing the time
10915
returned by <functionlink id="GetTime"/>.
10916
</description>
10917
</param>
10918
</parameters>
10919
<errors>
10920
</errors>
10921
</function>
10922
10923
<function id="GetTime" phase="any" callbacksafe="safe" num="139">
10924
<synopsis>Get Time</synopsis>
10925
<description>
10926
Return the current value of the system timer, in nanoseconds.
10927
<p/>
10928
The value returned represents nanoseconds since some fixed but
10929
arbitrary time (perhaps in the future, so values may be
10930
negative). This function provides nanosecond precision, but not
10931
necessarily nanosecond accuracy. No guarantees are made about
10932
how frequently values change.
10933
<p/>
10934
Get information about this timer with
10935
<functionlink id="GetTimerInfo"/>.
10936
</description>
10937
<origin>new</origin>
10938
<capabilities>
10939
</capabilities>
10940
<parameters>
10941
<param id="nanos_ptr">
10942
<outptr><jlong/></outptr>
10943
<description>
10944
On return, points to the time in nanoseconds.
10945
This is an unsigned value. If tested or printed as a jlong (signed value)
10946
it may appear to be a negative number.
10947
</description>
10948
</param>
10949
</parameters>
10950
<errors>
10951
</errors>
10952
</function>
10953
10954
<function id="GetAvailableProcessors" phase="any" num="144">
10955
<synopsis>Get Available Processors</synopsis>
10956
<description>
10957
Returns the number of processors available to the Java virtual machine.
10958
<p/>
10959
This value may change during a particular invocation of the virtual machine.
10960
Applications that are sensitive to the number of available processors should
10961
therefore occasionally poll this property.
10962
</description>
10963
<origin>new</origin>
10964
<capabilities>
10965
</capabilities>
10966
<parameters>
10967
<param id="processor_count_ptr">
10968
<outptr><jint/></outptr>
10969
<description>
10970
On return, points to the maximum number of processors available to the
10971
virtual machine; never smaller than one.
10972
</description>
10973
</param>
10974
</parameters>
10975
<errors>
10976
</errors>
10977
</function>
10978
10979
</category>
10980
10981
10982
<category id="classLoaderSearch" label="Class Loader Search">
10983
10984
<intro>
10985
These functions allow the agent to add to the locations that a class loader searches for a class.
10986
This is useful for installing instrumentation under the correct class loader.
10987
</intro>
10988
10989
<function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">
10990
<synopsis>Add To Bootstrap Class Loader Search</synopsis>
10991
<description>
10992
This function can be used to cause instrumentation classes to be defined by the
10993
bootstrap class loader. See <vmspec chapter="5.3.1"/>.
10994
After the bootstrap
10995
class loader unsuccessfully searches for a class, the specified platform-dependent
10996
search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in
10997
the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,
10998
the segments will be searched in the order that this function was called.
10999
<p/>
11000
In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11001
search path segment to be searched after the bootstrap class loader unsuccessfully searches
11002
for a class. The segment is typically a directory or JAR file.
11003
<p/>
11004
In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent
11005
path to a <externallink id="jar/jar.html">
11006
JAR file</externallink>. The agent should take care that the JAR file does not
11007
contain any classes or resources other than those to be defined by the bootstrap
11008
class loader for the purposes of instrumentation.
11009
<p/>
11010
<vmspec/> specifies that a subsequent attempt to resolve a symbolic
11011
reference that the Java virtual machine has previously unsuccessfully attempted
11012
to resolve always fails with the same error that was thrown as a result of the
11013
initial resolution attempt. Consequently, if the JAR file contains an entry
11014
that corresponds to a class for which the Java virtual machine has
11015
unsuccessfully attempted to resolve a reference, then subsequent attempts to
11016
resolve that reference will fail with the same error as the initial attempt.
11017
</description>
11018
<origin>new</origin>
11019
<capabilities>
11020
</capabilities>
11021
<parameters>
11022
<param id="segment">
11023
<inbuf><char/></inbuf>
11024
<description>
11025
The platform-dependent search path segment, encoded as a
11026
<internallink id="mUTF">modified UTF-8</internallink> string.
11027
</description>
11028
</param>
11029
</parameters>
11030
<errors>
11031
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11032
<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11033
existing JAR file is an invalid path.
11034
</error>
11035
</errors>
11036
</function>
11037
11038
<function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">
11039
<synopsis>Add To System Class Loader Search</synopsis>
11040
<description>
11041
This function can be used to cause instrumentation classes to be
11042
defined by the system class loader. See <vmspec chapter="5.3.2"/>.
11043
After the class loader unsuccessfully searches for a class, the specified platform-dependent search
11044
path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the
11045
<paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the
11046
segments will be searched in the order that this function was called.
11047
<p/>
11048
In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11049
search path segment to be searched after the system class loader unsuccessfully searches
11050
for a class. The segment is typically a directory or JAR file.
11051
<p/>
11052
In the live phase the <paramlink id="segment"/> is a platform-dependent path to a
11053
<externallink id="jar/jar.html">JAR file</externallink> to be
11054
searched after the system class loader unsuccessfully searches for a class. The agent should
11055
take care that the JAR file does not contain any classes or resources other than those to be
11056
defined by the system class loader for the purposes of instrumentation.
11057
<p/>
11058
In the live phase the system class loader supports adding a JAR file to be searched if
11059
the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>
11060
which takes a single parameter of type <code>java.lang.String</code>. The method is not required
11061
to have <code>public</code> access.
11062
<p/>
11063
<vmspec/> specifies that a subsequent attempt to resolve a symbolic
11064
reference that the Java virtual machine has previously unsuccessfully attempted
11065
to resolve always fails with the same error that was thrown as a result of the
11066
initial resolution attempt. Consequently, if the JAR file contains an entry
11067
that corresponds to a class for which the Java virtual machine has
11068
unsuccessfully attempted to resolve a reference, then subsequent attempts to
11069
resolve that reference will fail with the same error as the initial attempt.
11070
</description>
11071
<origin>new</origin>
11072
<capabilities>
11073
</capabilities>
11074
<parameters>
11075
<param id="segment">
11076
<inbuf><char/></inbuf>
11077
<description>
11078
The platform-dependent search path segment, encoded as a
11079
<internallink id="mUTF">modified UTF-8</internallink> string.
11080
</description>
11081
</param>
11082
</parameters>
11083
<errors>
11084
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11085
<paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11086
existing JAR file is an invalid path.
11087
</error>
11088
<error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">
11089
Operation not supported by the system class loader.
11090
</error>
11091
</errors>
11092
</function>
11093
11094
</category>
11095
11096
11097
<category id="props" label="System Properties">
11098
11099
<intro>
11100
These functions get and set system properties.
11101
</intro>
11102
11103
<function id="GetSystemProperties" phase="onload" num="130">
11104
<synopsis>Get System Properties</synopsis>
11105
<description>
11106
The list of VM system property keys which may be used with
11107
<functionlink id="GetSystemProperty"/> is returned.
11108
It is strongly recommended that virtual machines provide the
11109
following property keys:
11110
<ul>
11111
<li><code>java.vm.vendor</code></li>
11112
<li><code>java.vm.version</code></li>
11113
<li><code>java.vm.name</code></li>
11114
<li><code>java.vm.info</code></li>
11115
<li><code>java.library.path</code></li>
11116
<li><code>java.class.path</code></li>
11117
</ul>
11118
Provides access to system properties defined by and used
11119
by the VM.
11120
Properties set on the command-line are included.
11121
This allows getting and setting of these properties
11122
before the VM even begins executing bytecodes.
11123
Since this is a VM view of system properties, the set of available
11124
properties will usually be different than that
11125
in <code>java.lang.System.getProperties</code>.
11126
JNI method invocation may be used to access
11127
<code>java.lang.System.getProperties</code>.
11128
<p/>
11129
The set of properties may grow during execution.
11130
</description>
11131
<origin>new</origin>
11132
<capabilities>
11133
</capabilities>
11134
<parameters>
11135
<param id="count_ptr">
11136
<outptr><jint/></outptr>
11137
<description>
11138
On return, points to the number of property keys returned.
11139
</description>
11140
</param>
11141
<param id="property_ptr">
11142
<allocallocbuf outcount="count_ptr"><char/></allocallocbuf>
11143
<description>
11144
On return, points to an array of property keys, encoded as
11145
<internallink id="mUTF">modified UTF-8</internallink> strings.
11146
</description>
11147
</param>
11148
</parameters>
11149
<errors>
11150
</errors>
11151
</function>
11152
11153
<function id="GetSystemProperty" phase="onload" num="131">
11154
<synopsis>Get System Property</synopsis>
11155
<description>
11156
Return a VM system property value given the property key.
11157
<p/>
11158
The function <functionlink id="GetSystemProperties"/>
11159
returns the set of property keys which may be used.
11160
The properties which can be retrieved may grow during
11161
execution.
11162
<p/>
11163
Since this is a VM view of system properties, the values
11164
of properties may differ from that returned by
11165
<code>java.lang.System.getProperty(String)</code>.
11166
A typical VM might copy the values of the VM system
11167
properties into the <code>Properties</code> held by
11168
<code>java.lang.System</code> during the initialization
11169
of that class. Thereafter any changes to the VM system
11170
properties (with <functionlink id="SetSystemProperty"/>)
11171
or the <code>java.lang.System</code> system properties
11172
(with <code>java.lang.System.setProperty(String,String)</code>)
11173
would cause the values to diverge.
11174
JNI method invocation may be used to access
11175
<code>java.lang.System.getProperty(String)</code>.
11176
</description>
11177
<origin>new</origin>
11178
<capabilities>
11179
</capabilities>
11180
<parameters>
11181
<param id="property">
11182
<inbuf><char/></inbuf>
11183
<description>
11184
The key of the property to retrieve, encoded as a
11185
<internallink id="mUTF">modified UTF-8</internallink> string.
11186
</description>
11187
</param>
11188
<param id="value_ptr">
11189
<allocbuf><char/></allocbuf>
11190
<description>
11191
On return, points to the property value, encoded as a
11192
<internallink id="mUTF">modified UTF-8</internallink> string.
11193
</description>
11194
</param>
11195
</parameters>
11196
<errors>
11197
<error id="JVMTI_ERROR_NOT_AVAILABLE">
11198
This property is not available.
11199
Use <functionlink id="GetSystemProperties"/> to find available properties.
11200
</error>
11201
</errors>
11202
</function>
11203
11204
<function id="SetSystemProperty" phase="onloadOnly" num="132">
11205
<synopsis>Set System Property</synopsis>
11206
<description>
11207
Set a VM system property value.
11208
<p/>
11209
The function <functionlink id="GetSystemProperties"/>
11210
returns the set of property keys, some of these may be settable.
11211
See <functionlink id="GetSystemProperty"/>.
11212
</description>
11213
<origin>new</origin>
11214
<capabilities>
11215
</capabilities>
11216
<parameters>
11217
<param id="property">
11218
<inbuf><char/></inbuf>
11219
<description>
11220
The key of the property, encoded as a
11221
<internallink id="mUTF">modified UTF-8</internallink> string.
11222
</description>
11223
</param>
11224
<param id="value_ptr">
11225
<inbuf>
11226
<char/>
11227
<nullok>
11228
do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>
11229
if the property is not writeable
11230
</nullok>
11231
</inbuf>
11232
<description>
11233
The property value to set, encoded as a
11234
<internallink id="mUTF">modified UTF-8</internallink> string.
11235
</description>
11236
</param>
11237
</parameters>
11238
<errors>
11239
<error id="JVMTI_ERROR_NOT_AVAILABLE">
11240
This property is not available or is not writeable.
11241
</error>
11242
</errors>
11243
</function>
11244
11245
</category>
11246
11247
<category id="general" label="General">
11248
11249
<intro>
11250
</intro>
11251
11252
<function id="GetPhase" jkernel="yes" phase="any" num="133">
11253
<synopsis>Get Phase</synopsis>
11254
<description>
11255
Return the current phase of VM execution.
11256
The phases proceed in sequence:
11257
<constants id="jvmtiPhase" label="Phases of execution" kind="enum">
11258
<constant id="JVMTI_PHASE_ONLOAD" num="1">
11259
<code>OnLoad</code> phase: while in the
11260
<internallink id="onload"><code>Agent_OnLoad</code></internallink>
11261
or, for statically linked agents, the <internallink id="onload">
11262
<code>Agent_OnLoad_&lt;agent-lib-name&gt;
11263
</code></internallink> function.
11264
</constant>
11265
<constant id="JVMTI_PHASE_PRIMORDIAL" num="2">
11266
Primordial phase: between return from <code>Agent_OnLoad</code>
11267
or <code>Agent_OnLoad_&lt;agent-lib-name&gt;</code> and the
11268
<code>VMStart</code> event.
11269
</constant>
11270
<constant id="JVMTI_PHASE_START" num="6">
11271
Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event
11272
is sent and until the <code>VMInit</code> event is sent.
11273
</constant>
11274
<constant id="JVMTI_PHASE_LIVE" num="4">
11275
Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent
11276
and until the <eventlink id="VMDeath"></eventlink> event returns.
11277
</constant>
11278
<constant id="JVMTI_PHASE_DEAD" num="8">
11279
Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after
11280
start-up failure.
11281
</constant>
11282
</constants>
11283
In the case of start-up failure the VM will proceed directly to the dead
11284
phase skipping intermediate phases and neither a <code>VMInit</code> nor
11285
<code>VMDeath</code> event will be sent.
11286
<p/>
11287
Most <jvmti/> functions operate only in the live phase.
11288
The following functions operate in either the <code>OnLoad</code> or live phases:
11289
<functionphaselist phase="onload"/>
11290
The following functions operate in only the <code>OnLoad</code> phase:
11291
<functionphaselist phase="onloadOnly"/>
11292
The following functions operate in the start or live phases:
11293
<functionphaselist phase="start"/>
11294
The following functions operate in any phase:
11295
<functionphaselist phase="any"/>
11296
JNI functions (except the Invocation API) must only be used in the start or live phases.
11297
<p/>
11298
Most <jvmti/> events are sent only in the live phase.
11299
The following events operate in others phases:
11300
<eventphaselist phase="start"/>
11301
<eventphaselist phase="any"/>
11302
</description>
11303
<origin>new</origin>
11304
<capabilities>
11305
</capabilities>
11306
<parameters>
11307
<param id="phase_ptr">
11308
<outptr><enum>jvmtiPhase</enum></outptr>
11309
<description>
11310
On return, points to the phase.
11311
</description>
11312
</param>
11313
</parameters>
11314
<errors>
11315
</errors>
11316
</function>
11317
11318
<function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">
11319
<synopsis>Dispose Environment</synopsis>
11320
<description>
11321
Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>
11322
(see <internallink id="environments"><jvmti/> Environments</internallink>).
11323
Dispose of any resources held by the environment.
11324
<issue>
11325
What resources are reclaimed? What is undone?
11326
Breakpoints,watchpoints removed?
11327
</issue>
11328
Threads suspended by this environment are not resumed by this call,
11329
this must be done explicitly by the agent.
11330
Memory allocated by this environment via calls to <jvmti/> functions
11331
is not released, this can be done explicitly by the agent
11332
by calling <functionlink id="Deallocate"/>.
11333
Raw monitors created by this environment are not destroyed,
11334
this can be done explicitly by the agent
11335
by calling <functionlink id="DestroyRawMonitor"/>.
11336
The state of threads waiting on raw monitors created by this environment
11337
are not affected.
11338
<p/>
11339
Any <functionlink id="SetNativeMethodPrefix">native method
11340
prefixes</functionlink> for this environment will be unset;
11341
the agent must remove any prefixed native methods before
11342
dispose is called.
11343
<p/>
11344
Any <internallink id="capability">capabilities</internallink>
11345
held by this environment are relinquished.
11346
<p/>
11347
Events enabled by this environment will no longer be sent, however
11348
event handlers currently running will continue to run. Caution must
11349
be exercised in the design of event handlers whose environment may
11350
be disposed and thus become invalid during their execution.
11351
<p/>
11352
This environment may not be used after this call.
11353
This call returns to the caller.
11354
</description>
11355
<origin>new</origin>
11356
<capabilities>
11357
</capabilities>
11358
<parameters>
11359
</parameters>
11360
<errors>
11361
</errors>
11362
</function>
11363
11364
<function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">
11365
<synopsis>Set Environment Local Storage</synopsis>
11366
<description>
11367
The VM stores a pointer value associated with each environment.
11368
This pointer value is called <i>environment-local storage</i>.
11369
This value is <code>NULL</code> unless set with this function.
11370
Agents can allocate memory in which they store environment specific
11371
information. By setting environment-local storage it can then be
11372
accessed with
11373
<functionlink id="GetEnvironmentLocalStorage"></functionlink>.
11374
<p/>
11375
Called by the agent to set the value of the <jvmti/>
11376
environment-local storage. <jvmti/> supplies to the agent a pointer-size
11377
environment-local storage that can be used to record per-environment
11378
information.
11379
</description>
11380
<origin>new</origin>
11381
<capabilities>
11382
</capabilities>
11383
<parameters>
11384
<param id="data">
11385
<inbuf>
11386
<void/>
11387
<nullok>value is set to <code>NULL</code></nullok>
11388
</inbuf>
11389
<description>
11390
The value to be entered into the environment-local storage.
11391
</description>
11392
</param>
11393
</parameters>
11394
<errors>
11395
</errors>
11396
</function>
11397
11398
<function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">
11399
<synopsis>Get Environment Local Storage</synopsis>
11400
<description>
11401
Called by the agent to get the value of the <jvmti/> environment-local
11402
storage.
11403
</description>
11404
<origin>new</origin>
11405
<capabilities>
11406
</capabilities>
11407
<parameters>
11408
<param id="data_ptr">
11409
<agentbuf><void/></agentbuf>
11410
<description>
11411
Pointer through which the value of the environment local
11412
storage is returned.
11413
If environment-local storage has not been set with
11414
<functionlink id="SetEnvironmentLocalStorage"></functionlink> returned
11415
pointer is <code>NULL</code>.
11416
</description>
11417
</param>
11418
</parameters>
11419
<errors>
11420
</errors>
11421
</function>
11422
11423
<function id="GetVersionNumber" jkernel="yes" phase="any" num="88">
11424
<synopsis>Get Version Number</synopsis>
11425
<description>
11426
Return the <jvmti/> version via <code>version_ptr</code>.
11427
The return value is the version identifier.
11428
The version identifier includes major, minor and micro
11429
version as well as the interface type.
11430
<constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">
11431
<constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">
11432
Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.
11433
</constant>
11434
<constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">
11435
Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.
11436
</constant>
11437
</constants>
11438
<constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">
11439
<constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">
11440
Mask to extract interface type.
11441
The value of the version returned by this function masked with
11442
<code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always
11443
<code>JVMTI_VERSION_INTERFACE_JVMTI</code>
11444
since this is a <jvmti/> function.
11445
</constant>
11446
<constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">
11447
Mask to extract major version number.
11448
</constant>
11449
<constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">
11450
Mask to extract minor version number.
11451
</constant>
11452
<constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">
11453
Mask to extract micro version number.
11454
</constant>
11455
</constants>
11456
<constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">
11457
<constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">
11458
Shift to extract major version number.
11459
</constant>
11460
<constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">
11461
Shift to extract minor version number.
11462
</constant>
11463
<constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">
11464
Shift to extract micro version number.
11465
</constant>
11466
</constants>
11467
</description>
11468
<origin>jvmdi</origin>
11469
<capabilities>
11470
</capabilities>
11471
<parameters>
11472
<param id="version_ptr">
11473
<outptr><jint/></outptr>
11474
<description>
11475
On return, points to the <jvmti/> version.
11476
</description>
11477
</param>
11478
</parameters>
11479
<errors>
11480
</errors>
11481
</function>
11482
11483
11484
<function id="GetErrorName" phase="any" num="128">
11485
<synopsis>Get Error Name</synopsis>
11486
<description>
11487
Return the symbolic name for an
11488
<internallink id="ErrorSection">error code</internallink>.
11489
<p/>
11490
For example
11491
<code>GetErrorName(env, JVMTI_ERROR_NONE, &amp;err_name)</code>
11492
would return in <code>err_name</code> the string
11493
<code>"JVMTI_ERROR_NONE"</code>.
11494
</description>
11495
<origin>new</origin>
11496
<capabilities>
11497
</capabilities>
11498
<parameters>
11499
<param id="error">
11500
<enum>jvmtiError</enum>
11501
<description>
11502
The error code.
11503
</description>
11504
</param>
11505
<param id="name_ptr">
11506
<allocbuf><char/></allocbuf>
11507
<description>
11508
On return, points to the error name.
11509
The name is encoded as a
11510
<internallink id="mUTF">modified UTF-8</internallink> string,
11511
but is restricted to the ASCII subset.
11512
</description>
11513
</param>
11514
</parameters>
11515
<errors>
11516
</errors>
11517
</function>
11518
11519
<function id="SetVerboseFlag" phase="any" num="150">
11520
<synopsis>Set Verbose Flag</synopsis>
11521
<description>
11522
<constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">
11523
<constant id="JVMTI_VERBOSE_OTHER" num="0">
11524
Verbose output other than the below.
11525
</constant>
11526
<constant id="JVMTI_VERBOSE_GC" num="1">
11527
Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.
11528
</constant>
11529
<constant id="JVMTI_VERBOSE_CLASS" num="2">
11530
Verbose class loading output, like that specified with <code>-verbose:class</code>.
11531
</constant>
11532
<constant id="JVMTI_VERBOSE_JNI" num="4">
11533
Verbose JNI output, like that specified with <code>-verbose:jni</code>.
11534
</constant>
11535
</constants>
11536
Control verbose output.
11537
This is the output which typically is sent to <code>stderr</code>.
11538
</description>
11539
<origin>new</origin>
11540
<capabilities>
11541
</capabilities>
11542
<parameters>
11543
<param id="flag">
11544
<enum>jvmtiVerboseFlag</enum>
11545
<description>
11546
Which verbose flag to set.
11547
</description>
11548
</param>
11549
<param id="value">
11550
<jboolean/>
11551
<description>
11552
New value of the flag.
11553
</description>
11554
</param>
11555
</parameters>
11556
<errors>
11557
</errors>
11558
</function>
11559
11560
11561
<function id="GetJLocationFormat" phase="any" num="129">
11562
<synopsis>Get JLocation Format</synopsis>
11563
<description>
11564
Although the greatest functionality is achieved with location information
11565
referencing the virtual machine bytecode index, the definition of
11566
<code>jlocation</code> has intentionally been left unconstrained to allow VM
11567
implementations that do not have this information.
11568
<p/>
11569
This function describes the representation of <code>jlocation</code> used in this VM.
11570
If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,
11571
<code>jlocation</code>s can
11572
be used as in indices into the array returned by
11573
<functionlink id="GetBytecodes"></functionlink>.
11574
<constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">
11575
<constant id="JVMTI_JLOCATION_JVMBCI" num="1">
11576
<code>jlocation</code> values represent virtual machine
11577
bytecode indices--that is, offsets into the
11578
virtual machine code for a method.
11579
</constant>
11580
<constant id="JVMTI_JLOCATION_MACHINEPC" num="2">
11581
<code>jlocation</code> values represent native machine
11582
program counter values.
11583
</constant>
11584
<constant id="JVMTI_JLOCATION_OTHER" num="0">
11585
<code>jlocation</code> values have some other representation.
11586
</constant>
11587
</constants>
11588
</description>
11589
<origin>new</origin>
11590
<capabilities>
11591
</capabilities>
11592
<parameters>
11593
<param id="format_ptr">
11594
<outptr><enum>jvmtiJlocationFormat</enum></outptr>
11595
<description>
11596
On return, points to the format identifier for <code>jlocation</code> values.
11597
</description>
11598
</param>
11599
</parameters>
11600
<errors>
11601
</errors>
11602
</function>
11603
11604
</category>
11605
11606
<category id="heap_monitoring" label="Heap Monitoring">
11607
<function id="SetHeapSamplingInterval" phase="onload" num="156" since="11">
11608
<synopsis>Set Heap Sampling Interval</synopsis>
11609
<description>
11610
Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated.
11611
Each thread keeps a counter of bytes allocated. The event will only be generated
11612
when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink>
11613
since the last sample.
11614
<p/>
11615
Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be
11616
generated by each allocation supported by the system once the new interval is taken into account.
11617
<p/>
11618
Note that updating the new sampling interval might take various number of allocations
11619
to provoke internal data structure updates. Therefore it is important to
11620
consider the sampling interval as an average. This includes the interval 0, where events
11621
might not be generated straight away for each allocation.
11622
</description>
11623
<origin>new</origin>
11624
<capabilities>
11625
<required id="can_generate_sampled_object_alloc_events"></required>
11626
</capabilities>
11627
<parameters>
11628
<param id="sampling_interval">
11629
<jint/>
11630
<description>
11631
The sampling interval in bytes. The sampler uses a statistical approach to
11632
generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of
11633
memory allocated by a given thread.
11634
<p/>
11635
Once the new sampling interval is taken into account, 0 as a sampling interval will generate
11636
a sample for every allocation.
11637
<p/>
11638
Note: The overhead of this feature is directly correlated with the sampling interval.
11639
A high sampling interval, such as 1024 bytes, will incur a high overhead.
11640
A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only
11641
be used with an understanding that it may impact performance.
11642
</description>
11643
</param>
11644
</parameters>
11645
<errors>
11646
<error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11647
<paramlink id="sampling_interval"></paramlink> is less than zero.
11648
</error>
11649
</errors>
11650
</function>
11651
</category>
11652
11653
</functionsection>
11654
11655
<errorsection label="Error Reference">
11656
<intro>
11657
Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.
11658
<p/>
11659
It is the responsibility of the agent to call <jvmti/> functions with
11660
valid parameters and in the proper context (calling thread is attached,
11661
phase is correct, etc.).
11662
Detecting some error conditions may be difficult, inefficient, or
11663
impossible for an implementation.
11664
The errors listed in
11665
<internallink id="reqerrors">Function Specific Required Errors</internallink>
11666
must be detected by the implementation.
11667
All other errors represent the recommended response to the error
11668
condition.
11669
</intro>
11670
11671
<errorcategory id="universal-error" label="Universal Errors">
11672
<intro>
11673
The following errors may be returned by any function
11674
</intro>
11675
11676
<errorid id="JVMTI_ERROR_NONE" num="0">
11677
No error has occurred. This is the error code that is returned
11678
on successful completion of the function.
11679
</errorid>
11680
<errorid id="JVMTI_ERROR_NULL_POINTER" num="100">
11681
Pointer is unexpectedly <code>NULL</code>.
11682
</errorid>
11683
<errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">
11684
The function attempted to allocate memory and no more memory was
11685
available for allocation.
11686
</errorid>
11687
<errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">
11688
The desired functionality has not been enabled in this virtual machine.
11689
</errorid>
11690
<errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">
11691
The thread being used to call this function is not attached
11692
to the virtual machine. Calls must be made from attached threads.
11693
See <code>AttachCurrentThread</code> in the JNI invocation API.
11694
</errorid>
11695
<errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">
11696
The <jvmti/> environment provided is no longer connected or is
11697
not an environment.
11698
</errorid>
11699
<errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">
11700
The desired functionality is not available in the current
11701
<functionlink id="GetPhase">phase</functionlink>.
11702
Always returned if the virtual machine has completed running.
11703
</errorid>
11704
<errorid id="JVMTI_ERROR_INTERNAL" num="113">
11705
An unexpected internal error has occurred.
11706
</errorid>
11707
</errorcategory>
11708
11709
<errorcategory id="reqerrors" label="Function Specific Required Errors">
11710
<intro>
11711
The following errors are returned by some <jvmti/> functions and must
11712
be returned by the implementation when the condition occurs.
11713
</intro>
11714
11715
<errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">
11716
Invalid priority.
11717
</errorid>
11718
<errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">
11719
Thread was not suspended.
11720
</errorid>
11721
<errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">
11722
Thread already suspended.
11723
</errorid>
11724
<errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">
11725
This operation requires the thread to be alive--that is,
11726
it must be started and not yet have died.
11727
</errorid>
11728
<errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">
11729
The class has been loaded but not yet prepared.
11730
</errorid>
11731
<errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">
11732
There are no Java programming language or JNI stack frames at the specified depth.
11733
</errorid>
11734
<errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">
11735
Information about the frame is not available (e.g. for native frames).
11736
</errorid>
11737
<errorid id="JVMTI_ERROR_DUPLICATE" num="40">
11738
Item already set.
11739
</errorid>
11740
<errorid id="JVMTI_ERROR_NOT_FOUND" num="41">
11741
Desired element (e.g. field or breakpoint) not found
11742
</errorid>
11743
<errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">
11744
This thread doesn't own the raw monitor.
11745
</errorid>
11746
<errorid id="JVMTI_ERROR_INTERRUPT" num="52">
11747
The call has been interrupted before completion.
11748
</errorid>
11749
<errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">
11750
The class cannot be modified.
11751
</errorid>
11752
<errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">
11753
The module cannot be modified.
11754
</errorid>
11755
<errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">
11756
The functionality is not available in this virtual machine.
11757
</errorid>
11758
<errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">
11759
The requested information is not available.
11760
</errorid>
11761
<errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">
11762
The specified event type ID is not recognized.
11763
</errorid>
11764
<errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">
11765
The requested information is not available for native method.
11766
</errorid>
11767
<errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">
11768
The class loader does not support this operation.
11769
</errorid>
11770
</errorcategory>
11771
11772
<errorcategory id="function-specific-errors" label="Function Specific Agent Errors">
11773
<intro>
11774
The following errors are returned by some <jvmti/> functions.
11775
They are returned in the event of invalid parameters passed by the
11776
agent or usage in an invalid context.
11777
An implementation is not required to detect these errors.
11778
</intro>
11779
11780
<errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">
11781
The passed thread is not a valid thread.
11782
</errorid>
11783
<errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">
11784
Invalid field.
11785
</errorid>
11786
<errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">
11787
Invalid module.
11788
</errorid>
11789
<errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">
11790
Invalid method.
11791
</errorid>
11792
<errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">
11793
Invalid location.
11794
</errorid>
11795
<errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">
11796
Invalid object.
11797
</errorid>
11798
<errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">
11799
Invalid class.
11800
</errorid>
11801
<errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">
11802
The variable is not an appropriate type for the function used.
11803
</errorid>
11804
<errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">
11805
Invalid slot.
11806
</errorid>
11807
<errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">
11808
The capability being used is false in this environment.
11809
</errorid>
11810
<errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">
11811
Thread group invalid.
11812
</errorid>
11813
<errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">
11814
Invalid raw monitor.
11815
</errorid>
11816
<errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">
11817
Illegal argument.
11818
</errorid>
11819
<errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">
11820
The state of the thread has been modified, and is now inconsistent.
11821
</errorid>
11822
<errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">
11823
A new class file has a version number not supported by this VM.
11824
</errorid>
11825
<errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">
11826
A new class file is malformed (the VM would return a <code>ClassFormatError</code>).
11827
</errorid>
11828
<errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">
11829
The new class file definitions would lead to a circular
11830
definition (the VM would return a <code>ClassCircularityError</code>).
11831
</errorid>
11832
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">
11833
A new class file would require adding a method.
11834
</errorid>
11835
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">
11836
A new class version changes a field.
11837
</errorid>
11838
<errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">
11839
The class bytes fail verification.
11840
</errorid>
11841
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">
11842
A direct superclass is different for the new class
11843
version, or the set of directly implemented
11844
interfaces is different.
11845
</errorid>
11846
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">
11847
A new class version does not declare a method
11848
declared in the old class version.
11849
</errorid>
11850
<errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">
11851
The class name defined in the new class file is
11852
different from the name in the old class object.
11853
</errorid>
11854
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">
11855
A new class version has different modifiers.
11856
</errorid>
11857
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">
11858
A method in the new class version has different modifiers
11859
than its counterpart in the old class version.
11860
</errorid>
11861
<errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72">
11862
A new class version has unsupported differences in class attributes.
11863
</errorid>
11864
</errorcategory>
11865
</errorsection>
11866
11867
<eventsection label="Events">
11868
<intro label="Handling Events" id="eventIntro">
11869
Agents can be informed of many events that occur in application
11870
programs.
11871
<p/>
11872
To handle events, designate a set of callback functions with
11873
<functionlink id="SetEventCallbacks"></functionlink>.
11874
For each event the corresponding callback function will be
11875
called.
11876
Arguments to the callback function provide additional
11877
information about the event.
11878
<p/>
11879
The callback function is usually called from within an application
11880
thread. The <jvmti/> implementation does not
11881
queue events in any way. This means
11882
that event callback functions must be written
11883
carefully. Here are some general guidelines. See
11884
the individual event descriptions for further
11885
suggestions.
11886
<p/>
11887
<ul>
11888
<li>Any exception thrown during the execution of an event callback can
11889
overwrite any current pending exception in the current application thread.
11890
Care must be taken to preserve a pending exception
11891
when an event callback makes a JNI call that might generate an exception.
11892
</li>
11893
<li>Event callback functions must be re-entrant. The <jvmti/> implementation does
11894
not queue events. If an agent needs to process events one at a time, it
11895
can use a raw monitor inside the
11896
event callback functions to serialize event processing.
11897
</li>
11898
<li>Event callback functions that execute JNI's FindClass function to load
11899
classes need to note that FindClass locates the class loader associated
11900
with the current native method. For the purposes of class loading, an
11901
event callback that includes a JNI environment as a parameter to the
11902
callback will treated as if it is a native call, where the native method
11903
is in the class of the event thread's current frame.
11904
</li>
11905
</ul>
11906
<p/>
11907
Some <jvmti/> events identify objects with JNI references.
11908
All references
11909
in <jvmti/> events are JNI local references and will become invalid
11910
after the event callback returns.
11911
Unless stated otherwise, memory referenced by pointers sent in event
11912
callbacks may not be referenced after the event callback returns.
11913
<p/>
11914
Except where stated otherwise, events are delivered on the thread
11915
that caused the event.
11916
Events are sent at the time they occur.
11917
The specification for each event includes the set of
11918
<functionlink id="GetPhase">phases</functionlink> in which it can be sent;
11919
if an event triggering activity occurs during another phase, no event
11920
is sent.
11921
<p/>
11922
A thread that generates an event does not change its execution status
11923
(for example, the event does not cause the thread to be suspended).
11924
If an agent wishes the event to result in suspension, then the agent
11925
is responsible for explicitly suspending the thread with
11926
<functionlink id="SuspendThread"></functionlink>.
11927
<p/>
11928
If an event is enabled in multiple environments, the event will be sent
11929
to each agent in the order that the environments were created.
11930
</intro>
11931
11932
<intro label="Enabling Events" id="enablingevents">
11933
All events are initially disabled. In order to receive any
11934
event:
11935
<ul>
11936
<li>
11937
If the event requires a capability, that capability must
11938
be added with
11939
<functionlink id="AddCapabilities"></functionlink>.
11940
</li>
11941
<li>
11942
A callback for the event must be set with
11943
<functionlink id="SetEventCallbacks"></functionlink>.
11944
</li>
11945
<li>
11946
The event must be enabled with
11947
<functionlink id="SetEventNotificationMode"></functionlink>.
11948
</li>
11949
</ul>
11950
</intro>
11951
11952
<intro label="Multiple Co-located Events" id="eventorder">
11953
In many situations it is possible for multiple events to occur
11954
at the same location in one thread. When this happens, all the events
11955
are reported through the event callbacks in the order specified in this section.
11956
<p/>
11957
If the current location is at the entry point of a method, the
11958
<eventlink id="MethodEntry"></eventlink> event is reported before
11959
any other event at the current location in the same thread.
11960
<p/>
11961
If an exception catch has been detected at the current location,
11962
either because it is the beginning of a catch clause or a native method
11963
that cleared a pending exception has returned, the
11964
<code>exceptionCatch</code> event is reported before
11965
any other event at the current location in the same thread.
11966
<p/>
11967
If a <code>singleStep</code> event or
11968
<code>breakpoint</code> event is triggered at the
11969
current location, the event is defined to occur
11970
immediately before the code at the current location is executed.
11971
These events are reported before any events which are triggered
11972
by the execution of code at the current location in the same
11973
thread (specifically:
11974
<code>exception</code>,
11975
<code>fieldAccess</code>, and
11976
<code>fieldModification</code>).
11977
If both a step and breakpoint event are triggered for the same thread and
11978
location, the step event is reported before the breakpoint event.
11979
<p/>
11980
If the current location is the exit point of a method (that is, the last
11981
location before returning to the caller), the
11982
<eventlink id="MethodExit"></eventlink> event and
11983
the <eventlink id="FramePop"></eventlink> event (if requested)
11984
are reported after all other events at the current location in the same
11985
thread. There is no specified ordering of these two events
11986
with respect to each other.
11987
<p/>
11988
Co-located events can be triggered during the processing of some other
11989
event by the agent at the same location in the same thread.
11990
If such an event, of type <i>y</i>, is triggered during the processing of
11991
an event of type <i>x</i>, and if <i>x</i>
11992
precedes <i>y</i> in the ordering specified above, the co-located event
11993
<i>y</i> is reported for the current thread and location. If <i>x</i> does not precede
11994
<i>y</i>, <i>y</i> is not reported for the current thread and location.
11995
For example, if a breakpoint is set at the current location
11996
during the processing of <eventlink id="SingleStep"></eventlink>,
11997
that breakpoint will be reported before the thread moves off the current
11998
location.
11999
<p/>The following events are never considered to be co-located with
12000
other events.
12001
<ul>
12002
<li><eventlink id="VMStart"></eventlink></li>
12003
<li><eventlink id="VMInit"></eventlink></li>
12004
<li><eventlink id="VMDeath"></eventlink></li>
12005
<li><eventlink id="ThreadStart"></eventlink></li>
12006
<li><eventlink id="ThreadEnd"></eventlink></li>
12007
<li><eventlink id="ClassLoad"></eventlink></li>
12008
<li><eventlink id="ClassPrepare"></eventlink></li>
12009
</ul>
12010
</intro>
12011
12012
<intro label="Event Callbacks" id="jvmtiEventCallbacks">
12013
The event callback structure below is used to specify the handler function
12014
for events. It is set with the
12015
<functionlink id="SetEventCallbacks"></functionlink> function.
12016
</intro>
12017
12018
<event label="Single Step"
12019
id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">
12020
<description>
12021
Single step events allow the agent to trace thread execution
12022
at the finest granularity allowed by the VM. A single step event is
12023
generated whenever a thread reaches a new location.
12024
Typically, single step events represent the completion of one VM
12025
instruction as defined in <vmspec/>. However, some implementations
12026
may define locations differently. In any case the
12027
<code>method</code> and <code>location</code>
12028
parameters uniquely identify the current location and allow
12029
the mapping to source file and line number when that information is
12030
available.
12031
<p/>
12032
No single step events are generated from within native methods.
12033
</description>
12034
<origin>jvmdi</origin>
12035
<capabilities>
12036
<required id="can_generate_single_step_events"></required>
12037
</capabilities>
12038
<parameters>
12039
<param id="jni_env">
12040
<outptr>
12041
<struct>JNIEnv</struct>
12042
</outptr>
12043
<description>
12044
The JNI environment of the event (current) thread
12045
</description>
12046
</param>
12047
<param id="thread">
12048
<jthread/>
12049
<description>
12050
Thread about to execution a new instruction
12051
</description>
12052
</param>
12053
<param id="klass">
12054
<jclass method="method"/>
12055
<description>
12056
Class of the method about to execute a new instruction
12057
</description>
12058
</param>
12059
<param id="method">
12060
<jmethodID class="klass"/>
12061
<description>
12062
Method about to execute a new instruction
12063
</description>
12064
</param>
12065
<param id="location">
12066
<jlocation/>
12067
<description>
12068
Location of the new instruction
12069
</description>
12070
</param>
12071
</parameters>
12072
</event>
12073
12074
<event label="Breakpoint"
12075
id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">
12076
<description>
12077
Breakpoint events are generated whenever a thread reaches a location
12078
designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.
12079
The <code>method</code> and <code>location</code>
12080
parameters uniquely identify the current location and allow
12081
the mapping to source file and line number when that information is
12082
available.
12083
</description>
12084
<origin>jvmdi</origin>
12085
<capabilities>
12086
<required id="can_generate_breakpoint_events"></required>
12087
</capabilities>
12088
<parameters>
12089
<param id="jni_env">
12090
<outptr>
12091
<struct>JNIEnv</struct>
12092
</outptr>
12093
<description>
12094
The JNI environment of the event (current) thread.
12095
</description>
12096
</param>
12097
<param id="thread">
12098
<jthread/>
12099
<description>
12100
Thread that hit the breakpoint
12101
</description>
12102
</param>
12103
<param id="klass">
12104
<jclass method="method"/>
12105
<description>
12106
Class of the method that hit the breakpoint
12107
</description>
12108
</param>
12109
<param id="method">
12110
<jmethodID class="klass"/>
12111
<description>
12112
Method that hit the breakpoint
12113
</description>
12114
</param>
12115
<param id="location">
12116
<jlocation/>
12117
<description>
12118
location of the breakpoint
12119
</description>
12120
</param>
12121
</parameters>
12122
</event>
12123
12124
<event label="Field Access"
12125
id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">
12126
<description>
12127
Field access events are generated whenever a thread accesses
12128
a field that was designated as a watchpoint
12129
with <functionlink id="SetFieldAccessWatch"></functionlink>.
12130
The <code>method</code> and <code>location</code>
12131
parameters uniquely identify the current location and allow
12132
the mapping to source file and line number when that information is
12133
available.
12134
</description>
12135
<origin>jvmdi</origin>
12136
<capabilities>
12137
<required id="can_generate_field_access_events"></required>
12138
</capabilities>
12139
<parameters>
12140
<param id="jni_env">
12141
<outptr>
12142
<struct>JNIEnv</struct>
12143
</outptr>
12144
<description>
12145
The JNI environment of the event (current) thread
12146
</description>
12147
</param>
12148
<param id="thread">
12149
<jthread/>
12150
<description>
12151
Thread accessing the field
12152
</description>
12153
</param>
12154
<param id="klass">
12155
<jclass method="method"/>
12156
<description>
12157
Class of the method where the access is occurring
12158
</description>
12159
</param>
12160
<param id="method">
12161
<jmethodID class="klass"/>
12162
<description>
12163
Method where the access is occurring
12164
</description>
12165
</param>
12166
<param id="location">
12167
<jlocation/>
12168
<description>
12169
Location where the access is occurring
12170
</description>
12171
</param>
12172
<param id="field_klass">
12173
<jclass field="field"/>
12174
<description>
12175
Class of the field being accessed
12176
</description>
12177
</param>
12178
<param id="object">
12179
<jobject/>
12180
<description>
12181
Object with the field being accessed if the field is an
12182
instance field; <code>NULL</code> otherwise
12183
</description>
12184
</param>
12185
<param id="field">
12186
<jfieldID class="field_klass"/>
12187
<description>
12188
Field being accessed
12189
</description>
12190
</param>
12191
</parameters>
12192
</event>
12193
12194
<event label="Field Modification"
12195
id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">
12196
<description>
12197
Field modification events are generated whenever a thread modifies
12198
a field that was designated as a watchpoint
12199
with <functionlink id="SetFieldModificationWatch"></functionlink>.
12200
The <code>method</code> and <code>location</code>
12201
parameters uniquely identify the current location and allow
12202
the mapping to source file and line number when that information is
12203
available.
12204
</description>
12205
<origin>jvmdi</origin>
12206
<capabilities>
12207
<required id="can_generate_field_modification_events"></required>
12208
</capabilities>
12209
<parameters>
12210
<param id="jni_env">
12211
<outptr>
12212
<struct>JNIEnv</struct>
12213
</outptr>
12214
<description>
12215
The JNI environment of the event (current) thread
12216
</description>
12217
</param>
12218
<param id="thread">
12219
<jthread/>
12220
<description>
12221
Thread modifying the field
12222
</description>
12223
</param>
12224
<param id="klass">
12225
<jclass method="method"/>
12226
<description>
12227
Class of the method where the modification is occurring
12228
</description>
12229
</param>
12230
<param id="method">
12231
<jmethodID class="klass"/>
12232
<description>
12233
Method where the modification is occurring
12234
</description>
12235
</param>
12236
<param id="location">
12237
<jlocation/>
12238
<description>
12239
Location where the modification is occurring
12240
</description>
12241
</param>
12242
<param id="field_klass">
12243
<jclass field="field"/>
12244
<description>
12245
Class of the field being modified
12246
</description>
12247
</param>
12248
<param id="object">
12249
<jobject/>
12250
<description>
12251
Object with the field being modified if the field is an
12252
instance field; <code>NULL</code> otherwise
12253
</description>
12254
</param>
12255
<param id="field">
12256
<jfieldID class="field_klass"/>
12257
<description>
12258
Field being modified
12259
</description>
12260
</param>
12261
<param id="signature_type">
12262
<char/>
12263
<description>
12264
Signature type of the new value
12265
</description>
12266
</param>
12267
<param id="new_value">
12268
<jvalue/>
12269
<description>
12270
The new value
12271
</description>
12272
</param>
12273
</parameters>
12274
</event>
12275
12276
<event label="Frame Pop"
12277
id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">
12278
<description>
12279
Frame pop events are generated upon exit from a single method
12280
in a single frame as specified
12281
in a call to <functionlink id="NotifyFramePop"></functionlink>.
12282
This is true whether termination is caused by
12283
executing its return instruction
12284
or by throwing an exception to its caller
12285
(see <paramlink id="was_popped_by_exception"></paramlink>).
12286
However, frame pops caused by the <functionlink id="PopFrame"/>
12287
function are not reported.
12288
<p/>
12289
The location reported by <functionlink id="GetFrameLocation"></functionlink>
12290
for the depth 0 identifies the executable location in the returning method,
12291
immediately prior to the return.
12292
</description>
12293
<origin>jvmdi</origin>
12294
<capabilities>
12295
<required id="can_generate_frame_pop_events"></required>
12296
</capabilities>
12297
<parameters>
12298
<param id="jni_env">
12299
<outptr>
12300
<struct>JNIEnv</struct>
12301
</outptr>
12302
<description>
12303
The JNI environment of the event (current) thread
12304
</description>
12305
</param>
12306
<param id="thread">
12307
<jthread/>
12308
<description>
12309
Thread that is popping the frame
12310
</description>
12311
</param>
12312
<param id="klass">
12313
<jclass method="method"/>
12314
<description>
12315
Class of the method being popped
12316
</description>
12317
</param>
12318
<param id="method">
12319
<jmethodID class="klass"/>
12320
<description>
12321
Method being popped
12322
</description>
12323
</param>
12324
<param id="was_popped_by_exception">
12325
<jboolean/>
12326
<description>
12327
True if frame was popped by a thrown exception.
12328
False if method exited through its return instruction.
12329
</description>
12330
</param>
12331
</parameters>
12332
</event>
12333
12334
<event label="Method Entry"
12335
id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">
12336
<description>
12337
Method entry events are generated upon entry of Java
12338
programming language methods (including native methods).
12339
<p/>
12340
The location reported by <functionlink id="GetFrameLocation"></functionlink>
12341
for the depth 0 identifies the initial executable location in the method.
12342
<p/>
12343
Enabling method
12344
entry or exit events will significantly degrade performance on many platforms and is thus
12345
not advised for performance critical usage (such as profiling).
12346
<internallink id="bci">Bytecode instrumentation</internallink> should be
12347
used in these cases.
12348
</description>
12349
<origin>jvmdi</origin>
12350
<capabilities>
12351
<required id="can_generate_method_entry_events"></required>
12352
</capabilities>
12353
<parameters>
12354
<param id="jni_env">
12355
<outptr>
12356
<struct>JNIEnv</struct>
12357
</outptr>
12358
<description>
12359
The JNI environment of the event (current) thread
12360
</description>
12361
</param>
12362
<param id="thread">
12363
<jthread/>
12364
<description>
12365
Thread entering the method
12366
</description>
12367
</param>
12368
<param id="klass">
12369
<jclass method="method"/>
12370
<description>
12371
Class of the method being entered
12372
</description>
12373
</param>
12374
<param id="method">
12375
<jmethodID class="klass"/>
12376
<description>
12377
Method being entered
12378
</description>
12379
</param>
12380
</parameters>
12381
</event>
12382
12383
<event label="Method Exit"
12384
id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">
12385
<description>
12386
Method exit events are generated upon exit from Java
12387
programming language methods (including native methods).
12388
This is true whether termination is caused by
12389
executing its return instruction
12390
or by throwing an exception to its caller
12391
(see <paramlink id="was_popped_by_exception"></paramlink>).
12392
<p/>
12393
The location reported by <functionlink id="GetFrameLocation"></functionlink>
12394
for the depth 0 identifies the executable location in the returning method
12395
immediately prior to the return.
12396
<p/>
12397
Enabling method
12398
entry or exit events will significantly degrade performance on many platforms and is thus
12399
not advised for performance critical usage (such as profiling).
12400
<internallink id="bci">Bytecode instrumentation</internallink> should be
12401
used in these cases.
12402
</description>
12403
<origin>jvmdi</origin>
12404
<capabilities>
12405
<required id="can_generate_method_exit_events"></required>
12406
</capabilities>
12407
<parameters>
12408
<param id="jni_env">
12409
<outptr>
12410
<struct>JNIEnv</struct>
12411
</outptr>
12412
<description>
12413
The JNI environment of the event (current) thread
12414
</description>
12415
</param>
12416
<param id="thread">
12417
<jthread/>
12418
<description>
12419
Thread exiting the method
12420
</description>
12421
</param>
12422
<param id="klass">
12423
<jclass method="method"/>
12424
<description>
12425
Class of the method being exited
12426
</description>
12427
</param>
12428
<param id="method">
12429
<jmethodID class="klass"/>
12430
<description>
12431
Method being exited
12432
</description>
12433
</param>
12434
<param id="was_popped_by_exception">
12435
<jboolean/>
12436
<description>
12437
True if frame was popped by a thrown exception.
12438
False if method exited through its return instruction.
12439
</description>
12440
</param>
12441
<param id="return_value">
12442
<jvalue/>
12443
<description>
12444
The return value of the method being exited.
12445
Undefined and should not be used if
12446
<paramlink id="was_popped_by_exception"></paramlink>
12447
is true.
12448
</description>
12449
</param>
12450
</parameters>
12451
</event>
12452
12453
<event label="Native Method Bind" phase="any"
12454
id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">
12455
<description>
12456
A Native Method Bind event is sent when a VM binds a
12457
Java programming language native method
12458
to the address of a function that implements the native method.
12459
This will occur when the native method is called for the first time
12460
and also occurs when the JNI function <code>RegisterNatives</code> is called.
12461
This event allows the bind to be redirected to an agent-specified
12462
proxy function.
12463
This event is not sent when the native method is unbound.
12464
Typically, this proxy function will need to be specific to a
12465
particular method or, to handle the general case, automatically
12466
generated assembly code, since after instrumentation code is
12467
executed the function at the original binding
12468
address will usually be invoked.
12469
The original binding can be restored or the redirection changed
12470
by use of the JNI function <code>RegisterNatives</code>.
12471
Some events may be sent during the primordial phase, JNI and
12472
most of <jvmti/> cannot be used at this time but the method and
12473
address can be saved for use later.
12474
</description>
12475
<origin>new</origin>
12476
<capabilities>
12477
<required id="can_generate_native_method_bind_events"></required>
12478
</capabilities>
12479
<parameters>
12480
<param id="jni_env">
12481
<outptr>
12482
<struct>JNIEnv</struct>
12483
</outptr>
12484
<description>
12485
The JNI environment of the event (current) thread
12486
Will be <code>NULL</code> if sent during the primordial
12487
<functionlink id="GetPhase">phase</functionlink>.
12488
</description>
12489
</param>
12490
<param id="thread">
12491
<jthread/>
12492
<description>
12493
Thread requesting the bind
12494
</description>
12495
</param>
12496
<param id="klass">
12497
<jclass method="method"/>
12498
<description>
12499
Class of the method being bound
12500
</description>
12501
</param>
12502
<param id="method">
12503
<jmethodID class="klass"/>
12504
<description>
12505
Native method being bound
12506
</description>
12507
</param>
12508
<param id="address">
12509
<outptr><void/></outptr>
12510
<description>
12511
The address the VM is about to bind to--that is, the
12512
address of the implementation of the native method
12513
</description>
12514
</param>
12515
<param id="new_address_ptr">
12516
<agentbuf><void/></agentbuf>
12517
<description>
12518
if the referenced address is changed (that is, if
12519
<code>*new_address_ptr</code> is set), the binding
12520
will instead be made to the supplied address.
12521
</description>
12522
</param>
12523
</parameters>
12524
</event>
12525
12526
<event label="Exception"
12527
id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">
12528
<description>
12529
Exception events are generated whenever an exception is first detected
12530
in a Java programming language method.
12531
Where "exception" means any <code>java.lang.Throwable</code>.
12532
The exception may have been thrown by a Java programming language or native
12533
method, but in the case of native methods, the event is not generated
12534
until the exception is first seen by a Java programming language method. If an exception is
12535
set and cleared in a native method (and thus is never visible to Java programming language code),
12536
no exception event is generated.
12537
<p/>
12538
The <code>method</code> and <code>location</code>
12539
parameters uniquely identify the current location
12540
(where the exception was detected) and allow
12541
the mapping to source file and line number when that information is
12542
available. The <code>exception</code> field identifies the thrown
12543
exception object. The <code>catch_method</code>
12544
and <code>catch_location</code> identify the location of the catch clause,
12545
if any, that handles the thrown exception. If there is no such catch clause,
12546
each field is set to 0. There is no guarantee that the thread will ever
12547
reach this catch clause. If there are native methods on the call stack
12548
between the throw location and the catch clause, the exception may
12549
be reset by one of those native methods.
12550
Similarly, exceptions that are reported as uncaught (<code>catch_klass</code>
12551
et al. set to 0) may in fact be caught by native code.
12552
Agents can check for these occurrences by monitoring
12553
<eventlink id="ExceptionCatch"></eventlink> events.
12554
Note that finally clauses are implemented as catch and re-throw. Therefore they
12555
will be reported in the catch location.
12556
</description>
12557
<origin>jvmdi</origin>
12558
<capabilities>
12559
<required id="can_generate_exception_events"></required>
12560
</capabilities>
12561
<parameters>
12562
<param id="jni_env">
12563
<outptr>
12564
<struct>JNIEnv</struct>
12565
</outptr>
12566
<description>
12567
The JNI environment of the event (current) thread
12568
</description>
12569
</param>
12570
<param id="thread">
12571
<jthread/>
12572
<description>
12573
Thread generating the exception
12574
</description>
12575
</param>
12576
<param id="klass">
12577
<jclass method="method"/>
12578
<description>
12579
Class generating the exception
12580
</description>
12581
</param>
12582
<param id="method">
12583
<jmethodID class="klass"/>
12584
<description>
12585
Method generating the exception
12586
</description>
12587
</param>
12588
<param id="location">
12589
<jlocation/>
12590
<description>
12591
Location where exception occurred
12592
</description>
12593
</param>
12594
<param id="exception">
12595
<jobject/>
12596
<description>
12597
The exception being thrown
12598
</description>
12599
</param>
12600
<param id="catch_klass">
12601
<jclass method="catch_method"/>
12602
<description>
12603
Class that will catch the exception, or <code>NULL</code> if no known catch
12604
</description>
12605
</param>
12606
<param id="catch_method">
12607
<jmethodID class="catch_klass"/>
12608
<description>
12609
Method that will catch the exception, or <code>NULL</code> if no known catch
12610
</description>
12611
</param>
12612
<param id="catch_location">
12613
<jlocation/>
12614
<description>
12615
location which will catch the exception or zero if no known catch
12616
</description>
12617
</param>
12618
</parameters>
12619
</event>
12620
12621
<event label="Exception Catch"
12622
id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">
12623
<description>
12624
Exception catch events are generated whenever a thrown exception is caught.
12625
Where "exception" means any <code>java.lang.Throwable</code>.
12626
If the exception is caught in a Java programming language method, the event is generated
12627
when the catch clause is reached. If the exception is caught in a native
12628
method, the event is generated as soon as control is returned to a Java programming language
12629
method. Exception catch events are generated for any exception for which
12630
a throw was detected in a Java programming language method.
12631
Note that finally clauses are implemented as catch and re-throw. Therefore they
12632
will generate exception catch events.
12633
<p/>
12634
The <code>method</code> and <code>location</code>
12635
parameters uniquely identify the current location
12636
and allow the mapping to source file and line number when that information is
12637
available. For exceptions caught in a Java programming language method, the
12638
<code>exception</code> object identifies the exception object. Exceptions
12639
caught in native methods are not necessarily available by the time the
12640
exception catch is reported, so the <code>exception</code> field is set
12641
to <code>NULL</code>.
12642
</description>
12643
<origin>jvmdi</origin>
12644
<capabilities>
12645
<required id="can_generate_exception_events"></required>
12646
</capabilities>
12647
<parameters>
12648
<param id="jni_env">
12649
<outptr>
12650
<struct>JNIEnv</struct>
12651
</outptr>
12652
<description>
12653
The JNI environment of the event (current) thread
12654
</description>
12655
</param>
12656
<param id="thread">
12657
<jthread/>
12658
<description>
12659
Thread catching the exception
12660
</description>
12661
</param>
12662
<param id="klass">
12663
<jclass method="method"/>
12664
<description>
12665
Class catching the exception
12666
</description>
12667
</param>
12668
<param id="method">
12669
<jmethodID class="klass"/>
12670
<description>
12671
Method catching the exception
12672
</description>
12673
</param>
12674
<param id="location">
12675
<jlocation/>
12676
<description>
12677
Location where exception is being caught
12678
</description>
12679
</param>
12680
<param id="exception">
12681
<jobject/>
12682
<description>
12683
Exception being caught
12684
</description>
12685
</param>
12686
</parameters>
12687
</event>
12688
12689
<event label="Thread Start"
12690
id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">
12691
<description>
12692
Thread start events are generated by a new thread before its initial
12693
method executes.
12694
<p/>
12695
A thread may be listed in the array returned by
12696
<functionlink id="GetAllThreads"></functionlink>
12697
before its thread start event is generated.
12698
It is possible for other events to be generated
12699
on a thread before its thread start event.
12700
<p/>
12701
The event is sent on the newly started <paramlink id="thread"></paramlink>.
12702
</description>
12703
<origin>jvmdi</origin>
12704
<capabilities>
12705
</capabilities>
12706
<parameters>
12707
<param id="jni_env">
12708
<outptr>
12709
<struct>JNIEnv</struct>
12710
</outptr>
12711
<description>
12712
The JNI environment of the event (current) thread.
12713
</description>
12714
</param>
12715
<param id="thread">
12716
<jthread/>
12717
<description>
12718
Thread starting
12719
</description>
12720
</param>
12721
</parameters>
12722
</event>
12723
12724
<event label="Thread End"
12725
id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">
12726
<description>
12727
Thread end events are generated by a terminating thread
12728
after its initial method has finished execution.
12729
<p/>
12730
A thread may be listed in the array returned by
12731
<functionlink id="GetAllThreads"></functionlink>
12732
after its thread end event is generated.
12733
No events are generated on a thread
12734
after its thread end event.
12735
<p/>
12736
The event is sent on the dying <paramlink id="thread"></paramlink>.
12737
</description>
12738
<origin>jvmdi</origin>
12739
<capabilities>
12740
</capabilities>
12741
<parameters>
12742
<param id="jni_env">
12743
<outptr>
12744
<struct>JNIEnv</struct>
12745
</outptr>
12746
<description>
12747
The JNI environment of the event (current) thread.
12748
</description>
12749
</param>
12750
<param id="thread">
12751
<jthread/>
12752
<description>
12753
Thread ending
12754
</description>
12755
</param>
12756
</parameters>
12757
</event>
12758
12759
<event label="Class Load"
12760
id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">
12761
<description>
12762
A class load event is generated
12763
<functionlink id="GetLoadedClasses">when a class or interface is created.</functionlink>.
12764
<p/>
12765
Array class creation does not generate a class load event.
12766
The creation of a primitive class (for example, java.lang.Integer.TYPE)
12767
does not generate a class load event.
12768
<p/>
12769
The order of class load events generated by a particular thread is guaranteed
12770
to match the order of class loading within that thread.
12771
<p/>
12772
This event is sent at an early stage in loading the class. As
12773
a result the class should be used carefully. Note, for example,
12774
that methods and fields are not yet loaded, so queries for methods,
12775
fields, subclasses, and so on will not give correct results.
12776
See "Loading of Classes and Interfaces" in the <i>Java Language
12777
Specification</i>. For most
12778
purposes the <eventlink id="ClassPrepare"></eventlink> event will
12779
be more useful.
12780
</description>
12781
<origin>jvmdi</origin>
12782
<capabilities>
12783
</capabilities>
12784
<parameters>
12785
<param id="jni_env">
12786
<outptr>
12787
<struct>JNIEnv</struct>
12788
</outptr>
12789
<description>
12790
The JNI environment of the event (current) thread
12791
</description>
12792
</param>
12793
<param id="thread">
12794
<jthread/>
12795
<description>
12796
Thread loading the class
12797
</description>
12798
</param>
12799
<param id="klass">
12800
<jclass/>
12801
<description>
12802
Class being loaded
12803
</description>
12804
</param>
12805
</parameters>
12806
</event>
12807
12808
<elide>
12809
<event label="Class Unload"
12810
id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">
12811
<description>
12812
A class unload event is generated when the class is about to be unloaded.
12813
Class unload events take place during garbage collection and must be
12814
handled extremely carefully. The garbage collector holds many locks
12815
and has suspended all other threads, so the event handler cannot depend
12816
on the ability to acquire any locks. The class unload event handler should
12817
do as little as possible, perhaps by queuing information to be processed
12818
later. In particular, the <code>jclass</code> should be used only in
12819
the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:
12820
<ul>
12821
<li><functionlink id="GetClassSignature"></functionlink></li>
12822
<li><functionlink id="GetSourceFileName"></functionlink></li>
12823
<li><functionlink id="IsInterface"></functionlink></li>
12824
<li><functionlink id="IsArrayClass"></functionlink></li>
12825
</ul>
12826
</description>
12827
<origin>jvmdi</origin>
12828
<capabilities>
12829
</capabilities>
12830
<parameters>
12831
<param id="jni_env">
12832
<outptr>
12833
<struct>JNIEnv</struct>
12834
</outptr>
12835
<description>
12836
The JNI environment of the event (current) thread
12837
</description>
12838
</param>
12839
<param id="thread">
12840
<jthread/>
12841
<description>
12842
Thread generating the class unload
12843
</description>
12844
</param>
12845
<param id="klass">
12846
<jclass/>
12847
<description>
12848
Class being unloaded
12849
</description>
12850
</param>
12851
</parameters>
12852
</event>
12853
</elide>
12854
12855
<event label="Class Prepare"
12856
id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">
12857
<description>
12858
A class prepare event is generated when class preparation is complete.
12859
At this point, class fields, methods, and implemented interfaces are
12860
available, and no code from the class has been executed. Since array
12861
classes never have fields or methods, class prepare events are not
12862
generated for them. Class prepare events are not generated for
12863
primitive classes (for example, <code>java.lang.Integer.TYPE</code>).
12864
</description>
12865
<origin>jvmdi</origin>
12866
<capabilities>
12867
</capabilities>
12868
<parameters>
12869
<param id="jni_env">
12870
<outptr>
12871
<struct>JNIEnv</struct>
12872
</outptr>
12873
<description>
12874
The JNI environment of the event (current) thread
12875
</description>
12876
</param>
12877
<param id="thread">
12878
<jthread/>
12879
<description>
12880
Thread generating the class prepare
12881
</description>
12882
</param>
12883
<param id="klass">
12884
<jclass/>
12885
<description>
12886
Class being prepared
12887
</description>
12888
</param>
12889
</parameters>
12890
</event>
12891
12892
<event label="Class File Load Hook" phase="any"
12893
id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">
12894
<description>
12895
This event is sent when the VM obtains class file data,
12896
but before it constructs
12897
the in-memory representation for that class.
12898
This event is also sent when the class is being modified by the
12899
<functionlink id="RetransformClasses"/> function or
12900
the <functionlink id="RedefineClasses"/> function,
12901
called in any <jvmti/> environment.
12902
The agent can instrument
12903
the existing class file data sent by the VM to include profiling/debugging hooks.
12904
See the description of
12905
<internallink id="bci">bytecode instrumentation</internallink>
12906
for usage information.
12907
<p/>
12908
When the capabilities
12909
<internallink id="jvmtiCapabilities.can_generate_early_class_hook_events">
12910
<code>can_generate_early_class_hook_events</code></internallink> and
12911
<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
12912
<code>can_generate_all_class_hook_events</code></internallink>
12913
are enabled then this event may be sent in the primordial phase.
12914
Otherwise, this event may be sent before the VM is initialized (the start
12915
<functionlink id="GetPhase">phase</functionlink>).
12916
Some classes might not be compatible
12917
with the function (eg. ROMized classes or implementation defined classes) and this event will
12918
not be generated for these classes.
12919
<p/>
12920
The agent must allocate the space for the modified
12921
class file data buffer
12922
using the memory allocation function
12923
<functionlink id="Allocate"></functionlink> because the
12924
VM is responsible for freeing the new class file data buffer
12925
using <functionlink id="Deallocate"></functionlink>.
12926
<p/>
12927
If the agent wishes to modify the class file, it must set
12928
<code>new_class_data</code> to point
12929
to the newly instrumented class file data buffer and set
12930
<code>new_class_data_len</code> to the length of that
12931
buffer before returning
12932
from this call. If no modification is desired, the agent simply
12933
does not set <code>new_class_data</code>. If multiple agents
12934
have enabled this event the results are chained. That is, if
12935
<code>new_class_data</code> has been set, it becomes the
12936
<code>class_data</code> for the next agent.
12937
<p/>
12938
When handling a class load in the live phase, then the
12939
<functionlink id="GetNamedModule"></functionlink>
12940
function can be used to map class loader and a package name to a module.
12941
When a class is being redefined or retransformed then
12942
<code>class_being_redefined</code> is non <code>NULL</code> and so
12943
the JNI <code>GetModule</code> function can also be used
12944
to obtain the Module.
12945
<p/>
12946
The order that this event is sent to each environment differs
12947
from other events.
12948
This event is sent to environments in the following order:
12949
<ul>
12950
<li><fieldlink id="can_retransform_classes"
12951
struct="jvmtiCapabilities">retransformation
12952
incapable</fieldlink>
12953
environments, in the
12954
order in which they were created
12955
</li>
12956
<li><fieldlink id="can_retransform_classes"
12957
struct="jvmtiCapabilities">retransformation
12958
capable</fieldlink>
12959
environments, in the
12960
order in which they were created
12961
</li>
12962
</ul>
12963
When triggered by <functionlink id="RetransformClasses"/>,
12964
this event is sent only to <fieldlink id="can_retransform_classes"
12965
struct="jvmtiCapabilities">retransformation
12966
capable</fieldlink>
12967
environments.
12968
</description>
12969
<origin>jvmpi</origin>
12970
<capabilities>
12971
<capability id="can_generate_all_class_hook_events"></capability>
12972
<capability id="can_generate_early_class_hook_events"></capability>
12973
</capabilities>
12974
<parameters>
12975
<param id="jni_env">
12976
<outptr>
12977
<struct>JNIEnv</struct>
12978
</outptr>
12979
<description>
12980
The JNI environment of the event (current) thread.
12981
</description>
12982
</param>
12983
<param id="class_being_redefined">
12984
<jclass/>
12985
<description>
12986
The class being
12987
<functionlink id="RedefineClasses">redefined</functionlink> or
12988
<functionlink id="RetransformClasses">retransformed</functionlink>.
12989
<code>NULL</code> if sent by class load.
12990
</description>
12991
</param>
12992
<param id="loader">
12993
<jobject/>
12994
<description>
12995
The class loader loading the class.
12996
<code>NULL</code> if the bootstrap class loader.
12997
</description>
12998
</param>
12999
<param id="name">
13000
<vmbuf><char/></vmbuf>
13001
<description>
13002
Name of class being loaded as a VM internal qualified name
13003
(for example, "java/util/List"), encoded as a
13004
<internallink id="mUTF">modified UTF-8</internallink> string.
13005
Note: if the class is defined with a <code>NULL</code> name or
13006
without a name specified, <code>name</code> will be <code>NULL</code>.
13007
</description>
13008
</param>
13009
<param id="protection_domain">
13010
<jobject/>
13011
<description>
13012
The <code>ProtectionDomain</code> of the class.
13013
</description>
13014
</param>
13015
<param id="class_data_len">
13016
<jint/>
13017
<description>
13018
Length of current class file data buffer.
13019
</description>
13020
</param>
13021
<param id="class_data">
13022
<vmbuf><uchar/></vmbuf>
13023
<description>
13024
Pointer to the current class file data buffer.
13025
</description>
13026
</param>
13027
<param id="new_class_data_len">
13028
<outptr><jint/></outptr>
13029
<description>
13030
Pointer to the length of the new class file data buffer.
13031
</description>
13032
</param>
13033
<param id="new_class_data">
13034
<agentbuf incount="new_class_data_len"><uchar/></agentbuf>
13035
<description>
13036
Pointer to the pointer to the instrumented class file data buffer.
13037
</description>
13038
</param>
13039
</parameters>
13040
</event>
13041
13042
<event label="VM Start Event"
13043
id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">
13044
<description>
13045
The VM start event signals the start of the VM.
13046
At this time JNI is live but the VM is not yet fully initialized.
13047
Once this event is generated, the agent is free to call any JNI function.
13048
This event signals the beginning of the start phase,
13049
<jvmti/> functions permitted in the start phase may be called.
13050
<p/>
13051
The timing of this event may depend on whether the agent has added the
13052
<internallink id="jvmtiCapabilities.can_generate_early_vmstart">
13053
<code>can_generate_early_vmstart</code></internallink> capability or not.
13054
If the capability has been added then the VM posts the event as early
13055
as possible. The VM is capable of executing bytecode but it may not have
13056
initialized to the point where it can load classes in modules other than
13057
<code>java.base</code>, or even arbitrary classes in <code>java.base</code>.
13058
Agents that do load-time instrumentation in this
13059
phase must take great care when instrumenting code that potentially
13060
executes in this phase. Extreme care should also be taken with JNI
13061
<code>FindClass</code> as it may not be possible to load classes and attempts
13062
to do so may result in unpredictable behavior, maybe even stability issues
13063
on some VM implementations.
13064
If the capability has not been added then the VM delays posting this
13065
event until it is capable of loading classes in modules other than
13066
<code>java.base</code> or the VM has completed its initialization.
13067
Agents that create more than one JVM TI environment, where the
13068
capability is added to some but not all environments, may observe the
13069
start phase beginning earlier in the JVM TI environments that possess
13070
the capability.
13071
<p/>
13072
In the case of VM start-up failure, this event will not be sent.
13073
</description>
13074
<origin>jvmdi</origin>
13075
<capabilities>
13076
</capabilities>
13077
<parameters>
13078
<param id="jni_env">
13079
<outptr>
13080
<struct>JNIEnv</struct>
13081
</outptr>
13082
<description>
13083
The JNI environment of the event (current) thread.
13084
</description>
13085
</param>
13086
</parameters>
13087
</event>
13088
13089
<event label="VM Initialization Event"
13090
id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">
13091
<description>
13092
The VM initialization event signals the completion of VM initialization. Once
13093
this event is generated, the agent is free to call any JNI or <jvmti/>
13094
function. The VM initialization event can be preceded by or can be concurrent
13095
with other events, but
13096
the preceding events should be handled carefully, if at all, because the
13097
VM has not completed its initialization. The thread start event for the
13098
main application thread is guaranteed not to occur until after the
13099
handler for the VM initialization event returns.
13100
<p/>
13101
In the case of VM start-up failure, this event will not be sent.
13102
</description>
13103
<origin>jvmdi</origin>
13104
<capabilities>
13105
</capabilities>
13106
<parameters>
13107
<param id="jni_env">
13108
<outptr>
13109
<struct>JNIEnv</struct>
13110
</outptr>
13111
<description>
13112
The JNI environment of the event (current) thread.
13113
</description>
13114
</param>
13115
<param id="thread">
13116
<jthread/>
13117
<description>
13118
The initial thread
13119
</description>
13120
</param>
13121
</parameters>
13122
</event>
13123
13124
<event label="VM Death Event"
13125
id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">
13126
<description>
13127
The VM death event notifies the agent of the termination of the VM.
13128
No events will occur after the VMDeath event.
13129
<p/>
13130
In the case of VM start-up failure, this event will not be sent.
13131
Note that <internallink id="onunload">Agent_OnUnload</internallink>
13132
will still be called in these cases.
13133
</description>
13134
<origin>jvmdi</origin>
13135
<capabilities>
13136
</capabilities>
13137
<parameters>
13138
<param id="jni_env">
13139
<outptr>
13140
<struct>JNIEnv</struct>
13141
</outptr>
13142
<description>
13143
The JNI environment of the event (current) thread
13144
</description>
13145
</param>
13146
</parameters>
13147
</event>
13148
13149
<event label="Compiled Method Load" phase="start"
13150
id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">
13151
<description>
13152
Sent when a method is compiled and loaded into memory by the VM.
13153
If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.
13154
If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,
13155
followed by a new <code>CompiledMethodLoad</code> event.
13156
Note that a single method may have multiple compiled forms, and that
13157
this event will be sent for each form.
13158
Note also that several methods may be inlined into a single
13159
address range, and that this event will be sent for each method.
13160
<p/>
13161
These events can be sent after their initial occurrence with
13162
<functionlink id="GenerateEvents"></functionlink>.
13163
</description>
13164
<origin>jvmpi</origin>
13165
<typedef id="jvmtiAddrLocationMap" label="Native address to location entry">
13166
<field id="start_address">
13167
<vmbuf><void/></vmbuf>
13168
<description>
13169
Starting native address of code corresponding to a location
13170
</description>
13171
</field>
13172
<field id="location">
13173
<jlocation/>
13174
<description>
13175
Corresponding location. See
13176
<functionlink id="GetJLocationFormat"></functionlink>
13177
for the meaning of location.
13178
</description>
13179
</field>
13180
</typedef>
13181
<capabilities>
13182
<required id="can_generate_compiled_method_load_events"></required>
13183
</capabilities>
13184
<parameters>
13185
<param id="klass">
13186
<jclass method="method"/>
13187
<description>
13188
Class of the method being compiled and loaded
13189
</description>
13190
</param>
13191
<param id="method">
13192
<jmethodID class="klass"/>
13193
<description>
13194
Method being compiled and loaded
13195
</description>
13196
</param>
13197
<param id="code_size">
13198
<jint/>
13199
<description>
13200
Size of compiled code
13201
</description>
13202
</param>
13203
<param id="code_addr">
13204
<vmbuf><void/></vmbuf>
13205
<description>
13206
Address where compiled method code is loaded
13207
</description>
13208
</param>
13209
<param id="map_length">
13210
<jint/>
13211
<description>
13212
Number of <typelink id="jvmtiAddrLocationMap"></typelink>
13213
entries in the address map.
13214
Zero if mapping information cannot be supplied.
13215
</description>
13216
</param>
13217
<param id="map">
13218
<vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>
13219
<description>
13220
Map from native addresses to location.
13221
The native address range of each entry is from
13222
<fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>
13223
to <code>start_address-1</code> of the next entry.
13224
<code>NULL</code> if mapping information cannot be supplied.
13225
</description>
13226
</param>
13227
<param id="compile_info">
13228
<vmbuf><void/></vmbuf>
13229
<description>
13230
VM-specific compilation information.
13231
The referenced compile information is managed by the VM
13232
and must not depend on the agent for collection.
13233
A VM implementation defines the content and lifetime
13234
of the information.
13235
</description>
13236
</param>
13237
</parameters>
13238
</event>
13239
13240
<event label="Compiled Method Unload" phase="start"
13241
id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">
13242
<description>
13243
Sent when a compiled method is unloaded from memory.
13244
This event might not be sent on the thread which performed the unload.
13245
This event may be sent sometime after the unload occurs, but
13246
will be sent before the memory is reused
13247
by a newly generated compiled method. This event may be sent after
13248
the class is unloaded.
13249
</description>
13250
<origin>jvmpi</origin>
13251
<capabilities>
13252
<required id="can_generate_compiled_method_load_events"></required>
13253
</capabilities>
13254
<parameters>
13255
<param id="klass">
13256
<jclass method="method"/>
13257
<description>
13258
Class of the compiled method being unloaded.
13259
</description>
13260
</param>
13261
<param id="method">
13262
<jmethodID class="klass"/>
13263
<description>
13264
Compiled method being unloaded.
13265
For identification of the compiled method only -- the class
13266
may be unloaded and therefore the method should not be used
13267
as an argument to further JNI or <jvmti/> functions.
13268
</description>
13269
</param>
13270
<param id="code_addr">
13271
<vmbuf><void/></vmbuf>
13272
<description>
13273
Address where compiled method code was loaded.
13274
For identification of the compiled method only --
13275
the space may have been reclaimed.
13276
</description>
13277
</param>
13278
</parameters>
13279
</event>
13280
13281
<event label="Dynamic Code Generated" phase="any"
13282
id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">
13283
<description>
13284
Sent when a component of the virtual machine is generated dynamically.
13285
This does not correspond to Java programming language code that is
13286
compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.
13287
This is for native code--for example, an interpreter that is generated
13288
differently depending on command-line options.
13289
<p/>
13290
Note that this event has no controlling capability.
13291
If a VM cannot generate these events, it simply does not send any.
13292
<p/>
13293
These events can be sent after their initial occurrence with
13294
<functionlink id="GenerateEvents"></functionlink>.
13295
</description>
13296
<origin>jvmpi</origin>
13297
<capabilities>
13298
</capabilities>
13299
<parameters>
13300
<param id="name">
13301
<vmbuf><char/></vmbuf>
13302
<description>
13303
Name of the code, encoded as a
13304
<internallink id="mUTF">modified UTF-8</internallink> string.
13305
Intended for display to an end-user.
13306
The name might not be unique.
13307
</description>
13308
</param>
13309
<param id="address">
13310
<vmbuf><void/></vmbuf>
13311
<description>
13312
Native address of the code
13313
</description>
13314
</param>
13315
<param id="length">
13316
<jint/>
13317
<description>
13318
Length in bytes of the code
13319
</description>
13320
</param>
13321
</parameters>
13322
</event>
13323
13324
<event label="Data Dump Request"
13325
id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">
13326
<description>
13327
Sent by the VM to request the agent to dump its data. This
13328
is just a hint and the agent need not react to this event.
13329
This is useful for processing command-line signals from users. For
13330
example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux
13331
causes the VM to send this event to the agent.
13332
</description>
13333
<origin>jvmpi</origin>
13334
<capabilities>
13335
</capabilities>
13336
<parameters>
13337
</parameters>
13338
</event>
13339
13340
<event label="Monitor Contended Enter"
13341
id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">
13342
<description>
13343
Sent when a thread is attempting to enter a Java programming language
13344
monitor already acquired by another thread.
13345
</description>
13346
<origin>jvmpi</origin>
13347
<capabilities>
13348
<required id="can_generate_monitor_events"></required>
13349
</capabilities>
13350
<parameters>
13351
<param id="jni_env">
13352
<outptr>
13353
<struct>JNIEnv</struct>
13354
</outptr>
13355
<description>
13356
The JNI environment of the event (current) thread
13357
</description>
13358
</param>
13359
<param id="thread">
13360
<jthread/>
13361
<description>
13362
JNI local reference to the thread
13363
attempting to enter the monitor
13364
</description>
13365
</param>
13366
<param id="object">
13367
<jobject/>
13368
<description>
13369
JNI local reference to the monitor
13370
</description>
13371
</param>
13372
</parameters>
13373
</event>
13374
13375
<event label="Monitor Contended Entered"
13376
id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">
13377
<description>
13378
Sent when a thread enters a Java programming language
13379
monitor after waiting for it to be released by another thread.
13380
</description>
13381
<origin>jvmpi</origin>
13382
<capabilities>
13383
<required id="can_generate_monitor_events"></required>
13384
</capabilities>
13385
<parameters>
13386
<param id="jni_env">
13387
<outptr>
13388
<struct>JNIEnv</struct>
13389
</outptr>
13390
<description>
13391
The JNI environment of the event (current) thread
13392
</description>
13393
</param>
13394
<param id="thread">
13395
<jthread/>
13396
<description>
13397
JNI local reference to the thread entering
13398
the monitor
13399
</description>
13400
</param>
13401
<param id="object">
13402
<jobject/>
13403
<description>
13404
JNI local reference to the monitor
13405
</description>
13406
</param>
13407
</parameters>
13408
</event>
13409
13410
<event label="Monitor Wait"
13411
id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">
13412
<description>
13413
Sent when a thread is about to wait on an object.
13414
</description>
13415
<origin>jvmpi</origin>
13416
<capabilities>
13417
<required id="can_generate_monitor_events"></required>
13418
</capabilities>
13419
<parameters>
13420
<param id="jni_env">
13421
<outptr>
13422
<struct>JNIEnv</struct>
13423
</outptr>
13424
<description>
13425
The JNI environment of the event (current) thread
13426
</description>
13427
</param>
13428
<param id="thread">
13429
<jthread/>
13430
<description>
13431
JNI local reference to the thread about to wait
13432
</description>
13433
</param>
13434
<param id="object">
13435
<jobject/>
13436
<description>
13437
JNI local reference to the monitor
13438
</description>
13439
</param>
13440
<param id="timeout">
13441
<jlong/>
13442
<description>
13443
The number of milliseconds the thread will wait
13444
</description>
13445
</param>
13446
</parameters>
13447
</event>
13448
13449
<event label="Monitor Waited"
13450
id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">
13451
<description>
13452
Sent when a thread finishes waiting on an object.
13453
</description>
13454
<origin>jvmpi</origin>
13455
<capabilities>
13456
<required id="can_generate_monitor_events"></required>
13457
</capabilities>
13458
<parameters>
13459
<param id="jni_env">
13460
<outptr>
13461
<struct>JNIEnv</struct>
13462
</outptr>
13463
<description>
13464
The JNI environment of the event (current) thread
13465
</description>
13466
</param>
13467
<param id="thread">
13468
<jthread/>
13469
<description>
13470
JNI local reference to the thread that was finished waiting
13471
</description>
13472
</param>
13473
<param id="object">
13474
<jobject/>
13475
<description>
13476
JNI local reference to the monitor.
13477
</description>
13478
</param>
13479
<param id="timed_out">
13480
<jboolean/>
13481
<description>
13482
True if the monitor timed out
13483
</description>
13484
</param>
13485
</parameters>
13486
</event>
13487
13488
<event label="Resource Exhausted"
13489
id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"
13490
since="1.1">
13491
<description>
13492
Sent when a VM resource needed by a running application has been exhausted.
13493
Except as required by the optional capabilities, the set of resources
13494
which report exhaustion is implementation dependent.
13495
<p/>
13496
The following bit flags define the properties of the resource exhaustion:
13497
<constants id="jvmtiResourceExhaustionFlags"
13498
label="Resource Exhaustion Flags"
13499
kind="bits"
13500
since="1.1">
13501
<constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">
13502
After this event returns, the VM will throw a
13503
<code>java.lang.OutOfMemoryError</code>.
13504
</constant>
13505
<constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">
13506
The VM was unable to allocate memory from the <tm>Java</tm>
13507
platform <i>heap</i>.
13508
The <i>heap</i> is the runtime
13509
data area from which memory for all class instances and
13510
arrays are allocated.
13511
</constant>
13512
<constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">
13513
The VM was unable to create a thread.
13514
</constant>
13515
</constants>
13516
</description>
13517
<origin>new</origin>
13518
<capabilities>
13519
<capability id="can_generate_resource_exhaustion_heap_events">
13520
Can generate events when the VM is unable to allocate memory from the
13521
<internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.
13522
</capability>
13523
<capability id="can_generate_resource_exhaustion_threads_events">
13524
Can generate events when the VM is unable to
13525
<internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create
13526
a thread</internallink>.
13527
</capability>
13528
</capabilities>
13529
<parameters>
13530
<param id="jni_env">
13531
<outptr>
13532
<struct>JNIEnv</struct>
13533
</outptr>
13534
<description>
13535
The JNI environment of the event (current) thread
13536
</description>
13537
</param>
13538
<param id="flags">
13539
<jint/>
13540
<description>
13541
Flags defining the properties of the of resource exhaustion
13542
as specified by the
13543
<internallink id="jvmtiResourceExhaustionFlags">Resource
13544
Exhaustion Flags</internallink>.
13545
</description>
13546
</param>
13547
<param id="reserved">
13548
<vmbuf><void/></vmbuf>
13549
<description>
13550
Reserved.
13551
</description>
13552
</param>
13553
<param id="description">
13554
<vmbuf><char/></vmbuf>
13555
<description>
13556
Description of the resource exhaustion, encoded as a
13557
<internallink id="mUTF">modified UTF-8</internallink> string.
13558
</description>
13559
</param>
13560
</parameters>
13561
</event>
13562
13563
<event label="VM Object Allocation"
13564
id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">
13565
<description>
13566
Sent when a method causes the virtual machine to directly allocate an
13567
Object visible to Java programming language code.
13568
Generally object allocation should be detected by instrumenting
13569
the bytecodes of allocating methods.
13570
Object allocation generated in native code by JNI function
13571
calls should be detected using
13572
<internallink id="jniIntercept">JNI function interception</internallink>.
13573
Some methods might not have associated bytecodes and are not
13574
native methods, they instead are executed directly by the
13575
VM. These methods should send this event.
13576
Virtual machines which are incapable of bytecode instrumentation
13577
for some or all of their methods can send this event.
13578
13579
Note that the <internallink
13580
id="SampledObjectAlloc">SampledObjectAlloc</internallink>
13581
event is triggered on all Java object allocations, including those
13582
caused by bytecode method execution, JNI method execution, and
13583
directly by VM methods.
13584
<p/>
13585
Typical examples where this event might be sent:
13586
<ul>
13587
<li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>
13588
<li>Methods not represented by bytecodes -- for example, VM intrinsics and
13589
J2ME preloaded classes</li>
13590
</ul>
13591
Cases where this event would not be generated:
13592
<ul>
13593
<li>Allocation due to bytecodes -- for example, the <code>new</code>
13594
and <code>newarray</code> VM instructions</li>
13595
<li>Allocation due to JNI function calls -- for example,
13596
<code>AllocObject</code></li>
13597
<li>Allocations during VM initialization</li>
13598
<li>VM internal objects</li>
13599
</ul>
13600
</description>
13601
<origin>new</origin>
13602
<capabilities>
13603
<required id="can_generate_vm_object_alloc_events"></required>
13604
</capabilities>
13605
<parameters>
13606
<param id="jni_env">
13607
<outptr>
13608
<struct>JNIEnv</struct>
13609
</outptr>
13610
<description>
13611
The JNI environment of the event (current) thread
13612
</description>
13613
</param>
13614
<param id="thread">
13615
<jthread/>
13616
<description>
13617
Thread allocating the object.
13618
</description>
13619
</param>
13620
<param id="object">
13621
<jobject/>
13622
<description>
13623
JNI local reference to the object that was allocated.
13624
</description>
13625
</param>
13626
<param id="object_klass">
13627
<jclass/>
13628
<description>
13629
JNI local reference to the class of the object.
13630
</description>
13631
</param>
13632
<param id="size">
13633
<jlong/>
13634
<description>
13635
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
13636
</description>
13637
</param>
13638
</parameters>
13639
</event>
13640
13641
<event label="Sampled Object Allocation"
13642
id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">
13643
<description>
13644
Sent when an allocated object is sampled.
13645
By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid
13646
pattern-based bias and provides an approximate overall average interval over long periods of
13647
sampling.
13648
<p/>
13649
Each thread tracks how many bytes it has allocated since it sent the last event.
13650
When the number of bytes exceeds the sampling interval, it will send another event.
13651
This implies that, on average, one object will be sampled every time a thread has
13652
allocated 512KB bytes since the last sample.
13653
<p/>
13654
Note that the sampler is pseudo-random: it will not sample every 512KB precisely.
13655
The goal of this is to ensure high quality sampling even if allocation is
13656
happening in a fixed pattern (i.e., the same set of objects are being allocated
13657
every 512KB).
13658
<p/>
13659
If another sampling interval is required, the user can call
13660
<functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value,
13661
representing the new sampling interval.
13662
<p/>
13663
This event is sent once the sampled allocation has been performed. It provides the object, stack trace
13664
of the allocation, the thread allocating, the size of allocation, and the object's class.
13665
<p/>
13666
A typical use case of this system is to determine where heap allocations originate.
13667
In conjunction with weak references and the function
13668
<functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which
13669
stack trace, and which are still live during the execution of the program.
13670
</description>
13671
<origin>new</origin>
13672
<capabilities>
13673
<required id="can_generate_sampled_object_alloc_events"></required>
13674
</capabilities>
13675
<parameters>
13676
<param id="jni_env">
13677
<outptr>
13678
<struct>JNIEnv</struct>
13679
</outptr>
13680
<description>
13681
The JNI environment of the event (current) thread.
13682
</description>
13683
</param>
13684
<param id="thread">
13685
<jthread/>
13686
<description>
13687
Thread allocating the object.
13688
</description>
13689
</param>
13690
<param id="object">
13691
<jobject/>
13692
<description>
13693
JNI local reference to the object that was allocated.
13694
</description>
13695
</param>
13696
<param id="object_klass">
13697
<jclass/>
13698
<description>
13699
JNI local reference to the class of the object
13700
</description>
13701
</param>
13702
<param id="size">
13703
<jlong/>
13704
<description>
13705
Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
13706
</description>
13707
</param>
13708
</parameters>
13709
</event>
13710
13711
<event label="Object Free"
13712
id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">
13713
<description>
13714
An Object Free event is sent when the garbage collector frees an object.
13715
Events are only sent for tagged objects--see
13716
<internallink id="Heap">heap functions</internallink>.
13717
<p/>
13718
The event handler must not use JNI functions and
13719
must not use <jvmti/> functions except those which
13720
specifically allow such use (see the raw monitor, memory management,
13721
and environment local storage functions).
13722
</description>
13723
<origin>new</origin>
13724
<capabilities>
13725
<required id="can_generate_object_free_events"></required>
13726
</capabilities>
13727
<parameters>
13728
<param id="tag">
13729
<jlong/>
13730
<description>
13731
The freed object's tag
13732
</description>
13733
</param>
13734
</parameters>
13735
</event>
13736
13737
<event label="Garbage Collection Start"
13738
id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">
13739
<description>
13740
A Garbage Collection Start event is sent when a
13741
garbage collection pause begins.
13742
Only stop-the-world collections are reported--that is, collections during
13743
which all threads cease to modify the state of the Java virtual machine.
13744
This means that some collectors will never generate these events.
13745
This event is sent while the VM is still stopped, thus
13746
the event handler must not use JNI functions and
13747
must not use <jvmti/> functions except those which
13748
specifically allow such use (see the raw monitor, memory management,
13749
and environment local storage functions).
13750
<p/>
13751
This event is always sent as a matched pair with
13752
<eventlink id="GarbageCollectionFinish"/>
13753
(assuming both events are enabled) and no garbage collection
13754
events will occur between them.
13755
</description>
13756
<origin>new</origin>
13757
<capabilities>
13758
<required id="can_generate_garbage_collection_events"></required>
13759
</capabilities>
13760
<parameters>
13761
</parameters>
13762
</event>
13763
13764
<event label="Garbage Collection Finish"
13765
id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">
13766
<description>
13767
A Garbage Collection Finish event is sent when a
13768
garbage collection pause ends.
13769
This event is sent while the VM is still stopped, thus
13770
the event handler must not use JNI functions and
13771
must not use <jvmti/> functions except those which
13772
specifically allow such use (see the raw monitor, memory management,
13773
and environment local storage functions).
13774
<p/>
13775
Some agents may need to do post garbage collection operations that
13776
require the use of the disallowed <jvmti/> or JNI functions. For these
13777
cases an agent thread can be created which waits on a raw monitor,
13778
and the handler for the Garbage Collection Finish event simply
13779
notifies the raw monitor
13780
<p/>
13781
This event is always sent as a matched pair with
13782
<eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).
13783
<issue>
13784
The most important use of this event is to provide timing information,
13785
and thus additional information is not required. However,
13786
information about the collection which is "free" should be included -
13787
what that information is needs to be determined.
13788
</issue>
13789
</description>
13790
<origin>new</origin>
13791
<capabilities>
13792
<required id="can_generate_garbage_collection_events"></required>
13793
</capabilities>
13794
<parameters>
13795
</parameters>
13796
</event>
13797
13798
<elide>
13799
<event label="Verbose Output" phase="any"
13800
id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">
13801
<description>
13802
Send verbose messages as strings.
13803
<issue>
13804
This format is extremely fragile, as it can change with each
13805
platform, collector and version. Alternatives include:
13806
<ul>
13807
<li>building off Java programming language M and M APIs</li>
13808
<li>XML</li>
13809
<li>key/value pairs</li>
13810
<li>removing it</li>
13811
</ul>
13812
</issue>
13813
<issue>
13814
Though this seemed trivial to implement.
13815
In the RI it appears this will be quite complex.
13816
</issue>
13817
</description>
13818
<origin>new</origin>
13819
<capabilities>
13820
</capabilities>
13821
<parameters>
13822
<param id="flag">
13823
<enum>jvmtiVerboseFlag</enum>
13824
<description>
13825
Which verbose output is being sent.
13826
</description>
13827
</param>
13828
<param id="message">
13829
<vmbuf><char/></vmbuf>
13830
<description>
13831
Message text, encoded as a
13832
<internallink id="mUTF">modified UTF-8</internallink> string.
13833
</description>
13834
</param>
13835
</parameters>
13836
</event>
13837
</elide>
13838
13839
</eventsection>
13840
13841
<datasection>
13842
<intro>
13843
<jvmti/> extends the data types defined by JNI.
13844
</intro>
13845
<basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">
13846
<basetype id="jboolean">
13847
<description>
13848
Holds a Java programming language <code>boolean</code>.
13849
Unsigned 8 bits.
13850
</description>
13851
</basetype>
13852
<basetype id="jchar">
13853
<description>
13854
Holds a Java programming language <code>char</code>.
13855
Unsigned 16 bits.
13856
</description>
13857
</basetype>
13858
<basetype id="jint">
13859
<description>
13860
Holds a Java programming language <code>int</code>.
13861
Signed 32 bits.
13862
</description>
13863
</basetype>
13864
<basetype id="jlong">
13865
<description>
13866
Holds a Java programming language <code>long</code>.
13867
Signed 64 bits.
13868
</description>
13869
</basetype>
13870
<basetype id="jfloat">
13871
<description>
13872
Holds a Java programming language <code>float</code>.
13873
32 bits.
13874
</description>
13875
</basetype>
13876
<basetype id="jdouble">
13877
<description>
13878
Holds a Java programming language <code>double</code>.
13879
64 bits.
13880
</description>
13881
</basetype>
13882
<basetype id="jobject">
13883
<description>
13884
Holds a Java programming language object.
13885
</description>
13886
</basetype>
13887
<basetype id="jclass">
13888
<description>
13889
Holds a Java programming language class.
13890
</description>
13891
</basetype>
13892
<basetype id="jvalue">
13893
<description>
13894
Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java
13895
programming language value.
13896
</description>
13897
</basetype>
13898
<basetype id="jfieldID">
13899
<description>
13900
Identifies a Java programming language field.
13901
<code>jfieldID</code>s returned by <jvmti/> functions and events may be
13902
safely stored.
13903
</description>
13904
</basetype>
13905
<basetype id="jmethodID">
13906
<description>
13907
Identifies a Java programming language method, initializer, or constructor.
13908
<code>jmethodID</code>s returned by <jvmti/> functions and events may be
13909
safely stored. However, if the class is unloaded, they become invalid
13910
and must not be used.
13911
</description>
13912
</basetype>
13913
<basetype id="JNIEnv">
13914
<description>
13915
Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)
13916
is a JNI environment.
13917
</description>
13918
</basetype>
13919
</basetypes>
13920
13921
<basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">
13922
<basetype id="jvmtiEnv">
13923
<description>
13924
The <jvmti/> <internallink id="environments">environment</internallink> pointer.
13925
See the <internallink id="FunctionSection">Function Section</internallink>.
13926
<code>jvmtiEnv</code> points to the
13927
<internallink id="FunctionTable">function table</internallink> pointer.
13928
</description>
13929
</basetype>
13930
<basetype id="jthread">
13931
<definition>typedef jobject jthread;</definition>
13932
<description>
13933
Subtype of <datalink id="jobject"></datalink> that holds a thread.
13934
</description>
13935
</basetype>
13936
<basetype id="jthreadGroup">
13937
<definition>typedef jobject jthreadGroup;</definition>
13938
<description>
13939
Subtype of <datalink id="jobject"></datalink> that holds a thread group.
13940
</description>
13941
</basetype>
13942
<basetype id="jlocation">
13943
<definition>typedef jlong jlocation;</definition>
13944
<description>
13945
A 64 bit value, representing a monotonically increasing
13946
executable position within a method.
13947
<code>-1</code> indicates a native method.
13948
See <functionlink id="GetJLocationFormat"></functionlink> for the format on a
13949
given VM.
13950
</description>
13951
</basetype>
13952
<basetype id="jrawMonitorID">
13953
<definition>struct _jrawMonitorID;
13954
typedef struct _jrawMonitorID *jrawMonitorID;</definition>
13955
<description>
13956
A raw monitor.
13957
</description>
13958
</basetype>
13959
<basetype id="jvmtiError">
13960
<description>
13961
Holds an error return code.
13962
See the <internallink id="ErrorSection">Error section</internallink> for possible values.
13963
<example>
13964
typedef enum {
13965
JVMTI_ERROR_NONE = 0,
13966
JVMTI_ERROR_INVALID_THREAD = 10,
13967
...
13968
} jvmtiError;
13969
</example>
13970
</description>
13971
</basetype>
13972
<basetype id="jvmtiEvent">
13973
<description>
13974
An identifier for an event type.
13975
See the <internallink id="EventSection">Event section</internallink> for possible values.
13976
It is guaranteed that future versions of this specification will
13977
never assign zero as an event type identifier.
13978
<example>
13979
typedef enum {
13980
JVMTI_EVENT_SINGLE_STEP = 1,
13981
JVMTI_EVENT_BREAKPOINT = 2,
13982
...
13983
} jvmtiEvent;
13984
</example>
13985
</description>
13986
</basetype>
13987
<basetype id="jvmtiEventCallbacks" name="eventCallbacks">
13988
<description>
13989
The callbacks used for events.
13990
<example>
13991
typedef struct {
13992
jvmtiEventVMInit VMInit;
13993
jvmtiEventVMDeath VMDeath;
13994
...
13995
} jvmtiEventCallbacks;
13996
</example>
13997
See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>
13998
for the complete structure.
13999
<p/>
14000
Where, for example, the VM initialization callback is defined:
14001
<example>
14002
typedef void (JNICALL *jvmtiEventVMInit)
14003
(jvmtiEnv *jvmti_env,
14004
JNIEnv* jni_env,
14005
jthread thread);
14006
</example>
14007
See the individual events for the callback function definition.
14008
</description>
14009
</basetype>
14010
<basetype id="jniNativeInterface">
14011
<definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>
14012
<description>
14013
Typedef for the JNI function table <code>JNINativeInterface</code>
14014
defined in the
14015
<externallink id="jni/functions.html#interface-function-table">
14016
JNI Specification</externallink>.
14017
The JNI reference implementation defines this with an underscore.
14018
</description>
14019
</basetype>
14020
</basetypes>
14021
14022
</datasection>
14023
14024
<issuessection label="Issues">
14025
<intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">
14026
JVMDI requires that the agent suspend threads before calling
14027
certain sensitive functions. JVMPI requires garbage collection to be
14028
disabled before calling certain sensitive functions.
14029
It was suggested that rather than have this requirement, that
14030
VM place itself in a suitable state before performing an
14031
operation. This makes considerable sense since each VM
14032
knows its requirements and can most easily arrange a
14033
safe state.
14034
<p/>
14035
The ability to externally suspend/resume threads will, of
14036
course, remain. The ability to enable/disable garbage collection will not.
14037
<p/>
14038
This issue is resolved--suspend will not
14039
be required. The spec has been updated to reflect this.
14040
</intro>
14041
14042
<intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">
14043
There are a variety of approaches to sampling call stacks.
14044
The biggest bifurcation is between VM controlled and agent
14045
controlled.
14046
<p/>
14047
This issue is resolved--agent controlled
14048
sampling will be the approach.
14049
</intro>
14050
14051
<intro id="threadRepresentation" label="Resolved Issue: Thread Representation">
14052
JVMDI represents threads as jthread. JVMPI primarily
14053
uses JNIEnv* to represent threads.
14054
<p/>
14055
The Expert Group has chosen jthread as the representation
14056
for threads in <jvmti/>.
14057
JNIEnv* is sent by
14058
events since it is needed to JNI functions. JNIEnv, per the
14059
JNI spec, are not supposed to be used outside their thread.
14060
</intro>
14061
14062
<intro id="design" label="Resolved Issue: Method Representation">
14063
The JNI spec allows an implementation to depend on jclass/jmethodID
14064
pairs, rather than simply a jmethodID, to reference a method.
14065
JVMDI, for consistency, choose the same representation.
14066
JVMPI, however, specifies that a jmethodID alone maps to a
14067
method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store
14068
pointers in jmethodIDs, and as a result, a jmethodID is sufficient.
14069
In fact, any JVM implementation that supports JVMPI must have
14070
such a representation.
14071
<jvmti/> will use jmethodID as a unique representation of a method
14072
(no jclass is used).
14073
There should be efficiency gains, particularly in
14074
functionality like stack dumping, to this representation.
14075
<p/>
14076
Note that fields were not used in JVMPI and that the access profile
14077
of fields differs from methods--for implementation efficiency
14078
reasons, a jclass/jfieldID pair will still be needed for field
14079
reference.
14080
</intro>
14081
14082
<intro id="localReferenceIssue" label="Resolved Issue: Local References">
14083
Functions return local references.
14084
</intro>
14085
14086
<intro id="frameRep" label="Resolved Issue: Representation of frames">
14087
In JVMDI, a frame ID is used to represent a frame. Problem with this
14088
is that a VM must track when a frame becomes invalid, a far better
14089
approach, and the one used in <jvmti/>, is to reference frames by depth.
14090
</intro>
14091
14092
<intro id="requiredCapabilities" label="Issue: Required Capabilities">
14093
Currently, having a required capabilities means that the functionality
14094
is optional. Capabilities are useful even for required functionality
14095
since they can inform the VM is needed set-up. Thus, there should be
14096
a set of capabilities that a conformant implementation must provide
14097
(if requested during Agent_OnLoad).
14098
</intro>
14099
14100
<intro id="taghint" label="Proposal: add tag hint function">
14101
A hint of the percentage of objects that will be tagged would
14102
help the VM pick a good implementation.
14103
</intro>
14104
14105
<intro id="moreMonitorQueries" label="Request: More Monitor Quires">
14106
How difficult or easy would be to extend the monitor_info category to include
14107
<pre>
14108
- current number of monitors
14109
- enumeration of monitors
14110
- enumeration of threads waiting on a given monitor
14111
</pre>
14112
The reason for my question is the fact that current get_monitor_info support
14113
requires the agent to specify a given thread to get the info which is probably
14114
OK in the profiling/debugging space, while in the monitoring space the agent
14115
could be watching the monitor list and then decide which thread to ask for
14116
the info. You might ask why is this important for monitoring .... I think it
14117
can aid in the detection/prediction of application contention caused by hot-locks.
14118
</intro>
14119
</issuessection>
14120
14121
<changehistory id="ChangeHistory" update="09/05/07">
14122
<intro>
14123
The <jvmti/> specification is an evolving document with major, minor,
14124
and micro version numbers.
14125
A released version of the specification is uniquely identified
14126
by its major and minor version.
14127
The functions, events, and capabilities in this specification
14128
indicate a "Since" value which is the major and minor version in
14129
which it was introduced.
14130
The version of the specification implemented by the VM can
14131
be retrieved at runtime with the <functionlink id="GetVersionNumber"/>
14132
function.
14133
</intro>
14134
<change date="14 Nov 2002">
14135
Converted to XML document.
14136
</change>
14137
<change date="14 Nov 2002">
14138
Elided heap dump functions (for now) since what was there
14139
was wrong.
14140
</change>
14141
<change date="18 Nov 2002">
14142
Added detail throughout.
14143
</change>
14144
<change date="18 Nov 2002">
14145
Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.
14146
</change>
14147
<change date="19 Nov 2002">
14148
Added AsyncGetStackTrace.
14149
</change>
14150
<change date="19 Nov 2002">
14151
Added jframeID return to GetStackTrace.
14152
</change>
14153
<change date="19 Nov 2002">
14154
Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there
14155
since they are redundant with GetStackTrace.
14156
</change>
14157
<change date="19 Nov 2002">
14158
Elided ClearAllBreakpoints since it has always been redundant.
14159
</change>
14160
<change date="19 Nov 2002">
14161
Added GetSystemProperties.
14162
</change>
14163
<change date="19 Nov 2002">
14164
Changed the thread local storage functions to use jthread.
14165
</change>
14166
<change date="20 Nov 2002">
14167
Added GetJLocationFormat.
14168
</change>
14169
<change date="22 Nov 2002">
14170
Added events and introductory text.
14171
</change>
14172
<change date="22 Nov 2002">
14173
Cross reference type and constant definitions.
14174
</change>
14175
<change date="24 Nov 2002">
14176
Added DTD.
14177
</change>
14178
<change date="24 Nov 2002">
14179
Added capabilities function section.
14180
</change>
14181
<change date="29 Nov 2002">
14182
Assign capabilities to each function and event.
14183
</change>
14184
<change date="29 Nov 2002">
14185
Add <internallink id="jniIntercept">JNI interception functions</internallink>.
14186
</change>
14187
<change date="30 Nov 2002">
14188
Auto generate SetEventNotificationMode capabilities.
14189
</change>
14190
<change date="30 Nov 2002">
14191
Add <eventlink id="VMObjectAlloc"></eventlink> event.
14192
</change>
14193
<change date="30 Nov 2002">
14194
Add <eventlink id="DynamicCodeGenerated"></eventlink> event.
14195
</change>
14196
<change date="30 Nov 2002">
14197
Add const to declarations.
14198
</change>
14199
<change date="30 Nov 2002">
14200
Change method exit and frame pop to send on exception.
14201
</change>
14202
<change date="1 Dec 2002">
14203
Add ForceGarbageCollection.
14204
</change>
14205
<change date="2 Dec 2002">
14206
Redo Xrun section; clarify GetStackTrace and add example;
14207
Fix width problems; use "agent" consistently.
14208
</change>
14209
<change date="8 Dec 2002">
14210
Remove previous start-up intro.
14211
Add <internallink id="environments"><jvmti/> Environments</internallink>
14212
section.
14213
</change>
14214
<change date="8 Dec 2002">
14215
Add <functionlink id="DisposeEnvironment"></functionlink>.
14216
</change>
14217
<change date="9 Dec 2002">
14218
Numerous minor updates.
14219
</change>
14220
<change date="15 Dec 2002">
14221
Add heap profiling functions added:
14222
get/set annotation, iterate live objects/heap.
14223
Add heap profiling functions place holder added:
14224
heap roots.
14225
Heap profiling event added: object free.
14226
Heap profiling event redesigned: vm object allocation.
14227
Heap profiling event placeholders added: garbage collection start/finish.
14228
Native method bind event added.
14229
</change>
14230
<change date="19 Dec 2002">
14231
Revamp suspend/resume functions.
14232
Add origin information with jvmdi tag.
14233
Misc fixes.
14234
</change>
14235
<change date="24 Dec 2002">
14236
Add semantics to types.
14237
</change>
14238
<change date="27 Dec 2002">
14239
Add local reference section.
14240
Autogenerate parameter descriptions from types.
14241
</change>
14242
<change date="28 Dec 2002">
14243
Document that RunAgentThread sends threadStart.
14244
</change>
14245
<change date="29 Dec 2002">
14246
Remove redundant local ref and dealloc warning.
14247
Convert GetRawMonitorName to allocated buffer.
14248
Add GenerateEvents.
14249
</change>
14250
<change date="30 Dec 2002">
14251
Make raw monitors a type and rename to "jrawMonitorID".
14252
</change>
14253
<change date="1 Jan 2003">
14254
Include origin information.
14255
Clean-up JVMDI issue references.
14256
Remove Deallocate warnings which are now automatically generated.
14257
</change>
14258
<change date="2 Jan 2003">
14259
Fix representation issues for jthread.
14260
</change>
14261
<change date="3 Jan 2003">
14262
Make capabilities buffered out to 64 bits - and do it automatically.
14263
</change>
14264
<change date="4 Jan 2003">
14265
Make constants which are enumeration into enum types.
14266
Parameters now of enum type.
14267
Clean-up and index type section.
14268
Replace remaining datadef entities with callback.
14269
</change>
14270
<change date="7 Jan 2003">
14271
Correct GenerateEvents description.
14272
More internal semantics work.
14273
</change>
14274
<change date="9 Jan 2003">
14275
Replace previous GetSystemProperties with two functions
14276
which use allocated information instead fixed.
14277
Add SetSystemProperty.
14278
More internal semantics work.
14279
</change>
14280
<change date="12 Jan 2003">
14281
Add varargs to end of SetEventNotificationMode.
14282
</change>
14283
<change date="20 Jan 2003">
14284
Finish fixing spec to reflect that alloc sizes are jlong.
14285
</change>
14286
<change date="22 Jan 2003">
14287
Allow NULL as RunAgentThread arg.
14288
</change>
14289
<change date="22 Jan 2003">
14290
Fixed names to standardized naming convention
14291
Removed AsyncGetStackTrace.
14292
</change>
14293
<change date="29 Jan 2003">
14294
Since we are using jthread, removed GetThread.
14295
</change>
14296
<change date="31 Jan 2003">
14297
Change GetFieldName to allow NULLs like GetMethodName.
14298
</change>
14299
<change date="29 Feb 2003" version="v40">
14300
Rewrite the introductory text, adding sections on
14301
start-up, environments and bytecode instrumentation.
14302
Change the command line arguments per EG discussions.
14303
Add an introduction to the capabilities section.
14304
Add the extension mechanism category and functions.
14305
Mark for deletion, but clarified anyhow, SuspendAllThreads.
14306
Rename IterateOverLiveObjects to IterateOverReachableObjects and
14307
change the text accordingly.
14308
Clarify IterateOverHeap.
14309
Clarify CompiledMethodLoad.
14310
Discuss prerequisite state for Calling Functions.
14311
Clarify SetAllocationHooks.
14312
Added issues ("To be resolved:") through-out.
14313
And so on...
14314
</change>
14315
<change date="6 Mar 2003" version="v41">
14316
Remove struct from the call to GetOwnedMonitorInfo.
14317
Automatically generate most error documentation, remove
14318
(rather broken) hand written error doc.
14319
Better describe capability use (empty initial set).
14320
Add min value to jint params.
14321
Remove the capability can_access_thread_local_storage.
14322
Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
14323
same for *NOT_IMPLEMENTED.
14324
Description fixes.
14325
</change>
14326
<change date="8 Mar 2003" version="v42">
14327
Rename GetClassSignature to GetClassName.
14328
Rename IterateOverClassObjects to IterateOverInstancesOfClass.
14329
Remove GetMaxStack (operand stack isn't used in <jvmti/>).
14330
Description fixes: define launch-time, remove native frame pop
14331
from PopFrame, and assorted clarifications.
14332
</change>
14333
<change date="8 Mar 2003" version="v43">
14334
Fix minor editing problem.
14335
</change>
14336
<change date="10 Mar 2003" version="v44">
14337
Add phase information.
14338
Remap (compact) event numbers.
14339
</change>
14340
<change date="11 Mar 2003" version="v45">
14341
More phase information - allow "any".
14342
Elide raw monitor queries and events.
14343
Minor description fixes.
14344
</change>
14345
<change date="12 Mar 2003" version="v46">
14346
Add GetPhase.
14347
Use "phase" through document.
14348
Elide GetRawMonitorName.
14349
Elide GetObjectMonitors.
14350
</change>
14351
<change date="12 Mar 2003" version="v47">
14352
Fixes from link, XML, and spell checking.
14353
Auto-generate the callback structure.
14354
</change>
14355
<change date="13 Mar 2003" version="v48">
14356
One character XML fix.
14357
</change>
14358
<change date="13 Mar 2003" version="v49">
14359
Change function parameter names to be consistent with
14360
event parameters (fooBarBaz becomes foo_bar_baz).
14361
</change>
14362
<change date="14 Mar 2003" version="v50">
14363
Fix broken link. Fix thread markers.
14364
</change>
14365
<change date="14 Mar 2003" version="v51">
14366
Change constants so they are under 128 to workaround
14367
compiler problems.
14368
</change>
14369
<change date="23 Mar 2003" version="v52">
14370
Overhaul capabilities. Separate GetStackTrace into
14371
GetStackTrace and GetStackFrames.
14372
</change>
14373
<change date="8 Apr 2003" version="v54">
14374
Use depth instead of jframeID to reference frames.
14375
Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.
14376
Remove frame arg from events.
14377
</change>
14378
<change date="9 Apr 2003" version="v55">
14379
Remove GetObjectWithAnnotation since tests show bufferred approach more efficient.
14380
Add missing annotation_count to GetObjectsWithAnnotations
14381
</change>
14382
<change date="10 Apr 2003" version="v56">
14383
Remove confusing parenthetical statement in GetObjectsWithAnnotations
14384
</change>
14385
<change date="13 Apr 2003" version="v58">
14386
Replace jclass/jmethodID representation of method with simply jmethodID;
14387
Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.
14388
Replace can_access_frames with can_access_local_variables; remove from purely stack access.
14389
Use can_get_synthetic_attribute; fix description.
14390
Clarify that zero length arrays must be deallocated.
14391
Clarify RelinquishCapabilities.
14392
Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.
14393
</change>
14394
<change date="27 Apr 2003" version="v59">
14395
Remove lingering indirect references to OBSOLETE_METHOD_ID.
14396
</change>
14397
<change date="4 May 2003" version="v60">
14398
Allow DestroyRawMonitor during OnLoad.
14399
</change>
14400
<change date="7 May 2003" version="v61">
14401
Added not monitor owner error return to DestroyRawMonitor.
14402
</change>
14403
<change date="13 May 2003" version="v62">
14404
Clarify semantics of raw monitors.
14405
Change flags on <code>GetThreadStatus</code>.
14406
<code>GetClassLoader</code> return NULL for the bootstrap class loader.
14407
Add <code>GetClassName</code> issue.
14408
Define local variable signature.
14409
Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.
14410
Remove over specification in <code>GetObjectsWithAnnotations</code>.
14411
Elide <code>SetAllocationHooks</code>.
14412
Elide <code>SuspendAllThreads</code>.
14413
</change>
14414
<change date="14 May 2003" version="v63">
14415
Define the data type <code>jvmtiEventCallbacks</code>.
14416
Zero length allocations return NULL.
14417
Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.
14418
Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.
14419
</change>
14420
<change date="15 May 2003" version="v64">
14421
Better wording, per review.
14422
</change>
14423
<change date="15 May 2003" version="v65">
14424
First Alpha.
14425
Make jmethodID and jfieldID unique, jclass not used.
14426
</change>
14427
<change date="27 May 2003" version="v66">
14428
Fix minor XSLT errors.
14429
</change>
14430
<change date="13 June 2003" version="v67">
14431
Undo making jfieldID unique (jmethodID still is).
14432
</change>
14433
<change date="17 June 2003" version="v68">
14434
Changes per June 11th Expert Group meeting --
14435
Overhaul Heap functionality: single callback,
14436
remove GetHeapRoots, add reachable iterators,
14437
and rename "annotation" to "tag".
14438
NULL thread parameter on most functions is current
14439
thread.
14440
Add timers.
14441
Remove ForceExit.
14442
Add GetEnvironmentLocalStorage.
14443
Add verbose flag and event.
14444
Add AddToBootstrapClassLoaderSearch.
14445
Update ClassFileLoadHook.
14446
</change>
14447
<change date="18 June 2003" version="v69">
14448
Clean up issues sections.
14449
Rename GetClassName back to GetClassSignature and
14450
fix description.
14451
Add generic signature to GetClassSignature,
14452
GetFieldSignature, GetMethodSignature, and
14453
GetLocalVariableTable.
14454
Elide EstimateCostOfCapabilities.
14455
Clarify that the system property functions operate
14456
on the VM view of system properties.
14457
Clarify Agent_OnLoad.
14458
Remove "const" from JNIEnv* in events.
14459
Add metadata accessors.
14460
</change>
14461
<change date="18 June 2003" version="v70">
14462
Add start_depth to GetStackTrace.
14463
Move system properties to a new category.
14464
Add GetObjectSize.
14465
Remove "X" from command line flags.
14466
XML, HTML, and spell check corrections.
14467
</change>
14468
<change date="19 June 2003" version="v71">
14469
Fix JVMTI_HEAP_ROOT_THREAD to be 6.
14470
Make each synopsis match the function name.
14471
Fix unclear wording.
14472
</change>
14473
<change date="26 June 2003" version="v72">
14474
SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value
14475
to be set to NULL.
14476
NotifyFramePop, GetFrameLocationm and all the local variable operations
14477
needed to have their wording about frames fixed.
14478
Grammar and clarity need to be fixed throughout.
14479
Capitalization and puntuation need to be consistent.
14480
Need micro version number and masks for accessing major, minor, and micro.
14481
The error code lists should indicate which must be returned by
14482
an implementation.
14483
The command line properties should be visible in the properties functions.
14484
Disallow popping from the current thread.
14485
Allow implementations to return opaque frame error when they cannot pop.
14486
The NativeMethodBind event should be sent during any phase.
14487
The DynamicCodeGenerated event should be sent during any phase.
14488
The following functions should be allowed to operate before VMInit:
14489
Set/GetEnvironmentLocalStorage
14490
GetMethodDeclaringClass
14491
GetClassSignature
14492
GetClassModifiers
14493
IsInterface
14494
IsArrayClass
14495
GetMethodName
14496
GetMethodModifiers
14497
GetMaxLocals
14498
GetArgumentsSize
14499
GetLineNumberTable
14500
GetMethodLocation
14501
IsMethodNative
14502
IsMethodSynthetic.
14503
Other changes (to XSL):
14504
Argument description should show asterisk after not before pointers.
14505
NotifyFramePop, GetFrameLocationm and all the local variable operations
14506
should hsve the NO_MORE_FRAMES error added.
14507
Not alive threads should have a different error return than invalid thread.
14508
</change>
14509
<change date="7 July 2003" version="v73">
14510
VerboseOutput event was missing message parameter.
14511
Minor fix-ups.
14512
</change>
14513
<change date="14 July 2003" version="v74">
14514
Technical Publications Department corrections.
14515
Allow thread and environment local storage to be set to NULL.
14516
</change>
14517
<change date="23 July 2003" version="v75">
14518
Use new Agent_OnLoad rather than overloaded JVM_OnLoad.
14519
Add JNICALL to callbacks (XSL).
14520
Document JNICALL requirement for both events and callbacks (XSL).
14521
Restrict RedefineClasses to methods and attributes.
14522
Elide the VerboseOutput event.
14523
VMObjectAlloc: restrict when event is sent and remove method parameter.
14524
Finish loose ends from Tech Pubs edit.
14525
</change>
14526
<change date="24 July 2003" version="v76">
14527
Change ClassFileLoadHook event to send the class instead of a boolean of redefine.
14528
</change>
14529
<change date="24 July 2003" version="v77">
14530
XML fixes.
14531
Minor text clarifications and corrections.
14532
</change>
14533
<change date="24 July 2003" version="v78">
14534
Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.
14535
Clarify that stack frames are JVM Spec frames.
14536
Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,
14537
and can_get_source_debug_extension.
14538
PopFrame cannot have a native calling method.
14539
Removed incorrect statement in GetClassloaderClasses
14540
(see <vmspec chapter="4.4"/>).
14541
</change>
14542
<change date="24 July 2003" version="v79">
14543
XML and text fixes.
14544
Move stack frame description into Stack Frame category.
14545
</change>
14546
<change date="26 July 2003" version="v80">
14547
Allow NULL (means bootstrap loader) for GetClassloaderClasses.
14548
Add new heap reference kinds for references from classes.
14549
Add timer information struct and query functions.
14550
Add AvailableProcessors.
14551
Rename GetOtherThreadCpuTime to GetThreadCpuTime.
14552
Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE
14553
to SetEventNotification mode.
14554
Add initial thread to the VM_INIT event.
14555
Remove platform assumptions from AddToBootstrapClassLoaderSearch.
14556
</change>
14557
<change date="26 July 2003" version="v81">
14558
Grammar and clarity changes per review.
14559
</change>
14560
<change date="27 July 2003" version="v82">
14561
More grammar and clarity changes per review.
14562
Add Agent_OnUnload.
14563
</change>
14564
<change date="28 July 2003" version="v83">
14565
Change return type of Agent_OnUnload to void.
14566
</change>
14567
<change date="28 July 2003" version="v84">
14568
Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.
14569
</change>
14570
<change date="28 July 2003" version="v85">
14571
Steal java.lang.Runtime.availableProcessors() wording for
14572
AvailableProcessors().
14573
Guarantee that zero will never be an event ID.
14574
Remove some issues which are no longer issues.
14575
Per review, rename and more completely document the timer
14576
information functions.
14577
</change>
14578
<change date="29 July 2003" version="v86">
14579
Non-spec visible change to XML controlled implementation:
14580
SetThreadLocalStorage must run in VM mode.
14581
</change>
14582
<change date="5 August 2003" version="0.1.87">
14583
Add GetErrorName.
14584
Add varargs warning to jvmtiExtensionEvent.
14585
Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.
14586
Remove unused can_get_exception_info capability.
14587
Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.
14588
Fix jvmtiExtensionFunctionInfo.func declared type.
14589
Extension function returns error code.
14590
Use new version numbering.
14591
</change>
14592
<change date="5 August 2003" version="0.2.88">
14593
Remove the ClassUnload event.
14594
</change>
14595
<change date="8 August 2003" version="0.2.89">
14596
Heap reference iterator callbacks return an enum that
14597
allows outgoing object references to be ignored.
14598
Allow JNIEnv as a param type to extension events/functions.
14599
</change>
14600
<change date="15 August 2003" version="0.2.90">
14601
Fix a typo.
14602
</change>
14603
<change date="2 September 2003" version="0.2.91">
14604
Remove all metadata functions: GetClassMetadata,
14605
GetFieldMetadata, and GetMethodMetadata.
14606
</change>
14607
<change date="1 October 2003" version="0.2.92">
14608
Mark the functions Allocate. Deallocate, RawMonitor*,
14609
SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage
14610
as safe for use in heap callbacks and GC events.
14611
</change>
14612
<change date="24 November 2003" version="0.2.93">
14613
Add pass through opaque user data pointer to heap iterate
14614
functions and callbacks.
14615
In the CompiledMethodUnload event, send the code address.
14616
Add GarbageCollectionOccurred event.
14617
Add constant pool reference kind.
14618
Mark the functions CreateRawMonitor and DestroyRawMonitor
14619
as safe for use in heap callbacks and GC events.
14620
Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,
14621
GetThreadCpuTimerInfo, IterateOverReachableObjects,
14622
IterateOverObjectsReachableFromObject, GetTime and
14623
JVMTI_ERROR_NULL_POINTER.
14624
Add missing errors to: GenerateEvents and
14625
AddToBootstrapClassLoaderSearch.
14626
Fix description of ClassFileLoadHook name parameter.
14627
In heap callbacks and GC/ObjectFree events, specify
14628
that only explicitly allowed functions can be called.
14629
Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,
14630
GetTimerInfo, and GetTime during callback.
14631
Allow calling SetTag/GetTag during the onload phase.
14632
SetEventNotificationMode, add: error attempted inappropriate
14633
thread level control.
14634
Remove jvmtiExceptionHandlerEntry.
14635
Fix handling of native methods on the stack --
14636
location_ptr param of GetFrameLocation, remove
14637
JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,
14638
jvmtiFrameInfo.location, and jlocation.
14639
Remove typo (from JVMPI) implying that the MonitorWaited
14640
event is sent on sleep.
14641
</change>
14642
<change date="25 November 2003" version="0.2.94">
14643
Clarifications and typos.
14644
</change>
14645
<change date="3 December 2003" version="0.2.95">
14646
Allow NULL user_data in heap iterators.
14647
</change>
14648
<change date="28 January 2004" version="0.2.97">
14649
Add GetThreadState, deprecate GetThreadStatus.
14650
</change>
14651
<change date="29 January 2004" version="0.2.98">
14652
INVALID_SLOT and TYPE_MISMATCH errors should be optional.
14653
</change>
14654
<change date="12 February 2004" version="0.2.102">
14655
Remove MonitorContendedExit.
14656
Added JNIEnv parameter to VMObjectAlloc.
14657
Clarified definition of class_tag and referrer_index
14658
parameters to heap callbacks.
14659
</change>
14660
<change date="16 Febuary 2004" version="0.2.103">
14661
Document JAVA_TOOL_OPTIONS.
14662
</change>
14663
<change date="17 Febuary 2004" version="0.2.105">
14664
Divide start phase into primordial and start.
14665
Add VMStart event
14666
Change phase associations of functions and events.
14667
</change>
14668
<change date="18 Febuary 2004" version="0.3.6">
14669
Elide deprecated GetThreadStatus.
14670
Bump minor version, subtract 100 from micro version
14671
</change>
14672
<change date="18 Febuary 2004" version="0.3.7">
14673
Document that timer nanosecond values are unsigned.
14674
Clarify text having to do with native methods.
14675
</change>
14676
<change date="19 Febuary 2004" version="0.3.8">
14677
Fix typos.
14678
Remove elided deprecated GetThreadStatus.
14679
</change>
14680
<change date="23 Febuary 2004" version="0.3.9">
14681
Require NotifyFramePop to act on suspended threads.
14682
</change>
14683
<change date="24 Febuary 2004" version="0.3.10">
14684
Add capabilities
14685
(<internallink id="jvmtiCapabilities.can_redefine_any_class"
14686
><code>can_redefine_any_class</code></internallink>
14687
and
14688
<internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"
14689
><code>can_generate_all_class_hook_events</code></internallink>)
14690
and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)
14691
which allow some classes to be unmodifiable.
14692
</change>
14693
<change date="28 Febuary 2004" version="0.3.11">
14694
Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.
14695
</change>
14696
<change date="8 March 2004" version="0.3.12">
14697
Clarified CompiledMethodUnload so that it is clear the event
14698
may be posted after the class has been unloaded.
14699
</change>
14700
<change date="5 March 2004" version="0.3.13">
14701
Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.
14702
</change>
14703
<change date="13 March 2004" version="0.3.14">
14704
Added guideline for the use of the JNI FindClass function in event
14705
callback functions.
14706
</change>
14707
<change date="15 March 2004" version="0.3.15">
14708
Add GetAllStackTraces and GetThreadListStackTraces.
14709
</change>
14710
<change date="19 March 2004" version="0.3.16">
14711
ClassLoad and ClassPrepare events can be posted during start phase.
14712
</change>
14713
<change date="25 March 2004" version="0.3.17">
14714
Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,
14715
GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.
14716
</change>
14717
<change date="29 March 2004" version="0.3.18">
14718
Return the timer kind in the timer information structure.
14719
</change>
14720
<change date="31 March 2004" version="0.3.19">
14721
Spec clarifications:
14722
JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.
14723
ForceGarbageCollection does not run finalizers.
14724
The context of the specification is the Java platform.
14725
Warn about early instrumentation.
14726
</change>
14727
<change date="1 April 2004" version="0.3.20">
14728
Refinements to the above clarifications and
14729
Clarify that an error returned by Agent_OnLoad terminates the VM.
14730
</change>
14731
<change date="1 April 2004" version="0.3.21">
14732
Array class creation does not generate a class load event.
14733
</change>
14734
<change date="7 April 2004" version="0.3.22">
14735
Align thread state hierarchy more closely with java.lang.Thread.State.
14736
</change>
14737
<change date="12 April 2004" version="0.3.23">
14738
Clarify the documentation of thread state.
14739
</change>
14740
<change date="19 April 2004" version="0.3.24">
14741
Remove GarbageCollectionOccurred event -- can be done by agent.
14742
</change>
14743
<change date="22 April 2004" version="0.3.25">
14744
Define "command-line option".
14745
</change>
14746
<change date="29 April 2004" version="0.3.26">
14747
Describe the intended use of bytecode instrumentation.
14748
Fix description of extension event first parameter.
14749
</change>
14750
<change date="30 April 2004" version="0.3.27">
14751
Clarification and typos.
14752
</change>
14753
<change date="18 May 2004" version="0.3.28">
14754
Remove DataDumpRequest event.
14755
</change>
14756
<change date="18 May 2004" version="0.3.29">
14757
Clarify RawMonitorWait with zero timeout.
14758
Clarify thread state after RunAgentThread.
14759
</change>
14760
<change date="24 May 2004" version="0.3.30">
14761
Clean-up: fix bad/old links, etc.
14762
</change>
14763
<change date="30 May 2004" version="0.3.31">
14764
Clarifications including:
14765
All character strings are modified UTF-8.
14766
Agent thread visibiity.
14767
Meaning of obsolete method version.
14768
Thread invoking heap callbacks,
14769
</change>
14770
<change date="1 June 2004" version="1.0.32">
14771
Bump major.minor version numbers to "1.0".
14772
</change>
14773
<change date="2 June 2004" version="1.0.33">
14774
Clarify interaction between ForceGarbageCollection
14775
and ObjectFree.
14776
</change>
14777
<change date="6 June 2004" version="1.0.34">
14778
Restrict AddToBootstrapClassLoaderSearch and
14779
SetSystemProperty to the OnLoad phase only.
14780
</change>
14781
<change date="11 June 2004" version="1.0.35">
14782
Fix typo in SetTag.
14783
</change>
14784
<change date="18 June 2004" version="1.0.36">
14785
Fix trademarks.
14786
Add missing parameter in example GetThreadState usage.
14787
</change>
14788
<change date="4 August 2004" version="1.0.37">
14789
Copyright updates.
14790
</change>
14791
<change date="5 November 2004" version="1.0.38">
14792
Add missing function table layout.
14793
Add missing description of C++ member function format of functions.
14794
Clarify that name in CFLH can be NULL.
14795
Released as part of <tm>J2SE</tm> 5.0.
14796
</change>
14797
<change date="24 April 2005" version="1.1.47">
14798
Bump major.minor version numbers to "1.1".
14799
Add ForceEarlyReturn* functions.
14800
Add GetOwnedMonitorStackDepthInfo function.
14801
Add GetCurrentThread function.
14802
Add "since" version marker.
14803
Add AddToSystemClassLoaderSearch.
14804
Allow AddToBootstrapClassLoaderSearch be used in live phase.
14805
Fix historic rubbish in the descriptions of the heap_object_callback
14806
parameter of IterateOverHeap and IterateOverInstancesOfClass functions;
14807
disallow NULL for this parameter.
14808
Clarify, correct and make consistent: wording about current thread,
14809
opaque frames and insufficient number of frames in PopFrame.
14810
Consistently use "current frame" rather than "topmost".
14811
Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*
14812
by making them compatible with those in ForceEarlyReturn*.
14813
Many other clarifications and wording clean ups.
14814
</change>
14815
<change date="25 April 2005" version="1.1.48">
14816
Add GetConstantPool.
14817
Switch references to the first edition of the VM Spec, to the seconds edition.
14818
</change>
14819
<change date="26 April 2005" version="1.1.49">
14820
Clarify minor/major version order in GetConstantPool.
14821
</change>
14822
<change date="26 April 2005" version="1.1.50">
14823
Add SetNativeMethodPrefix and SetNativeMethodPrefixes.
14824
Reassign GetOwnedMonitorStackDepthInfo to position 153.
14825
Break out Class Loader Search in its own documentation category.
14826
Deal with overly long lines in XML source.
14827
</change>
14828
<change date="29 April 2005" version="1.1.51">
14829
Allow agents be started in the live phase.
14830
Added paragraph about deploying agents.
14831
</change>
14832
<change date="30 April 2005" version="1.1.52">
14833
Add specification description to SetNativeMethodPrefix(es).
14834
Better define the conditions on GetConstantPool.
14835
</change>
14836
<change date="30 April 2005" version="1.1.53">
14837
Break out the GetClassVersionNumber function from GetConstantPool.
14838
Clean-up the references to the VM Spec.
14839
</change>
14840
<change date="1 May 2005" version="1.1.54">
14841
Allow SetNativeMethodPrefix(es) in any phase.
14842
Add clarifications about the impact of redefinition on GetConstantPool.
14843
</change>
14844
<change date="2 May 2005" version="1.1.56">
14845
Various clarifications to SetNativeMethodPrefix(es).
14846
</change>
14847
<change date="2 May 2005" version="1.1.57">
14848
Add missing performance warning to the method entry event.
14849
</change>
14850
<change date="5 May 2005" version="1.1.58">
14851
Remove internal JVMDI support.
14852
</change>
14853
<change date="8 May 2005" version="1.1.59">
14854
Add <functionlink id="RetransformClasses"/>.
14855
Revamp the bytecode instrumentation documentation.
14856
Change <functionlink id="IsMethodObsolete"/> to no longer
14857
require the can_redefine_classes capability.
14858
</change>
14859
<change date="11 May 2005" version="1.1.63">
14860
Clarifications for retransformation.
14861
</change>
14862
<change date="11 May 2005" version="1.1.64">
14863
Clarifications for retransformation, per review.
14864
Lock "retransformation (in)capable" at class load enable time.
14865
</change>
14866
<change date="4 June 2005" version="1.1.67">
14867
Add new heap functionity which supports reporting primitive values,
14868
allows setting the referrer tag, and has more powerful filtering:
14869
FollowReferences, IterateThroughHeap, and their associated
14870
callbacks, structs, enums, and constants.
14871
</change>
14872
<change date="4 June 2005" version="1.1.68">
14873
Clarification.
14874
</change>
14875
<change date="6 June 2005" version="1.1.69">
14876
FollowReferences, IterateThroughHeap: Put callbacks in a struct;
14877
Add missing error codes; reduce bits in the visit control flags.
14878
</change>
14879
<change date="14 June 2005" version="1.1.70">
14880
More on new heap functionity: spec clean-up per review.
14881
</change>
14882
<change date="15 June 2005" version="1.1.71">
14883
More on new heap functionity: Rename old heap section to Heap (1.0).
14884
</change>
14885
<change date="21 June 2005" version="1.1.72">
14886
Fix typos.
14887
</change>
14888
<change date="27 June 2005" version="1.1.73">
14889
Make referrer info structure a union.
14890
</change>
14891
<change date="9 September 2005" version="1.1.74">
14892
In new heap functions:
14893
Add missing superclass reference kind.
14894
Use a single scheme for computing field indexes.
14895
Remove outdated references to struct based referrer info.
14896
</change>
14897
<change date="12 September 2005" version="1.1.75">
14898
Don't callback during FollowReferences on frivolous java.lang.Object superclass.
14899
</change>
14900
<change date="13 September 2005" version="1.1.76">
14901
In string primitive callback, length now Unicode length.
14902
In array and string primitive callbacks, value now "const".
14903
Note possible compiler impacts on setting JNI function table.
14904
</change>
14905
<change date="13 September 2005" version="1.1.77">
14906
GetClassVersionNumbers() and GetConstantPool() should return
14907
error on array or primitive class.
14908
</change>
14909
<change date="14 September 2005" version="1.1.78">
14910
Grammar fixes.
14911
</change>
14912
<change date="26 September 2005" version="1.1.79">
14913
Add IsModifiableClass query.
14914
</change>
14915
<change date="9 February 2006" version="1.1.81">
14916
Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.
14917
</change>
14918
<change date="13 February 2006" version="1.1.82">
14919
Doc fixes: update can_redefine_any_class to include retransform.
14920
Clarify that exception events cover all Throwables.
14921
In GetStackTrace, no test is done for start_depth too big if start_depth is zero,
14922
Clarify fields reported in Primitive Field Callback -- static vs instance.
14923
Repair confusing names of heap types, including callback names.
14924
Require consistent usage of stack depth in the face of thread launch methods.
14925
Note incompatibility of <jvmti/> memory management with other systems.
14926
</change>
14927
<change date="14 February 2006" version="1.1.85">
14928
Fix typos and missing renames.
14929
</change>
14930
<change date="13 March 2006" version="1.1.86">
14931
Clarify that jmethodIDs and jfieldIDs can be saved.
14932
Clarify that Iterate Over Instances Of Class includes subclasses.
14933
</change>
14934
<change date="14 March 2006" version="1.1.87">
14935
Better phrasing.
14936
</change>
14937
<change date="16 March 2006" version="1.1.88">
14938
Match the referrer_index for static fields in Object Reference Callback
14939
with the Reference Implementation (and all other known implementations);
14940
that is, make it match the definition for instance fields.
14941
In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover
14942
an invalid thread in the list; and specify that not started threads
14943
return empty stacks.
14944
</change>
14945
<change date="17 March 2006" version="1.1.89">
14946
Typo.
14947
</change>
14948
<change date="25 March 2006" version="1.1.90">
14949
Typo.
14950
</change>
14951
<change date="6 April 2006" version="1.1.91">
14952
Remove restrictions on AddToBootstrapClassLoaderSearch and
14953
AddToSystemClassLoaderSearch.
14954
</change>
14955
<change date="1 May 2006" version="1.1.93">
14956
Changed spec to return -1 for monitor stack depth for the
14957
implementation which can not determine stack depth.
14958
</change>
14959
<change date="3 May 2006" version="1.1.94">
14960
Corrections for readability and accuracy courtesy of Alan Pratt of IBM.
14961
List the object relationships reported in FollowReferences.
14962
</change>
14963
<change date="5 May 2006" version="1.1.95">
14964
Clarify the object relationships reported in FollowReferences.
14965
</change>
14966
<change date="28 June 2006" version="1.1.98">
14967
Clarify DisposeEnvironment; add warning.
14968
Fix typos in SetLocalXXX "retrieve" => "set".
14969
Clarify that native method prefixes must remain set while used.
14970
Clarify that exactly one Agent_OnXXX is called per agent.
14971
Clarify that library loading is independent from start-up.
14972
Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.
14973
</change>
14974
<change date="31 July 2006" version="1.1.99">
14975
Clarify the interaction between functions and exceptions.
14976
Clarify and give examples of field indices.
14977
Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.
14978
Update links to point to Java 6.
14979
</change>
14980
<change date="6 August 2006" version="1.1.102">
14981
Add ResourceExhaustedEvent.
14982
</change>
14983
<change date="11 October 2012" version="1.2.2">
14984
Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.
14985
</change>
14986
<change date="19 June 2013" version="1.2.3">
14987
Added support for statically linked agents.
14988
</change>
14989
<change date="13 October 2016" version="9.0.0">
14990
Support for modules:
14991
- The majorversion is 9 now
14992
- The ClassFileLoadHook events are not sent during the primordial phase anymore.
14993
- Allow CompiledMethodLoad events at start phase
14994
- Add new capabilities:
14995
- can_generate_early_vmstart
14996
- can_generate_early_class_hook_events
14997
- Add new functions:
14998
- GetAllModules
14999
- AddModuleReads, AddModuleExports, AddModuleOpens, AddModuleUses, AddModuleProvides
15000
- IsModifiableModule
15001
Clarified can_redefine_any_classes, can_retransform_any_classes and IsModifiableClass API to
15002
disallow some implementation defined classes.
15003
</change>
15004
<change date="12 February 2017" version="9.0.0">
15005
Minor update for GetCurrentThread function:
15006
- The function may return NULL in the start phase if the
15007
can_generate_early_vmstart capability is enabled.
15008
</change>
15009
<change date="7 February 2018" version="11.0.0">
15010
Minor update for new class file NestHost and NestMembers attributes:
15011
- Specify that RedefineClasses and RetransformClasses are not allowed
15012
to change the class file NestHost and NestMembers attributes.
15013
- Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED
15014
that can be returned by RedefineClasses and RetransformClasses.
15015
</change>
15016
<change date="20 May 2019" version="13.0.0">
15017
Minor spec update for the capability "can_redefine_any_class".
15018
It now says:
15019
"RedefineClasses can be called on any modifiable class. See IsModifiableClass.
15020
(can_redefine_classes must also be set)"
15021
</change>
15022
<change date="5 June 2019" version="13.0.0">
15023
Minor PopFrame spec update:
15024
- The specified thread must be suspended or must be the current thread.
15025
(It was not allowed to be the current thread before.)
15026
</change>
15027
<change date="10 October 2019" version="14.0.0">
15028
Minor update for new class file Record attribute:
15029
- Specify that RedefineClasses and RetransformClasses are not allowed
15030
to change the class file Record attribute.
15031
</change>
15032
<change date="13 May 2020" version="15.0.0">
15033
Minor update for new class file PermittedSubclasses attribute:
15034
- Specify that RedefineClasses and RetransformClasses are not allowed
15035
to change the class file PermittedSubclasses attribute.
15036
</change>
15037
</changehistory>
15038
15039
</specification>
15040
<!-- Keep this comment at the end of the file
15041
Local variables:
15042
mode: sgml
15043
sgml-omittag:t
15044
sgml-shorttag:t
15045
sgml-namecase-general:t
15046
sgml-general-insert-case:lower
15047
sgml-minimize-attributes:nil
15048
sgml-always-quote-attributes:t
15049
sgml-indent-step:2
15050
sgml-indent-data:t
15051
sgml-parent-document:nil
15052
sgml-exposed-tags:nil
15053
sgml-local-catalogs:nil
15054
sgml-local-ecat-files:nil
15055
End:
15056
-->
15057
15058