1 <?xml version="1.0" encoding="UTF-8"?>
2 <?xml-stylesheet type="text/xsl" href="jvmti.xsl"?>
3 <!--
4 Copyright (c) 2002, 2026, 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 <!ATTLIST jobject frame CDATA #IMPLIED>
138
139 <!ELEMENT jvalue EMPTY>
140 <!ELEMENT jchar EMPTY>
141 <!ELEMENT jint EMPTY>
142 <!ATTLIST jint min CDATA #IMPLIED>
143 <!ELEMENT jlong EMPTY>
144 <!ELEMENT jfloat EMPTY>
145 <!ELEMENT jdouble EMPTY>
146 <!ELEMENT jlocation EMPTY>
147 <!ELEMENT jboolean EMPTY>
148 <!ELEMENT char EMPTY>
149 <!ELEMENT uchar EMPTY>
150 <!ELEMENT size_t EMPTY>
151 <!ELEMENT void EMPTY>
152 <!ELEMENT enum (#PCDATA)*>
153 <!ELEMENT struct (#PCDATA)*>
154
155 <!ELEMENT nullok ANY>
156
157 <!ELEMENT ptrtype ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
158 jthreadGroup|jobject|jvalue), nullok?)>
159
160 <!ELEMENT outptr ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
161 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|
162 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
163 <!ATTLIST outptr impl CDATA #IMPLIED>
164
165 <!ELEMENT allocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
166 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
167 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
168 <!ATTLIST allocbuf incount CDATA #IMPLIED
169 outcount CDATA #IMPLIED>
170
171 <!ELEMENT allocallocbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
172 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
173 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
174 <!ATTLIST allocallocbuf incount CDATA #IMPLIED
175 outcount CDATA #IMPLIED>
176
177 <!ELEMENT inptr (struct, nullok?)>
178
179 <!ELEMENT inbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
180 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
181 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
182 <!ATTLIST inbuf incount CDATA #IMPLIED>
183
184 <!ELEMENT outbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
185 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
186 jlocation|jboolean|char|uchar|size_t|void|outbuf), nullok?)>
187 <!ATTLIST outbuf incount CDATA #IMPLIED
188 outcount CDATA #IMPLIED>
189
190 <!ELEMENT vmbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
191 jthreadGroup|jobject|jvalue|enum|jchar|jint|jlong|jfloat|jdouble|
192 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
193 <!ATTLIST vmbuf incount CDATA #IMPLIED
194 outcount CDATA #IMPLIED>
195
196 <!ELEMENT agentbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
197 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
198 jlocation|jboolean|char|uchar|size_t|void), nullok?)>
199 <!ATTLIST agentbuf incount CDATA #IMPLIED
200 outcount CDATA #IMPLIED>
201
202 <!ELEMENT allocfieldbuf ((struct|jmethodID|jfieldID|jframeID|jrawMonitorID|jclass|jthread|
203 jthreadGroup|jobject|jvalue|enum|jint|jlong|jfloat|jdouble|
204 jlocation|jboolean|char|uchar|size_t|void))>
205 <!ATTLIST allocfieldbuf outcount CDATA #IMPLIED>
206
207 <!ELEMENT errors (error*)>
208
209 <!ELEMENT error ANY>
210 <!ATTLIST error id CDATA #REQUIRED>
211
212 <!ELEMENT errorsection (intro*, errorcategory*)>
213 <!ATTLIST errorsection label CDATA #REQUIRED>
214
215 <!ELEMENT errorcategory (intro*, errorid*)>
216 <!ATTLIST errorcategory id CDATA #REQUIRED
217 label CDATA #REQUIRED>
218
219 <!ELEMENT errorid ANY>
220 <!ATTLIST errorid id CDATA #REQUIRED
221 num CDATA #REQUIRED>
222
223 <!ELEMENT datasection (intro*, basetypes*)>
224
225 <!ELEMENT basetypes (intro*, basetype*)>
226 <!ATTLIST basetypes id CDATA #REQUIRED
227 label CDATA #REQUIRED>
228
229 <!ELEMENT basetype (definition?,description)>
230 <!ATTLIST basetype id CDATA #REQUIRED
231 name CDATA #IMPLIED>
232
233 <!ELEMENT definition (#PCDATA|jvmti)*>
234
235 <!ELEMENT eventsection (intro*, (event|elide)*)>
236 <!ATTLIST eventsection label CDATA #REQUIRED>
237
238 <!ELEMENT event (description, origin, typedef*, capabilities, parameters)>
239 <!ATTLIST event id CDATA #REQUIRED
240 label CDATA #REQUIRED
241 const CDATA #REQUIRED
242 num CDATA #REQUIRED
243 phase (onload|start|live|any) #IMPLIED
244 filtered (thread|global) #IMPLIED
245 since CDATA "1.0">
246
247 <!ELEMENT issuessection (intro*)>
248 <!ATTLIST issuessection label CDATA #REQUIRED>
249
250 <!ELEMENT changehistory (intro*, change*)>
251 <!ATTLIST changehistory update CDATA #REQUIRED
252 id CDATA #REQUIRED>
253
254 <!ELEMENT change ANY>
255 <!ATTLIST change date CDATA #REQUIRED
256 version CDATA #IMPLIED>
257
258 <!ELEMENT functionlink (#PCDATA|jvmti|code|i|b)*>
259 <!ATTLIST functionlink id CDATA #REQUIRED>
260
261 <!ELEMENT datalink (#PCDATA|jvmti|code|i|b)*>
262 <!ATTLIST datalink id CDATA #REQUIRED>
263
264 <!ELEMENT typelink (#PCDATA|jvmti|code|i|b)*>
265 <!ATTLIST typelink id CDATA #REQUIRED>
266
267 <!ELEMENT fieldlink (#PCDATA|jvmti|code|i|b)*>
268 <!ATTLIST fieldlink id CDATA #REQUIRED
269 struct CDATA #REQUIRED>
270
271 <!ELEMENT paramlink (#PCDATA|jvmti|code|i|b)*>
272 <!ATTLIST paramlink id CDATA #REQUIRED>
273
274 <!ELEMENT eventlink (#PCDATA|jvmti|code|i|b)*>
275 <!ATTLIST eventlink id CDATA #REQUIRED>
276
277 <!ELEMENT errorlink (#PCDATA|jvmti|code|i|b|tm)*>
278 <!ATTLIST errorlink id CDATA #REQUIRED>
279
280 <!ELEMENT externallink (#PCDATA|jvmti|code|i|b|tm)*>
281 <!ATTLIST externallink id CDATA #REQUIRED>
282
283 <!ELEMENT vmspec EMPTY>
284 <!ATTLIST vmspec chapter CDATA #IMPLIED>
285
286 <!ELEMENT internallink (#PCDATA|jvmti|code|i|b)*>
287 <!ATTLIST internallink id CDATA #REQUIRED>
288
289 <!ELEMENT functionphaselist EMPTY>
290 <!ATTLIST functionphaselist phase (onload|onloadOnly|start|live|any) #REQUIRED>
291
292 <!ELEMENT eventphaselist EMPTY>
293 <!ATTLIST eventphaselist phase (onload|start|live|any) #REQUIRED>
294
295 <!ELEMENT issue ANY>
296
297 <!ELEMENT rationale ANY>
298
299 <!ELEMENT todo ANY>
300
301 <!ELEMENT origin (#PCDATA)*>
302
303 <!ELEMENT elide (intro|function|callback|event)*>
304 <!ATTLIST elide why CDATA #IMPLIED>
305
306 <!ELEMENT constants (constant*)>
307 <!ATTLIST constants id CDATA #REQUIRED
308 label CDATA #REQUIRED
309 kind (enum|bits|const) #REQUIRED
310 since CDATA "1.0">
311
312 <!ELEMENT constant ANY>
313 <!ATTLIST constant id CDATA #REQUIRED
314 num CDATA #REQUIRED>
315
316 <!ELEMENT tm (#PCDATA)>
317
318 <!ELEMENT i (#PCDATA|jvmti|tm)*>
319
320 <!ELEMENT b (#PCDATA|jvmti|code)*>
321
322 <!ELEMENT code (#PCDATA|space)*>
323
324 <!ELEMENT pre ANY>
325
326 <!ELEMENT space EMPTY>
327
328 <!ELEMENT jvmti EMPTY>
329
330 <!ELEMENT example (#PCDATA|i)*>
331
332 <!ELEMENT br EMPTY>
333
334 <!ELEMENT p EMPTY>
335
336 <!ELEMENT blockquote ANY>
337
338 <!ELEMENT dl (dt|dd)+>
339
340 <!ELEMENT dd ANY>
341
342 <!ELEMENT dt (#PCDATA|jvmti|code|i|b)*>
343
344 <!ELEMENT table (tr)+>
345
346 <!ELEMENT tr (td|th)*>
347 <!ATTLIST tr class CDATA #IMPLIED>
348
349 <!ELEMENT td ANY>
350 <!ATTLIST td class CDATA #IMPLIED>
351
352 <!ELEMENT th ANY>
353 <!ATTLIST th class CDATA #IMPLIED
354 scope (col|row) #IMPLIED>
355
356 <!ELEMENT ul (li)+>
357 <!ATTLIST ul type (disc|circle|square) "disc">
358
359 <!ELEMENT li ANY>
360 ]>
361
362 <specification label="JVM(TM) Tool Interface">
363 <title subtitle="Version">
364 <tm>JVM</tm> Tool Interface
365 </title>
366
367 <intro id="whatIs" label="What is the JVM Tool Interface?">
368 The <tm>JVM</tm> Tool Interface (<jvmti/>)
369 is a programming interface used by development and monitoring tools.
370 It provides both a way to inspect the state and
371 to control the execution of applications running in the
372 <tm>Java</tm> virtual machine (VM).
373 <p/>
374 <jvmti/> is intended to provide a VM interface for the full breadth of tools
375 that need access to VM state, including but not limited to: profiling,
376 debugging, monitoring, thread analysis, and coverage analysis tools.
377 <p/>
378 <jvmti/> may not be available in all implementations of the <tm>Java</tm> virtual
379 machine.
380 <p/>
381 <jvmti/> is a two-way interface.
382 A client of <jvmti/>, hereafter called an <i>agent</i>,
383 can be notified of
384 interesting occurrences through <internallink id="EventSection">events</internallink>.
385 <jvmti/>
386 can query and control the application through many
387 <internallink id="FunctionSection">functions</internallink>,
388 either in response to events or
389 independent of them.
390 <p/>
391 Agents run in the same process with and communicate directly with
392 the virtual machine executing
393 the application being examined. This communication is
394 through a native interface (<jvmti/>). The native in-process interface allows
395 maximal control with minimal intrusion on the part of a tool.
396 Typically, agents are relatively compact. They can be controlled
397 by a separate process which implements the bulk of a tool's
398 function without interfering with the target application's normal execution.
399 </intro>
400
401 <intro id="architecture" label="Architecture">
402 Tools can be written directly to <jvmti/> or indirectly
403 through higher level interfaces.
404 The Java Platform Debugger Architecture includes <jvmti/>, but also
405 contains higher-level, out-of-process debugger interfaces. The higher-level
406 interfaces are more appropriate than <jvmti/> for many tools.
407 For more information on the Java Platform Debugger Architecture,
408 see the
409 <externallink id="jpda/architecture.html">Java
410 Platform Debugger Architecture website</externallink>.
411 </intro>
412
413 <intro id="writingAgents" label="Writing Agents">
414 Agents can be written in any native language that supports C
415 language calling conventions and C or C++
416 definitions.
417 <p/>
418 The function, event, data type, and constant definitions needed for
419 using <jvmti/> are defined in the include file <code>jvmti.h</code>.
420 To use these definitions add the <tm>J2SE</tm> include directory
421 to your include path and add
422 <example>
423 #include <jvmti.h>
424 </example>
425 to your source code.
426 </intro>
427
428 <intro id="deployingAgents" label="Deploying Agents">
429 An agent is deployed in a platform specific manner but is typically the
430 platform equivalent of a dynamic library. On the <tm>Windows</tm> operating
431 system, for example, an agent library is a "Dynamic Linked Library" (DLL).
432 On <tm>Linux</tm> Operating Environment, an agent library is a shared object
433 (<code>.so</code> file).
434 <p/>
435
436 An agent may be started at VM startup by specifying the agent library
437 name using a <internallink id="starting">command line option</internallink>.
438 Some implementations may support a mechanism to <internallink id="onattach">
439 start agents</internallink> in the live <functionlink id="GetPhase">phase</functionlink>.
440 The details of how this is initiated are implementation specific.
441 </intro>
442
443 <intro id="entryPoint" label="Statically Linked Agents (since version 1.2.3)">
444
445 A native JVMTI Agent may be <i>statically linked</i> with the VM.
446 The manner in which the library and VM image are combined is
447 implementation-dependent.
448 An agent L whose image has been combined with the VM is defined as
449 <i>statically linked</i> if and only if the agent exports a function
450 called Agent_OnLoad_L.
451 <p/>
452 If a <i>statically linked</i> agent L exports a function called
453 Agent_OnLoad_L and a function called Agent_OnLoad, the Agent_OnLoad
454 function will be ignored.
455 If an agent L is <i>statically linked</i>, an Agent_OnLoad_L
456 function will be invoked with the same arguments and expected return
457 value as specified for the Agent_OnLoad function.
458 An agent L that is <i>statically linked</i> will prohibit an agent of
459 the same name from being loaded dynamically.
460 <p/>
461 The VM will invoke the Agent_OnUnload_L function of the agent, if such
462 a function is exported, at the same point during VM execution as it would
463 have called the dynamic entry point Agent_OnUnLoad. A statically loaded
464 agent cannot be unloaded. The Agent_OnUnload_L function will still be
465 called to do any other agent shutdown related tasks.
466 If a <i>statically linked</i> agent L exports a function called
467 Agent_OnUnLoad_L and a function called Agent_OnUnLoad, the Agent_OnUnLoad
468 function will be ignored.
469 <p/>
470 If an agent L is <i>statically linked</i>, an Agent_OnAttach_L function
471 will be invoked with the same arguments and expected return value as
472 specified for the Agent_OnAttach function.
473 If a <i>statically linked</i> agent L exports a function called
474 Agent_OnAttach_L and a function called Agent_OnAttach, the Agent_OnAttach
475 function will be ignored.
476 </intro>
477
478 <intro id="starting" label="Agent Command Line Options">
479 The term "command-line option" is used below to
480 mean options supplied in the <code>JavaVMInitArgs</code> argument
481 to the <code>JNI_CreateJavaVM</code> function of the JNI
482 Invocation API.
483 <p/>
484 One of the two following
485 command-line options is used on VM startup to
486 properly load and run agents.
487 These arguments identify the library containing
488 the agent as well as an options
489 string to be passed in at startup.
490 <dl>
491 <dt><code>-agentlib:</code><i><agent-lib-name></i><code>=</code><i><options></i></dt>
492 <dd>
493 The name following <code>-agentlib:</code> is the name of the
494 library to load. Lookup of the library, both its full name and location,
495 proceeds in a platform-specific manner.
496 Typically, the <i><agent-lib-name></i> is expanded to an
497 operating system specific file name.
498 The <i><options></i> will be passed to the agent on start-up.
499 For example, if the option
500 <code>-agentlib:foo=opt1,opt2</code> is specified, the VM will attempt to
501 load the shared library <code>foo.dll</code> from the system <code>PATH</code>
502 under <tm>Windows</tm> or <code>libfoo.so</code> from the
503 <code>LD_LIBRARY_PATH</code> under <tm>Linux</tm>.
504 If the agent library is statically linked into the executable
505 then no actual loading takes place.
506 <p/>
507 </dd>
508 <dt><code>-agentpath:</code><i><path-to-agent></i><code>=</code><i><options></i></dt>
509 <dd>
510 The path following <code>-agentpath:</code> is the absolute path from which
511 to load the library.
512 No library name expansion will occur.
513 The <i><options></i> will be passed to the agent on start-up.
514 For example, if the option
515 <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code> is specified, the VM will attempt to
516 load the shared library <code>c:\myLibs\foo.dll</code>. If the agent
517 library is statically linked into the executable
518 then no actual loading takes place.
519 <p/>
520 </dd>
521 </dl>
522 For a dynamic shared library agent, the start-up routine
523 <internallink id="onload"><code>Agent_OnLoad</code></internallink>
524 in the library will be invoked. If the agent library is statically linked
525 into the executable then the system will attempt to invoke the
526 <code>Agent_OnLoad_<agent-lib-name></code> entry point where
527 <agent-lib-name> is the basename of the
528 agent. In the above example <code>-agentpath:c:\myLibs\foo.dll=opt1,opt2</code>,
529 the system will attempt to find and call the <code>Agent_OnLoad_foo</code> start-up routine.
530 <p/>
531 Libraries loaded with <code>-agentlib:</code> or <code>-agentpath:</code>
532 will be searched for JNI native method implementations to facilitate the
533 use of Java programming language code in tools, as is needed for
534 <internallink id="bci">bytecode instrumentation</internallink>.
535 <p/>
536 The agent libraries will be searched after all other libraries have been
537 searched (agents wishing to override or intercept the native method
538 implementations of non-agent methods can use the
539 <eventlink id="NativeMethodBind">NativeMethodBind event</eventlink>).
540 <p/>
541 These switches do the above and nothing more - they do not change the
542 state of the VM or <jvmti/>. No command line options are needed
543 to enable <jvmti/>
544 or aspects of <jvmti/>, this is handled programmatically
545 by the use of
546 <internallink id="capability">capabilities</internallink>.
547 </intro>
548
549 <intro id="startup" label="Agent Start-Up">
550 The VM starts each agent by invoking a start-up function.
551 If the agent is started in the <code>OnLoad</code>
552 <functionlink id="GetPhase">phase</functionlink> the function
553 <internallink id="onload"><code>Agent_OnLoad</code></internallink>
554 or <internallink id="onload"><code>Agent_OnLoad_L</code></internallink>
555 for statically linked agents will be invoked.
556 If the agent is started in the live
557 <functionlink id="GetPhase">phase</functionlink> the function
558 <internallink id="onattach"><code>Agent_OnAttach</code></internallink>
559 or <internallink id="onattach"><code>Agent_OnAttach_L</code></internallink>
560 for statically linked agents will be invoked.
561 Exactly one call to a start-up function is made per agent.
562 </intro>
563
564 <intro id="onload" label="Agent Start-Up (OnLoad phase)">
565 If an agent is started during the <code>OnLoad</code> phase then its
566 agent library must export a start-up function with the following prototype:
567 <example>
568 JNIEXPORT jint JNICALL
569 Agent_OnLoad(JavaVM *vm, char *options, void *reserved)</example>
570 Or for a statically linked agent named 'L':
571 <example>
572 JNIEXPORT jint JNICALL
573 Agent_OnLoad_L(JavaVM *vm, char *options, void *reserved)</example>
574
575 The VM will start the agent by calling this function.
576 It will be called early enough in VM initialization that:
577 <ul>
578 <li><functionlink id="SetSystemProperty">system properties</functionlink>
579 may be set before they have been used in the start-up of the VM</li>
580 <li>the full set of
581 <internallink id="capability">capabilities</internallink>
582 is still available (note that capabilities that configure the VM
583 may only be available at this time--see the
584 <internallink id="capability">Capability function section</internallink>)</li>
585 <li>no bytecodes have executed</li>
586 <li>no classes have been loaded</li>
587 <li>no objects have been created</li>
588 </ul>
589 <p/>
590 The VM will call the <code>Agent_OnLoad</code> or
591 <code>Agent_OnLoad_<agent-lib-name></code> function with
592 <i><options></i> as the second argument -
593 that is, using the command-line option examples,
594 <code>"opt1,opt2"</code> will be passed to the <code>char *options</code>
595 argument of <code>Agent_OnLoad</code>.
596 The <code>options</code> argument is encoded as a
597 <internallink id="mUTF">modified UTF-8</internallink> string.
598 If <i>=<options></i> is not specified,
599 a zero length string is passed to <code>options</code>.
600 The lifespan of the <code>options</code> string is the
601 <code>Agent_OnLoad</code> or <code>Agent_OnLoad_<agent-lib-name></code>
602 call. If needed beyond this time the string or parts of the string must
603 be copied.
604 The period between when <code>Agent_OnLoad</code> is called and when it
605 returns is called the <i>OnLoad phase</i>.
606 Since the VM is not initialized during the OnLoad
607 <functionlink id="GetPhase">phase</functionlink>,
608 the set of allowed operations
609 inside <code>Agent_OnLoad</code> is restricted (see the function descriptions for the
610 functionality available at this time).
611 The agent can safely process the options and set
612 event callbacks with <functionlink id="SetEventCallbacks"></functionlink>. Once
613 the VM initialization event is received
614 (that is, the <eventlink id="VMInit">VMInit</eventlink>
615 callback is invoked), the agent
616 can complete its initialization.
617 <rationale>
618 Early startup is required so that agents can set the desired capabilities,
619 many of which must be set before the VM is initialized.
620 In JVMDI, the -Xdebug command-line option provided
621 very coarse-grain control of capabilities.
622 JVMPI implementations use various tricks to provide a single "JVMPI on" switch.
623 No reasonable command-line
624 option could provide the fine-grain of control required to balance needed capabilities vs
625 performance impact.
626 Early startup is also needed so that agents can control the execution
627 environment - modifying the file system and system properties to install
628 their functionality.
629 </rationale>
630 <p/>
631 The return value from <code>Agent_OnLoad</code> or
632 <code>Agent_OnLoad_<agent-lib-name></code> is used to indicate an error.
633 Any value other than zero indicates an error and causes termination of the VM.
634 </intro>
635
636 <intro id="onattach" label="Agent Start-Up (Live phase)">
637 A VM may support a mechanism that allows agents to be started in the VM during the live
638 <functionlink id="GetPhase">phase</functionlink>. The details of how this is supported,
639 are implementation specific. For example, a tool may use some platform specific mechanism,
640 or implementation specific API, to attach to the running VM, and request it start a given
641 agent.
642 <p/>
643 The VM prints a warning on the standard error stream for each agent that it attempts
644 to start in the live phase. If an agent was previously started (in the <code>OnLoad</code>
645 phase or in the live phase), then it is implementation specific as to whether a
646 warning is printed when attempting to start the same agent a second or subsequent time.
647 Warnings can be disabled by means of an implementation-specific command line option.
648 <p/>
649 <b>Implementation Note:</b> For the HotSpot VM, the VM option
650 <code>-XX:+EnableDynamicAgentLoading</code> is used to opt-in to allow dynamic loading
651 of agents in the live phase. This option suppresses the warning to standard error when
652 starting an agent in the live phase.
653 <p/>
654 If an agent is started during the live phase then its agent library
655 must export a start-up function
656 with the following prototype:
657 <example>
658 JNIEXPORT jint JNICALL
659 Agent_OnAttach(JavaVM* vm, char *options, void *reserved)</example>
660 Or for a statically linked agent named 'L':
661 <example>
662 JNIEXPORT jint JNICALL
663 Agent_OnAttach_L(JavaVM* vm, char *options, void *reserved)</example>
664
665 <p/>
666 The VM will start the agent by calling this function.
667 It will be called in the context of a thread
668 that is attached to the VM. The first argument <i><vm></i> is the Java VM.
669 The <i><options></i> argument is the startup options provided to the agent.
670 <i><options></i> is encoded as a <internallink id="mUTF">modified UTF-8
671 </internallink> string.
672 If startup options were not provided, a zero length string is passed to
673 <code>options</code>. The lifespan of the <code>options</code> string is the
674 <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name></code> call.
675 If needed beyond this time the string or parts of the string must be copied.
676 <p/>
677 Note that some <internallink id="capability">capabilities</internallink>
678 may not be available in the live phase.
679 <p/>
680 The <code>Agent_OnAttach</code> or <code>Agent_OnAttach_<agent-lib-name
681 ></code> function initializes the agent and returns a value
682 to the VM to indicate if an error occurred. Any value other than zero indicates an error.
683 An error does not cause the VM to terminate. Instead the VM ignores the error, or takes
684 some implementation specific action -- for example it might print an error to standard error,
685 or record the error in a system log.
686 </intro>
687
688 <intro id="onunload" label="Agent Shutdown">
689 The library may optionally export a
690 shutdown function with the following prototype:
691 <example>
692 JNIEXPORT void JNICALL
693 Agent_OnUnload(JavaVM *vm)</example>
694 Or for a statically linked agent named 'L':
695 <example>
696 JNIEXPORT void JNICALL
697 Agent_OnUnload_L(JavaVM *vm)</example>
698
699 This function will be called by the VM when the library is about to be unloaded.
700 The library will be unloaded (unless it is statically linked into the
701 executable) and this function will be called if some platform specific
702 mechanism causes the unload (an unload mechanism is not specified in this document)
703 or the library is (in effect) unloaded by the termination of the VM.
704 VM termination includes normal termination and VM failure, including start-up failure,
705 but not, of course, uncontrolled shutdown. An implementation may also
706 choose to not call this function if the <code>Agent_OnAttach</code>/
707 <code>Agent_OnAttach_L</code> function reported an error (returned a non-zero value).
708 Note the distinction between this function and the
709 <eventlink id="VMDeath">VM Death event</eventlink>: for the VM Death event
710 to be sent, the VM must have run at least to the point of initialization and a valid
711 <jvmti/> environment must exist which has set a callback for VMDeath
712 and enabled the event.
713 None of these are required for <code>Agent_OnUnload</code> or
714 <code>Agent_OnUnload_<agent-lib-name></code> and this function
715 is also called if the library is unloaded for other reasons.
716 In the case that a VM Death event is sent, it will be sent before this
717 function is called (assuming this function is called due to VM termination).
718 This function can be used to clean-up resources allocated by the agent.
719 </intro>
720
721 <intro id="tooloptions" label="JAVA_TOOL_OPTIONS">
722 Since the command-line cannot always be accessed or modified, for example in embedded VMs
723 or simply VMs launched deep within scripts, a <code>JAVA_TOOL_OPTIONS</code> variable is
724 provided so that agents may be launched in these cases.
725 <p/>
726 Platforms which support environment variables or other named strings, may support the
727 <code>JAVA_TOOL_OPTIONS</code> variable. This variable will be broken into options at white-space
728 boundaries. White-space characters include space, tab, carriage-return, new-line,
729 vertical-tab, and form-feed. Sequences of white-space characters are considered
730 equivalent to a single white-space character. No white-space is included in the options
731 unless quoted. Quoting is as follows:
732 <ul>
733 <li>All characters enclosed between a pair of single quote marks (''), except a single
734 quote, are quoted.</li>
735 <li>Double quote characters have no special meaning inside a pair of single quote marks.</li>
736 <li>All characters enclosed between a pair of double quote marks (""), except a double
737 quote, are quoted.</li>
738 <li>Single quote characters have no special meaning inside a pair of double quote marks.</li>
739 <li>A quoted part can start or end anywhere in the variable.</li>
740 <li>White-space characters have no special meaning when quoted -- they are included in
741 the option like any other character and do not mark white-space boundaries.</li>
742 <li>The pair of quote marks is not included in the option.</li>
743 </ul>
744 <code>JNI_CreateJavaVM</code> (in the JNI Invocation API) will prepend these options to the options supplied
745 in its <code>JavaVMInitArgs</code> argument. Note that module related options must be expressed in their
746 "option=value" format (note the required '=' between "option" and "value") for <code>JNI_CreateJavaVM</code>
747 to process them correctly.
748 <p/>
749 Platforms may disable this feature in cases where security is
750 a concern; for example, the Reference Implementation disables this feature on Unix systems when
751 the effective user or group ID differs from the real ID.
752 This feature is intended to support the initialization of tools -- specifically including the
753 launching of native or Java programming language agents. Multiple tools may wish to use this
754 feature, so the variable should not be overwritten, instead, options should be appended to
755 the variable. Note that since the variable is processed at the time of the JNI Invocation
756 API create VM call, options processed by a launcher (e.g., VM selection options) will not be handled.
757 </intro>
758
759 <intro id="environments" label="Environments">
760 The <jvmti/> specification supports the use of multiple simultaneous
761 <jvmti/> agents.
762 Each agent has its own <jvmti/> environment.
763 That is, the <jvmti/> state is
764 separate for each agent - changes to one environment do not affect the
765 others. The state of a <jvmti/>
766 environment includes:
767 <ul>
768 <li><functionlink id="SetEventCallbacks">the event callbacks</functionlink></li>
769 <li><functionlink id="SetEventNotificationMode">the set of events which are enabled</functionlink></li>
770 <li><internallink id="capability">the capabilities</internallink></li>
771 <li><internallink id="memory">the memory allocation/deallocation hooks</internallink></li>
772 </ul>
773 Although their <jvmti/> state
774 is separate, agents inspect and modify the shared state
775 of the VM, they also share the native environment in which they execute.
776 As such, an agent can perturb the results of other agents or cause them
777 to fail. It is the responsibility of the agent writer to specify the level
778 of compatibility with other agents. <jvmti/> implementations are not capable
779 of preventing destructive interactions between agents. Techniques to reduce
780 the likelihood of these occurrences are beyond the scope of this document.
781 <p/>
782 An agent creates a <jvmti/> environment
783 by passing a <jvmti/> version
784 as the interface ID to the JNI Invocation API function
785 <externallink id="jni/invocation.html#getenv">
786 <code>GetEnv</code></externallink>.
787 See <internallink id="jvmtiEnvAccess">Accessing <jvmti/> Functions</internallink>
788 for more details on the creation and use of
789 <jvmti/> environments.
790 Typically, <jvmti/> environments are created by calling <code>GetEnv</code> from
791 <internallink id="onload"><code>Agent_OnLoad</code></internallink>.
792 </intro>
793
794 <intro id="bci" label="Bytecode Instrumentation">
795 This interface does not include some events that one might expect in an interface with
796 profiling support. Some examples include full speed
797 method enter and exit events. The interface instead provides support for
798 <i>bytecode instrumentation</i>, the ability to alter the Java virtual machine
799 bytecode instructions which comprise the target program. Typically, these alterations
800 are to add "events" to the code of a method - for example, to add, at the beginning of a method,
801 a call to <code>MyProfiler.methodEntered()</code>.
802 Since the changes are purely additive, they do not modify application
803 state or behavior.
804 Because the inserted agent code is standard bytecodes, the VM can run at full speed,
805 optimizing not only the target program but also the instrumentation. If the
806 instrumentation does not involve switching from bytecode execution, no expensive
807 state transitions are needed. The result is high performance events.
808 This approach also provides complete control to the agent: instrumentation can be
809 restricted to "interesting" portions of the code (e.g., the end user's code) and
810 can be conditional. Instrumentation can run entirely in Java programming language
811 code or can call into the native agent. Instrumentation can simply maintain
812 counters or can statistically sample events.
813 <p/>
814 Instrumentation can be inserted in one of three ways:
815 <ul>
816 <li>
817 Static Instrumentation: The class file is instrumented before it
818 is loaded into the VM - for example, by creating a duplicate directory of
819 <code>*.class</code> files which have been modified to add the instrumentation.
820 This method is extremely awkward and, in general, an agent cannot know
821 the origin of the class files which will be loaded.
822 </li>
823 <li>
824 Load-Time Instrumentation: When a class file is loaded by the VM, the raw
825 bytes of the class file are sent for instrumentation to the agent.
826 The <eventlink id="ClassFileLoadHook"/>
827 event, triggered by the class load,
828 provides this functionality. This mechanism provides efficient
829 and complete access to one-time instrumentation.
830 </li>
831 <li>
832 Dynamic Instrumentation: A class which is already loaded (and possibly
833 even running) is modified. This optional feature is provided by the
834 <eventlink id="ClassFileLoadHook"/> event, triggered by calling the
835 <functionlink id="RetransformClasses"/> function.
836 Classes can be modified multiple times and can be returned to their
837 original state.
838 The mechanism allows instrumentation which changes during the
839 course of execution.
840 </li>
841 </ul>
842 <p/>
843 The class modification functionality provided in this interface
844 is intended to provide a mechanism for instrumentation
845 (the <eventlink id="ClassFileLoadHook"/> event
846 and the <functionlink id="RetransformClasses"/> function)
847 and, during development, for fix-and-continue debugging
848 (the <functionlink id="RedefineClasses"/> function).
849 <p/>
850 Care must be taken to avoid perturbing dependencies, especially when
851 instrumenting core classes. For example, an approach to getting notification
852 of every object allocation is to instrument the constructor on
853 <code>Object</code>. Assuming that the constructor is initially
854 empty, the constructor could be changed to:
855 <example>
856 public Object() {
857 MyProfiler.allocationTracker(this);
858 }
859 </example>
860 However, if this change was made using the
861 <eventlink id="ClassFileLoadHook"/>
862 event then this might impact a typical VM as follows:
863 the first created object will call the constructor causing a class load of
864 <code>MyProfiler</code>; which will then cause
865 object creation, and since <code>MyProfiler</code> isn't loaded yet,
866 infinite recursion; resulting in a stack overflow. A refinement of this
867 would be to delay invoking the tracking method until a safe time. For
868 example, <code>trackAllocations</code> could be set in the
869 handler for the <code>VMInit</code> event.
870 <example>
871 static boolean trackAllocations = false;
872
873 public Object() {
874 if (trackAllocations) {
875 MyProfiler.allocationTracker(this);
876 }
877 }
878 </example>
879 <p/>
880 The <functionlink id="SetNativeMethodPrefix"/> allows native methods
881 to be instrumented by the use of wrapper methods.
882 </intro>
883
884 <intro id="bcimodules" label="Bytecode Instrumentation of code in modules">
885 Agents can use the functions <functionlink id="AddModuleReads"/>,
886 <functionlink id="AddModuleExports"/>, <functionlink id="AddModuleOpens"/>,
887 <functionlink id="AddModuleUses"/> and <functionlink id="AddModuleProvides"/>
888 to update a module to expand the set of modules that it reads, the set of
889 packages that it exports or opens to other modules, or the services that it
890 uses and provides.
891 <p/>
892 As an aid to agents that deploy supporting classes on the search path of
893 the bootstrap class loader, or the search path of the class loader that
894 loads the main class, the Java virtual machine arranges for the module
895 of classes transformed by the <eventlink id="ClassFileLoadHook"/> event to
896 read the unnamed module of both class loaders.
897 </intro>
898
899 <intro id="mUTF" label="Modified UTF-8 String Encoding">
900 <jvmti/> uses modified UTF-8 to encode character strings.
901 This is the same encoding used by JNI.
902 Modified UTF-8 differs
903 from standard UTF-8 in the representation of supplementary characters
904 and of the null character. See the
905 <externallink id="jni/types.html#modified-utf-8-strings">
906 Modified UTF-8 Strings</externallink>
907 section of the JNI specification for details.
908 </intro>
909
910 <intro id="context" label="Specification Context">
911 Since this interface provides access to the state of applications running in the
912 Java virtual machine;
913 terminology refers to the Java platform and not the native
914 platform (unless stated otherwise). For example:
915 <ul>
916 <li>"thread" means Java programming language thread.</li>
917 <li>"stack frame" means Java virtual machine stack frame.</li>
918 <li>"class" means Java programming language class.</li>
919 <li>"heap" means Java virtual machine heap.</li>
920 <li>"monitor" means Java programming language object monitor.</li>
921 </ul>
922 <p/>
923 Sun, Sun Microsystems, the Sun logo, Java, and JVM
924 are trademarks or registered trademarks of Oracle
925 and/or its affiliates, in the U.S. and other countries.
926 </intro>
927
928
929 <functionsection label="Functions">
930 <intro id="jvmtiEnvAccess" label="Accessing Functions">
931 Native code accesses <jvmti/> features
932 by calling <jvmti/> functions.
933 Access to <jvmti/> functions is by use of an interface pointer
934 in the same manner as
935 <externallink id="jni/design.html">Java
936 Native Interface (JNI) functions</externallink> are accessed.
937 The <jvmti/> interface pointer is called the
938 <i>environment pointer</i>.
939 <p/>
940 An environment pointer is a pointer to an environment and has
941 the type <code>jvmtiEnv*</code>.
942 An environment has information about its <jvmti/> connection.
943 The first value in the environment is a pointer to the function table.
944 The function table is an array of pointers to <jvmti/> functions.
945 Every function pointer is at a predefined offset inside the
946 array.
947 <p/>
948 When used from the C language:
949 double indirection is used to access the functions;
950 the environment pointer provides context and is the first
951 parameter of each function call; for example:
952 <example>
953 jvmtiEnv *jvmti;
954 ...
955 jvmtiError err = (*jvmti)->GetLoadedClasses(jvmti, &class_count, &classes);
956 </example>
957 <p/>
958 When used from the C++ language:
959 functions are accessed as member functions of <code>jvmtiEnv</code>;
960 the environment pointer is not passed to the function call; for example:
961 <example>
962 jvmtiEnv *jvmti;
963 ...
964 jvmtiError err = jvmti->GetLoadedClasses(&class_count, &classes);
965 </example>
966 Unless otherwise stated, all examples and declarations in this
967 specification use the C language.
968 <p/>
969 A <jvmti/> environment can be obtained through the JNI Invocation API
970 <code>GetEnv</code> function:
971 <example>
972 jvmtiEnv *jvmti;
973 ...
974 (*jvm)->GetEnv(jvm, &jvmti, JVMTI_VERSION_1_0);
975 </example>
976 Each call to <code>GetEnv</code>
977 creates a new <jvmti/> connection and thus
978 a new <jvmti/> environment.
979 The <code>version</code> argument of <code>GetEnv</code> must be
980 a <jvmti/> version.
981 The returned environment may have a different version than the
982 requested version but the returned environment must be compatible.
983 <code>GetEnv</code> will return <code>JNI_EVERSION</code> if a
984 compatible version is not available, if <jvmti/> is not supported or
985 <jvmti/> is not supported in the current VM configuration.
986 Other interfaces may be added for creating <jvmti/> environments
987 in specific contexts.
988 Each environment has its own state (for example,
989 <functionlink id="SetEventNotificationMode">desired events</functionlink>,
990 <functionlink id="SetEventCallbacks">event handling functions</functionlink>, and
991 <functionlink id="AddCapabilities">capabilities</functionlink>).
992 An environment is released with
993 <functionlink id="DisposeEnvironment"></functionlink>.
994 Thus, unlike JNI which has one environment per thread, <jvmti/> environments work
995 across threads and are created dynamically.
996 </intro>
997
998 <intro id="nullPointers" label="Null Pointers">
999 Parts of this specification refer to a "null pointer" as a possible function parameter
1000 or return value. A "null pointer" is C <code>NULL</code> or C++ <code>nullptr</code>.
1001 </intro>
1002
1003 <intro id="functionReturn" label="Function Return Values">
1004 <jvmti/> functions always return an
1005 <internallink id="ErrorSection">error code</internallink> via the
1006 <datalink id="jvmtiError"/> function return value.
1007 Some functions can return additional
1008 values through pointers provided by the calling function.
1009 In some cases, <jvmti/> functions allocate memory that your program must
1010 explicitly deallocate. This is indicated in the individual <jvmti/>
1011 function descriptions. Empty lists, arrays, sequences, etc are
1012 returned as a null pointer.
1013 <p/>
1014 In the event that the <jvmti/> function encounters
1015 an error (any return value other than <code>JVMTI_ERROR_NONE</code>) the values
1016 of memory referenced by argument pointers is undefined, but no memory
1017 will have been allocated and no global references will have been allocated.
1018 If the error occurs because of invalid input, no action will have occurred.
1019 </intro>
1020
1021 <intro id="refs" label="Managing JNI Object References">
1022 <jvmti/> functions identify objects with JNI references
1023 (<datalink id="jobject"/> and <datalink id="jclass"/>)
1024 and their derivatives
1025 (<datalink id="jthread"/> and <datalink id="jthreadGroup"/>).
1026 References passed to
1027 <jvmti/> functions can be either global or local, but they must be
1028 strong references. All references returned by <jvmti/> functions are
1029 local references--these local references are created
1030 during the <jvmti/> call.
1031 Local references are a resource that must be managed (see the
1032 <externallink id="jni/functions.html#local-references">
1033 JNI Documentation</externallink>).
1034 When threads return from native code all local references
1035 are freed. Note that some threads, including typical
1036 agent threads, will never return from native code.
1037 A thread is ensured the ability to create sixteen local
1038 references without the need for any explicit management.
1039 For threads executing a limited number of <jvmti/> calls before
1040 returning from native code
1041 (for example, threads processing events),
1042 it may be determined that no explicit management
1043 is needed.
1044 However, long running agent threads will need explicit
1045 local reference management--usually with the JNI functions
1046 <code>PushLocalFrame</code> and <code>PopLocalFrame</code>.
1047 Conversely, to preserve references beyond the
1048 return from native code, they must be converted to global references.
1049 These rules do not apply to <datalink id="jmethodID"/> and <datalink id="jfieldID"/>
1050 as they are not <datalink id="jobject"/>s.
1051 </intro>
1052
1053 <intro id="prereqState" label="Prerequisite State for Calling Functions">
1054 Unless the function explicitly states that the agent must bring
1055 a thread or the VM to a particular state (for example, suspended),
1056 the <jvmti/> implementation is responsible for bringing the VM to a
1057 safe and consistent state for performing the function.
1058 </intro>
1059
1060 <intro id="functionsExceptions" label="Exceptions and Functions">
1061 <jvmti/> functions never throw exceptions; error conditions are
1062 communicated via the
1063 <internallink id="functionReturn">function return value</internallink>.
1064 Any existing exception state is preserved across a call to a
1065 <jvmti/> function.
1066 See the
1067 <externallink
1068 id="jni/design.html#java-exceptions"
1069 >Java Exceptions</externallink>
1070 section of the JNI specification for information on handling exceptions.
1071 </intro>
1072
1073 <category id="memory" label="Memory Management">
1074 <intro>
1075 These functions provide for the allocation and deallocation of
1076 memory used by <jvmti/> functionality and can be used to provide
1077 working memory for agents.
1078 Memory managed by <jvmti/> is not compatible with other memory
1079 allocation libraries and mechanisms.
1080 </intro>
1081
1082 <function id="Allocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="46">
1083 <synopsis>Allocate</synopsis>
1084 <description>
1085 Allocate an area of memory through the <jvmti/> allocator.
1086 The allocated
1087 memory should be freed with <functionlink id="Deallocate"></functionlink>.
1088 </description>
1089 <origin>jvmdi</origin>
1090 <capabilities>
1091 </capabilities>
1092 <parameters>
1093 <param id="size">
1094 <jlong/>
1095 <description>
1096 The number of bytes to allocate.
1097 <rationale>
1098 <code>jlong</code> is used for compatibility with JVMDI.
1099 </rationale>
1100 </description>
1101 </param>
1102 <param id="mem_ptr">
1103 <allocbuf incount="size"><uchar/></allocbuf>
1104 <description>
1105 On return, a pointer to the beginning of the allocated memory.
1106 If <code>size</code> is zero, a null pointer is returned.
1107 </description>
1108 </param>
1109 </parameters>
1110 <errors>
1111 <error id="JVMTI_ERROR_OUT_OF_MEMORY">
1112 Memory request cannot be honored.
1113 </error>
1114 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
1115 <paramlink id="size"></paramlink> is less than zero.
1116 </error>
1117 </errors>
1118 </function>
1119
1120 <function id="Deallocate" jkernel="yes" phase="any" callbacksafe="safe" impl="notrace" num="47">
1121 <synopsis>Deallocate</synopsis>
1122 <description>
1123 Deallocate <code>mem</code> using the <jvmti/> allocator.
1124 This function should
1125 be used to deallocate any memory allocated and returned
1126 by a <jvmti/> function
1127 (including memory allocated with <functionlink id="Allocate"></functionlink>).
1128 All allocated memory must be deallocated
1129 or the memory cannot be reclaimed.
1130 </description>
1131 <origin>jvmdi</origin>
1132 <capabilities>
1133 </capabilities>
1134 <parameters>
1135 <param id="mem">
1136 <outbuf>
1137 <uchar/>
1138 <nullok>the call is ignored</nullok>
1139 </outbuf>
1140 <description>
1141 A pointer to the beginning of the allocated memory.
1142 Please ignore "On return, the elements are set."
1143 <todo>keep it from generating "On return, the elements are set"</todo>
1144 </description>
1145 </param>
1146 </parameters>
1147 <errors>
1148 </errors>
1149 </function>
1150 </category>
1151
1152 <category id="threadCategory" label="Thread">
1153 <intro>
1154 These functions provide information about threads and allow an agent to
1155 suspend and resume threads.
1156 <p/>
1157 The <code>jthread</code> specified to these functions can be a JNI
1158 reference to a
1159 <externallink id="../api/java.base/java/lang/Thread.html#platform-threads">platform thread</externallink>
1160 or <externallink id="../api/java.base/java/lang/Thread.html#virtual-threads">virtual thread</externallink>.
1161 Some functions are not supported on virtual threads and return
1162 <code>JVMTI_ERROR_UNSUPPORTED_OPERATION</code> when called with a reference
1163 to a virtual thread.
1164 </intro>
1165
1166 <function id="GetThreadState" num="17">
1167 <synopsis>Get Thread State</synopsis>
1168 <description>
1169 Get the state of a thread. The state of the thread is represented by the
1170 answers to the hierarchical set of questions below:
1171 <ul type="circle">
1172 <li><i>Alive?</i>
1173 <ul>
1174 <li>Not alive.
1175 <ul type="circle">
1176 <li><i>Why not alive?</i>
1177 <ul>
1178 <li>New.</li>
1179 <li>Terminated (<datalink
1180 id="JVMTI_THREAD_STATE_TERMINATED"><code>JVMTI_THREAD_STATE_TERMINATED</code></datalink>)</li>
1181 </ul>
1182 </li>
1183 </ul>
1184 </li>
1185 <li>Alive (<datalink
1186 id="JVMTI_THREAD_STATE_ALIVE"><code>JVMTI_THREAD_STATE_ALIVE</code></datalink>)
1187 <ul type="circle">
1188 <li><i>Suspended?</i>
1189 <ul>
1190 <li>Suspended (<datalink
1191 id="JVMTI_THREAD_STATE_SUSPENDED"><code>JVMTI_THREAD_STATE_SUSPENDED</code></datalink>)</li>
1192 <li>Not suspended</li>
1193 </ul>
1194 </li>
1195 <li><i>Interrupted?</i>
1196 <ul>
1197 <li>Interrupted (<datalink
1198 id="JVMTI_THREAD_STATE_INTERRUPTED"><code>JVMTI_THREAD_STATE_INTERRUPTED</code></datalink>)</li>
1199 <li>Not interrupted.</li>
1200 </ul>
1201 </li>
1202 <li><i>In native?</i>
1203 <ul>
1204 <li>In native code (<datalink
1205 id="JVMTI_THREAD_STATE_IN_NATIVE"><code>JVMTI_THREAD_STATE_IN_NATIVE</code></datalink>)</li>
1206 <li>In Java programming language code</li>
1207 </ul>
1208 </li>
1209 <li><i>What alive state?</i>
1210 <ul>
1211 <li>Runnable (<datalink
1212 id="JVMTI_THREAD_STATE_RUNNABLE"><code>JVMTI_THREAD_STATE_RUNNABLE</code></datalink>)</li>
1213 <li>Blocked (<datalink
1214 id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></datalink>)</li>
1215 <li>Waiting (<datalink
1216 id="JVMTI_THREAD_STATE_WAITING"><code>JVMTI_THREAD_STATE_WAITING</code></datalink>)
1217 <ul type="circle">
1218 <li><i>Timed wait?</i>
1219 <ul>
1220 <li>Indefinite (<datalink
1221 id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY"><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></datalink>)</li>
1222 <li>Timed (<datalink
1223 id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT"><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></datalink>)</li>
1224 </ul>
1225 </li>
1226 <li><i>Why waiting?</i>
1227 <ul>
1228 <li>Object.wait (<datalink
1229 id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT"><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></datalink>)</li>
1230 <li>LockSupport.park (<datalink
1231 id="JVMTI_THREAD_STATE_PARKED"><code>JVMTI_THREAD_STATE_PARKED</code></datalink>)</li>
1232 <li>Sleeping (<datalink
1233 id="JVMTI_THREAD_STATE_SLEEPING"><code>JVMTI_THREAD_STATE_SLEEPING</code></datalink>)</li>
1234 </ul>
1235 </li>
1236 </ul>
1237 </li>
1238 </ul>
1239 </li>
1240 </ul>
1241 </li>
1242 </ul>
1243 </li>
1244 </ul>
1245 <p/>
1246 The answers are represented by the following bit vector.
1247 <constants id="jvmtiThreadState" label="Thread State Flags" kind="bits">
1248 <constant id="JVMTI_THREAD_STATE_ALIVE" num="0x0001">
1249 Thread is alive. Zero if thread is new (not started) or terminated.
1250 </constant>
1251 <constant id="JVMTI_THREAD_STATE_TERMINATED" num="0x0002">
1252 Thread has completed execution.
1253 </constant>
1254 <constant id="JVMTI_THREAD_STATE_RUNNABLE" num="0x0004">
1255 Thread is runnable.
1256 </constant>
1257 <constant id="JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER" num="0x0400">
1258 Thread is waiting to enter a synchronized block/method or,
1259 after an <code>Object.wait()</code>, waiting to re-enter a
1260 synchronized block/method.
1261 </constant>
1262 <constant id="JVMTI_THREAD_STATE_WAITING" num="0x0080">
1263 Thread is waiting.
1264 </constant>
1265 <constant id="JVMTI_THREAD_STATE_WAITING_INDEFINITELY" num="0x0010">
1266 Thread is waiting without a timeout.
1267 For example, <code>Object.wait()</code>.
1268 </constant>
1269 <constant id="JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" num="0x0020">
1270 Thread is waiting with a maximum time to wait specified.
1271 For example, <code>Object.wait(long)</code>.
1272 </constant>
1273 <constant id="JVMTI_THREAD_STATE_SLEEPING" num="0x0040">
1274 Thread is sleeping -- <code>Thread.sleep</code>.
1275 </constant>
1276 <constant id="JVMTI_THREAD_STATE_IN_OBJECT_WAIT" num="0x0100">
1277 Thread is waiting on an object monitor -- <code>Object.wait</code>.
1278 </constant>
1279 <constant id="JVMTI_THREAD_STATE_PARKED" num="0x0200">
1280 Thread is parked, for example: <code>LockSupport.park</code>,
1281 <code>LockSupport.parkUtil</code> and <code>LockSupport.parkNanos</code>.
1282 A virtual thread that is sleeping, in <code>Thread.sleep</code>, may
1283 have this state flag set instead of <code>JVMTI_THREAD_STATE_SLEEPING</code>.
1284 </constant>
1285 <constant id="JVMTI_THREAD_STATE_SUSPENDED" num="0x100000">
1286 Thread is suspended by a suspend function
1287 (such as <functionlink id="SuspendThread"></functionlink>).
1288 If this bit is set, the other bits refer to the thread state before
1289 suspension.
1290 </constant>
1291 <constant id="JVMTI_THREAD_STATE_INTERRUPTED" num="0x200000">
1292 Thread has been interrupted.
1293 </constant>
1294 <constant id="JVMTI_THREAD_STATE_IN_NATIVE" num="0x400000">
1295 Thread is in native code--that is, a native method is running
1296 which has not called back into the VM or Java programming
1297 language code.
1298 <p/>
1299 This flag is not set when running VM compiled Java programming
1300 language code nor is it set when running VM code or
1301 VM support code. Native VM interface functions, such as JNI and
1302 <jvmti/> functions, may be implemented as VM code.
1303 </constant>
1304 <constant id="JVMTI_THREAD_STATE_VENDOR_1" num="0x10000000">
1305 Defined by VM vendor.
1306 </constant>
1307 <constant id="JVMTI_THREAD_STATE_VENDOR_2" num="0x20000000">
1308 Defined by VM vendor.
1309 </constant>
1310 <constant id="JVMTI_THREAD_STATE_VENDOR_3" num="0x40000000">
1311 Defined by VM vendor.
1312 </constant>
1313 </constants>
1314 The following definitions are used to convert <jvmti/> thread state
1315 to <code>java.lang.Thread.State</code> style states.
1316 <constants id="jvmtiJavaLangThreadState" label="java.lang.Thread.State Conversion Masks" kind="bits">
1317 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_MASK"
1318 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">
1319 Mask the state with this before comparison
1320 </constant>
1321 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_NEW"
1322 num="0">
1323 <code>java.lang.Thread.State.NEW</code>
1324 </constant>
1325 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED"
1326 num="JVMTI_THREAD_STATE_TERMINATED">
1327 <code>java.lang.Thread.State.TERMINATED</code>
1328 </constant>
1329 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE"
1330 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_RUNNABLE">
1331 <code>java.lang.Thread.State.RUNNABLE</code>
1332 </constant>
1333 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED"
1334 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER">
1335 <code>java.lang.Thread.State.BLOCKED</code>
1336 </constant>
1337 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_WAITING"
1338 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY">
1339 <code>java.lang.Thread.State.WAITING</code>
1340 </constant>
1341 <constant id="JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING"
1342 num="JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT">
1343 <code>java.lang.Thread.State.TIMED_WAITING</code>
1344 </constant>
1345 </constants>
1346 <b>Rules</b>
1347 <p/>
1348 There can be no more than one answer to a question, although there can be no
1349 answer (because the answer is unknown, does not apply, or none of the answers is
1350 correct). An answer is set only when the enclosing answers match.
1351 That is, no more than one of
1352 <ul type="circle">
1353 <li><code>JVMTI_THREAD_STATE_RUNNABLE</code></li>
1354 <li><code>JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER</code></li>
1355 <li><code>JVMTI_THREAD_STATE_WAITING</code></li>
1356 </ul>
1357 can be set (a <tm>J2SE</tm> compliant implementation will always set
1358 one of these if <code>JVMTI_THREAD_STATE_ALIVE</code> is set).
1359 And if any of these are set, the enclosing answer
1360 <code>JVMTI_THREAD_STATE_ALIVE</code> is set.
1361 No more than one of
1362 <ul type="circle">
1363 <li><code>JVMTI_THREAD_STATE_WAITING_INDEFINITELY</code></li>
1364 <li><code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code></li>
1365 </ul>
1366 can be set (a <tm>J2SE</tm> compliant implementation will always set
1367 one of these if <code>JVMTI_THREAD_STATE_WAITING</code> is set).
1368 And if either is set, the enclosing answers
1369 <code>JVMTI_THREAD_STATE_ALIVE</code> and
1370 <code>JVMTI_THREAD_STATE_WAITING</code> are set.
1371 No more than one of
1372 <ul type="circle">
1373 <li><code>JVMTI_THREAD_STATE_IN_OBJECT_WAIT</code></li>
1374 <li><code>JVMTI_THREAD_STATE_PARKED</code></li>
1375 <li><code>JVMTI_THREAD_STATE_SLEEPING</code></li>
1376 </ul>
1377 can be set. And if any of these is set, the enclosing answers
1378 <code>JVMTI_THREAD_STATE_ALIVE</code> and
1379 <code>JVMTI_THREAD_STATE_WAITING</code> are set.
1380 Also, if <code>JVMTI_THREAD_STATE_SLEEPING</code> is set,
1381 then <code>JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT</code> is set.
1382 If a state <i>A</i> is implemented using the mechanism of
1383 state <i>B</i> then it is state <i>A</i> which
1384 is returned by this function.
1385 For example, if <code>Thread.sleep(long)</code>
1386 is implemented using <code>Object.wait(long)</code>
1387 then it is still <code>JVMTI_THREAD_STATE_SLEEPING</code>
1388 which is returned.
1389 More than one of
1390 <ul type="circle">
1391 <li><code>JVMTI_THREAD_STATE_SUSPENDED</code></li>
1392 <li><code>JVMTI_THREAD_STATE_INTERRUPTED</code></li>
1393 <li><code>JVMTI_THREAD_STATE_IN_NATIVE</code></li>
1394 </ul>
1395 can be set, but if any is set,
1396 <code>JVMTI_THREAD_STATE_ALIVE</code> is set.
1397 <p/>
1398 And finally,
1399 <code>JVMTI_THREAD_STATE_TERMINATED</code> cannot be set unless
1400 <code>JVMTI_THREAD_STATE_ALIVE</code> is not set.
1401 <p/>
1402 The thread state representation is designed for extension in future versions
1403 of the specification; thread state values should be used accordingly, that is
1404 they should not be used as ordinals.
1405 Most queries can be made by testing a single bit, if use in a switch statement is desired,
1406 the state bits should be masked with the interesting bits.
1407 All bits not defined above are reserved for future use.
1408 A VM, compliant to the current specification, must set reserved bits to zero.
1409 An agent should ignore reserved bits --
1410 they should not be assumed to be zero and thus should not be included in comparisons.
1411 <p/>
1412 <b>Examples</b>
1413 <p/>
1414 Note that the values below exclude reserved and vendor bits.
1415 <p/>
1416 The state of a thread blocked at a <code>synchronized</code>-statement would be:
1417 <example>
1418 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER
1419 </example>
1420 The state of a thread which hasn't started yet would be:
1421 <example>
1422 0
1423 </example>
1424 The state of a thread at a <code>Object.wait(3000)</code> would be:
1425 <example>
1426 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_WAITING +
1427 JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT +
1428 JVMTI_THREAD_STATE_IN_OBJECT_WAIT
1429 </example>
1430 The state of a thread suspended while runnable would be:
1431 <example>
1432 JVMTI_THREAD_STATE_ALIVE + JVMTI_THREAD_STATE_RUNNABLE + JVMTI_THREAD_STATE_SUSPENDED
1433 </example>
1434 <p/>
1435 <b>Testing the State</b>
1436 <p/>
1437 In most cases, the thread state can be determined by testing the one bit corresponding
1438 to that question. For example, the code to test if a thread is sleeping:
1439 <example>
1440 jint state;
1441 jvmtiError err;
1442
1443 err = (*jvmti)->GetThreadState(jvmti, thread, &state);
1444 if (err == JVMTI_ERROR_NONE) {
1445 if (state & JVMTI_THREAD_STATE_SLEEPING) { ...
1446 </example>
1447 <p/>
1448 For waiting (that is, in <code>Object.wait</code>, parked, or sleeping) it would be:
1449 <example>
1450 if (state & JVMTI_THREAD_STATE_WAITING) { ...
1451 </example>
1452 For some states, more than one bit will need to be tested as is the case
1453 when testing if a thread has not yet been started:
1454 <example>
1455 if ((state & (JVMTI_THREAD_STATE_ALIVE | JVMTI_THREAD_STATE_TERMINATED)) == 0) { ...
1456 </example>
1457 To distinguish timed from untimed <code>Object.wait</code>:
1458 <example>
1459 if (state & JVMTI_THREAD_STATE_IN_OBJECT_WAIT) {
1460 if (state & JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT) {
1461 printf("in Object.wait(long timeout)\n");
1462 } else {
1463 printf("in Object.wait()\n");
1464 }
1465 }
1466 </example>
1467 <p/>
1468 <b>Relationship to <code>java.lang.Thread.State</code></b>
1469 <p/>
1470 The thread state represented by <code>java.lang.Thread.State</code>
1471 returned from <code>java.lang.Thread.getState()</code> is a subset of the
1472 information returned from this function.
1473 The corresponding <code>java.lang.Thread.State</code> can be determined
1474 by using the provided conversion masks.
1475 For example, this returns the name of the <code>java.lang.Thread.State</code> thread state:
1476 <example>
1477 err = (*jvmti)->GetThreadState(jvmti, thread, &state);
1478 abortOnError(err);
1479 switch (state & JVMTI_JAVA_LANG_THREAD_STATE_MASK) {
1480 case JVMTI_JAVA_LANG_THREAD_STATE_NEW:
1481 return "NEW";
1482 case JVMTI_JAVA_LANG_THREAD_STATE_TERMINATED:
1483 return "TERMINATED";
1484 case JVMTI_JAVA_LANG_THREAD_STATE_RUNNABLE:
1485 return "RUNNABLE";
1486 case JVMTI_JAVA_LANG_THREAD_STATE_BLOCKED:
1487 return "BLOCKED";
1488 case JVMTI_JAVA_LANG_THREAD_STATE_WAITING:
1489 return "WAITING";
1490 case JVMTI_JAVA_LANG_THREAD_STATE_TIMED_WAITING:
1491 return "TIMED_WAITING";
1492 }
1493 </example>
1494 </description>
1495 <origin>new</origin>
1496 <capabilities>
1497 </capabilities>
1498 <parameters>
1499 <param id="thread">
1500 <jthread null="current" started="maybe" impl="noconvert"/>
1501 <description>
1502 The thread to query.
1503 </description>
1504 </param>
1505 <param id="thread_state_ptr">
1506 <outptr><jint/></outptr>
1507 <description>
1508 On return, points to state flags,
1509 as defined by the <internallink id="jvmtiThreadState">Thread State Flags</internallink>.
1510 </description>
1511 </param>
1512 </parameters>
1513 <errors>
1514 </errors>
1515 </function>
1516
1517 <function id="GetCurrentThread" phase="start" num="18" since="1.1">
1518 <synopsis>Get Current Thread</synopsis>
1519 <description>
1520 Get the current thread.
1521 The current thread is the Java programming language thread which has called the function.
1522 The function may return a null pointer in the start phase if the
1523 <internallink id="jvmtiCapabilities.can_generate_early_vmstart">
1524 <code>can_generate_early_vmstart</code></internallink> capability is enabled
1525 and the <code>java.lang.Thread</code> class has not been initialized yet.
1526 <p/>
1527 Note that most <jvmti/> functions that take a thread
1528 as an argument will accept null to mean
1529 the current thread.
1530 </description>
1531 <origin>new</origin>
1532 <capabilities>
1533 </capabilities>
1534 <parameters>
1535 <param id="thread_ptr">
1536 <outptr><jthread/></outptr>
1537 <description>
1538 On return, points to the current thread, or null.
1539 </description>
1540 </param>
1541 </parameters>
1542 <errors>
1543 </errors>
1544 </function>
1545
1546 <function id="GetAllThreads" num="4">
1547 <synopsis>Get All Threads</synopsis>
1548 <description>
1549 Get all live platform threads that are attached to the VM.
1550 The list of threads includes
1551 <internallink id="RunAgentThread">agent threads</internallink>.
1552 It does not include virtual threads.
1553 A thread is live if <code>java.lang.Thread.isAlive()</code>
1554 would return <code>true</code>, that is, the thread has
1555 been started and has not yet terminated.
1556 The universe of threads is determined by the context of the <jvmti/>
1557 environment, which typically is all threads attached to the VM.
1558 </description>
1559 <origin>jvmdi</origin>
1560 <capabilities>
1561 </capabilities>
1562 <parameters>
1563 <param id="threads_count_ptr">
1564 <outptr><jint/></outptr>
1565 <description>
1566 On return, points to the number of threads.
1567 </description>
1568 </param>
1569 <param id="threads_ptr">
1570 <allocbuf outcount="threads_count_ptr"><jthread/></allocbuf>
1571 <description>
1572 On return, points to an array of references, one
1573 for each thread.
1574 </description>
1575 </param>
1576 </parameters>
1577 <errors>
1578 </errors>
1579 </function>
1580
1581 <function id="SuspendThread" num="5">
1582 <synopsis>Suspend Thread</synopsis>
1583 <description>
1584 Suspend the specified thread. If the calling thread is specified,
1585 this function will not return until some other thread calls
1586 <functionlink id="ResumeThread"></functionlink>.
1587 If the thread is currently suspended, this function
1588 does nothing and returns an error.
1589 </description>
1590 <origin>jvmdi</origin>
1591 <capabilities>
1592 <required id="can_suspend"></required>
1593 </capabilities>
1594 <parameters>
1595 <param id="thread">
1596 <jthread null="current" impl="noconvert"/>
1597 <description>
1598 The thread to suspend.
1599 </description>
1600 </param>
1601 </parameters>
1602 <errors>
1603 <error id="JVMTI_ERROR_THREAD_SUSPENDED">
1604 Thread already suspended.
1605 </error>
1606 </errors>
1607 </function>
1608
1609 <elide>
1610 <function id="SuspendAllThreads" num="101">
1611 <synopsis>Suspend All Threads</synopsis>
1612 <description>
1613 <issue>
1614 There has been no explicit call for this function, and it will
1615 thus be removed if there is no interest.
1616 </issue>
1617 Suspend all live threads except:
1618 <ul>
1619 <li>already suspended threads</li>
1620 <li>those listed in <paramlink id="except_list"></paramlink></li>
1621 <li>certain system (non application) threads, as determined
1622 by the VM implementation</li>
1623 </ul>
1624 The threads are Java programming language threads;
1625 native threads which are not attached to the VM are not
1626 Java programming language threads.
1627 A thread is live if <code>java.lang.Thread.isAlive()</code>
1628 would return <code>true</code>, that is, the thread has
1629 been started and has not yet terminated.
1630 The universe of threads is determined
1631 by the context of the <jvmti/>
1632 environment, which, typically, is all threads attached to the VM,
1633 except critical VM internal threads and <jvmti/> agent threads
1634 (see <functionlink id="RunAgentThread"/>).
1635 <p/>
1636 If the calling thread is specified,
1637 all other threads are suspended first then the caller thread is suspended -
1638 this function will not return until some other thread calls
1639 <functionlink id="ResumeThread"></functionlink>.
1640 <p/>
1641 The list of actually
1642 suspended threads is returned in
1643 <paramlink id="suspended_list_ptr"></paramlink>.
1644 Suspension is as defined in <functionlink id="SuspendThread"></functionlink>.
1645 <functionlink id="ResumeThreadList"></functionlink>
1646 can be used to resume the suspended threads.
1647 </description>
1648 <origin>new</origin>
1649 <capabilities>
1650 <required id="can_suspend"></required>
1651 </capabilities>
1652 <parameters>
1653 <param id="except_count">
1654 <jint min="0"/>
1655 <description>
1656 The number of threads in the list of threads not to be suspended.
1657 </description>
1658 </param>
1659 <param id="except_list">
1660 <inbuf incount="except_count">
1661 <jthread/>
1662 <nullok>not an error if <code>except_count == 0</code></nullok>
1663 </inbuf>
1664 <description>
1665 The list of threads not to be suspended.
1666 </description>
1667 </param>
1668 <param id="suspended_count_ptr">
1669 <outptr><jint/></outptr>
1670 <description>
1671 On return, points to the number of threads suspended by this call.
1672 </description>
1673 </param>
1674 <param id="suspended_list_ptr">
1675 <allocbuf outcount="suspended_count_ptr"><jthread/></allocbuf>
1676 <description>
1677 On return, points to an array of references, one
1678 for each thread suspended.
1679 </description>
1680 </param>
1681 </parameters>
1682 <errors>
1683 <error id="JVMTI_ERROR_INVALID_THREAD">
1684 A thread in <paramlink id="except_list"></paramlink> was invalid.
1685 </error>
1686 <error id="JVMTI_ERROR_NULL_POINTER">
1687 Both <paramlink id="except_list"></paramlink> was null
1688 and <paramlink id="except_count"></paramlink> was non-zero.
1689 </error>
1690 </errors>
1691 </function>
1692 </elide>
1693
1694 <function id="SuspendThreadList" num="92">
1695 <synopsis>Suspend Thread List</synopsis>
1696 <description>
1697 Suspend the <paramlink id="request_count"></paramlink>
1698 threads specified in the
1699 <paramlink id="request_list"></paramlink> array.
1700 Threads may be resumed with
1701 <functionlink id="ResumeThreadList"></functionlink> or
1702 <functionlink id="ResumeThread"></functionlink>.
1703 If the calling thread is specified in the
1704 <paramlink id="request_list"></paramlink> array, this function will
1705 not return until some other thread resumes it.
1706 Errors encountered in the suspension of a thread
1707 are returned in the <paramlink id="results"></paramlink>
1708 array, <b>not</b> in the return value of this function.
1709 Threads that are currently suspended do not change state.
1710 </description>
1711 <origin>jvmdi</origin>
1712 <capabilities>
1713 <required id="can_suspend"></required>
1714 </capabilities>
1715 <parameters>
1716 <param id="request_count">
1717 <jint min="0"/>
1718 <description>
1719 The number of threads to suspend.
1720 </description>
1721 </param>
1722 <param id="request_list">
1723 <inbuf incount="request_count"><jthread/></inbuf>
1724 <description>
1725 The list of threads to suspend.
1726 </description>
1727 </param>
1728 <param id="results">
1729 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>
1730 <description>
1731 An agent supplied array of
1732 <paramlink id="request_count"></paramlink> elements.
1733 On return, filled with the error code for
1734 the suspend of the corresponding thread.
1735 The error code will be
1736 <errorlink id="JVMTI_ERROR_NONE"></errorlink>
1737 if the thread was suspended by this call.
1738 Possible error codes are those specified
1739 for <functionlink id="SuspendThread"></functionlink>.
1740 </description>
1741 </param>
1742 </parameters>
1743 <errors>
1744 </errors>
1745 </function>
1746
1747 <function id="SuspendAllVirtualThreads" num="118" since="21">
1748 <synopsis>Suspend All Virtual Threads</synopsis>
1749 <description>
1750 Suspend all virtual threads except those in the exception list.
1751 Virtual threads that are currently suspended do not change state.
1752 Virtual threads may be resumed with
1753 <functionlink id="ResumeAllVirtualThreads"></functionlink> or
1754 <functionlink id="ResumeThreadList"></functionlink> or
1755 <functionlink id="ResumeThread"></functionlink>.
1756 </description>
1757 <origin>new</origin>
1758 <capabilities>
1759 <required id="can_suspend"></required>
1760 <required id="can_support_virtual_threads">Can support virtual threads</required>
1761 </capabilities>
1762 <parameters>
1763 <param id="except_count">
1764 <jint min="0"/>
1765 <description>
1766 The number of threads in the list of threads not to be suspended.
1767 </description>
1768 </param>
1769 <param id="except_list">
1770 <inbuf incount="except_count">
1771 <jthread/>
1772 <nullok>not an error if <code>except_count == 0</code></nullok>
1773 </inbuf>
1774 <description>
1775 The list of threads not to be suspended.
1776 </description>
1777 </param>
1778 </parameters>
1779 <errors>
1780 <error id="JVMTI_ERROR_INVALID_THREAD">
1781 A thread in <paramlink id="except_list"></paramlink> was invalid.
1782 </error>
1783 <error id="JVMTI_ERROR_NULL_POINTER">
1784 Both <paramlink id="except_list"></paramlink> was null
1785 and <paramlink id="except_count"></paramlink> was non-zero.
1786 </error>
1787 </errors>
1788 </function>
1789
1790 <function id="ResumeThread" num="6">
1791 <synopsis>Resume Thread</synopsis>
1792 <description>
1793 Resume a suspended thread.
1794 Any threads currently suspended through
1795 a <jvmti/> suspend function (eg.
1796 <functionlink id="SuspendThread"></functionlink>)
1797 will resume execution;
1798 all other threads are unaffected.
1799 </description>
1800 <origin>jvmdi</origin>
1801 <capabilities>
1802 <required id="can_suspend"></required>
1803 </capabilities>
1804 <parameters>
1805 <param id="thread">
1806 <jthread impl="noconvert"/>
1807 <description>
1808 The thread to resume.
1809 </description>
1810 </param>
1811 </parameters>
1812 <errors>
1813 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
1814 Thread was not suspended.
1815 </error>
1816 <error id="JVMTI_ERROR_INVALID_TYPESTATE">
1817 The state of the thread has been modified, and is now inconsistent.
1818 </error>
1819 </errors>
1820 </function>
1821
1822 <function id="ResumeThreadList" num="93">
1823 <synopsis>Resume Thread List</synopsis>
1824 <description>
1825 Resume the <paramlink id="request_count"></paramlink>
1826 threads specified in the
1827 <paramlink id="request_list"></paramlink> array.
1828 Any thread suspended through
1829 a <jvmti/> suspend function (eg.
1830 <functionlink id="SuspendThreadList"></functionlink>)
1831 will resume execution.
1832 </description>
1833 <origin>jvmdi</origin>
1834 <capabilities>
1835 <required id="can_suspend"></required>
1836 </capabilities>
1837 <parameters>
1838 <param id="request_count">
1839 <jint min="0"/>
1840 <description>
1841 The number of threads to resume.
1842 </description>
1843 </param>
1844 <param id="request_list">
1845 <inbuf incount="request_count"><jthread/></inbuf>
1846 <description>
1847 The threads to resume.
1848 </description>
1849 </param>
1850 <param id="results">
1851 <outbuf incount="request_count"><enum>jvmtiError</enum></outbuf>
1852 <description>
1853 An agent supplied array of
1854 <paramlink id="request_count"></paramlink> elements.
1855 On return, filled with the error code for
1856 the resume of the corresponding thread.
1857 The error code will be
1858 <errorlink id="JVMTI_ERROR_NONE"></errorlink>
1859 if the thread was suspended by this call.
1860 Possible error codes are those specified
1861 for <functionlink id="ResumeThread"></functionlink>.
1862 </description>
1863 </param>
1864 </parameters>
1865 <errors>
1866 </errors>
1867 </function>
1868
1869 <function id="ResumeAllVirtualThreads" num="119" since="21">
1870 <synopsis>Resume All Virtual Threads</synopsis>
1871 <description>
1872 Resume all virtual threads except those in the exception list.
1873 Virtual threads that are currently resumed do not change state.
1874 Virtual threads may be suspended with
1875 <functionlink id="SuspendAllVirtualThreads"></functionlink> or
1876 <functionlink id="SuspendThreadList"></functionlink> or
1877 <functionlink id="SuspendThread"></functionlink>.
1878 </description>
1879 <origin>new</origin>
1880 <capabilities>
1881 <required id="can_suspend"></required>
1882 <required id="can_support_virtual_threads">Can support virtual threads</required>
1883 </capabilities>
1884 <parameters>
1885 <param id="except_count">
1886 <jint min="0"/>
1887 <description>
1888 The number of threads in the list of threads not to be resumed.
1889 </description>
1890 </param>
1891 <param id="except_list">
1892 <inbuf incount="except_count">
1893 <jthread/>
1894 <nullok>not an error if <code>except_count == 0</code></nullok>
1895 </inbuf>
1896 <description>
1897 The list of threads not to be resumed.
1898 </description>
1899 </param>
1900 </parameters>
1901 <errors>
1902 <error id="JVMTI_ERROR_INVALID_THREAD">
1903 A thread in <paramlink id="except_list"></paramlink> was invalid.
1904 </error>
1905 <error id="JVMTI_ERROR_NULL_POINTER">
1906 Both <paramlink id="except_list"></paramlink> was null
1907 and <paramlink id="except_count"></paramlink> was non-zero.
1908 </error>
1909 </errors>
1910 </function>
1911
1912 <function id="StopThread" num="7">
1913 <synopsis>Stop Thread</synopsis>
1914 <description>
1915 Send the specified asynchronous exception to the specified thread.
1916 </description>
1917 <origin>jvmdi</origin>
1918 <capabilities>
1919 <required id="can_signal_thread"></required>
1920 </capabilities>
1921 <parameters>
1922 <param id="thread">
1923 <jthread impl="noconvert"/>
1924 <description>
1925 The thread to stop.
1926 The <functionlink id="StopThread"></functionlink> function may be used to send
1927 an asynchronous exception to a virtual thread when it is suspended at an event.
1928 An implementation may support sending an asynchronous exception to a suspended
1929 virtual thread in other cases.
1930 </description>
1931 </param>
1932 <param id="exception">
1933 <jobject/>
1934 <description>
1935 The asynchronous exception object.
1936 </description>
1937 </param>
1938 </parameters>
1939 <errors>
1940 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
1941 Thread is a virtual thread and was not suspended and was not the current thread.
1942 </error>
1943 <error id="JVMTI_ERROR_OPAQUE_FRAME">
1944 The thread is a suspended virtual thread and the implementation was unable
1945 to throw an asynchronous exception from the current frame.
1946 </error>
1947 </errors>
1948 </function>
1949
1950 <function id="InterruptThread" num="8">
1951 <synopsis>Interrupt Thread</synopsis>
1952 <description>
1953 Interrupt the specified thread
1954 (similar to <code>java.lang.Thread.interrupt</code>).
1955 </description>
1956 <origin>jvmdi</origin>
1957 <capabilities>
1958 <required id="can_signal_thread"></required>
1959 </capabilities>
1960 <parameters>
1961 <param id="thread">
1962 <jthread impl="noconvert"/>
1963 <description>
1964 The thread to interrupt.
1965 </description>
1966 </param>
1967 </parameters>
1968 <errors>
1969 </errors>
1970 </function>
1971
1972 <function id="GetThreadInfo" num="9">
1973 <synopsis>Get Thread Info</synopsis>
1974 <typedef id="jvmtiThreadInfo" label="Thread information structure">
1975 <field id="name">
1976 <allocfieldbuf><char/></allocfieldbuf>
1977 <description>
1978 The thread name, encoded as a
1979 <internallink id="mUTF">modified UTF-8</internallink> string.
1980 </description>
1981 </field>
1982 <field id="priority">
1983 <jint/>
1984 <description>
1985 The thread priority. See the thread priority constants:
1986 <datalink id="jvmtiThreadPriority"></datalink>. The priority of a
1987 virtual thread is always <code>JVMTI_THREAD_NORM_PRIORITY</code>.
1988 </description>
1989 </field>
1990 <field id="is_daemon">
1991 <jboolean/>
1992 <description>
1993 Is this a daemon thread? The daemon status of a virtual thread is
1994 always <code>JNI_TRUE</code>.
1995 </description>
1996 </field>
1997 <field id="thread_group">
1998 <jthreadGroup/>
1999 <description>
2000 The thread group to which this thread belongs.
2001 Null if the thread has terminated.
2002 </description>
2003 </field>
2004 <field id="context_class_loader">
2005 <jobject/>
2006 <description>
2007 The context class loader associated with this thread.
2008 </description>
2009 </field>
2010 </typedef>
2011 <description>
2012 Get thread information. The fields of the <datalink id="jvmtiThreadInfo"/> structure
2013 are filled in with details of the specified thread.
2014 </description>
2015 <origin>jvmdi</origin>
2016 <capabilities>
2017 </capabilities>
2018 <parameters>
2019 <param id="thread">
2020 <jthread null="current" impl="noconvert" started="maybe"/>
2021 <description>
2022 The thread to query.
2023 </description>
2024 </param>
2025 <param id="info_ptr">
2026 <outptr><struct>jvmtiThreadInfo</struct></outptr>
2027 <description>
2028 On return, filled with information describing the specified thread.
2029 </description>
2030 </param>
2031 </parameters>
2032 <errors>
2033 </errors>
2034 </function>
2035
2036 <function id="GetOwnedMonitorInfo" num="10">
2037 <synopsis>Get Owned Monitor Info</synopsis>
2038 <description>
2039 Get information about the monitors owned by the
2040 specified thread.
2041 </description>
2042 <origin>jvmdiClone</origin>
2043 <capabilities>
2044 <required id="can_get_owned_monitor_info"></required>
2045 </capabilities>
2046 <parameters>
2047 <param id="thread">
2048 <jthread null="current" impl="noconvert"/>
2049 <description>
2050 The thread to query.
2051 </description>
2052 </param>
2053 <param id="owned_monitor_count_ptr">
2054 <outptr><jint/></outptr>
2055 <description>
2056 The number of monitors returned.
2057 </description>
2058 </param>
2059 <param id="owned_monitors_ptr">
2060 <allocbuf outcount="owned_monitor_count_ptr"><jobject/></allocbuf>
2061 <description>
2062 The array of owned monitors.
2063 </description>
2064 </param>
2065 </parameters>
2066 <errors>
2067 </errors>
2068 </function>
2069
2070 <function id="GetOwnedMonitorStackDepthInfo" num="153" since="1.1">
2071 <synopsis>Get Owned Monitor Stack Depth Info</synopsis>
2072 <typedef id="jvmtiMonitorStackDepthInfo"
2073 label="Monitor stack depth information structure">
2074 <field id="monitor">
2075 <jobject/>
2076 <description>
2077 The owned monitor.
2078 </description>
2079 </field>
2080 <field id="stack_depth">
2081 <jint/>
2082 <description>
2083 The stack depth. Corresponds to the stack depth used in the
2084 <internallink id="stack">Stack Frame functions</internallink>.
2085 That is, zero is the current frame, one is the frame which
2086 called the current frame. And it is negative one if the
2087 implementation cannot determine the stack depth (e.g., for
2088 monitors acquired by JNI <code>MonitorEnter</code>).
2089 </description>
2090 </field>
2091 </typedef>
2092 <description>
2093 Get information about the monitors owned by the
2094 specified thread and the depth of the stack frame which locked them.
2095 </description>
2096 <origin>new</origin>
2097 <capabilities>
2098 <required id="can_get_owned_monitor_stack_depth_info"></required>
2099 </capabilities>
2100 <parameters>
2101 <param id="thread">
2102 <jthread null="current" impl="noconvert"/>
2103 <description>
2104 The thread to query.
2105 </description>
2106 </param>
2107 <param id="monitor_info_count_ptr">
2108 <outptr><jint/></outptr>
2109 <description>
2110 The number of monitors returned.
2111 </description>
2112 </param>
2113 <param id="monitor_info_ptr">
2114 <allocbuf outcount="monitor_info_count_ptr">
2115 <struct>jvmtiMonitorStackDepthInfo</struct>
2116 </allocbuf>
2117 <description>
2118 The array of owned monitor depth information.
2119 </description>
2120 </param>
2121 </parameters>
2122 <errors>
2123 </errors>
2124 </function>
2125
2126 <function id="GetCurrentContendedMonitor" num="11">
2127 <synopsis>Get Current Contended Monitor</synopsis>
2128 <description>
2129 Get the object, if any, whose monitor the specified thread is waiting to
2130 enter or waiting to regain through <code>java.lang.Object.wait</code>.
2131 </description>
2132 <origin>jvmdi</origin>
2133 <capabilities>
2134 <required id="can_get_current_contended_monitor"></required>
2135 </capabilities>
2136 <parameters>
2137 <param id="thread">
2138 <jthread null="current" impl="noconvert"/>
2139 <description>
2140 The thread to query.
2141 </description>
2142 </param>
2143 <param id="monitor_ptr">
2144 <outptr><jobject/></outptr>
2145 <description>
2146 On return, filled with the current contended monitor, or
2147 null if there is none.
2148 </description>
2149 </param>
2150 </parameters>
2151 <errors>
2152 </errors>
2153 </function>
2154
2155 <callback id="jvmtiStartFunction">
2156 <void/>
2157 <synopsis>Agent Start Function</synopsis>
2158 <description>
2159 Agent supplied callback function.
2160 This function is the entry point for an agent thread
2161 started with
2162 <functionlink id="RunAgentThread"></functionlink>.
2163 </description>
2164 <parameters>
2165 <param id="jvmti_env">
2166 <outptr>
2167 <struct>jvmtiEnv</struct>
2168 </outptr>
2169 <description>
2170 The <jvmti/> environment.
2171 </description>
2172 </param>
2173 <param id="jni_env">
2174 <outptr>
2175 <struct>JNIEnv</struct>
2176 </outptr>
2177 <description>
2178 The JNI environment.
2179 </description>
2180 </param>
2181 <param id="arg">
2182 <outptr>
2183 <void/>
2184 </outptr>
2185 <description>
2186 The <code>arg</code> parameter passed to
2187 <functionlink id="RunAgentThread"></functionlink>.
2188 </description>
2189 </param>
2190 </parameters>
2191 </callback>
2192
2193 <function id="RunAgentThread" num="12">
2194 <synopsis>Run Agent Thread</synopsis>
2195 <description>
2196 Starts the execution of an agent thread. with the specified native function.
2197 The parameter <paramlink id="arg"></paramlink> is forwarded on to the
2198 <functionlink id="jvmtiStartFunction">start function</functionlink>
2199 (specified with <paramlink id="proc"></paramlink>) as its single argument.
2200 This function allows the creation of agent threads
2201 for handling communication with another process or for handling events
2202 without the need to load a special subclass of <code>java.lang.Thread</code> or
2203 implementer of <code>java.lang.Runnable</code>.
2204 Instead, the created thread can run entirely in native code.
2205 However, the created thread does require a newly created instance
2206 of <code>java.lang.Thread</code> (referenced by the argument <code>thread</code>) to
2207 which it will be associated.
2208 The thread object can be created with JNI calls.
2209 <p/>
2210 The following common thread priorities are provided for your convenience:
2211 <constants id="jvmtiThreadPriority" label="Thread Priority Constants" kind="const">
2212 <constant id="JVMTI_THREAD_MIN_PRIORITY" num="1">
2213 Minimum possible thread priority
2214 </constant>
2215 <constant id="JVMTI_THREAD_NORM_PRIORITY" num="5">
2216 Normal thread priority
2217 </constant>
2218 <constant id="JVMTI_THREAD_MAX_PRIORITY" num="10">
2219 Maximum possible thread priority
2220 </constant>
2221 </constants>
2222 <p/>
2223 The new thread is started as a daemon thread with the specified
2224 <paramlink id="priority"></paramlink>.
2225 If enabled, a <eventlink id="ThreadStart"/> event will be sent.
2226 <p/>
2227 Since the thread has been started, the thread will be live when this function
2228 returns, unless the thread terminated immediately.
2229 <p/>
2230 The thread group of the thread is ignored -- specifically, the thread is not
2231 added to the thread group and the thread is not seen on queries of the thread
2232 group at either the Java programming language or <jvmti/> levels.
2233 <p/>
2234 The thread is not visible to Java programming language queries but is
2235 included in <jvmti/> queries (for example,
2236 <functionlink id="GetAllThreads"/> and
2237 <functionlink id="GetAllStackTraces"/>).
2238 <p/>
2239 Upon execution of <code>proc</code>, the new thread will be attached to the
2240 VM -- see the JNI documentation on
2241 <externallink id="jni/invocation.html#attaching-to-the-vm"
2242 >Attaching to the VM</externallink>.
2243 </description>
2244 <origin>jvmdiClone</origin>
2245 <capabilities>
2246 </capabilities>
2247 <parameters>
2248 <param id="thread">
2249 <jthread impl="noconvert" started="no"/>
2250 <description>
2251 The thread to run.
2252 The <code>thread</code> may not be a virtual thread. Otherwise, the error code
2253 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
2254 </description>
2255 </param>
2256 <param id="proc">
2257 <ptrtype>
2258 <struct>jvmtiStartFunction</struct>
2259 </ptrtype>
2260 <description>
2261 The start function.
2262 </description>
2263 </param>
2264 <param id="arg">
2265 <inbuf>
2266 <void/>
2267 <nullok>A null pointer is passed to the start function</nullok>
2268 </inbuf>
2269 <description>
2270 The argument to the start function.
2271 </description>
2272 </param>
2273 <param id="priority">
2274 <jint/>
2275 <description>
2276 The priority of the started thread. Any thread
2277 priority allowed by <code>java.lang.Thread.setPriority</code> can be used including
2278 those in <datalink id="jvmtiThreadPriority"></datalink>.
2279 </description>
2280 </param>
2281 </parameters>
2282 <errors>
2283 <error id="JVMTI_ERROR_INVALID_PRIORITY">
2284 <paramlink id="priority"/> is less than
2285 <datalink id="JVMTI_THREAD_MIN_PRIORITY"/>
2286 or greater than
2287 <datalink id="JVMTI_THREAD_MAX_PRIORITY"/>
2288 </error>
2289 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
2290 <paramlink id="thread"/> is a virtual thread.
2291 </error>
2292 </errors>
2293 </function>
2294
2295 <function id="SetThreadLocalStorage" jkernel="yes" impl="notrace" phase="start" num="103">
2296 <synopsis>Set Thread Local Storage</synopsis>
2297 <description>
2298 The VM stores a pointer value associated with each environment-thread
2299 pair. This pointer value is called <i>thread-local storage</i>.
2300 This value is null unless set with this function.
2301 Agents can allocate memory in which they store thread specific
2302 information. By setting thread-local storage it can then be
2303 accessed with
2304 <functionlink id="GetThreadLocalStorage"></functionlink>.
2305 <p/>
2306 This function is called by the agent to set the value of the <jvmti/>
2307 thread-local storage. <jvmti/> supplies to the agent a pointer-size
2308 thread-local storage that can be used to record per-thread
2309 information.
2310 </description>
2311 <origin>jvmpi</origin>
2312 <capabilities>
2313 </capabilities>
2314 <parameters>
2315 <param id="thread">
2316 <jthread null="current" impl="noconvert"/>
2317 <description>
2318 Store to this thread.
2319 </description>
2320 </param>
2321 <param id="data">
2322 <inbuf>
2323 <void/>
2324 <nullok>value is set to null</nullok>
2325 </inbuf>
2326 <description>
2327 The value to be entered into the thread-local storage.
2328 </description>
2329 </param>
2330 </parameters>
2331 <errors>
2332 </errors>
2333 </function>
2334
2335 <function id="GetThreadLocalStorage" jkernel="yes" impl="innative notrace" phase="start" num="102">
2336 <synopsis>Get Thread Local Storage</synopsis>
2337 <description>
2338 Called by the agent to get the value of the <jvmti/> thread-local
2339 storage.
2340 </description>
2341 <origin>jvmpi</origin>
2342 <capabilities>
2343 </capabilities>
2344 <parameters>
2345 <param id="thread">
2346 <jthread null="current" impl="noconvert"/>
2347 <description>
2348 Retrieve from this thread.
2349 </description>
2350 </param>
2351 <param id="data_ptr">
2352 <agentbuf><void/></agentbuf>
2353 <description>
2354 Pointer through which the value of the thread local
2355 storage is returned.
2356 If thread-local storage has not been set with
2357 <functionlink id="SetThreadLocalStorage"></functionlink> the returned
2358 pointer is null.
2359 </description>
2360 </param>
2361 </parameters>
2362 <errors>
2363 </errors>
2364 </function>
2365
2366 </category>
2367
2368 <category id="thread_groups" label="Thread Group">
2369 <intro>
2370 </intro>
2371
2372 <function id="GetTopThreadGroups" num="13">
2373 <synopsis>Get Top Thread Groups</synopsis>
2374 <description>
2375 Return all top-level (parentless) thread groups in the VM.
2376 </description>
2377 <origin>jvmdi</origin>
2378 <capabilities>
2379 </capabilities>
2380 <parameters>
2381 <param id="group_count_ptr">
2382 <outptr><jint/></outptr>
2383 <description>
2384 On return, points to the number of top-level thread groups.
2385 </description>
2386 </param>
2387 <param id="groups_ptr">
2388 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>
2389 <description>
2390 On return, refers to a pointer to the top-level thread group array.
2391 </description>
2392 </param>
2393 </parameters>
2394 <errors>
2395 </errors>
2396 </function>
2397
2398 <function id="GetThreadGroupInfo" num="14">
2399 <synopsis>Get Thread Group Info</synopsis>
2400 <typedef id="jvmtiThreadGroupInfo" label="Thread group information structure">
2401 <field id="parent">
2402 <jthreadGroup/>
2403 <description>
2404 The parent thread group.
2405 </description>
2406 </field>
2407 <field id="name">
2408 <allocfieldbuf><char/></allocfieldbuf>
2409 <description>
2410 The thread group's name, encoded as a
2411 <internallink id="mUTF">modified UTF-8</internallink> string.
2412 </description>
2413 </field>
2414 <field id="max_priority">
2415 <jint/>
2416 <description>
2417 The maximum priority for this thread group.
2418 </description>
2419 </field>
2420 <field id="is_daemon">
2421 <jboolean/>
2422 <description>
2423 Is this a daemon thread group?
2424 </description>
2425 </field>
2426 </typedef>
2427 <description>
2428 Get information about the thread group. The fields of the
2429 <functionlink id="jvmtiThreadGroupInfo"></functionlink> structure
2430 are filled in with details of the specified thread group.
2431 </description>
2432 <origin>jvmdi</origin>
2433 <capabilities>
2434 </capabilities>
2435 <parameters>
2436 <param id="group">
2437 <jthreadGroup/>
2438 <description>
2439 The thread group to query.
2440 </description>
2441 </param>
2442 <param id="info_ptr">
2443 <outptr><struct>jvmtiThreadGroupInfo</struct></outptr>
2444 <description>
2445 On return, filled with information describing the specified
2446 thread group.
2447 </description>
2448 </param>
2449 </parameters>
2450 <errors>
2451 </errors>
2452 </function>
2453
2454 <function id="GetThreadGroupChildren" num="15">
2455 <synopsis>Get Thread Group Children</synopsis>
2456 <description>
2457 Get the live platform threads and the child thread groups in this
2458 thread group. Virtual threads are not returned by this function.
2459 </description>
2460 <origin>jvmdi</origin>
2461 <capabilities>
2462 </capabilities>
2463 <parameters>
2464 <param id="group">
2465 <jthreadGroup/>
2466 <description>
2467 The group to query.
2468 </description>
2469 </param>
2470 <param id="thread_count_ptr">
2471 <outptr><jint/></outptr>
2472 <description>
2473 On return, points to the number of live threads in this thread group.
2474 </description>
2475 </param>
2476 <param id="threads_ptr">
2477 <allocbuf outcount="thread_count_ptr"><jthread/></allocbuf>
2478 <description>
2479 On return, points to an array of the live threads in this thread group.
2480 </description>
2481 </param>
2482 <param id="group_count_ptr">
2483 <outptr><jint/></outptr>
2484 <description>
2485 On return, points to the number of child thread groups
2486 </description>
2487 </param>
2488 <param id="groups_ptr">
2489 <allocbuf outcount="group_count_ptr"><jthreadGroup/></allocbuf>
2490 <description>
2491 On return, points to an array of the child thread groups.
2492 </description>
2493 </param>
2494 </parameters>
2495 <errors>
2496 </errors>
2497 </function>
2498 </category>
2499
2500 <category id="stack" label="Stack Frame">
2501 <intro>
2502 These functions provide information about the stack of a thread.
2503 Stack frames are referenced by depth.
2504 The frame at depth zero is the current frame.
2505 <p/>
2506 Stack frames are as described in
2507 <vmspec chapter="3.6"/>,
2508 That is, they correspond to method
2509 invocations (including native methods) but do not correspond to platform native or
2510 VM internal frames.
2511 <p/>
2512 A <jvmti/> implementation may use method invocations to launch a thread and
2513 the corresponding frames may be included in the stack as presented by these functions --
2514 that is, there may be frames shown
2515 deeper than <code>main()</code> and <code>run()</code>.
2516 However this presentation must be consistent across all <jvmti/> functionality which
2517 uses stack frames or stack depth.
2518 </intro>
2519
2520 <typedef id="jvmtiFrameInfo" label="Stack frame information structure">
2521 <description>
2522 Information about a stack frame is returned in this structure.
2523 </description>
2524 <field id="method">
2525 <jmethodID/>
2526 <description>
2527 The method executing in this frame.
2528 </description>
2529 </field>
2530 <field id="location">
2531 <jlocation/>
2532 <description>
2533 The index of the instruction executing in this frame.
2534 <code>-1</code> if the frame is executing a native method.
2535 </description>
2536 </field>
2537 </typedef>
2538
2539 <typedef id="jvmtiStackInfo" label="Stack information structure">
2540 <description>
2541 Information about a set of stack frames is returned in this structure.
2542 </description>
2543 <field id="thread">
2544 <jthread/>
2545 <description>
2546 On return, the thread traced.
2547 </description>
2548 </field>
2549 <field id="state">
2550 <jint/>
2551 <description>
2552 On return, the thread state. See <functionlink id="GetThreadState"></functionlink>.
2553 </description>
2554 </field>
2555 <field id="frame_buffer">
2556 <outbuf incount="max_frame_count">
2557 <struct>jvmtiFrameInfo</struct>
2558 </outbuf>
2559 <description>
2560 On return, this agent allocated buffer is filled
2561 with stack frame information.
2562 </description>
2563 </field>
2564 <field id="frame_count">
2565 <jint/>
2566 <description>
2567 On return, the number of records filled into
2568 <code>frame_buffer</code>.
2569 This will be
2570 min(<code>max_frame_count</code>, <i>stackDepth</i>).
2571 </description>
2572 </field>
2573 </typedef>
2574
2575 <function id="GetStackTrace" num="104">
2576 <synopsis>Get Stack Trace</synopsis>
2577 <description>
2578 Get information about the stack of a thread.
2579 If <paramlink id="max_frame_count"></paramlink> is less than the depth of the stack,
2580 the <paramlink id="max_frame_count"></paramlink> topmost frames are returned,
2581 otherwise the entire stack is returned.
2582 The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2583 <p/>
2584 The following example causes up to five of the topmost frames
2585 to be returned and (if there are any frames) the currently
2586 executing method name to be printed.
2587 <example>
2588 jvmtiFrameInfo frames[5];
2589 jint count;
2590 jvmtiError err;
2591
2592 err = (*jvmti)->GetStackTrace(jvmti, aThread, 0, 5,
2593 frames, &count);
2594 if (err == JVMTI_ERROR_NONE && count >= 1) {
2595 char *methodName;
2596 err = (*jvmti)->GetMethodName(jvmti, frames[0].method,
2597 &methodName, NULL, NULL);
2598 if (err == JVMTI_ERROR_NONE) {
2599 printf("Executing method: %s", methodName);
2600 }
2601 }
2602 </example>
2603 <todo>
2604 check example code.
2605 </todo>
2606 <p/>
2607 The <paramlink id="thread"></paramlink> need not be suspended
2608 to call this function.
2609 <p/>
2610 The <functionlink id="GetLineNumberTable"></functionlink>
2611 function can be used to map locations to line numbers. Note that
2612 this mapping can be done lazily.
2613 </description>
2614 <origin>jvmpi</origin>
2615 <capabilities>
2616 </capabilities>
2617 <parameters>
2618 <param id="thread">
2619 <jthread null="current" impl="noconvert"/>
2620 <description>
2621 Fetch the stack trace of this thread.
2622 </description>
2623 </param>
2624 <param id="start_depth">
2625 <jint/>
2626 <description>
2627 Begin retrieving frames at this depth.
2628 If non-negative, count from the current frame,
2629 the first frame retrieved is at depth <code>start_depth</code>.
2630 For example, if zero, start from the current frame; if one, start from the
2631 caller of the current frame; if two, start from the caller of the
2632 caller of the current frame; and so on.
2633 If negative, count from below the oldest frame,
2634 the first frame retrieved is at depth <i>stackDepth</i><code> + start_depth</code>,
2635 where <i>stackDepth</i> is the count of frames on the stack.
2636 For example, if negative one, only the oldest frame is retrieved;
2637 if negative two, start from the frame called by the oldest frame.
2638 </description>
2639 </param>
2640 <param id="max_frame_count">
2641 <jint min="0"/>
2642 <description>
2643 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.
2644 </description>
2645 </param>
2646 <param id="frame_buffer">
2647 <outbuf incount="max_frame_count" outcount="count_ptr">
2648 <struct>jvmtiFrameInfo</struct>
2649 </outbuf>
2650 <description>
2651 On return, this agent allocated buffer is filled
2652 with stack frame information.
2653 </description>
2654 </param>
2655 <param id="count_ptr">
2656 <outptr><jint/></outptr>
2657 <description>
2658 On return, points to the number of records filled in.
2659 For non-negative <code>start_depth</code>, this will be
2660 min(<code>max_frame_count</code>, <i>stackDepth</i><code> - start_depth</code>).
2661 For negative <code>start_depth</code>, this will be
2662 min(<code>max_frame_count</code>, <code>-start_depth</code>).
2663 </description>
2664 </param>
2665 </parameters>
2666 <errors>
2667 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
2668 <paramlink id="start_depth"/> is positive and greater than or equal to <i>stackDepth</i>.
2669 Or <paramlink id="start_depth"/> is negative and less than <i>-stackDepth</i>.
2670 </error>
2671 </errors>
2672 </function>
2673
2674
2675 <function id="GetAllStackTraces" num="100">
2676 <synopsis>Get All Stack Traces</synopsis>
2677 <description>
2678 Get the stack traces of all live platform threads attached to the VM.
2679 The list includes the stack traces of
2680 <internallink id="RunAgentThread">agent threads</internallink>.
2681 It does not include the stack traces of virtual threads.
2682 <p/>
2683 If <paramlink id="max_frame_count"/> is less than the depth of a stack,
2684 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,
2685 otherwise the entire stack is returned.
2686 The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2687 <p/>
2688 All stacks are collected simultaneously, that is, no changes will occur to the
2689 thread state or stacks between the sampling of one thread and the next.
2690 The threads need not be suspended.
2691
2692 <example>
2693 jvmtiStackInfo *stack_info;
2694 jint thread_count;
2695 int ti;
2696 jvmtiError err;
2697
2698 err = (*jvmti)->GetAllStackTraces(jvmti, MAX_FRAMES, &stack_info, &thread_count);
2699 if (err != JVMTI_ERROR_NONE) {
2700 ...
2701 }
2702 for (ti = 0; ti < thread_count; ++ti) {
2703 jvmtiStackInfo *infop = &stack_info[ti];
2704 jthread thread = infop->thread;
2705 jint state = infop->state;
2706 jvmtiFrameInfo *frames = infop->frame_buffer;
2707 int fi;
2708
2709 myThreadAndStatePrinter(thread, state);
2710 for (fi = 0; fi < infop->frame_count; fi++) {
2711 myFramePrinter(frames[fi].method, frames[fi].location);
2712 }
2713 }
2714 /* this one Deallocate call frees all data allocated by GetAllStackTraces */
2715 err = (*jvmti)->Deallocate(jvmti, stack_info);
2716 </example>
2717 <todo>
2718 check example code.
2719 </todo>
2720
2721 </description>
2722 <origin>new</origin>
2723 <capabilities>
2724 </capabilities>
2725 <parameters>
2726 <param id="max_frame_count">
2727 <jint min="0"/>
2728 <description>
2729 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread.
2730 </description>
2731 </param>
2732 <param id="stack_info_ptr">
2733 <allocbuf>
2734 <struct>jvmtiStackInfo</struct>
2735 </allocbuf>
2736 <description>
2737 On return, this buffer is filled
2738 with stack information for each thread.
2739 The number of <datalink id="jvmtiStackInfo"/> records is determined
2740 by <paramlink id="thread_count_ptr"/>.
2741 <p/>
2742 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>
2743 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.
2744 These buffers must not be separately deallocated.
2745 </description>
2746 </param>
2747 <param id="thread_count_ptr">
2748 <outptr><jint/></outptr>
2749 <description>
2750 The number of threads traced.
2751 </description>
2752 </param>
2753 </parameters>
2754 <errors>
2755 </errors>
2756 </function>
2757
2758 <function id="GetThreadListStackTraces" num="101">
2759 <synopsis>Get Thread List Stack Traces</synopsis>
2760 <description>
2761 Get information about the stacks of the supplied threads.
2762 If <paramlink id="max_frame_count"/> is less than the depth of a stack,
2763 the <paramlink id="max_frame_count"/> topmost frames are returned for that thread,
2764 otherwise the entire stack is returned.
2765 The topmost frames, those most recently invoked, are at the beginning of the returned buffer.
2766 <p/>
2767 All stacks are collected simultaneously, that is, no changes will occur to the
2768 thread state or stacks between the sampling one thread and the next.
2769 The threads need not be suspended.
2770 <p/>
2771 If a thread has not yet started or terminates before the stack information is collected,
2772 a zero length stack (<datalink id="jvmtiStackInfo.frame_count"/> will be zero)
2773 will be returned and the thread <datalink id="jvmtiStackInfo.state"/> can be checked.
2774 <p/>
2775 See the example for the similar function
2776 <functionlink id="GetAllStackTraces"/>.
2777 </description>
2778 <origin>new</origin>
2779 <capabilities>
2780 </capabilities>
2781 <parameters>
2782 <param id="thread_count">
2783 <jint min="0"/>
2784 <description>
2785 The number of threads to trace.
2786 </description>
2787 </param>
2788 <param id="thread_list">
2789 <inbuf incount="thread_count"><jthread/></inbuf>
2790 <description>
2791 The list of threads to trace.
2792 </description>
2793 </param>
2794 <param id="max_frame_count">
2795 <jint min="0"/>
2796 <description>
2797 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve per thread.
2798 </description>
2799 </param>
2800 <param id="stack_info_ptr">
2801 <allocbuf outcount="thread_count">
2802 <struct>jvmtiStackInfo</struct>
2803 </allocbuf>
2804 <description>
2805 On return, this buffer is filled
2806 with stack information for each thread.
2807 The number of <datalink id="jvmtiStackInfo"/> records is determined
2808 by <paramlink id="thread_count"/>.
2809 <p/>
2810 Note that this buffer is allocated to include the <datalink id="jvmtiFrameInfo"/>
2811 buffers pointed to by <datalink id="jvmtiStackInfo.frame_buffer"/>.
2812 These buffers must not be separately deallocated.
2813 </description>
2814 </param>
2815 </parameters>
2816 <errors>
2817 <error id="JVMTI_ERROR_INVALID_THREAD">
2818 An element in <paramlink id="thread_list"/> is not a thread object.
2819 </error>
2820 </errors>
2821 </function>
2822
2823 <elide>
2824 <function id="AsyncGetStackTrace" num="1000">
2825 <synopsis>Get Stack Trace--Asynchronous</synopsis>
2826 <description>
2827 Get information about the entire stack of a thread (or a sub-section of it).
2828 This is the asynchronous version of <functionlink id="GetStackTrace"></functionlink>
2829 and is reentrant and safe to call
2830 from asynchronous signal handlers.
2831 The stack trace is returned only for the calling thread.
2832 <p/>
2833 The <functionlink id="GetLineNumberTable"></functionlink>
2834 function can be used to map locations to line numbers. Note that
2835 this mapping can be done lazily.
2836 </description>
2837 <origin>jvmpi</origin>
2838 <capabilities>
2839 <required id="can_get_async_stack_trace"></required>
2840 <capability id="can_show_JVM_spec_async_frames">
2841 If <code>false</code>,
2842 <paramlink id="use_java_stack"></paramlink>
2843 must be <code>false</code>.
2844 </capability>
2845 </capabilities>
2846 <parameters>
2847 <param id="use_java_stack">
2848 <jboolean/>
2849 <description>
2850 Return the stack showing <vmspec/>
2851 model of the stack;
2852 otherwise, show the internal representation of the stack with
2853 inlined and optimized methods missing. If the virtual machine
2854 is using the <i>Java Virtual Machine Specification</i> stack model
2855 internally, this flag is ignored.
2856 </description>
2857 </param>
2858 <param id="max_count">
2859 <jint min="0"/>
2860 <description>
2861 The maximum number of <datalink id="jvmtiFrameInfo"/> records to retrieve.
2862 Retrieve this many unless the stack depth is less than <code>max_count</code>.
2863 </description>
2864 </param>
2865 <param id="frame_buffer">
2866 <outbuf incount="max_count" outcount="count_ptr">
2867 <struct>jvmtiFrameInfo</struct>
2868 <nullok>this information is not returned</nullok>
2869 </outbuf>
2870 <description>
2871 The agent passes in a buffer
2872 large enough to hold <code>max_count</code> records of
2873 <datalink id="jvmtiFrameInfo"></datalink>. This buffer must be
2874 pre-allocated by the agent.
2875 </description>
2876 </param>
2877 <param id="count_ptr">
2878 <outptr><jint/></outptr>
2879 <description>
2880 On return, points to the number of records filled in..
2881 </description>
2882 </param>
2883 </parameters>
2884 <errors>
2885 <error id="JVMTI_ERROR_UNATTACHED_THREAD">
2886 The thread being used to call this function is not attached
2887 to the virtual machine. Calls must be made from attached threads.
2888 </error>
2889 </errors>
2890 </function>
2891 </elide>
2892
2893 <function id="GetFrameCount" num="16">
2894 <synopsis>Get Frame Count</synopsis>
2895 <description>
2896 Get the number of frames currently in the specified thread's call stack.
2897 <p/>
2898 If this function is called for a thread actively executing bytecodes (for example,
2899 not the current thread and not suspended), the information returned is transient.
2900 </description>
2901 <origin>jvmdi</origin>
2902 <capabilities>
2903 </capabilities>
2904 <parameters>
2905 <param id="thread">
2906 <jthread null="current" impl="noconvert"/>
2907 <description>
2908 The thread to query.
2909 </description>
2910 </param>
2911 <param id="count_ptr">
2912 <outptr><jint/></outptr>
2913 <description>
2914 On return, points to the number of frames in the call stack.
2915 </description>
2916 </param>
2917 </parameters>
2918 <errors>
2919 </errors>
2920 </function>
2921
2922 <function id="PopFrame" num="80">
2923 <synopsis>Pop Frame</synopsis>
2924 <description>
2925 Pop the current frame of <code>thread</code>'s stack.
2926 Popping a frame takes you to the previous frame.
2927 When the thread is resumed, the execution
2928 state of the thread is reset to the state
2929 immediately before the called method was invoked.
2930 That is (using <vmspec/> terminology):
2931 <ul>
2932 <li>the current frame is discarded as the previous frame becomes the current one</li>
2933 <li>the operand stack is restored--the argument values are added back
2934 and if the invoke was not <code>invokestatic</code>,
2935 <code>objectref</code> is added back as well</li>
2936 <li>the Java virtual machine PC is restored to the opcode
2937 of the invoke instruction</li>
2938 </ul>
2939 Note however, that any changes to the arguments, which
2940 occurred in the called method, remain;
2941 when execution continues, the first instruction to
2942 execute will be the invoke.
2943 <p/>
2944 Between calling <code>PopFrame</code> and resuming the
2945 thread the state of the stack is undefined.
2946 To pop frames beyond the first,
2947 these three steps must be repeated:
2948 <ul>
2949 <li>suspend the thread via an event (step, breakpoint, ...)</li>
2950 <li>call <code>PopFrame</code></li>
2951 <li>resume the thread</li>
2952 </ul>
2953 <p/>
2954 A lock acquired by calling the called method
2955 (if it is a <code>synchronized</code> method)
2956 and locks acquired by entering <code>synchronized</code>
2957 blocks within the called method are released.
2958 Note: this does not apply to native locks or
2959 <code>java.util.concurrent.locks</code> locks.
2960 <p/>
2961 Finally blocks are not executed.
2962 <p/>
2963 Changes to global state are not addressed and thus remain changed.
2964 <p/>
2965 The specified thread must be suspended or must be the current thread.
2966 <p/>
2967 Both the called method and calling method must be non-native Java programming
2968 language methods.
2969 <p/>
2970 No <jvmti/> events are generated by this function.
2971 </description>
2972 <origin>jvmdi</origin>
2973 <capabilities>
2974 <required id="can_pop_frame"></required>
2975 </capabilities>
2976 <parameters>
2977 <param id="thread">
2978 <jthread impl="noconvert"/>
2979 <description>
2980 The thread whose current frame is to be popped.
2981 The <functionlink id="PopFrame"></functionlink> function may be used to
2982 pop the current frame of a virtual thread when it is suspended at an event.
2983 An implementation may support popping the current frame of a suspended
2984 virtual thread in other cases.
2985 </description>
2986 </param>
2987 </parameters>
2988 <errors>
2989 <error id="JVMTI_ERROR_OPAQUE_FRAME">
2990 The implementation is unable to pop this frame
2991 (e.g. called or calling method is a native method).
2992 </error>
2993 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
2994 Thread was not suspended and was not the current thread.
2995 </error>
2996 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
2997 There are less than two stack frames on the call stack.
2998 </error>
2999 </errors>
3000 </function>
3001
3002 <function id="GetFrameLocation" num="19">
3003 <synopsis>Get Frame Location</synopsis>
3004 <description>
3005 <p/>
3006 For a Java programming language frame, return the location of the instruction
3007 currently executing.
3008 </description>
3009 <origin>jvmdiClone</origin>
3010 <capabilities>
3011 </capabilities>
3012 <parameters>
3013 <param id="thread">
3014 <jthread null="current" frame="frame" impl="noconvert"/>
3015 <description>
3016 The thread of the frame to query.
3017 </description>
3018 </param>
3019 <param id="depth">
3020 <jframeID thread="thread"/>
3021 <description>
3022 The depth of the frame to query.
3023 </description>
3024 </param>
3025 <param id="method_ptr">
3026 <outptr><jmethodID/></outptr>
3027 <description>
3028 On return, points to the method for the current location.
3029 </description>
3030 </param>
3031 <param id="location_ptr">
3032 <outptr><jlocation/></outptr>
3033 <description>
3034 On return, points to the index of the currently
3035 executing instruction.
3036 Is set to <code>-1</code> if the frame is executing
3037 a native method.
3038 </description>
3039 </param>
3040 </parameters>
3041 <errors>
3042 </errors>
3043 </function>
3044
3045 <function id="NotifyFramePop" num="20">
3046 <synopsis>Notify Frame Pop</synopsis>
3047 <description>
3048 When the frame that is currently at <paramlink id="depth"></paramlink>
3049 is popped from the stack, generate a
3050 <eventlink id="FramePop"></eventlink> event. See the
3051 <eventlink id="FramePop"></eventlink> event for details.
3052 Only frames corresponding to non-native Java programming language
3053 methods can receive notification.
3054 <p/>
3055 The specified thread must be suspended or must be the current thread.
3056 </description>
3057 <origin>jvmdi</origin>
3058 <capabilities>
3059 <required id="can_generate_frame_pop_events"></required>
3060 </capabilities>
3061 <parameters>
3062 <param id="thread">
3063 <jthread null="current" frame="depth" impl="noconvert"/>
3064 <description>
3065 The thread of the frame for which the frame pop event will be generated.
3066 </description>
3067 </param>
3068 <param id="depth">
3069 <jframeID thread="thread"/>
3070 <description>
3071 The depth of the frame for which the frame pop event will be generated.
3072 </description>
3073 </param>
3074 </parameters>
3075 <errors>
3076 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3077 A <eventlink id="FramePop"></eventlink> event cannot be generated for this frame
3078 (e.g. the frame at <code>depth</code> is executing a native method).
3079 </error>
3080 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3081 Thread was not suspended and was not the current thread.
3082 </error>
3083 <error id="JVMTI_ERROR_DUPLICATE">
3084 There is already a frame pop event request at the specified depth.
3085 </error>
3086 </errors>
3087 </function>
3088
3089 <function id="ClearAllFramePops" num="67" since="25">
3090 <synopsis>Clear Frame Pop</synopsis>
3091 <description>
3092 Clear all frame pop requests so that a <eventlink id="FramePop"></eventlink>
3093 event will not be generated for any frames.
3094 See the <eventlink id="FramePop"></eventlink> event for details.
3095 <p/>
3096 The specified thread must be suspended or must be the current thread.
3097 </description>
3098 <origin>new</origin>
3099 <capabilities>
3100 <required id="can_generate_frame_pop_events"></required>
3101 </capabilities>
3102 <parameters>
3103 <param id="thread">
3104 <jthread null="current" impl="noconvert"/>
3105 <description>
3106 The thread for which all the frame pop events will be cleared.
3107 </description>
3108 </param>
3109 </parameters>
3110 <errors>
3111 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3112 Thread was not suspended and was not the current thread.
3113 </error>
3114 </errors>
3115 </function>
3116
3117 </category>
3118
3119 <category id="ForceEarlyReturn" label="Force Early Return">
3120 <intro>
3121 These functions allow an agent to force a return from the current frame.
3122 The specified thread must be suspended or must be the current thread.
3123 These functions may be used to force a return from the current frame
3124 of a virtual thread when it is suspended at an event.
3125 An implementation may support forcing a return from the current frame
3126 of a suspended virtual thread in other cases.
3127 The method which will return early is referred to as the <i>called method</i>.
3128 The called method is the current method
3129 (as defined by
3130 <vmspec chapter="3.6"/>)
3131 for the specified thread at
3132 the time the function is called.
3133 <p/>
3134 The return occurs when execution of Java programming
3135 language code is resumed on this thread.
3136 Between calling one of these functions and resumption
3137 of thread execution, the state of the stack is undefined.
3138 <p/>
3139 No further instructions are executed in the called method.
3140 Specifically, finally blocks are not executed.
3141 Note: this can cause inconsistent states in the application.
3142 <p/>
3143 A lock acquired by calling the called method
3144 (if it is a <code>synchronized</code> method)
3145 and locks acquired by entering <code>synchronized</code>
3146 blocks within the called method are released.
3147 Note: this does not apply to native locks or
3148 <code>java.util.concurrent.locks</code> locks.
3149 <p/>
3150 Events, such as <eventlink id="MethodExit"></eventlink>,
3151 are generated as they would be in a normal return.
3152 <p/>
3153 The called method must be a non-native Java programming
3154 language method.
3155 Forcing return on a thread with only one frame on the
3156 stack causes the thread to exit when resumed.
3157 </intro>
3158
3159 <function id="ForceEarlyReturnObject" num="81" since="1.1">
3160 <synopsis>Force Early Return - Object</synopsis>
3161 <description>
3162 This function can be used to return from a method whose
3163 result type is <code>Object</code>
3164 or a subclass of <code>Object</code>.
3165 </description>
3166 <origin>new</origin>
3167 <capabilities>
3168 <required id="can_force_early_return"></required>
3169 </capabilities>
3170 <parameters>
3171 <param id="thread">
3172 <jthread null="current" impl="noconvert"/>
3173 <description>
3174 The thread whose current frame is to return early.
3175 </description>
3176 </param>
3177 <param id="value">
3178 <jobject/>
3179 <description>
3180 The return value for the called frame.
3181 An object or a null pointer.
3182 </description>
3183 </param>
3184 </parameters>
3185 <errors>
3186 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3187 The implementation is unable to force the current frame to return
3188 (e.g. current frame is executing a native method).
3189 </error>
3190 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3191 The result type of the called method is not
3192 <code>Object</code> or a subclass of <code>Object</code>.
3193 </error>
3194 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3195 The supplied <paramlink id="value"/> is not compatible with the
3196 result type of the called method.
3197 </error>
3198 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3199 Thread was not suspended and was not the current thread.
3200 </error>
3201 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3202 There are no more frames on the call stack.
3203 </error>
3204 </errors>
3205 </function>
3206
3207 <function id="ForceEarlyReturnInt" num="82" since="1.1">
3208 <synopsis>Force Early Return - Int</synopsis>
3209 <description>
3210 This function can be used to return from a method whose
3211 result type is <code>int</code>, <code>short</code>,
3212 <code>char</code>, <code>byte</code>, or
3213 <code>boolean</code>.
3214 </description>
3215 <origin>new</origin>
3216 <capabilities>
3217 <required id="can_force_early_return"></required>
3218 </capabilities>
3219 <parameters>
3220 <param id="thread">
3221 <jthread null="current" impl="noconvert"/>
3222 <description>
3223 The thread whose current frame is to return early.
3224 </description>
3225 </param>
3226 <param id="value">
3227 <jint/>
3228 <description>
3229 The return value for the called frame.
3230 </description>
3231 </param>
3232 </parameters>
3233 <errors>
3234 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3235 The implementation is unable to force the current frame to return
3236 (e.g. current frame is executing a native method).
3237 </error>
3238 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3239 The result type of the called method is not
3240 <code>int</code>, <code>short</code>,
3241 <code>char</code>, <code>byte</code>, or
3242 <code>boolean</code>.
3243 </error>
3244 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3245 Thread was not suspended and was not the current thread.
3246 </error>
3247 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3248 There are no frames on the call stack.
3249 </error>
3250 </errors>
3251 </function>
3252
3253 <function id="ForceEarlyReturnLong" num="83" since="1.1">
3254 <synopsis>Force Early Return - Long</synopsis>
3255 <description>
3256 This function can be used to return from a method whose
3257 result type is <code>long</code>.
3258 </description>
3259 <origin>new</origin>
3260 <capabilities>
3261 <required id="can_force_early_return"></required>
3262 </capabilities>
3263 <parameters>
3264 <param id="thread">
3265 <jthread null="current" impl="noconvert"/>
3266 <description>
3267 The thread whose current frame is to return early.
3268 </description>
3269 </param>
3270 <param id="value">
3271 <jlong/>
3272 <description>
3273 The return value for the called frame.
3274 </description>
3275 </param>
3276 </parameters>
3277 <errors>
3278 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3279 The implementation is unable to force the current frame to return
3280 (e.g. current frame is executing a native method).
3281 </error>
3282 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3283 The result type of the called method is not <code>long</code>.
3284 </error>
3285 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3286 Thread was not suspended and was not the current thread.
3287 </error>
3288 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3289 There are no frames on the call stack.
3290 </error>
3291 </errors>
3292 </function>
3293
3294 <function id="ForceEarlyReturnFloat" num="84" since="1.1">
3295 <synopsis>Force Early Return - Float</synopsis>
3296 <description>
3297 This function can be used to return from a method whose
3298 result type is <code>float</code>.
3299 </description>
3300 <origin>new</origin>
3301 <capabilities>
3302 <required id="can_force_early_return"></required>
3303 </capabilities>
3304 <parameters>
3305 <param id="thread">
3306 <jthread null="current" impl="noconvert"/>
3307 <description>
3308 The thread whose current frame is to return early.
3309 </description>
3310 </param>
3311 <param id="value">
3312 <jfloat/>
3313 <description>
3314 The return value for the called frame.
3315 </description>
3316 </param>
3317 </parameters>
3318 <errors>
3319 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3320 The implementation is unable to force the current frame to return
3321 (e.g. current frame is executing a native method).
3322 </error>
3323 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3324 The result type of the called method is not <code>float</code>.
3325 </error>
3326 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3327 Thread was not suspended and was not the current thread.
3328 </error>
3329 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3330 There are no frames on the call stack.
3331 </error>
3332 </errors>
3333 </function>
3334
3335 <function id="ForceEarlyReturnDouble" num="85" since="1.1">
3336 <synopsis>Force Early Return - Double</synopsis>
3337 <description>
3338 This function can be used to return from a method whose
3339 result type is <code>double</code>.
3340 </description>
3341 <origin>new</origin>
3342 <capabilities>
3343 <required id="can_force_early_return"></required>
3344 </capabilities>
3345 <parameters>
3346 <param id="thread">
3347 <jthread null="current" impl="noconvert"/>
3348 <description>
3349 The thread whose current frame is to return early.
3350 </description>
3351 </param>
3352 <param id="value">
3353 <jdouble/>
3354 <description>
3355 The return value for the called frame.
3356 </description>
3357 </param>
3358 </parameters>
3359 <errors>
3360 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3361 The implementation is unable to force the current frame to return
3362 (e.g. current frame is executing a native method).
3363 </error>
3364 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3365 The result type of the called method is not <code>double</code>.
3366 </error>
3367 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3368 Thread was not suspended and was not the current thread.
3369 </error>
3370 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3371 There are no frames on the call stack.
3372 </error>
3373 </errors>
3374 </function>
3375
3376 <function id="ForceEarlyReturnVoid" num="86" since="1.1">
3377 <synopsis>Force Early Return - Void</synopsis>
3378 <description>
3379 This function can be used to return from a method with a return type
3380 of <code>void</code>.
3381 A constructor is a special method named <code><init></code> with
3382 a return type of <code>void</code>. A class initializer is a special
3383 method named named <code><clinit></code> with a return type of
3384 <code>void</code>.
3385 <p/>
3386 When preview features are enabled, this function can not be used to return
3387 early from the constructor of a value class.
3388 </description>
3389 <origin>new</origin>
3390 <capabilities>
3391 <required id="can_force_early_return"></required>
3392 </capabilities>
3393 <parameters>
3394 <param id="thread">
3395 <jthread null="current" impl="noconvert"/>
3396 <description>
3397 The thread whose current frame is to return early.
3398 </description>
3399 </param>
3400 </parameters>
3401 <errors>
3402 <error id="JVMTI_ERROR_OPAQUE_FRAME">
3403 The implementation is unable to force the current frame to return
3404 (e.g. current frame is executing a native method or if preview features
3405 are enabled, the current frame is the constructor for a value class)
3406 </error>
3407 <error id="JVMTI_ERROR_TYPE_MISMATCH">
3408 The called method has a result type.
3409 </error>
3410 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
3411 Thread was not suspended and was not the current thread.
3412 </error>
3413 <error id="JVMTI_ERROR_NO_MORE_FRAMES">
3414 There are no frames on the call stack.
3415 </error>
3416 </errors>
3417 </function>
3418
3419 </category>
3420
3421 <category id="Heap" label="Heap">
3422 <intro>
3423 These functions are used to analyze the heap.
3424 Functionality includes the ability to view the objects in the
3425 heap and to tag these objects.
3426 </intro>
3427
3428 <intro id="objectTags" label="Object Tags">
3429 A <i>tag</i> is a value associated with an object.
3430 Tags are explicitly set by the agent using the
3431 <functionlink id="SetTag"></functionlink> function or by
3432 callback functions such as <functionlink id="jvmtiHeapIterationCallback"/>.
3433 <p/>
3434 Tags are local to the environment; that is, the tags of one
3435 environment are not visible in another.
3436 <p/>
3437 Tags are <code>jlong</code> values which can be used
3438 simply to mark an object or to store a pointer to more detailed
3439 information. Objects which have not been tagged have a
3440 tag of zero.
3441 Setting a tag to zero makes the object untagged.
3442 <p/>
3443 If the <eventlink id="ObjectFree"/> event is enabled then an Object Free
3444 event is sent for tagged objects when the garbage collector frees the object.
3445 When preview features are enabled, the Object Free event is only sent for tagged
3446 <externallink id="jni/functions.html#hasidentity">identity objects</externallink>.
3447 <b>The event is not sent for tagged values objects.</b>
3448 </intro>
3449
3450 <intro id="heapCallbacks" label="Heap Callback Functions">
3451 Heap functions which iterate through the heap and recursively
3452 follow object references use agent supplied callback functions
3453 to deliver the information.
3454 <p/>
3455 These heap callback functions must adhere to the following restrictions --
3456 These callbacks must not use JNI functions.
3457 These callbacks must not use <jvmti/> functions except
3458 <i>callback safe</i> functions which
3459 specifically allow such use (see the raw monitor, memory management,
3460 and environment local storage functions).
3461 <p/>
3462 An implementation may invoke a callback on an internal thread or
3463 the thread which called the iteration function.
3464 Heap callbacks are single threaded -- no more than one callback will
3465 be invoked at a time.
3466 <p/>
3467 The Heap Filter Flags can be used to prevent reporting
3468 based on the tag status of an object or its class.
3469 If no flags are set (the <code>jint</code> is zero), objects
3470 will not be filtered out.
3471
3472 <constants id="jvmtiHeapFilter" label="Heap Filter Flags" kind="bits">
3473 <constant id="JVMTI_HEAP_FILTER_TAGGED" num="0x4">
3474 Filter out tagged objects. Objects which are tagged are not included.
3475 </constant>
3476 <constant id="JVMTI_HEAP_FILTER_UNTAGGED" num="0x8">
3477 Filter out untagged objects. Objects which are not tagged are not included.
3478 </constant>
3479 <constant id="JVMTI_HEAP_FILTER_CLASS_TAGGED" num="0x10">
3480 Filter out objects with tagged classes. Objects whose class is tagged are not included.
3481 </constant>
3482 <constant id="JVMTI_HEAP_FILTER_CLASS_UNTAGGED" num="0x20">
3483 Filter out objects with untagged classes. Objects whose class is not tagged are not included.
3484 </constant>
3485 </constants>
3486
3487 <p/>
3488 The Heap Visit Control Flags are returned by the heap callbacks
3489 and can be used to abort the iteration. For the
3490 <functionlink id="jvmtiHeapReferenceCallback">Heap
3491 Reference Callback</functionlink>, it can also be used
3492 to prune the graph of traversed references
3493 (<code>JVMTI_VISIT_OBJECTS</code> is not set).
3494
3495 <constants id="jvmtiHeapVisitControl"
3496 label="Heap Visit Control Flags"
3497 kind="bits"
3498 since="1.1">
3499 <constant id="JVMTI_VISIT_OBJECTS" num="0x100">
3500 If we are visiting an object and if this callback
3501 was initiated by <functionlink id="FollowReferences"/>,
3502 traverse the references of this object.
3503 Otherwise ignored.
3504 </constant>
3505 <constant id="JVMTI_VISIT_ABORT" num="0x8000">
3506 Abort the iteration. Ignore all other bits.
3507 </constant>
3508 </constants>
3509
3510 <p/>
3511 The Heap Reference Enumeration is provided by the
3512 <functionlink id="jvmtiHeapReferenceCallback">Heap
3513 Reference Callback</functionlink> and
3514 <functionlink id="jvmtiPrimitiveFieldCallback">Primitive Field
3515 Callback</functionlink> to
3516 describe the kind of reference
3517 being reported.
3518
3519 <constants id="jvmtiHeapReferenceKind"
3520 label="Heap Reference Enumeration"
3521 kind="enum"
3522 since="1.1">
3523 <constant id="JVMTI_HEAP_REFERENCE_CLASS" num="1">
3524 Reference from an object to its class.
3525 </constant>
3526 <constant id="JVMTI_HEAP_REFERENCE_FIELD" num="2">
3527 Reference from an object to the value of one of its instance fields.
3528 </constant>
3529 <constant id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT" num="3">
3530 Reference from an array to one of its elements.
3531 </constant>
3532 <constant id="JVMTI_HEAP_REFERENCE_CLASS_LOADER" num="4">
3533 Reference from a class to its class loader.
3534 </constant>
3535 <constant id="JVMTI_HEAP_REFERENCE_SIGNERS" num="5">
3536 Reference from a class to its signers array.
3537 </constant>
3538 <constant id="JVMTI_HEAP_REFERENCE_PROTECTION_DOMAIN" num="6">
3539 Reference from a class to its protection domain.
3540 </constant>
3541 <constant id="JVMTI_HEAP_REFERENCE_INTERFACE" num="7">
3542 Reference from a class to one of its interfaces.
3543 Note: interfaces are defined via a constant pool reference,
3544 so the referenced interfaces may also be reported with a
3545 <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.
3546 </constant>
3547 <constant id="JVMTI_HEAP_REFERENCE_STATIC_FIELD" num="8">
3548 Reference from a class to the value of one of its static fields.
3549 </constant>
3550 <constant id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL" num="9">
3551 Reference from a class to a resolved entry in the constant pool.
3552 </constant>
3553 <constant id="JVMTI_HEAP_REFERENCE_SUPERCLASS" num="10">
3554 Reference from a class to its superclass.
3555 A callback is not sent if the superclass is <code>java.lang.Object</code>.
3556 Note: loaded classes define superclasses via a constant pool
3557 reference, so the referenced superclass may also be reported with
3558 a <code>JVMTI_HEAP_REFERENCE_CONSTANT_POOL</code> reference kind.
3559 </constant>
3560 <constant id="JVMTI_HEAP_REFERENCE_JNI_GLOBAL" num="21">
3561 Heap root reference: JNI global reference.
3562 </constant>
3563 <constant id="JVMTI_HEAP_REFERENCE_SYSTEM_CLASS" num="22">
3564 Heap root reference: System class.
3565 </constant>
3566 <constant id="JVMTI_HEAP_REFERENCE_MONITOR" num="23">
3567 Heap root reference: monitor.
3568 </constant>
3569 <constant id="JVMTI_HEAP_REFERENCE_STACK_LOCAL" num="24">
3570 Local variable on a thread stack.
3571 </constant>
3572 <constant id="JVMTI_HEAP_REFERENCE_JNI_LOCAL" num="25">
3573 JNI local reference.
3574 </constant>
3575 <constant id="JVMTI_HEAP_REFERENCE_THREAD" num="26">
3576 Heap root reference: Thread.
3577 </constant>
3578 <constant id="JVMTI_HEAP_REFERENCE_OTHER" num="27">
3579 Heap root reference: other heap root reference.
3580 </constant>
3581 </constants>
3582
3583 <p/>
3584 Definitions for the single character type descriptors of
3585 primitive types.
3586
3587 <constants id="jvmtiPrimitiveType"
3588 label="Primitive Type Enumeration"
3589 kind="enum"
3590 since="1.1">
3591 <constant id="JVMTI_PRIMITIVE_TYPE_BOOLEAN" num="90">
3592 'Z' - Java programming language <code>boolean</code> - JNI <code>jboolean</code>
3593 </constant>
3594 <constant id="JVMTI_PRIMITIVE_TYPE_BYTE" num="66">
3595 'B' - Java programming language <code>byte</code> - JNI <code>jbyte</code>
3596 </constant>
3597 <constant id="JVMTI_PRIMITIVE_TYPE_CHAR" num="67">
3598 'C' - Java programming language <code>char</code> - JNI <code>jchar</code>
3599 </constant>
3600 <constant id="JVMTI_PRIMITIVE_TYPE_SHORT" num="83">
3601 'S' - Java programming language <code>short</code> - JNI <code>jshort</code>
3602 </constant>
3603 <constant id="JVMTI_PRIMITIVE_TYPE_INT" num="73">
3604 'I' - Java programming language <code>int</code> - JNI <code>jint</code>
3605 </constant>
3606 <constant id="JVMTI_PRIMITIVE_TYPE_LONG" num="74">
3607 'J' - Java programming language <code>long</code> - JNI <code>jlong</code>
3608 </constant>
3609 <constant id="JVMTI_PRIMITIVE_TYPE_FLOAT" num="70">
3610 'F' - Java programming language <code>float</code> - JNI <code>jfloat</code>
3611 </constant>
3612 <constant id="JVMTI_PRIMITIVE_TYPE_DOUBLE" num="68">
3613 'D' - Java programming language <code>double</code> - JNI <code>jdouble</code>
3614 </constant>
3615 </constants>
3616 </intro>
3617
3618 <typedef id="jvmtiHeapReferenceInfoField"
3619 label="Reference information structure for Field references"
3620 since="1.1">
3621 <description>
3622 Reference information returned for
3623 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> and
3624 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.
3625 </description>
3626 <field id="index">
3627 <jint/>
3628 <description>
3629 For <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>, the
3630 referrer object is not a class or an interface.
3631 In this case, <code>index</code> is the index of the field
3632 in the class of the referrer object.
3633 This class is referred to below as <i>C</i>.
3634 <p/>
3635 For <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,
3636 the referrer object is a class (referred to below as <i>C</i>)
3637 or an interface (referred to below as <i>I</i>).
3638 In this case, <code>index</code> is the index of the field in
3639 that class or interface.
3640 <p/>
3641 If the referrer object is not an interface, then the field
3642 indices are determined as follows:
3643 <ul>
3644 <li>make a list of all the fields in <i>C</i> and its
3645 superclasses, starting with all the fields in
3646 <code>java.lang.Object</code> and ending with all the
3647 fields in <i>C</i>.</li>
3648 <li>Within this list, put
3649 the fields for a given class in the order returned by
3650 <functionlink id="GetClassFields"/>.</li>
3651 <li>Assign the fields in this list indices
3652 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>
3653 is the count of the fields in all the interfaces
3654 implemented by <i>C</i>.
3655 Note that <i>C</i> implements all interfaces
3656 directly implemented by its superclasses; as well
3657 as all superinterfaces of these interfaces.</li>
3658 </ul>
3659 If the referrer object is an interface, then the field
3660 indices are determined as follows:
3661 <ul>
3662 <li>make a list of the fields directly declared in
3663 <i>I</i>.</li>
3664 <li>Within this list, put
3665 the fields in the order returned by
3666 <functionlink id="GetClassFields"/>.</li>
3667 <li>Assign the fields in this list indices
3668 <i>n</i>, <i>n</i>+1, ..., in order, where <i>n</i>
3669 is the count of the fields in all the superinterfaces
3670 of <i>I</i>.</li>
3671 </ul>
3672 All fields are included in this computation, regardless of
3673 field modifier (static, public, private, etc).
3674 <p/>
3675 For example, given the following classes and interfaces:
3676 <example>
3677 interface I0 {
3678 int p = 0;
3679 }
3680
3681 interface I1 extends I0 {
3682 int x = 1;
3683 }
3684
3685 interface I2 extends I0 {
3686 int y = 2;
3687 }
3688
3689 class C1 implements I1 {
3690 public static int a = 3;
3691 private int b = 4;
3692 }
3693
3694 class C2 extends C1 implements I2 {
3695 static int q = 5;
3696 final int r = 6;
3697 }
3698 </example>
3699 Assume that <functionlink id="GetClassFields"/> called on
3700 <code>C1</code> returns the fields of <code>C1</code> in the
3701 order: a, b; and that the fields of <code>C2</code> are
3702 returned in the order: q, r.
3703 An instance of class <code>C1</code> will have the
3704 following field indices:
3705 <blockquote><table>
3706 <tr class="bgLight">
3707 <th class="centered" scope="col">Field</th>
3708 <th class="centered" scope="col">Index</th>
3709 <th scope="col">Description</th>
3710 </tr>
3711 <tr>
3712 <th class="centered" scope="row">
3713 a
3714 </th>
3715 <td class="centered">
3716 2
3717 </td>
3718 <td>
3719 The count of the fields in the interfaces
3720 implemented by <code>C1</code> is two (<i>n</i>=2):
3721 <code>p</code> of <code>I0</code>
3722 and <code>x</code> of <code>I1</code>.
3723 </td>
3724 </tr>
3725 <tr>
3726 <th class="centered" scope="row">
3727 b
3728 </th>
3729 <td class="centered">
3730 3
3731 </td>
3732 <td>
3733 the subsequent index.
3734 </td>
3735 </tr>
3736 </table></blockquote>
3737 The class <code>C1</code> will have the same field indices.
3738 <p/>
3739 An instance of class <code>C2</code> will have the
3740 following field indices:
3741 <blockquote><table>
3742 <tr class="bgLight">
3743 <th class="centered" scope="col">Field</th>
3744 <th class="centered" scope="col">Index</th>
3745 <th scope="col">Description</th>
3746 </tr>
3747 <tr>
3748 <th class="centered" scope="row">
3749 a
3750 </th>
3751 <td class="centered">
3752 3
3753 </td>
3754 <td>
3755 The count of the fields in the interfaces
3756 implemented by <code>C2</code> is three (<i>n</i>=3):
3757 <code>p</code> of <code>I0</code>,
3758 <code>x</code> of <code>I1</code> and <code>y</code> of <code>I2</code>
3759 (an interface of <code>C2</code>). Note that the field <code>p</code>
3760 of <code>I0</code> is only included once.
3761 </td>
3762 </tr>
3763 <tr>
3764 <th class="centered" scope="row">
3765 b
3766 </th>
3767 <td class="centered">
3768 4
3769 </td>
3770 <td>
3771 the subsequent index to "a".
3772 </td>
3773 </tr>
3774 <tr>
3775 <th class="centered" scope="row">
3776 q
3777 </th>
3778 <td class="centered">
3779 5
3780 </td>
3781 <td>
3782 the subsequent index to "b".
3783 </td>
3784 </tr>
3785 <tr>
3786 <th class="centered" scope="row">
3787 r
3788 </th>
3789 <td class="centered">
3790 6
3791 </td>
3792 <td>
3793 the subsequent index to "q".
3794 </td>
3795 </tr>
3796 </table></blockquote>
3797 The class <code>C2</code> will have the same field indices.
3798 Note that a field may have a different index depending on the
3799 object that is viewing it -- for example field "a" above.
3800 Note also: not all field indices may be visible from the
3801 callbacks, but all indices are shown for illustrative purposes.
3802 <p/>
3803 The interface <code>I1</code> will have the
3804 following field indices:
3805 <blockquote><table>
3806 <tr class="bgLight">
3807 <th class="centered" scope="col">Field</th>
3808 <th class="centered" scope="col">Index</th>
3809 <th scope="col">Description</th>
3810 </tr>
3811 <tr>
3812 <th class="centered" scope="row">
3813 x
3814 </th>
3815 <td class="centered">
3816 1
3817 </td>
3818 <td>
3819 The count of the fields in the superinterfaces
3820 of <code>I1</code> is one (<i>n</i>=1):
3821 <code>p</code> of <code>I0</code>.
3822 </td>
3823 </tr>
3824 </table></blockquote>
3825 </description>
3826 </field>
3827 </typedef>
3828
3829 <typedef id="jvmtiHeapReferenceInfoArray"
3830 label="Reference information structure for Array references"
3831 since="1.1">
3832 <description>
3833 Reference information returned for
3834 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.
3835 </description>
3836 <field id="index">
3837 <jint/>
3838 <description>
3839 The array index.
3840 </description>
3841 </field>
3842 </typedef>
3843
3844 <typedef id="jvmtiHeapReferenceInfoConstantPool"
3845 label="Reference information structure for Constant Pool references"
3846 since="1.1">
3847 <description>
3848 Reference information returned for
3849 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.
3850 </description>
3851 <field id="index">
3852 <jint/>
3853 <description>
3854 The index into the constant pool of the class. See the description in
3855 <vmspec chapter="4.4"/>.
3856 </description>
3857 </field>
3858 </typedef>
3859
3860 <typedef id="jvmtiHeapReferenceInfoStackLocal"
3861 label="Reference information structure for Local Variable references"
3862 since="1.1">
3863 <description>
3864 Reference information returned for
3865 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.
3866 </description>
3867 <field id="thread_tag">
3868 <jlong/>
3869 <description>
3870 The tag of the thread corresponding to this stack, zero if not tagged.
3871 </description>
3872 </field>
3873 <field id="thread_id">
3874 <jlong/>
3875 <description>
3876 The unique thread ID of the thread corresponding to this stack.
3877 </description>
3878 </field>
3879 <field id="depth">
3880 <jint/>
3881 <description>
3882 The depth of the frame.
3883 </description>
3884 </field>
3885 <field id="method">
3886 <jmethodID/>
3887 <description>
3888 The method executing in this frame.
3889 </description>
3890 </field>
3891 <field id="location">
3892 <jlocation/>
3893 <description>
3894 The currently executing location in this frame.
3895 </description>
3896 </field>
3897 <field id="slot">
3898 <jint/>
3899 <description>
3900 The slot number of the local variable.
3901 </description>
3902 </field>
3903 </typedef>
3904
3905 <typedef id="jvmtiHeapReferenceInfoJniLocal"
3906 label="Reference information structure for JNI local references"
3907 since="1.1">
3908 <description>
3909 Reference information returned for
3910 <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.
3911 </description>
3912 <field id="thread_tag">
3913 <jlong/>
3914 <description>
3915 The tag of the thread corresponding to this stack, zero if not tagged.
3916 </description>
3917 </field>
3918 <field id="thread_id">
3919 <jlong/>
3920 <description>
3921 The unique thread ID of the thread corresponding to this stack.
3922 </description>
3923 </field>
3924 <field id="depth">
3925 <jint/>
3926 <description>
3927 The depth of the frame.
3928 </description>
3929 </field>
3930 <field id="method">
3931 <jmethodID/>
3932 <description>
3933 The method executing in this frame.
3934 </description>
3935 </field>
3936 </typedef>
3937
3938 <typedef id="jvmtiHeapReferenceInfoReserved"
3939 label="Reference information structure for Other references"
3940 since="1.1">
3941 <description>
3942 Reference information returned for other references.
3943 </description>
3944 <field id="reserved1">
3945 <jlong/>
3946 <description>
3947 reserved for future use.
3948 </description>
3949 </field>
3950 <field id="reserved2">
3951 <jlong/>
3952 <description>
3953 reserved for future use.
3954 </description>
3955 </field>
3956 <field id="reserved3">
3957 <jlong/>
3958 <description>
3959 reserved for future use.
3960 </description>
3961 </field>
3962 <field id="reserved4">
3963 <jlong/>
3964 <description>
3965 reserved for future use.
3966 </description>
3967 </field>
3968 <field id="reserved5">
3969 <jlong/>
3970 <description>
3971 reserved for future use.
3972 </description>
3973 </field>
3974 <field id="reserved6">
3975 <jlong/>
3976 <description>
3977 reserved for future use.
3978 </description>
3979 </field>
3980 <field id="reserved7">
3981 <jlong/>
3982 <description>
3983 reserved for future use.
3984 </description>
3985 </field>
3986 <field id="reserved8">
3987 <jlong/>
3988 <description>
3989 reserved for future use.
3990 </description>
3991 </field>
3992 </typedef>
3993
3994 <uniontypedef id="jvmtiHeapReferenceInfo"
3995 label="Reference information structure"
3996 since="1.1">
3997 <description>
3998 The information returned about referrers.
3999 Represented as a union of the various kinds of reference information.
4000 </description>
4001 <field id="field">
4002 <struct>jvmtiHeapReferenceInfoField</struct>
4003 <description>
4004 The referrer information for
4005 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>
4006 and <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/> references.
4007 </description>
4008 </field>
4009 <field id="array">
4010 <struct>jvmtiHeapReferenceInfoArray</struct>
4011 <description>
4012 The referrer information for
4013 For <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/> references.
4014 </description>
4015 </field>
4016 <field id="constant_pool">
4017 <struct>jvmtiHeapReferenceInfoConstantPool</struct>
4018 <description>
4019 The referrer information for
4020 For <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/> references.
4021 </description>
4022 </field>
4023 <field id="stack_local">
4024 <struct>jvmtiHeapReferenceInfoStackLocal</struct>
4025 <description>
4026 The referrer information for
4027 For <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/> references.
4028 </description>
4029 </field>
4030 <field id="jni_local">
4031 <struct>jvmtiHeapReferenceInfoJniLocal</struct>
4032 <description>
4033 The referrer information for
4034 For <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/> references.
4035 </description>
4036 </field>
4037 <field id="other">
4038 <struct>jvmtiHeapReferenceInfoReserved</struct>
4039 <description>
4040 reserved for future use.
4041 </description>
4042 </field>
4043 </uniontypedef>
4044
4045 <typedef id="jvmtiHeapCallbacks"
4046 label="Heap callback function structure"
4047 since="1.1">
4048 <field id="heap_iteration_callback">
4049 <ptrtype>
4050 <struct>jvmtiHeapIterationCallback</struct>
4051 </ptrtype>
4052 <description>
4053 The callback to be called to describe an
4054 object in the heap. Used by the
4055 <functionlink id="IterateThroughHeap"/> function, ignored by the
4056 <functionlink id="FollowReferences"/> function.
4057 </description>
4058 </field>
4059 <field id="heap_reference_callback">
4060 <ptrtype>
4061 <struct>jvmtiHeapReferenceCallback</struct>
4062 </ptrtype>
4063 <description>
4064 The callback to be called to describe an
4065 object reference. Used by the
4066 <functionlink id="FollowReferences"/> function, ignored by the
4067 <functionlink id="IterateThroughHeap"/> function.
4068 </description>
4069 </field>
4070 <field id="primitive_field_callback">
4071 <ptrtype>
4072 <struct>jvmtiPrimitiveFieldCallback</struct>
4073 </ptrtype>
4074 <description>
4075 The callback to be called to describe a
4076 primitive field.
4077 </description>
4078 </field>
4079 <field id="array_primitive_value_callback">
4080 <ptrtype>
4081 <struct>jvmtiArrayPrimitiveValueCallback</struct>
4082 </ptrtype>
4083 <description>
4084 The callback to be called to describe an
4085 array of primitive values.
4086 </description>
4087 </field>
4088 <field id="string_primitive_value_callback">
4089 <ptrtype>
4090 <struct>jvmtiStringPrimitiveValueCallback</struct>
4091 </ptrtype>
4092 <description>
4093 The callback to be called to describe a String value.
4094 </description>
4095 </field>
4096 <field id="reserved5">
4097 <ptrtype>
4098 <struct>jvmtiReservedCallback</struct>
4099 </ptrtype>
4100 <description>
4101 Reserved for future use..
4102 </description>
4103 </field>
4104 <field id="reserved6">
4105 <ptrtype>
4106 <struct>jvmtiReservedCallback</struct>
4107 </ptrtype>
4108 <description>
4109 Reserved for future use..
4110 </description>
4111 </field>
4112 <field id="reserved7">
4113 <ptrtype>
4114 <struct>jvmtiReservedCallback</struct>
4115 </ptrtype>
4116 <description>
4117 Reserved for future use..
4118 </description>
4119 </field>
4120 <field id="reserved8">
4121 <ptrtype>
4122 <struct>jvmtiReservedCallback</struct>
4123 </ptrtype>
4124 <description>
4125 Reserved for future use..
4126 </description>
4127 </field>
4128 <field id="reserved9">
4129 <ptrtype>
4130 <struct>jvmtiReservedCallback</struct>
4131 </ptrtype>
4132 <description>
4133 Reserved for future use..
4134 </description>
4135 </field>
4136 <field id="reserved10">
4137 <ptrtype>
4138 <struct>jvmtiReservedCallback</struct>
4139 </ptrtype>
4140 <description>
4141 Reserved for future use..
4142 </description>
4143 </field>
4144 <field id="reserved11">
4145 <ptrtype>
4146 <struct>jvmtiReservedCallback</struct>
4147 </ptrtype>
4148 <description>
4149 Reserved for future use..
4150 </description>
4151 </field>
4152 <field id="reserved12">
4153 <ptrtype>
4154 <struct>jvmtiReservedCallback</struct>
4155 </ptrtype>
4156 <description>
4157 Reserved for future use..
4158 </description>
4159 </field>
4160 <field id="reserved13">
4161 <ptrtype>
4162 <struct>jvmtiReservedCallback</struct>
4163 </ptrtype>
4164 <description>
4165 Reserved for future use..
4166 </description>
4167 </field>
4168 <field id="reserved14">
4169 <ptrtype>
4170 <struct>jvmtiReservedCallback</struct>
4171 </ptrtype>
4172 <description>
4173 Reserved for future use..
4174 </description>
4175 </field>
4176 <field id="reserved15">
4177 <ptrtype>
4178 <struct>jvmtiReservedCallback</struct>
4179 </ptrtype>
4180 <description>
4181 Reserved for future use..
4182 </description>
4183 </field>
4184 </typedef>
4185
4186
4187 <intro>
4188 <rationale>
4189 The heap dumping functionality (below) uses a callback
4190 for each object. While it would seem that a buffered approach
4191 would provide better throughput, tests do
4192 not show this to be the case--possibly due to locality of
4193 memory reference or array access overhead.
4194 </rationale>
4195
4196 <issue>
4197 Still under investigation as to if java.lang.ref references
4198 are reported as a different type of reference.
4199 </issue>
4200
4201 <issue>
4202 Should or can an indication of the cost or relative cost of
4203 these operations be included?
4204 </issue>
4205
4206 </intro>
4207
4208 <callback id="jvmtiHeapIterationCallback" since="1.1">
4209 <jint/>
4210 <synopsis>Heap Iteration Callback</synopsis>
4211 <description>
4212 Agent supplied callback function.
4213 Describes (but does not pass in) an object in the heap.
4214 <p/>
4215 This function should return a bit vector of the desired
4216 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4217 This will determine if the entire iteration should be aborted
4218 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4219 <p/>
4220 See the <internallink id="heapCallbacks">heap callback
4221 function restrictions</internallink>.
4222 </description>
4223 <parameters>
4224 <param id="class_tag">
4225 <jlong/>
4226 <description>
4227 The tag of the class of object (zero if the class is not tagged).
4228 If the object represents a runtime class,
4229 the <code>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="size">
4235 <jlong/>
4236 <description>
4237 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
4238 </description>
4239 </param>
4240 <param id="tag_ptr">
4241 <outptr><jlong/></outptr>
4242 <description>
4243 The object tag value, or zero if the object is not tagged.
4244 To set the tag value to be associated with the object
4245 the agent sets the <code>jlong</code> pointed to by the parameter.
4246 </description>
4247 </param>
4248 <param id="length">
4249 <jint/>
4250 <description>
4251 If this object is an array, the length of the array. Otherwise negative one (-1).
4252 </description>
4253 </param>
4254 <param id="user_data">
4255 <outptr><void/></outptr>
4256 <description>
4257 The user supplied data that was passed into the iteration function.
4258 </description>
4259 </param>
4260 </parameters>
4261 </callback>
4262
4263 <callback id="jvmtiHeapReferenceCallback" since="1.1">
4264 <jint/>
4265 <synopsis>Heap Reference Callback</synopsis>
4266 <description>
4267 Agent supplied callback function.
4268 Describes a reference from an object or the VM (the referrer) to another object
4269 (the referree) or a heap root to a referree.
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 objects referenced by the referree
4274 should be visited or if the entire iteration should be aborted.
4275 <p/>
4276 See the <internallink id="heapCallbacks">heap callback
4277 function restrictions</internallink>.
4278 </description>
4279 <parameters>
4280 <param id="reference_kind">
4281 <enum>jvmtiHeapReferenceKind</enum>
4282 <description>
4283 The kind of reference.
4284 </description>
4285 </param>
4286 <param id="reference_info">
4287 <inptr>
4288 <struct>jvmtiHeapReferenceInfo</struct>
4289 </inptr>
4290 <description>
4291 Details about the reference.
4292 Set when the <datalink id="jvmtiHeapReferenceCallback.reference_kind">reference_kind</datalink> is
4293 <datalink id="JVMTI_HEAP_REFERENCE_FIELD"/>,
4294 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>,
4295 <datalink id="JVMTI_HEAP_REFERENCE_ARRAY_ELEMENT"/>,
4296 <datalink id="JVMTI_HEAP_REFERENCE_CONSTANT_POOL"/>,
4297 <datalink id="JVMTI_HEAP_REFERENCE_STACK_LOCAL"/>,
4298 or <datalink id="JVMTI_HEAP_REFERENCE_JNI_LOCAL"/>.
4299 Otherwise a null pointer.
4300 </description>
4301 </param>
4302 <param id="class_tag">
4303 <jlong/>
4304 <description>
4305 The tag of the class of referree object (zero if the class is not tagged).
4306 If the referree object represents a runtime class,
4307 the <code>class_tag</code> is the tag
4308 associated with <code>java.lang.Class</code>
4309 (zero if <code>java.lang.Class</code> is not tagged).
4310 </description>
4311 </param>
4312 <param id="referrer_class_tag">
4313 <jlong/>
4314 <description>
4315 The tag of the class of the referrer object (zero if the class is not tagged
4316 or the referree is a heap root). If the referrer object represents a runtime
4317 class, the <code>referrer_class_tag</code> is the tag associated with
4318 the <code>java.lang.Class</code>
4319 (zero if <code>java.lang.Class</code> is not tagged).
4320 </description>
4321 </param>
4322 <param id="size">
4323 <jlong/>
4324 <description>
4325 Size of the referree object (in bytes).
4326 See <functionlink id="GetObjectSize"/>.
4327 </description>
4328 </param>
4329 <param id="tag_ptr">
4330 <outptr><jlong/></outptr>
4331 <description>
4332 Points to the referree object tag value, or zero if the object is not
4333 tagged.
4334 To set the tag value to be associated with the object
4335 the agent sets the <code>jlong</code> pointed to by the parameter.
4336 </description>
4337 </param>
4338 <param id="referrer_tag_ptr">
4339 <outptr><jlong/></outptr>
4340 <description>
4341 Points to the tag of the referrer object, or
4342 points to the zero if the referrer
4343 object is not tagged.
4344 Null if the referrer in not an object (that is,
4345 this callback is reporting a heap root).
4346 To set the tag value to be associated with the referrer object
4347 the agent sets the <code>jlong</code> pointed to by the parameter.
4348 If this callback is reporting a reference from an object to itself,
4349 <code>referrer_tag_ptr == tag_ptr</code>.
4350 </description>
4351 </param>
4352 <param id="length">
4353 <jint/>
4354 <description>
4355 If this object is an array, the length of the array. Otherwise negative one (-1).
4356 </description>
4357 </param>
4358 <param id="user_data">
4359 <outptr><void/></outptr>
4360 <description>
4361 The user supplied data that was passed into the iteration function.
4362 </description>
4363 </param>
4364 </parameters>
4365 </callback>
4366
4367 <callback id="jvmtiPrimitiveFieldCallback" since="1.1">
4368 <jint/>
4369 <synopsis>Primitive Field Callback</synopsis>
4370 <description>
4371 Agent supplied callback function which
4372 describes a primitive field of an object (<i>the object</i>).
4373 A primitive field is a field whose type is a primitive type.
4374 This callback will describe a static field if the object is a class,
4375 and otherwise will describe an instance field.
4376 <p/>
4377 This function should return a bit vector of the desired
4378 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4379 This will determine if the entire iteration should be aborted
4380 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4381 <p/>
4382 See the <internallink id="heapCallbacks">heap callback
4383 function restrictions</internallink>.
4384 </description>
4385 <parameters>
4386 <param id="kind">
4387 <enum>jvmtiHeapReferenceKind</enum>
4388 <description>
4389 The kind of field -- instance or static (<datalink id="JVMTI_HEAP_REFERENCE_FIELD"/> or
4390 <datalink id="JVMTI_HEAP_REFERENCE_STATIC_FIELD"/>).
4391 </description>
4392 </param>
4393 <param id="info">
4394 <inptr>
4395 <struct>jvmtiHeapReferenceInfo</struct>
4396 </inptr>
4397 <description>
4398 Which field (the field index).
4399 </description>
4400 </param>
4401 <param id="object_class_tag">
4402 <jlong/>
4403 <description>
4404 The tag of the class of the object (zero if the class is not tagged).
4405 If the object represents a runtime class, the
4406 <code>object_class_tag</code> is the tag
4407 associated with <code>java.lang.Class</code>
4408 (zero if <code>java.lang.Class</code> is not tagged).
4409 </description>
4410 </param>
4411 <param id="object_tag_ptr">
4412 <outptr><jlong/></outptr>
4413 <description>
4414 Points to the tag of the object, or zero if the object is not
4415 tagged.
4416 To set the tag value to be associated with the object
4417 the agent sets the <code>jlong</code> pointed to by the parameter.
4418 </description>
4419 </param>
4420 <param id="value">
4421 <jvalue/>
4422 <description>
4423 The value of the field.
4424 </description>
4425 </param>
4426 <param id="value_type">
4427 <enum>jvmtiPrimitiveType</enum>
4428 <description>
4429 The type of the field.
4430 </description>
4431 </param>
4432 <param id="user_data">
4433 <outptr><void/></outptr>
4434 <description>
4435 The user supplied data that was passed into the iteration function.
4436 </description>
4437 </param>
4438 </parameters>
4439 </callback>
4440
4441 <callback id="jvmtiArrayPrimitiveValueCallback" since="1.1">
4442 <jint/>
4443 <synopsis>Array Primitive Value Callback</synopsis>
4444 <description>
4445 Agent supplied callback function.
4446 Describes the values in an array of a primitive type.
4447 <p/>
4448 This function should return a bit vector of the desired
4449 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4450 This will determine if the entire iteration should be aborted
4451 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4452 <p/>
4453 See the <internallink id="heapCallbacks">heap callback
4454 function restrictions</internallink>.
4455 </description>
4456 <parameters>
4457 <param id="class_tag">
4458 <jlong/>
4459 <description>
4460 The tag of the class of the array object (zero if the class is not tagged).
4461 </description>
4462 </param>
4463 <param id="size">
4464 <jlong/>
4465 <description>
4466 Size of the array (in bytes).
4467 See <functionlink id="GetObjectSize"/>.
4468 </description>
4469 </param>
4470 <param id="tag_ptr">
4471 <outptr><jlong/></outptr>
4472 <description>
4473 Points to the tag of the array object, or zero if the object is not
4474 tagged.
4475 To set the tag value to be associated with the object
4476 the agent sets the <code>jlong</code> pointed to by the parameter.
4477 </description>
4478 </param>
4479 <param id="element_count">
4480 <jint/>
4481 <description>
4482 The length of the primitive array.
4483 </description>
4484 </param>
4485 <param id="element_type">
4486 <enum>jvmtiPrimitiveType</enum>
4487 <description>
4488 The type of the elements of the array.
4489 </description>
4490 </param>
4491 <param id="elements">
4492 <vmbuf><void/></vmbuf>
4493 <description>
4494 The elements of the array in a packed array of <code>element_count</code>
4495 items of <code>element_type</code> size each.
4496 </description>
4497 </param>
4498 <param id="user_data">
4499 <outptr><void/></outptr>
4500 <description>
4501 The user supplied data that was passed into the iteration function.
4502 </description>
4503 </param>
4504 </parameters>
4505 </callback>
4506
4507 <callback id="jvmtiStringPrimitiveValueCallback" since="1.1">
4508 <jint/>
4509 <synopsis>String Primitive Value Callback</synopsis>
4510 <description>
4511 Agent supplied callback function.
4512 Describes the value of a java.lang.String.
4513 <p/>
4514 This function should return a bit vector of the desired
4515 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>.
4516 This will determine if the entire iteration should be aborted
4517 (the <code>JVMTI_VISIT_OBJECTS</code> flag is ignored).
4518 <p/>
4519 See the <internallink id="heapCallbacks">heap callback
4520 function restrictions</internallink>.
4521 </description>
4522 <parameters>
4523 <param id="class_tag">
4524 <jlong/>
4525 <description>
4526 The tag of the class of the String class (zero if the class is not tagged).
4527 <issue>Is this needed?</issue>
4528 </description>
4529 </param>
4530 <param id="size">
4531 <jlong/>
4532 <description>
4533 Size of the string (in bytes).
4534 See <functionlink id="GetObjectSize"/>.
4535 </description>
4536 </param>
4537 <param id="tag_ptr">
4538 <outptr><jlong/></outptr>
4539 <description>
4540 Points to the tag of the String object, or zero if the object is not
4541 tagged.
4542 To set the tag value to be associated with the object
4543 the agent sets the <code>jlong</code> pointed to by the parameter.
4544 </description>
4545 </param>
4546 <param id="value">
4547 <vmbuf><jchar/></vmbuf>
4548 <description>
4549 The value of the String, encoded as a Unicode string.
4550 </description>
4551 </param>
4552 <param id="value_length">
4553 <jint/>
4554 <description>
4555 The length of the string.
4556 The length is equal to the number of 16-bit Unicode
4557 characters in the string.
4558 </description>
4559 </param>
4560 <param id="user_data">
4561 <outptr><void/></outptr>
4562 <description>
4563 The user supplied data that was passed into the iteration function.
4564 </description>
4565 </param>
4566 </parameters>
4567 </callback>
4568
4569
4570 <callback id="jvmtiReservedCallback" since="1.1">
4571 <jint/>
4572 <synopsis>reserved for future use Callback</synopsis>
4573 <description>
4574 Placeholder -- reserved for future use.
4575 </description>
4576 <parameters>
4577 </parameters>
4578 </callback>
4579
4580 <function id="FollowReferences" num="115" since="1.1">
4581 <synopsis>Follow References</synopsis>
4582 <description>
4583 This function initiates a traversal over the objects that are
4584 directly and indirectly reachable from the specified object or,
4585 if <code>initial_object</code> is not specified, all objects
4586 reachable from the heap roots.
4587 The heap root are the set of system classes,
4588 JNI globals, references from platform thread stacks, and other objects used as roots
4589 for the purposes of garbage collection.
4590 <p/>
4591 This function operates by traversing the reference graph.
4592 Let <i>A</i>, <i>B</i>, ... represent objects.
4593 When a reference from <i>A</i> to <i>B</i> is traversed,
4594 when a reference from a heap root to <i>B</i> is traversed,
4595 or when <i>B</i> is specified as the <paramlink id="initial_object"/>,
4596 then <i>B</i> is said to be <i>visited</i>.
4597 A reference from <i>A</i> to <i>B</i> is not traversed until <i>A</i>
4598 is visited.
4599 References are reported in the same order that the references are traversed.
4600 Object references are reported by invoking the agent supplied
4601 callback function <functionlink id="jvmtiHeapReferenceCallback"/>.
4602 In a reference from <i>A</i> to <i>B</i>, <i>A</i> is known
4603 as the <i>referrer</i> and <i>B</i> as the <i>referree</i>.
4604 The callback is invoked exactly once for each reference from a referrer;
4605 this is true even if there are reference cycles or multiple paths to
4606 the referrer.
4607 There may be more than one reference between a referrer and a referree,
4608 each reference is reported.
4609 These references may be distinguished by examining the
4610 <datalink
4611 id="jvmtiHeapReferenceCallback.reference_kind"><code>reference_kind</code></datalink>
4612 and
4613 <datalink
4614 id="jvmtiHeapReferenceCallback.reference_info"><code>reference_info</code></datalink>
4615 parameters of the <functionlink id="jvmtiHeapReferenceCallback"/> callback.
4616 <p/>
4617 This function reports a Java programming language view of object references,
4618 not a virtual machine implementation view. The following object references
4619 are reported when they are non-null:
4620 <ul>
4621 <li>Instance objects report references to each non-primitive instance fields
4622 (including inherited fields).</li>
4623 <li>Instance objects report a reference to the object type (class).</li>
4624 <li>Classes report a reference to the superclass and directly
4625 implemented/extended interfaces.</li>
4626 <li>Classes report a reference to the class loader, protection domain,
4627 signers, and resolved entries in the constant pool.</li>
4628 <li>Classes report a reference to each directly declared non-primitive
4629 static field.</li>
4630 <li>Arrays report a reference to the array type (class) and each
4631 array element.</li>
4632 <li>Primitive arrays report a reference to the array type.</li>
4633 </ul>
4634 <p/>
4635 This function can also be used to examine primitive (non-object) values.
4636 The primitive value of an array or String
4637 is reported after the object has been visited;
4638 it is reported by invoking the agent supplied callback function
4639 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or
4640 <functionlink id="jvmtiStringPrimitiveValueCallback"/>.
4641 A primitive field
4642 is reported after the object with that field is visited;
4643 it is reported by invoking the agent supplied callback function
4644 <functionlink id="jvmtiPrimitiveFieldCallback"/>.
4645 <p/>
4646 Whether a callback is provided or is null only determines
4647 whether the callback will be invoked, it does not influence
4648 which objects are visited nor does it influence whether other callbacks
4649 will be invoked.
4650 However, the
4651 <datalink id="jvmtiHeapVisitControl">visit control flags</datalink>
4652 returned by <functionlink id="jvmtiHeapReferenceCallback"/>
4653 do determine if the objects referenced by the
4654 current object as visited.
4655 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>
4656 and <paramlink id="klass"/> provided as parameters to this function
4657 do not control which objects are visited but they do control which
4658 objects and primitive values are reported by the callbacks.
4659 For example, if the only callback that was set is
4660 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>
4661 is set to the array of bytes class, then only arrays of byte will be
4662 reported.
4663 The table below summarizes this:
4664 <p/>
4665 <table>
4666 <tr class="bgLight">
4667 <th/>
4668 <th class="centered" scope="col">Controls objects visited</th>
4669 <th class="centered" scope="col">Controls objects reported</th>
4670 <th class="centered" scope="col">Controls primitives reported</th>
4671 </tr>
4672 <tr>
4673 <th scope="row">
4674 the
4675 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4676 returned by <functionlink id="jvmtiHeapReferenceCallback"/>
4677 </th>
4678 <td class="centered">
4679 <b>Yes</b>
4680 </td>
4681 <td class="centered">
4682 <b>Yes</b>, since visits are controlled
4683 </td>
4684 <td class="centered">
4685 <b>Yes</b>, since visits are controlled
4686 </td>
4687 </tr>
4688 <tr>
4689 <th scope="row">
4690 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>
4691 in <paramlink id="callbacks"/> set
4692 </th>
4693 <td class="centered">
4694 No
4695 </td>
4696 <td class="centered">
4697 <b>Yes</b>
4698 </td>
4699 <td class="centered">
4700 No
4701 </td>
4702 </tr>
4703 <tr>
4704 <th scope="row">
4705 <paramlink id="heap_filter"/>
4706 </th>
4707 <td class="centered">
4708 No
4709 </td>
4710 <td class="centered">
4711 <b>Yes</b>
4712 </td>
4713 <td class="centered">
4714 <b>Yes</b>
4715 </td>
4716 </tr>
4717 <tr>
4718 <th scope="row">
4719 <paramlink id="klass"/>
4720 </th>
4721 <td class="centered">
4722 No
4723 </td>
4724 <td class="centered">
4725 <b>Yes</b>
4726 </td>
4727 <td class="centered">
4728 <b>Yes</b>
4729 </td>
4730 </tr>
4731 </table>
4732 <p/>
4733 During the execution of this function the state of the heap
4734 does not change: no objects are allocated, no objects are
4735 garbage collected, and the state of objects (including
4736 held values) does not change.
4737 As a result, threads executing Java
4738 programming language code, threads attempting to resume the
4739 execution of Java programming language code, and threads
4740 attempting to execute JNI functions are typically stalled.
4741 </description>
4742 <origin>new</origin>
4743 <capabilities>
4744 <required id="can_tag_objects"></required>
4745 </capabilities>
4746 <parameters>
4747 <param id="heap_filter">
4748 <jint/>
4749 <description>
4750 This bit vector of
4751 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>.
4752 restricts the objects for which the callback function is called.
4753 This applies to both the object and primitive callbacks.
4754 </description>
4755 </param>
4756 <param id="klass">
4757 <ptrtype>
4758 <jclass/>
4759 <nullok>callbacks are not limited to instances of a particular
4760 class</nullok>
4761 </ptrtype>
4762 <description>
4763 Callbacks are only reported when the object is an instance of
4764 this class.
4765 Objects which are instances of a subclass of <code>klass</code>
4766 are not reported.
4767 If <code>klass</code> is an interface, no objects are reported.
4768 This applies to both the object and primitive callbacks.
4769 </description>
4770 </param>
4771 <param id="initial_object">
4772 <ptrtype>
4773 <jobject/>
4774 <nullok>references are followed from the heap roots</nullok>
4775 </ptrtype>
4776 <description>
4777 The object to follow
4778 </description>
4779 </param>
4780 <param id="callbacks">
4781 <inptr>
4782 <struct>jvmtiHeapCallbacks</struct>
4783 </inptr>
4784 <description>
4785 Structure defining the set of callback functions.
4786 </description>
4787 </param>
4788 <param id="user_data">
4789 <inbuf>
4790 <void/>
4791 <nullok>a null pointer is passed as the user supplied data</nullok>
4792 </inbuf>
4793 <description>
4794 User supplied data to be passed to the callback.
4795 </description>
4796 </param>
4797 </parameters>
4798 <errors>
4799 <error id="JVMTI_ERROR_INVALID_CLASS">
4800 <paramlink id="klass"/> is not a valid class.
4801 </error>
4802 <error id="JVMTI_ERROR_INVALID_OBJECT">
4803 <paramlink id="initial_object"/> is not a valid object.
4804 </error>
4805 </errors>
4806 </function>
4807
4808
4809 <function id="IterateThroughHeap" num="116" since="1.1">
4810 <synopsis>Iterate Through Heap</synopsis>
4811 <description>
4812 Initiate an iteration over all objects in the heap.
4813 This includes both reachable and
4814 unreachable objects. Objects are visited in no particular order.
4815 <p/>
4816 Heap objects are reported by invoking the agent supplied
4817 callback function <functionlink id="jvmtiHeapIterationCallback"/>.
4818 References between objects are not reported.
4819 If only reachable objects are desired, or if object reference information
4820 is needed, use <functionlink id="FollowReferences"/>.
4821 <p/>
4822 This function can also be used to examine primitive (non-object) values.
4823 The primitive value of an array or String
4824 is reported after the object has been visited;
4825 it is reported by invoking the agent supplied callback function
4826 <functionlink id="jvmtiArrayPrimitiveValueCallback"/> or
4827 <functionlink id="jvmtiStringPrimitiveValueCallback"/>.
4828 A primitive field
4829 is reported after the object with that field is visited;
4830 it is reported by invoking the agent supplied
4831 callback function
4832 <functionlink id="jvmtiPrimitiveFieldCallback"/>.
4833 <p/>
4834 Unless the iteration is aborted by the
4835 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4836 returned by a callback, all objects in the heap are visited.
4837 Whether a callback is provided or is null only determines
4838 whether the callback will be invoked, it does not influence
4839 which objects are visited nor does it influence whether other callbacks
4840 will be invoked.
4841 The <datalink id="jvmtiHeapFilter">heap filter flags</datalink>
4842 and <paramlink id="klass"/> provided as parameters to this function
4843 do not control which objects are visited but they do control which
4844 objects and primitive values are reported by the callbacks.
4845 For example, if the only callback that was set is
4846 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/> and <code>klass</code>
4847 is set to the array of bytes class, then only arrays of byte will be
4848 reported. The table below summarizes this (contrast this with
4849 <functionlink id="FollowReferences"/>):
4850 <p/>
4851 <table>
4852 <tr class="bgLight">
4853 <th/>
4854 <th class="centered" scope="col">Controls objects visited</th>
4855 <th class="centered" scope="col">Controls objects reported</th>
4856 <th class="centered" scope="col">Controls primitives reported</th>
4857 </tr>
4858 <tr>
4859 <th scope="row">
4860 the
4861 <datalink id="jvmtiHeapVisitControl">Heap Visit Control Flags</datalink>
4862 returned by <functionlink id="jvmtiHeapIterationCallback"/>
4863 </th>
4864 <td class="centered">
4865 No<br/>(unless they abort the iteration)
4866 </td>
4867 <td class="centered">
4868 No<br/>(unless they abort the iteration)
4869 </td>
4870 <td class="centered">
4871 No<br/>(unless they abort the iteration)
4872 </td>
4873 </tr>
4874 <tr>
4875 <th scope="row">
4876 <fieldlink id="array_primitive_value_callback" struct="jvmtiHeapCallbacks"/>
4877 in <paramlink id="callbacks"/> set
4878 </th>
4879 <td class="centered">
4880 No
4881 </td>
4882 <td class="centered">
4883 <b>Yes</b>
4884 </td>
4885 <td class="centered">
4886 No
4887 </td>
4888 </tr>
4889 <tr>
4890 <th scope="row">
4891 <paramlink id="heap_filter"/>
4892 </th>
4893 <td class="centered">
4894 No
4895 </td>
4896 <td class="centered">
4897 <b>Yes</b>
4898 </td>
4899 <td class="centered">
4900 <b>Yes</b>
4901 </td>
4902 </tr>
4903 <tr>
4904 <th scope="row">
4905 <paramlink id="klass"/>
4906 </th>
4907 <td class="centered">
4908 No
4909 </td>
4910 <td class="centered">
4911 <b>Yes</b>
4912 </td>
4913 <td class="centered">
4914 <b>Yes</b>
4915 </td>
4916 </tr>
4917 </table>
4918 <p/>
4919 During the execution of this function the state of the heap
4920 does not change: no objects are allocated, no objects are
4921 garbage collected, and the state of objects (including
4922 held values) does not change.
4923 As a result, threads executing Java
4924 programming language code, threads attempting to resume the
4925 execution of Java programming language code, and threads
4926 attempting to execute JNI functions are typically stalled.
4927 </description>
4928 <origin>new</origin>
4929 <capabilities>
4930 <required id="can_tag_objects"></required>
4931 </capabilities>
4932 <parameters>
4933 <param id="heap_filter">
4934 <jint/>
4935 <description>
4936 This bit vector of
4937 <datalink id="jvmtiHeapFilter">heap filter flags</datalink>.
4938 restricts the objects for which the callback function is called.
4939 This applies to both the object and primitive callbacks.
4940 </description>
4941 </param>
4942 <param id="klass">
4943 <ptrtype>
4944 <jclass/>
4945 <nullok>callbacks are not limited to instances of a particular class</nullok>
4946 </ptrtype>
4947 <description>
4948 Callbacks are only reported when the object is an instance of
4949 this class.
4950 Objects which are instances of a subclass of <code>klass</code>
4951 are not reported.
4952 If <code>klass</code> is an interface, no objects are reported.
4953 This applies to both the object and primitive callbacks.
4954 </description>
4955 </param>
4956 <param id="callbacks">
4957 <inptr>
4958 <struct>jvmtiHeapCallbacks</struct>
4959 </inptr>
4960 <description>
4961 Structure defining the set callback functions.
4962 </description>
4963 </param>
4964 <param id="user_data">
4965 <inbuf>
4966 <void/>
4967 <nullok>a null pointer is passed as the user supplied data</nullok>
4968 </inbuf>
4969 <description>
4970 User supplied data to be passed to the callback.
4971 </description>
4972 </param>
4973 </parameters>
4974 <errors>
4975 <error id="JVMTI_ERROR_INVALID_CLASS">
4976 <paramlink id="klass"/> is not a valid class.
4977 </error>
4978 </errors>
4979 </function>
4980
4981 <function id="GetTag" phase="start" num="106">
4982 <synopsis>Get Tag</synopsis>
4983 <description>
4984 Retrieve the tag associated with an object.
4985 The tag is a long value typically used to store a
4986 unique identifier or pointer to object information.
4987 The tag is set with
4988 <functionlink id="SetTag"></functionlink>.
4989 Objects for which no tags have been set return a
4990 tag value of zero.
4991 </description>
4992 <origin>new</origin>
4993 <capabilities>
4994 <required id="can_tag_objects"></required>
4995 </capabilities>
4996 <parameters>
4997 <param id="object">
4998 <jobject/>
4999 <description>
5000 The object whose tag is to be retrieved.
5001 </description>
5002 </param>
5003 <param id="tag_ptr">
5004 <outptr><jlong/></outptr>
5005 <description>
5006 On return, the referenced long is set to the value
5007 of the tag.
5008 </description>
5009 </param>
5010 </parameters>
5011 <errors>
5012 </errors>
5013 </function>
5014
5015 <function id="SetTag" phase="start" num="107">
5016 <synopsis>Set Tag</synopsis>
5017 <description>
5018 Set the tag associated with an object.
5019 The tag is a long value typically used to store a
5020 unique identifier or pointer to object information.
5021 The tag is visible with
5022 <functionlink id="GetTag"></functionlink>.
5023 </description>
5024 <origin>new</origin>
5025 <capabilities>
5026 <required id="can_tag_objects"></required>
5027 </capabilities>
5028 <parameters>
5029 <param id="object">
5030 <jobject/>
5031 <description>
5032 The object whose tag is to be set.
5033 </description>
5034 </param>
5035 <param id="tag">
5036 <jlong/>
5037 <description>
5038 The new value of the tag.
5039 </description>
5040 </param>
5041 </parameters>
5042 <errors>
5043 </errors>
5044 </function>
5045
5046 <function id="GetObjectsWithTags" num="114">
5047 <synopsis>Get Objects With Tags</synopsis>
5048 <description>
5049 Return objects in the heap with the specified tags.
5050 The format is parallel arrays of objects and tags.
5051 </description>
5052 <origin>new</origin>
5053 <capabilities>
5054 <required id="can_tag_objects"></required>
5055 </capabilities>
5056 <parameters>
5057 <param id="tag_count">
5058 <jint min="0"/>
5059 <description>
5060 Number of tags to scan for.
5061 </description>
5062 </param>
5063 <param id="tags">
5064 <inbuf incount="tag_count">
5065 <jlong/>
5066 </inbuf>
5067 <description>
5068 Scan for objects with these tags.
5069 Zero is not permitted in this array.
5070 </description>
5071 </param>
5072 <param id="count_ptr">
5073 <outptr>
5074 <jint/>
5075 </outptr>
5076 <description>
5077 Return the number of objects with any of the tags
5078 in <paramlink id="tags"/>.
5079 </description>
5080 </param>
5081 <param id="object_result_ptr">
5082 <allocbuf outcount="count_ptr">
5083 <jobject/>
5084 <nullok>this information is not returned</nullok>
5085 </allocbuf>
5086 <description>
5087 Returns the array of objects with any of the tags
5088 in <paramlink id="tags"/>.
5089 </description>
5090 </param>
5091 <param id="tag_result_ptr">
5092 <allocbuf outcount="count_ptr">
5093 <jlong/>
5094 <nullok>this information is not returned</nullok>
5095 </allocbuf>
5096 <description>
5097 For each object in <paramlink id="object_result_ptr"/>,
5098 return the tag at the corresponding index.
5099 </description>
5100 </param>
5101 </parameters>
5102 <errors>
5103 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
5104 Zero is present in <paramlink id="tags"></paramlink>.
5105 </error>
5106 </errors>
5107 </function>
5108
5109 <function id="ForceGarbageCollection" num="108">
5110 <synopsis>Force Garbage Collection</synopsis>
5111 <description>
5112 Force the VM to perform a garbage collection.
5113 The garbage collection is as complete as possible.
5114 This function does not cause finalizers to be run.
5115 This function does not return until the garbage collection
5116 is finished.
5117 <p/>
5118 Although garbage collection is as complete
5119 as possible there is no guarantee that all
5120 <eventlink id="ObjectFree"/>
5121 events will have been
5122 sent by the time that this function
5123 returns. In particular, an object may be
5124 prevented from being freed because it
5125 is awaiting finalization.
5126 </description>
5127 <origin>new</origin>
5128 <capabilities>
5129 </capabilities>
5130 <parameters>
5131 </parameters>
5132 <errors>
5133 </errors>
5134 </function>
5135
5136
5137 </category>
5138
5139 <category id="Heap_1_0" label="Heap (1.0)">
5140 <intro>
5141 <b>
5142 These functions and data types were introduced in the original
5143 <jvmti/> version 1.0. They are deprecated and will be changed
5144 to return an error in a future release. They were superseded in
5145 <jvmti/> version 1.2 (Java SE 6) by more
5146 </b>
5147 <internallink id="Heap"><b>powerful and flexible versions</b></internallink>
5148 <b>
5149 which:
5150 </b>
5151 <ul>
5152 <li>
5153 <b>
5154 Allow access to primitive values (the value of Strings, arrays,
5155 and primitive fields)
5156 </b>
5157 </li>
5158 <li>
5159 <b>
5160 Allow the tag of the referrer to be set, thus enabling more
5161 efficient localized reference graph building
5162 </b>
5163 </li>
5164 <li>
5165 <b>
5166 Provide more extensive filtering abilities
5167 </b>
5168 </li>
5169 <li>
5170 <b>
5171 Are extensible, allowing their abilities to grow in future versions of <jvmti/>
5172 </b>
5173 </li>
5174 </ul>
5175 <p/>
5176 <b>Please use the </b>
5177 <internallink id="Heap"><b>current Heap functions</b></internallink>.
5178 <p/>
5179 <constants id="jvmtiHeapObjectFilter" label="Heap Object Filter Enumeration" kind="enum">
5180 <constant id="JVMTI_HEAP_OBJECT_TAGGED" num="1">
5181 Tagged objects only.
5182 </constant>
5183 <constant id="JVMTI_HEAP_OBJECT_UNTAGGED" num="2">
5184 Untagged objects only.
5185 </constant>
5186 <constant id="JVMTI_HEAP_OBJECT_EITHER" num="3">
5187 Either tagged or untagged objects.
5188 </constant>
5189 </constants>
5190
5191 <constants id="jvmtiHeapRootKind" label="Heap Root Kind Enumeration" kind="enum">
5192 <constant id="JVMTI_HEAP_ROOT_JNI_GLOBAL" num="1">
5193 JNI global reference.
5194 </constant>
5195 <constant id="JVMTI_HEAP_ROOT_SYSTEM_CLASS" num="2">
5196 System class.
5197 </constant>
5198 <constant id="JVMTI_HEAP_ROOT_MONITOR" num="3">
5199 Monitor.
5200 </constant>
5201 <constant id="JVMTI_HEAP_ROOT_STACK_LOCAL" num="4">
5202 Stack local.
5203 </constant>
5204 <constant id="JVMTI_HEAP_ROOT_JNI_LOCAL" num="5">
5205 JNI local reference.
5206 </constant>
5207 <constant id="JVMTI_HEAP_ROOT_THREAD" num="6">
5208 Thread.
5209 </constant>
5210 <constant id="JVMTI_HEAP_ROOT_OTHER" num="7">
5211 Other.
5212 </constant>
5213 </constants>
5214
5215 <constants id="jvmtiObjectReferenceKind" label="Object Reference Enumeration" kind="enum">
5216 <constant id="JVMTI_REFERENCE_CLASS" num="1">
5217 Reference from an object to its class.
5218 </constant>
5219 <constant id="JVMTI_REFERENCE_FIELD" num="2">
5220 Reference from an object to the value of one of its instance fields.
5221 For references of this kind the <code>referrer_index</code>
5222 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5223 jvmtiObjectReferenceCallback</internallink> is the index of the
5224 the instance field. The index is based on the order of all the
5225 object's fields. This includes all fields of the directly declared
5226 static and instance fields in the class, and includes all fields (both
5227 public and private) fields declared in superclasses and superinterfaces.
5228 The index is thus calculated by summing the index of the field in the directly
5229 declared class (see <functionlink id="GetClassFields"/>), with the total
5230 number of fields (both public and private) declared in all superclasses
5231 and superinterfaces. The index starts at zero.
5232 </constant>
5233 <constant id="JVMTI_REFERENCE_ARRAY_ELEMENT" num="3">
5234 Reference from an array to one of its elements.
5235 For references of this kind the <code>referrer_index</code>
5236 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5237 jvmtiObjectReferenceCallback</internallink> is the array index.
5238 </constant>
5239 <constant id="JVMTI_REFERENCE_CLASS_LOADER" num="4">
5240 Reference from a class to its class loader.
5241 </constant>
5242 <constant id="JVMTI_REFERENCE_SIGNERS" num="5">
5243 Reference from a class to its signers array.
5244 </constant>
5245 <constant id="JVMTI_REFERENCE_PROTECTION_DOMAIN" num="6">
5246 Reference from a class to its protection domain.
5247 </constant>
5248 <constant id="JVMTI_REFERENCE_INTERFACE" num="7">
5249 Reference from a class to one of its interfaces.
5250 </constant>
5251 <constant id="JVMTI_REFERENCE_STATIC_FIELD" num="8">
5252 Reference from a class to the value of one of its static fields.
5253 For references of this kind the <code>referrer_index</code>
5254 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5255 jvmtiObjectReferenceCallback</internallink> is the index of the
5256 the static field. The index is based on the order of all the
5257 object's fields. This includes all fields of the directly declared
5258 static and instance fields in the class, and includes all fields (both
5259 public and private) fields declared in superclasses and superinterfaces.
5260 The index is thus calculated by summing the index of the field in the directly
5261 declared class (see <functionlink id="GetClassFields"/>), with the total
5262 number of fields (both public and private) declared in all superclasses
5263 and superinterfaces. The index starts at zero.
5264 Note: this definition differs from that in the <jvmti/> 1.0 Specification.
5265 <rationale>No known implementations used the 1.0 definition.</rationale>
5266 </constant>
5267 <constant id="JVMTI_REFERENCE_CONSTANT_POOL" num="9">
5268 Reference from a class to a resolved entry in the constant pool.
5269 For references of this kind the <code>referrer_index</code>
5270 parameter to the <internallink id="jvmtiObjectReferenceCallback">
5271 jvmtiObjectReferenceCallback</internallink> is the index into
5272 constant pool table of the class, starting at 1. See
5273 <vmspec chapter="4.4"/>.
5274 </constant>
5275 </constants>
5276
5277 <constants id="jvmtiIterationControl" label="Iteration Control Enumeration" kind="enum">
5278 <constant id="JVMTI_ITERATION_CONTINUE" num="1">
5279 Continue the iteration.
5280 If this is a reference iteration, follow the references of this object.
5281 </constant>
5282 <constant id="JVMTI_ITERATION_IGNORE" num="2">
5283 Continue the iteration.
5284 If this is a reference iteration, ignore the references of this object.
5285 </constant>
5286 <constant id="JVMTI_ITERATION_ABORT" num="0">
5287 Abort the iteration.
5288 </constant>
5289 </constants>
5290 </intro>
5291
5292 <callback id="jvmtiHeapObjectCallback">
5293 <enum>jvmtiIterationControl</enum>
5294 <synopsis>Heap Object Callback</synopsis>
5295 <description>
5296 Agent supplied callback function.
5297 Describes (but does not pass in) an object in the heap.
5298 <p/>
5299 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5300 or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5301 <p/>
5302 See the <internallink id="heapCallbacks">heap callback
5303 function restrictions</internallink>.
5304 </description>
5305 <parameters>
5306 <param id="class_tag">
5307 <jlong/>
5308 <description>
5309 The tag of the class of object (zero if the class is not tagged).
5310 If the object represents a runtime class,
5311 the <code>class_tag</code> is the tag
5312 associated with <code>java.lang.Class</code>
5313 (zero if <code>java.lang.Class</code> is not tagged).
5314 </description>
5315 </param>
5316 <param id="size">
5317 <jlong/>
5318 <description>
5319 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5320 </description>
5321 </param>
5322 <param id="tag_ptr">
5323 <outptr><jlong/></outptr>
5324 <description>
5325 The object tag value, or zero if the object is not tagged.
5326 To set the tag value to be associated with the object
5327 the agent sets the <code>jlong</code> pointed to by the parameter.
5328 </description>
5329 </param>
5330 <param id="user_data">
5331 <outptr><void/></outptr>
5332 <description>
5333 The user supplied data that was passed into the iteration function.
5334 </description>
5335 </param>
5336 </parameters>
5337 </callback>
5338
5339 <callback id="jvmtiHeapRootCallback">
5340 <enum>jvmtiIterationControl</enum>
5341 <synopsis>Heap Root Object Callback</synopsis>
5342 <description>
5343 Agent supplied callback function.
5344 Describes (but does not pass in) an object that is a root for the purposes
5345 of garbage collection.
5346 <p/>
5347 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5348 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5349 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5350 <p/>
5351 See the <internallink id="heapCallbacks">heap callback
5352 function restrictions</internallink>.
5353 </description>
5354 <parameters>
5355 <param id="root_kind">
5356 <enum>jvmtiHeapRootKind</enum>
5357 <description>
5358 The kind of heap root.
5359 </description>
5360 </param>
5361 <param id="class_tag">
5362 <jlong/>
5363 <description>
5364 The tag of the class of object (zero if the class is not tagged).
5365 If the object represents a runtime class, the <code>class_tag</code> is the tag
5366 associated with <code>java.lang.Class</code>
5367 (zero if <code>java.lang.Class</code> is not tagged).
5368 </description>
5369 </param>
5370 <param id="size">
5371 <jlong/>
5372 <description>
5373 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5374 </description>
5375 </param>
5376 <param id="tag_ptr">
5377 <outptr><jlong/></outptr>
5378 <description>
5379 The object tag value, or zero if the object is not tagged.
5380 To set the tag value to be associated with the object
5381 the agent sets the <code>jlong</code> pointed to by the parameter.
5382 </description>
5383 </param>
5384 <param id="user_data">
5385 <outptr><void/></outptr>
5386 <description>
5387 The user supplied data that was passed into the iteration function.
5388 </description>
5389 </param>
5390 </parameters>
5391 </callback>
5392
5393 <callback id="jvmtiStackReferenceCallback">
5394 <enum>jvmtiIterationControl</enum>
5395 <synopsis>Stack Reference Object Callback</synopsis>
5396 <description>
5397 Agent supplied callback function.
5398 Describes (but does not pass in) an object on the stack that is a root for
5399 the purposes of garbage collection.
5400 <p/>
5401 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5402 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5403 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5404 <p/>
5405 See the <internallink id="heapCallbacks">heap callback
5406 function restrictions</internallink>.
5407 </description>
5408 <parameters>
5409 <param id="root_kind">
5410 <enum>jvmtiHeapRootKind</enum>
5411 <description>
5412 The kind of root (either <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5413 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>).
5414 </description>
5415 </param>
5416 <param id="class_tag">
5417 <jlong/>
5418 <description>
5419 The tag of the class of object (zero if the class is not tagged).
5420 If the object represents a runtime class, the <code>class_tag</code> is the tag
5421 associated with <code>java.lang.Class</code>
5422 (zero if <code>java.lang.Class</code> is not tagged).
5423 </description>
5424 </param>
5425 <param id="size">
5426 <jlong/>
5427 <description>
5428 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
5429 </description>
5430 </param>
5431 <param id="tag_ptr">
5432 <outptr><jlong/></outptr>
5433 <description>
5434 The object tag value, or zero if the object is not tagged.
5435 To set the tag value to be associated with the object
5436 the agent sets the <code>jlong</code> pointed to by the parameter.
5437 </description>
5438 </param>
5439 <param id="thread_tag">
5440 <jlong/>
5441 <description>
5442 The tag of the thread corresponding to this stack, zero if not tagged.
5443 </description>
5444 </param>
5445 <param id="depth">
5446 <jint/>
5447 <description>
5448 The depth of the frame.
5449 </description>
5450 </param>
5451 <param id="method">
5452 <jmethodID/>
5453 <description>
5454 The method executing in this frame.
5455 </description>
5456 </param>
5457 <param id="slot">
5458 <jint/>
5459 <description>
5460 The slot number.
5461 </description>
5462 </param>
5463 <param id="user_data">
5464 <outptr><void/></outptr>
5465 <description>
5466 The user supplied data that was passed into the iteration function.
5467 </description>
5468 </param>
5469 </parameters>
5470 </callback>
5471
5472 <callback id="jvmtiObjectReferenceCallback">
5473 <enum>jvmtiIterationControl</enum>
5474 <synopsis>Object Reference Callback</synopsis>
5475 <description>
5476 Agent supplied callback function.
5477 Describes a reference from an object (the referrer) to another object
5478 (the referree).
5479 <p/>
5480 Return value should be <code>JVMTI_ITERATION_CONTINUE</code> to continue iteration,
5481 <code>JVMTI_ITERATION_IGNORE</code> to continue iteration without pursuing
5482 references from referree object or <code>JVMTI_ITERATION_ABORT</code> to stop iteration.
5483 <p/>
5484 See the <internallink id="heapCallbacks">heap callback
5485 function restrictions</internallink>.
5486 </description>
5487 <parameters>
5488 <param id="reference_kind">
5489 <enum>jvmtiObjectReferenceKind</enum>
5490 <description>
5491 The type of reference.
5492 </description>
5493 </param>
5494 <param id="class_tag">
5495 <jlong/>
5496 <description>
5497 The tag of the class of referree object (zero if the class is not tagged).
5498 If the referree object represents a runtime class,
5499 the <code>class_tag</code> is the tag
5500 associated with <code>java.lang.Class</code>
5501 (zero if <code>java.lang.Class</code> is not tagged).
5502 </description>
5503 </param>
5504 <param id="size">
5505 <jlong/>
5506 <description>
5507 Size of the referree object (in bytes).
5508 See <functionlink id="GetObjectSize"/>.
5509 </description>
5510 </param>
5511 <param id="tag_ptr">
5512 <outptr><jlong/></outptr>
5513 <description>
5514 The referree object tag value, or zero if the object is not
5515 tagged.
5516 To set the tag value to be associated with the object
5517 the agent sets the <code>jlong</code> pointed to by the parameter.
5518 </description>
5519 </param>
5520 <param id="referrer_tag">
5521 <jlong/>
5522 <description>
5523 The tag of the referrer object, or zero if the referrer
5524 object is not tagged.
5525 </description>
5526 </param>
5527 <param id="referrer_index">
5528 <jint/>
5529 <description>
5530 For references of type <code>JVMTI_REFERENCE_FIELD</code> or
5531 <code>JVMTI_REFERENCE_STATIC_FIELD</code> the index
5532 of the field in the referrer object. The index is based on the
5533 order of all the object's fields - see <internallink
5534 id="JVMTI_REFERENCE_FIELD">JVMTI_REFERENCE_FIELD</internallink>
5535 or <internallink
5536 id="JVMTI_REFERENCE_STATIC_FIELD">JVMTI_REFERENCE_STATIC_FIELD
5537 </internallink> for further description.
5538 <p/>
5539 For references of type <code>JVMTI_REFERENCE_ARRAY_ELEMENT</code>
5540 the array index - see <internallink id="JVMTI_REFERENCE_ARRAY_ELEMENT">
5541 JVMTI_REFERENCE_ARRAY_ELEMENT</internallink> for further description.
5542 <p/>
5543 For references of type <code>JVMTI_REFERENCE_CONSTANT_POOL</code>
5544 the index into the constant pool of the class - see
5545 <internallink id="JVMTI_REFERENCE_CONSTANT_POOL">
5546 JVMTI_REFERENCE_CONSTANT_POOL</internallink> for further
5547 description.
5548 <p/>
5549 For references of other kinds the <code>referrer_index</code> is
5550 <code>-1</code>.
5551 </description>
5552 </param>
5553 <param id="user_data">
5554 <outptr><void/></outptr>
5555 <description>
5556 The user supplied data that was passed into the iteration function.
5557 </description>
5558 </param>
5559 </parameters>
5560 </callback>
5561
5562 <function id="IterateOverObjectsReachableFromObject" num="109">
5563 <synopsis>Iterate Over Objects Reachable From Object</synopsis>
5564 <description>
5565 This function iterates over all objects that are directly
5566 and indirectly reachable from the specified object.
5567 For each object <i>A</i> (known
5568 as the referrer) with a reference to object <i>B</i> the specified
5569 callback function is called to describe the object reference.
5570 The callback is called exactly once for each reference from a referrer;
5571 this is true even if there are reference cycles or multiple paths to
5572 the referrer.
5573 There may be more than one reference between a referrer and a referree,
5574 These may be distinguished by the
5575 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5576 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5577 The callback for an object will always occur after the callback for
5578 its referrer.
5579 <p/>
5580 See <functionlink id="FollowReferences"/> for the object
5581 references which are reported.
5582 <p/>
5583 During the execution of this function the state of the heap
5584 does not change: no objects are allocated, no objects are
5585 garbage collected, and the state of objects (including
5586 held values) does not change.
5587 As a result, threads executing Java
5588 programming language code, threads attempting to resume the
5589 execution of Java programming language code, and threads
5590 attempting to execute JNI functions are typically stalled.
5591 </description>
5592 <origin>new</origin>
5593 <capabilities>
5594 <required id="can_tag_objects"></required>
5595 </capabilities>
5596 <parameters>
5597 <param id="object">
5598 <jobject/>
5599 <description>
5600 The object
5601 </description>
5602 </param>
5603 <param id="object_reference_callback">
5604 <ptrtype>
5605 <struct>jvmtiObjectReferenceCallback</struct>
5606 </ptrtype>
5607 <description>
5608 The callback to be called to describe each
5609 object reference.
5610 </description>
5611 </param>
5612 <param id="user_data">
5613 <inbuf>
5614 <void/>
5615 <nullok>a null pointer is passed as the user supplied data</nullok>
5616 </inbuf>
5617 <description>
5618 User supplied data to be passed to the callback.
5619 </description>
5620 </param>
5621 </parameters>
5622 <errors>
5623 </errors>
5624 </function>
5625
5626 <function id="IterateOverReachableObjects" num="110">
5627 <synopsis>Iterate Over Reachable Objects</synopsis>
5628 <description>
5629 This function iterates over the root objects and all objects that
5630 are directly and indirectly reachable from the root objects.
5631 The root objects comprise the set of system classes,
5632 JNI globals, references from platform thread stacks, and other objects used as roots
5633 for the purposes of garbage collection.
5634 <p/>
5635 For each root the <paramlink id="heap_root_callback"></paramlink>
5636 or <paramlink id="stack_ref_callback"></paramlink> callback is called.
5637 An object can be a root object for more than one reason and in that case
5638 the appropriate callback is called for each reason.
5639 <p/>
5640 For each object reference the <paramlink id="object_ref_callback"></paramlink>
5641 callback function is called to describe the object reference.
5642 The callback is called exactly once for each reference from a referrer;
5643 this is true even if there are reference cycles or multiple paths to
5644 the referrer.
5645 There may be more than one reference between a referrer and a referree,
5646 These may be distinguished by the
5647 <datalink id="jvmtiObjectReferenceCallback.reference_kind"></datalink> and
5648 <datalink id="jvmtiObjectReferenceCallback.referrer_index"></datalink>.
5649 The callback for an object will always occur after the callback for
5650 its referrer.
5651 <p/>
5652 See <functionlink id="FollowReferences"/> for the object
5653 references which are reported.
5654 <p/>
5655 Roots are always reported to the profiler before any object references
5656 are reported. In other words, the <paramlink id="object_ref_callback"></paramlink>
5657 callback will not be called until the appropriate callback has been called
5658 for all roots. If the <paramlink id="object_ref_callback"></paramlink> callback is
5659 specified as null then this function returns after
5660 reporting the root objects to the profiler.
5661 <p/>
5662 During the execution of this function the state of the heap
5663 does not change: no objects are allocated, no objects are
5664 garbage collected, and the state of objects (including
5665 held values) does not change.
5666 As a result, threads executing Java
5667 programming language code, threads attempting to resume the
5668 execution of Java programming language code, and threads
5669 attempting to execute JNI functions are typically stalled.
5670 </description>
5671 <origin>new</origin>
5672 <capabilities>
5673 <required id="can_tag_objects"></required>
5674 </capabilities>
5675 <parameters>
5676 <param id="heap_root_callback">
5677 <ptrtype>
5678 <struct>jvmtiHeapRootCallback</struct>
5679 <nullok>do not report heap roots</nullok>
5680 </ptrtype>
5681 <description>
5682 The callback function to be called for each heap root of type
5683 <code>JVMTI_HEAP_ROOT_JNI_GLOBAL</code>,
5684 <code>JVMTI_HEAP_ROOT_SYSTEM_CLASS</code>,
5685 <code>JVMTI_HEAP_ROOT_MONITOR</code>,
5686 <code>JVMTI_HEAP_ROOT_THREAD</code>, or
5687 <code>JVMTI_HEAP_ROOT_OTHER</code>.
5688 </description>
5689 </param>
5690 <param id="stack_ref_callback">
5691 <ptrtype>
5692 <struct>jvmtiStackReferenceCallback</struct>
5693 <nullok>do not report stack references</nullok>
5694 </ptrtype>
5695 <description>
5696 The callback function to be called for each heap root of
5697 <code>JVMTI_HEAP_ROOT_STACK_LOCAL</code> or
5698 <code>JVMTI_HEAP_ROOT_JNI_LOCAL</code>.
5699 </description>
5700 </param>
5701 <param id="object_ref_callback">
5702 <ptrtype>
5703 <struct>jvmtiObjectReferenceCallback</struct>
5704 <nullok>do not follow references from the root objects</nullok>
5705 </ptrtype>
5706 <description>
5707 The callback function to be called for each object reference.
5708 </description>
5709 </param>
5710 <param id="user_data">
5711 <inbuf>
5712 <void/>
5713 <nullok>a null pointer is passed as the user supplied data</nullok>
5714 </inbuf>
5715 <description>
5716 User supplied data to be passed to the callback.
5717 </description>
5718 </param>
5719 </parameters>
5720 <errors>
5721 </errors>
5722 </function>
5723
5724 <function id="IterateOverHeap" num="111">
5725 <synopsis>Iterate Over Heap</synopsis>
5726 <description>
5727 Iterate over all objects in the heap. This includes both reachable and
5728 unreachable objects.
5729 <p/>
5730 The <paramlink id="object_filter"></paramlink> parameter indicates the
5731 objects for which the callback function is called. If this parameter
5732 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5733 called for every object that is tagged. If the parameter is
5734 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5735 for objects that are not tagged. If the parameter
5736 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5737 called for every object in the heap, irrespective of whether it is
5738 tagged or not.
5739 <p/>
5740 During the execution of this function the state of the heap
5741 does not change: no objects are allocated, no objects are
5742 garbage collected, and the state of objects (including
5743 held values) does not change.
5744 As a result, threads executing Java
5745 programming language code, threads attempting to resume the
5746 execution of Java programming language code, and threads
5747 attempting to execute JNI functions are typically stalled.
5748 </description>
5749 <origin>new</origin>
5750 <capabilities>
5751 <required id="can_tag_objects"></required>
5752 </capabilities>
5753 <parameters>
5754 <param id="object_filter">
5755 <enum>jvmtiHeapObjectFilter</enum>
5756 <description>
5757 Indicates the objects for which the callback function is called.
5758 </description>
5759 </param>
5760 <param id="heap_object_callback">
5761 <ptrtype>
5762 <struct>jvmtiHeapObjectCallback</struct>
5763 </ptrtype>
5764 <description>
5765 The iterator function to be called for each
5766 object matching the <paramlink id="object_filter"/>.
5767 </description>
5768 </param>
5769 <param id="user_data">
5770 <inbuf>
5771 <void/>
5772 <nullok>a null pointer is passed as the user supplied data</nullok>
5773 </inbuf>
5774 <description>
5775 User supplied data to be passed to the callback.
5776 </description>
5777 </param>
5778 </parameters>
5779 <errors>
5780 </errors>
5781 </function>
5782
5783 <function id="IterateOverInstancesOfClass" num="112">
5784 <synopsis>Iterate Over Instances Of Class</synopsis>
5785 <description>
5786 Iterate over all objects in the heap that are instances of the specified class.
5787 This includes direct instances of the specified class and
5788 instances of all subclasses of the specified class.
5789 This includes both reachable and unreachable objects.
5790 <p/>
5791 The <paramlink id="object_filter"></paramlink> parameter indicates the
5792 objects for which the callback function is called. If this parameter
5793 is <code>JVMTI_HEAP_OBJECT_TAGGED</code> then the callback will only be
5794 called for every object that is tagged. If the parameter is
5795 <code>JVMTI_HEAP_OBJECT_UNTAGGED</code> then the callback will only be
5796 called for objects that are not tagged. If the parameter
5797 is <code>JVMTI_HEAP_OBJECT_EITHER</code> then the callback will be
5798 called for every object in the heap, irrespective of whether it is
5799 tagged or not.
5800 <p/>
5801 During the execution of this function the state of the heap
5802 does not change: no objects are allocated, no objects are
5803 garbage collected, and the state of objects (including
5804 held values) does not change.
5805 As a result, threads executing Java
5806 programming language code, threads attempting to resume the
5807 execution of Java programming language code, and threads
5808 attempting to execute JNI functions are typically stalled.
5809 </description>
5810 <origin>new</origin>
5811 <capabilities>
5812 <required id="can_tag_objects"></required>
5813 </capabilities>
5814 <parameters>
5815 <param id="klass">
5816 <jclass/>
5817 <description>
5818 Iterate over objects of this class only.
5819 </description>
5820 </param>
5821 <param id="object_filter">
5822 <enum>jvmtiHeapObjectFilter</enum>
5823 <description>
5824 Indicates the objects for which the callback function is called.
5825 </description>
5826 </param>
5827 <param id="heap_object_callback">
5828 <ptrtype>
5829 <struct>jvmtiHeapObjectCallback</struct>
5830 </ptrtype>
5831 <description>
5832 The iterator function to be called for each
5833 <paramlink id="klass"/> instance matching
5834 the <paramlink id="object_filter"/>.
5835 </description>
5836 </param>
5837 <param id="user_data">
5838 <inbuf>
5839 <void/>
5840 <nullok>null pointeris passed as the user supplied data</nullok>
5841 </inbuf>
5842 <description>
5843 User supplied data to be passed to the callback.
5844 </description>
5845 </param>
5846 </parameters>
5847 <errors>
5848 </errors>
5849 </function>
5850
5851 </category>
5852
5853 <category id="local" label="Local Variable">
5854
5855 <intro>
5856 These functions are used to retrieve or set the value of a local variable.
5857 The variable is identified by the depth of the frame containing its
5858 value and the variable's slot number within that frame.
5859 The mapping of variables to
5860 slot numbers can be obtained with the function
5861 <functionlink id="GetLocalVariableTable"></functionlink>.
5862 <p/>
5863 The <code>GetLocalXXX</code> functions may be used to retrieve the value of
5864 a local variable contained in the frame of a virtual thread.
5865 The <code>SetLocalXXX</code> functions may be used to set the value of a
5866 local variable in the topmost frame of a virtual thread suspended at an event.
5867 An implementation may support setting locals in other cases.
5868 </intro>
5869
5870 <function id="GetLocalObject" num="21">
5871 <synopsis>Get Local Variable - Object</synopsis>
5872 <description>
5873 This function can be used to retrieve the value of a local
5874 variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
5875 <p/>
5876 When preview features are enabled, if the local is the "<code>this</code>"
5877 object and "<code>this</code>" is a value object under construction, the
5878 function retrieves a snapshot of the "<code>this</code>" object representing
5879 the value object's state at the point the snapshot is taken.
5880 <p/>
5881 The specified thread must be suspended or must be the current thread.
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" impl="noconvert"/>
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><jobject/></outptr>
5908 <description>
5909 On return, points to the variable's value.
5910 When preview features are enabled, if the local is the "<code>this</code>"
5911 object and "<code>this</code>" is a value object under construction,
5912 <code>value_ptr</code> will point to a snapshot of the "<code>this</code>"
5913 object representing the value object's state at the point the snapshot
5914 is taken.
5915 </description>
5916 </param>
5917 </parameters>
5918 <errors>
5919 <error id="JVMTI_ERROR_INVALID_SLOT">
5920 Invalid <code>slot</code>.
5921 </error>
5922 <error id="JVMTI_ERROR_TYPE_MISMATCH">
5923 The variable type is not
5924 <code>Object</code> or a subclass of <code>Object</code>.
5925 </error>
5926 <error id="JVMTI_ERROR_OPAQUE_FRAME">
5927 The implementation is unable to get the frame locals
5928 (e.g. the frame at <code>depth</code> is executing a native method).
5929 </error>
5930 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
5931 Thread was not suspended and was not the current thread.
5932 </error>
5933 </errors>
5934 </function>
5935
5936 <function id="GetLocalInstance" num="155" since="1.2">
5937 <synopsis>Get Local Instance</synopsis>
5938 <description>
5939 This function can be used to retrieve the value of the local object
5940 variable at slot 0 (the "<code>this</code>" object) from non-static
5941 frames. This function can retrieve the "<code>this</code>" object from
5942 native method frames, whereas <code>GetLocalObject()</code> would
5943 return <code>JVMTI_ERROR_OPAQUE_FRAME</code> in those cases.
5944 <p/>
5945 When preview features are enabled and the "<code>this</code>" object is
5946 a value object under construction, the function retrieves a snapshot of the
5947 "<code>this</code>" object that represents the value object's state at
5948 the point the snapshot is taken.
5949 <p/>
5950 The specified thread must be suspended or must be the current thread.
5951 </description>
5952 <origin>new</origin>
5953 <capabilities>
5954 <required id="can_access_local_variables"></required>
5955 </capabilities>
5956 <parameters>
5957 <param id="thread">
5958 <jthread null="current" frame="frame" impl="noconvert"/>
5959 <description>
5960 The thread of the frame containing the variable's value.
5961 </description>
5962 </param>
5963 <param id="depth">
5964 <jframeID thread="thread"/>
5965 <description>
5966 The depth of the frame containing the variable's value.
5967 </description>
5968 </param>
5969 <param id="value_ptr">
5970 <outptr><jobject/></outptr>
5971 <description>
5972 On return, points to the variable's value.
5973 When preview features are enabled, and the "<code>this</code>" object is
5974 a value object under construction, <code>value_ptr</code> will point to
5975 a snapshot of the "<code>this</code>" object representing the value
5976 object's state at the point the snapshot is taken.
5977 </description>
5978 </param>
5979 </parameters>
5980 <errors>
5981 <error id="JVMTI_ERROR_INVALID_SLOT">
5982 If the specified frame is a static method frame.
5983 </error>
5984 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
5985 Thread was not suspended and was not the current thread.
5986 </error>
5987 </errors>
5988 </function>
5989 <function id="GetLocalInt" num="22">
5990 <synopsis>Get Local Variable - Int</synopsis>
5991 <description>
5992 This function can be used to retrieve the value of a local
5993 variable whose type is <code>int</code>,
5994 <code>short</code>, <code>char</code>, <code>byte</code>, or
5995 <code>boolean</code>.
5996 <p/>
5997 The specified thread must be suspended or must be the current thread.
5998 </description>
5999 <origin>jvmdi</origin>
6000 <capabilities>
6001 <required id="can_access_local_variables"></required>
6002 </capabilities>
6003 <parameters>
6004 <param id="thread">
6005 <jthread null="current" frame="frame" impl="noconvert"/>
6006 <description>
6007 The thread of the frame containing the variable's value.
6008 </description>
6009 </param>
6010 <param id="depth">
6011 <jframeID thread="thread"/>
6012 <description>
6013 The depth of the frame containing the variable's value.
6014 </description>
6015 </param>
6016 <param id="slot">
6017 <jint/>
6018 <description>
6019 The variable's slot number.
6020 </description>
6021 </param>
6022 <param id="value_ptr">
6023 <outptr><jint/></outptr>
6024 <description>
6025 On return, points to the variable's value.
6026 </description>
6027 </param>
6028 </parameters>
6029 <errors>
6030 <error id="JVMTI_ERROR_INVALID_SLOT">
6031 Invalid <code>slot</code>.
6032 </error>
6033 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6034 The variable type is not
6035 <code>int</code>, <code>short</code>,
6036 <code>char</code>, <code>byte</code>, or
6037 <code>boolean</code>.
6038 </error>
6039 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6040 The implementation is unable to get the frame locals
6041 (e.g. the frame at <code>depth</code> is executing a native method).
6042 </error>
6043 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6044 Thread was not suspended and was not the current thread.
6045 </error>
6046 </errors>
6047 </function>
6048
6049 <function id="GetLocalLong" num="23">
6050 <synopsis>Get Local Variable - Long</synopsis>
6051 <description>
6052 This function can be used to retrieve the value of a local
6053 variable whose type is <code>long</code>.
6054 <p/>
6055 The specified thread must be suspended or must be the current thread.
6056 </description>
6057 <origin>jvmdi</origin>
6058 <capabilities>
6059 <required id="can_access_local_variables"></required>
6060 </capabilities>
6061 <parameters>
6062 <param id="thread">
6063 <jthread null="current" frame="frame" impl="noconvert"/>
6064 <description>
6065 The thread of the frame containing the variable's value.
6066 </description>
6067 </param>
6068 <param id="depth">
6069 <jframeID thread="thread"/>
6070 <description>
6071 The depth of the frame containing the variable's value.
6072 </description>
6073 </param>
6074 <param id="slot">
6075 <jint/>
6076 <description>
6077 The variable's slot number.
6078 </description>
6079 </param>
6080 <param id="value_ptr">
6081 <outptr><jlong/></outptr>
6082 <description>
6083 On return, points to the variable's value.
6084 </description>
6085 </param>
6086 </parameters>
6087 <errors>
6088 <error id="JVMTI_ERROR_INVALID_SLOT">
6089 Invalid <code>slot</code>.
6090 </error>
6091 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6092 The variable type is not <code>long</code>.
6093 </error>
6094 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6095 The implementation is unable to get the frame locals
6096 (e.g. the frame at <code>depth</code> is executing a native method).
6097 </error>
6098 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6099 Thread was not suspended and was not the current thread.
6100 </error>
6101 </errors>
6102 </function>
6103
6104 <function id="GetLocalFloat" num="24">
6105 <synopsis>Get Local Variable - Float</synopsis>
6106 <description>
6107 This function can be used to retrieve the value of a local
6108 variable whose type is <code>float</code>.
6109 <p/>
6110 The specified thread must be suspended or must be the current thread.
6111 </description>
6112 <origin>jvmdi</origin>
6113 <capabilities>
6114 <required id="can_access_local_variables"></required>
6115 </capabilities>
6116 <parameters>
6117 <param id="thread">
6118 <jthread null="current" frame="frame" impl="noconvert"/>
6119 <description>
6120 The thread of the frame containing the variable's value.
6121 </description>
6122 </param>
6123 <param id="depth">
6124 <jframeID thread="thread"/>
6125 <description>
6126 The depth of the frame containing the variable's value.
6127 </description>
6128 </param>
6129 <param id="slot">
6130 <jint/>
6131 <description>
6132 The variable's slot number.
6133 </description>
6134 </param>
6135 <param id="value_ptr">
6136 <outptr><jfloat/></outptr>
6137 <description>
6138 On return, points to the variable's value.
6139 </description>
6140 </param>
6141 </parameters>
6142 <errors>
6143 <error id="JVMTI_ERROR_INVALID_SLOT">
6144 Invalid <code>slot</code>.
6145 </error>
6146 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6147 The variable type is not <code>float</code>.
6148 </error>
6149 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6150 The implementation is unable to get the frame locals
6151 (e.g. the frame at <code>depth</code> is executing a native method).
6152 </error>
6153 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6154 Thread was not suspended and was not the current thread.
6155 </error>
6156 </errors>
6157 </function>
6158
6159 <function id="GetLocalDouble" num="25">
6160 <synopsis>Get Local Variable - Double</synopsis>
6161 <description>
6162 This function can be used to retrieve the value of a local
6163 variable whose type is <code>double</code>.
6164 <p/>
6165 The specified thread must be suspended or must be the current thread.
6166 </description>
6167 <origin>jvmdi</origin>
6168 <capabilities>
6169 <required id="can_access_local_variables"></required>
6170 </capabilities>
6171 <parameters>
6172 <param id="thread">
6173 <jthread null="current" frame="frame" impl="noconvert"/>
6174 <description>
6175 The thread of the frame containing the variable's value.
6176 </description>
6177 </param>
6178 <param id="depth">
6179 <jframeID thread="thread"/>
6180 <description>
6181 The depth of the frame containing the variable's value.
6182 </description>
6183 </param>
6184 <param id="slot">
6185 <jint/>
6186 <description>
6187 The variable's slot number.
6188 </description>
6189 </param>
6190 <param id="value_ptr">
6191 <outptr><jdouble/></outptr>
6192 <description>
6193 On return, points to the variable's value.
6194 </description>
6195 </param>
6196 </parameters>
6197 <errors>
6198 <error id="JVMTI_ERROR_INVALID_SLOT">
6199 Invalid <code>slot</code>.
6200 </error>
6201 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6202 The variable type is not <code>double</code>.
6203 </error>
6204 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6205 The implementation is unable to get the frame locals
6206 (e.g. the frame at <code>depth</code> is executing a native method).
6207 </error>
6208 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6209 Thread was not suspended and was not the current thread.
6210 </error>
6211 </errors>
6212 </function>
6213
6214 <function id="SetLocalObject" num="26">
6215 <synopsis>Set Local Variable - Object</synopsis>
6216 <description>
6217 This function can be used to set the value of a local
6218 variable whose type is <code>Object</code> or a subclass of <code>Object</code>.
6219 <p/>
6220 The specified thread must be suspended or must be the current thread.
6221 </description>
6222 <origin>jvmdi</origin>
6223 <capabilities>
6224 <required id="can_access_local_variables"></required>
6225 </capabilities>
6226 <parameters>
6227 <param id="thread">
6228 <jthread null="current" frame="frame" impl="noconvert"/>
6229 <description>
6230 The thread of the frame containing the variable's value.
6231 </description>
6232 </param>
6233 <param id="depth">
6234 <jframeID thread="thread"/>
6235 <description>
6236 The depth of the frame containing the variable's value.
6237 </description>
6238 </param>
6239 <param id="slot">
6240 <jint/>
6241 <description>
6242 The variable's slot number.
6243 </description>
6244 </param>
6245 <param id="value">
6246 <jobject/>
6247 <description>
6248 The new value for the variable.
6249 </description>
6250 </param>
6251 </parameters>
6252 <errors>
6253 <error id="JVMTI_ERROR_INVALID_SLOT">
6254 Invalid <code>slot</code>.
6255 </error>
6256 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6257 The variable type is not
6258 <code>Object</code> or a subclass of <code>Object</code>.
6259 </error>
6260 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6261 The supplied <paramlink id="value"/> is not compatible
6262 with the variable type.
6263 </error>
6264 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6265 The implementation is unable to set the frame locals
6266 (e.g. the frame at <code>depth</code> is executing a native method).
6267 </error>
6268 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6269 Thread was not suspended and was not the current thread.
6270 </error>
6271 </errors>
6272 </function>
6273
6274 <function id="SetLocalInt" num="27">
6275 <synopsis>Set Local Variable - Int</synopsis>
6276 <description>
6277 This function can be used to set the value of a local
6278 variable whose type is <code>int</code>,
6279 <code>short</code>, <code>char</code>, <code>byte</code>, or
6280 <code>boolean</code>.
6281 <p/>
6282 The specified thread must be suspended or must be the current thread.
6283 </description>
6284 <origin>jvmdi</origin>
6285 <capabilities>
6286 <required id="can_access_local_variables"></required>
6287 </capabilities>
6288 <parameters>
6289 <param id="thread">
6290 <jthread null="current" frame="frame" impl="noconvert"/>
6291 <description>
6292 The thread of the frame containing the variable's value.
6293 </description>
6294 </param>
6295 <param id="depth">
6296 <jframeID thread="thread"/>
6297 <description>
6298 The depth of the frame containing the variable's value.
6299 </description>
6300 </param>
6301 <param id="slot">
6302 <jint/>
6303 <description>
6304 The variable's slot number.
6305 </description>
6306 </param>
6307 <param id="value">
6308 <jint/>
6309 <description>
6310 The new value for the variable.
6311 </description>
6312 </param>
6313 </parameters>
6314 <errors>
6315 <error id="JVMTI_ERROR_INVALID_SLOT">
6316 Invalid <code>slot</code>.
6317 </error>
6318 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6319 The variable type is not
6320 <code>int</code>, <code>short</code>,
6321 <code>char</code>, <code>byte</code>, or
6322 <code>boolean</code>.
6323 </error>
6324 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6325 The implementation is unable to set the frame locals
6326 (e.g. the frame at <code>depth</code> is executing a native method).
6327 </error>
6328 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6329 Thread was not suspended and was not the current thread.
6330 </error>
6331 </errors>
6332 </function>
6333
6334 <function id="SetLocalLong" num="28">
6335 <synopsis>Set Local Variable - Long</synopsis>
6336 <description>
6337 This function can be used to set the value of a local
6338 variable whose type is <code>long</code>.
6339 <p/>
6340 The specified thread must be suspended or must be the current thread.
6341 </description>
6342 <origin>jvmdi</origin>
6343 <capabilities>
6344 <required id="can_access_local_variables"></required>
6345 </capabilities>
6346 <parameters>
6347 <param id="thread">
6348 <jthread null="current" frame="frame" impl="noconvert"/>
6349 <description>
6350 The thread of the frame containing the variable's value.
6351 </description>
6352 </param>
6353 <param id="depth">
6354 <jframeID thread="thread"/>
6355 <description>
6356 The depth of the frame containing the variable's value.
6357 </description>
6358 </param>
6359 <param id="slot">
6360 <jint/>
6361 <description>
6362 The variable's slot number.
6363 </description>
6364 </param>
6365 <param id="value">
6366 <jlong/>
6367 <description>
6368 The new value for the variable.
6369 </description>
6370 </param>
6371 </parameters>
6372 <errors>
6373 <error id="JVMTI_ERROR_INVALID_SLOT">
6374 Invalid <code>slot</code>.
6375 </error>
6376 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6377 The variable type is not <code>long</code>.
6378 </error>
6379 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6380 The implementation is unable to set the frame locals
6381 (e.g. the frame at <code>depth</code> is executing a native method).
6382 </error>
6383 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6384 Thread was not suspended and was not the current thread.
6385 </error>
6386 </errors>
6387 </function>
6388
6389 <function id="SetLocalFloat" num="29">
6390 <synopsis>Set Local Variable - Float</synopsis>
6391 <description>
6392 This function can be used to set the value of a local
6393 variable whose type is <code>float</code>.
6394 <p/>
6395 The specified thread must be suspended or must be the current thread.
6396 </description>
6397 <origin>jvmdi</origin>
6398 <capabilities>
6399 <required id="can_access_local_variables"></required>
6400 </capabilities>
6401 <parameters>
6402 <param id="thread">
6403 <jthread null="current" frame="frame" impl="noconvert"/>
6404 <description>
6405 The thread of the frame containing the variable's value.
6406 </description>
6407 </param>
6408 <param id="depth">
6409 <jframeID thread="thread"/>
6410 <description>
6411 The depth of the frame containing the variable's value.
6412 </description>
6413 </param>
6414 <param id="slot">
6415 <jint/>
6416 <description>
6417 The variable's slot number.
6418 </description>
6419 </param>
6420 <param id="value">
6421 <jfloat/>
6422 <description>
6423 The new value for the variable.
6424 </description>
6425 </param>
6426 </parameters>
6427 <errors>
6428 <error id="JVMTI_ERROR_INVALID_SLOT">
6429 Invalid <code>slot</code>.
6430 </error>
6431 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6432 The variable type is not <code>float</code>.
6433 </error>
6434 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6435 The implementation is unable to set the frame locals
6436 (e.g. the frame at <code>depth</code> is executing a native method).
6437 </error>
6438 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6439 Thread was not suspended and was not the current thread.
6440 </error>
6441 </errors>
6442 </function>
6443
6444 <function id="SetLocalDouble" num="30">
6445 <synopsis>Set Local Variable - Double</synopsis>
6446 <description>
6447 This function can be used to set the value of a local
6448 variable whose type is <code>double</code>.
6449 <p/>
6450 The specified thread must be suspended or must be the current thread.
6451 </description>
6452 <origin>jvmdi</origin>
6453 <capabilities>
6454 <required id="can_access_local_variables"></required>
6455 </capabilities>
6456 <parameters>
6457 <param id="thread">
6458 <jthread null="current" frame="frame" impl="noconvert"/>
6459 <description>
6460 The thread of the frame containing the variable's value.
6461 </description>
6462 </param>
6463 <param id="depth">
6464 <jframeID thread="thread"/>
6465 <description>
6466 The depth of the frame containing the variable's value.
6467 </description>
6468 </param>
6469 <param id="slot">
6470 <jint/>
6471 <description>
6472 The variable's slot number.
6473 </description>
6474 </param>
6475 <param id="value">
6476 <jdouble/>
6477 <description>
6478 The new value for the variable.
6479 </description>
6480 </param>
6481 </parameters>
6482 <errors>
6483 <error id="JVMTI_ERROR_INVALID_SLOT">
6484 Invalid <code>slot</code>.
6485 </error>
6486 <error id="JVMTI_ERROR_TYPE_MISMATCH">
6487 The variable type is not <code>double</code>.
6488 </error>
6489 <error id="JVMTI_ERROR_OPAQUE_FRAME">
6490 The implementation is unable to set the frame locals
6491 (e.g. the frame at <code>depth</code> is executing a native method).
6492 </error>
6493 <error id="JVMTI_ERROR_THREAD_NOT_SUSPENDED">
6494 Thread was not suspended and was not the current thread.
6495 </error>
6496 </errors>
6497 </function>
6498 </category>
6499
6500 <category id="breakpointCategory" label="Breakpoint">
6501
6502 <intro>
6503 </intro>
6504
6505 <function id="SetBreakpoint" num="38">
6506 <synopsis>Set Breakpoint</synopsis>
6507 <description>
6508 Set a breakpoint at the instruction indicated by
6509 <code>method</code> and <code>location</code>.
6510 An instruction can only have one breakpoint.
6511 <p/>
6512 Whenever the designated instruction is about to be executed, a
6513 <eventlink id="Breakpoint"></eventlink> event is generated.
6514 </description>
6515 <origin>jvmdi</origin>
6516 <capabilities>
6517 <required id="can_generate_breakpoint_events"></required>
6518 </capabilities>
6519 <parameters>
6520 <param id="klass">
6521 <jclass method="method"/>
6522 <description>
6523 The class in which to set the breakpoint
6524 </description>
6525 </param>
6526 <param id="method">
6527 <jmethodID class="klass"/>
6528 <description>
6529 The method in which to set the breakpoint
6530 </description>
6531 </param>
6532 <param id="location">
6533 <jlocation/>
6534 <description>
6535 the index of the instruction at which to set the breakpoint
6536
6537 </description>
6538 </param>
6539 </parameters>
6540 <errors>
6541 <error id="JVMTI_ERROR_DUPLICATE">
6542 The designated bytecode already has a breakpoint.
6543 </error>
6544 </errors>
6545 </function>
6546
6547 <function id="ClearBreakpoint" num="39">
6548 <synopsis>Clear Breakpoint</synopsis>
6549 <description>
6550 Clear the breakpoint at the bytecode indicated by
6551 <code>method</code> and <code>location</code>.
6552 </description>
6553 <origin>jvmdi</origin>
6554 <capabilities>
6555 <required id="can_generate_breakpoint_events"></required>
6556 </capabilities>
6557 <parameters>
6558 <param id="klass">
6559 <jclass method="method"/>
6560 <description>
6561 The class in which to clear the breakpoint
6562 </description>
6563 </param>
6564 <param id="method">
6565 <jmethodID class="klass"/>
6566 <description>
6567 The method in which to clear the breakpoint
6568 </description>
6569 </param>
6570 <param id="location">
6571 <jlocation/>
6572 <description>
6573 the index of the instruction at which to clear the breakpoint
6574 </description>
6575 </param>
6576 </parameters>
6577 <errors>
6578 <error id="JVMTI_ERROR_NOT_FOUND">
6579 There's no breakpoint at the designated bytecode.
6580 </error>
6581 </errors>
6582 </function>
6583
6584 </category>
6585
6586 <category id="fieldWatch" label="Watched Field">
6587
6588 <intro>
6589 </intro>
6590
6591 <function id="SetFieldAccessWatch" num="41">
6592 <synopsis>Set Field Access Watch</synopsis>
6593 <description>
6594 Generate a <eventlink id="FieldAccess"></eventlink> event
6595 when the field specified
6596 by <code>klass</code> and
6597 <code>field</code> is about to be accessed.
6598 An event will be generated for each access of the field
6599 until it is canceled with
6600 <functionlink id="ClearFieldAccessWatch"></functionlink>.
6601 Field accesses from Java programming language code or from JNI code are watched,
6602 fields modified by other means are not watched.
6603 Note that <jvmti/> users should be aware that their own field accesses
6604 will trigger the watch.
6605 A field can only have one field access watch set.
6606 Modification of a field is not considered an access--use
6607 <functionlink id="SetFieldModificationWatch"></functionlink>
6608 to monitor modifications.
6609 </description>
6610 <origin>jvmdi</origin>
6611 <capabilities>
6612 <required id="can_generate_field_access_events"></required>
6613 </capabilities>
6614 <parameters>
6615 <param id="klass">
6616 <jclass field="field"/>
6617 <description>
6618 The class containing the field to watch
6619 </description>
6620 </param>
6621 <param id="field">
6622 <jfieldID class="klass"/>
6623 <description>
6624 The field to watch
6625
6626 </description>
6627 </param>
6628 </parameters>
6629 <errors>
6630 <error id="JVMTI_ERROR_DUPLICATE">
6631 The designated field is already being watched for accesses.
6632 </error>
6633 </errors>
6634 </function>
6635
6636 <function id="ClearFieldAccessWatch" num="42">
6637 <synopsis>Clear Field Access Watch</synopsis>
6638 <description>
6639 Cancel a field access watch previously set by
6640 <functionlink id="SetFieldAccessWatch"></functionlink>, on the
6641 field specified
6642 by <code>klass</code> and
6643 <code>field</code>.
6644 </description>
6645 <origin>jvmdi</origin>
6646 <capabilities>
6647 <required id="can_generate_field_access_events"></required>
6648 </capabilities>
6649 <parameters>
6650 <param id="klass">
6651 <jclass field="field"/>
6652 <description>
6653 The class containing the field to watch
6654 </description>
6655 </param>
6656 <param id="field">
6657 <jfieldID class="klass"/>
6658 <description>
6659 The field to watch
6660
6661 </description>
6662 </param>
6663 </parameters>
6664 <errors>
6665 <error id="JVMTI_ERROR_NOT_FOUND">
6666 The designated field is not being watched for accesses.
6667 </error>
6668 </errors>
6669 </function>
6670
6671 <function id="SetFieldModificationWatch" num="43">
6672 <synopsis>Set Field Modification Watch</synopsis>
6673 <description>
6674 Generate a <eventlink id="FieldModification"></eventlink> event
6675 when the field specified
6676 by <code>klass</code> and
6677 <code>field</code> is about to be modified.
6678 An event will be generated for each modification of the field
6679 until it is canceled with
6680 <functionlink id="ClearFieldModificationWatch"></functionlink>.
6681 Field modifications from Java programming language code or from JNI code are watched,
6682 fields modified by other means are not watched.
6683 Note that <jvmti/> users should be aware that their own field modifications
6684 will trigger the watch.
6685 A field can only have one field modification watch set.
6686 </description>
6687 <origin>jvmdi</origin>
6688 <capabilities>
6689 <required id="can_generate_field_modification_events"></required>
6690 </capabilities>
6691 <parameters>
6692 <param id="klass">
6693 <jclass field="field"/>
6694 <description>
6695 The class containing the field to watch
6696 </description>
6697 </param>
6698 <param id="field">
6699 <jfieldID class="klass"/>
6700 <description>
6701 The field to watch
6702
6703 </description>
6704 </param>
6705 </parameters>
6706 <errors>
6707 <error id="JVMTI_ERROR_DUPLICATE">
6708 The designated field is already being watched for modifications.
6709 </error>
6710 </errors>
6711 </function>
6712
6713 <function id="ClearFieldModificationWatch" num="44">
6714 <synopsis>Clear Field Modification Watch</synopsis>
6715 <description>
6716
6717 Cancel a field modification watch previously set by
6718 <functionlink id="SetFieldModificationWatch"></functionlink>, on the
6719 field specified
6720 by <code>klass</code> and
6721 <code>field</code>.
6722 </description>
6723 <origin>jvmdi</origin>
6724 <capabilities>
6725 <required id="can_generate_field_modification_events"></required>
6726 </capabilities>
6727 <parameters>
6728 <param id="klass">
6729 <jclass field="field"/>
6730 <description>
6731 The class containing the field to watch
6732 </description>
6733 </param>
6734 <param id="field">
6735 <jfieldID class="klass"/>
6736 <description>
6737 The field to watch
6738
6739 </description>
6740 </param>
6741 </parameters>
6742 <errors>
6743 <error id="JVMTI_ERROR_NOT_FOUND">
6744 The designated field is not being watched for modifications.
6745 </error>
6746 </errors>
6747 </function>
6748 </category>
6749
6750 <category id="module" label="Module">
6751
6752 <intro>
6753 </intro>
6754
6755 <function id="GetAllModules" num="3" since="9">
6756 <synopsis>Get All Modules</synopsis>
6757 <description>
6758 Return an array of all modules loaded in the virtual machine.
6759 The array includes the unnamed module for each class loader.
6760 The number of modules in the array is returned via
6761 <code>module_count_ptr</code>, and the array itself via
6762 <code>modules_ptr</code>.
6763 <p/>
6764 </description>
6765 <origin>new</origin>
6766 <capabilities>
6767 </capabilities>
6768 <parameters>
6769 <param id="module_count_ptr">
6770 <outptr><jint/></outptr>
6771 <description>
6772 On return, points to the number of returned modules.
6773 </description>
6774 </param>
6775 <param id="modules_ptr">
6776 <allocbuf outcount="module_count_ptr"><jobject/></allocbuf>
6777 <description>
6778 On return, points to an array of references, one
6779 for each module.
6780 </description>
6781 </param>
6782 </parameters>
6783 <errors>
6784 </errors>
6785 </function>
6786
6787 <function id="GetNamedModule" num="40" since="9">
6788 <synopsis>Get Named Module</synopsis>
6789 <description>
6790 Return the <code>java.lang.Module</code> object for a named
6791 module defined to a class loader that contains a given package.
6792 The module is returned via <code>module_ptr</code>.
6793 <p/>
6794 If a named module is defined to the class loader and it
6795 contains the package then that named module is returned,
6796 otherwise null is returned.
6797 <p/>
6798 </description>
6799 <origin>new</origin>
6800 <capabilities>
6801 </capabilities>
6802 <parameters>
6803 <param id="class_loader">
6804 <ptrtype>
6805 <jobject/>
6806 <nullok>the bootstrap loader is assumed</nullok>
6807 </ptrtype>
6808 <description>
6809 A class loader.
6810 If the <code>class_loader</code> is not null
6811 or a subclass of <code>java.lang.ClassLoader</code>
6812 this function returns
6813 <errorlink id="JVMTI_ERROR_ILLEGAL_ARGUMENT"></errorlink>.
6814 </description>
6815 </param>
6816 <param id="package_name">
6817 <inbuf><char/></inbuf>
6818 <description>
6819 The name of the package, encoded as a
6820 <internallink id="mUTF">modified UTF-8</internallink> string.
6821 The package name is in internal form (JVMS 4.2.1);
6822 identifiers are separated by forward slashes rather than periods.
6823 </description>
6824 </param>
6825 <param id="module_ptr">
6826 <outptr><jobject/></outptr>
6827 <description>
6828 On return, points to a <code>java.lang.Module</code> object
6829 or points to null.
6830 </description>
6831 </param>
6832 </parameters>
6833 <errors>
6834 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6835 If class loader is not null and is not a class loader object.
6836 </error>
6837 </errors>
6838 </function>
6839
6840 <function id="AddModuleReads" num="94" since="9">
6841 <synopsis>Add Module Reads</synopsis>
6842 <description>
6843 Update a module to read another module. This function is a no-op
6844 when <paramlink id="module"></paramlink> is an unnamed module.
6845 This function facilitates the instrumentation of code
6846 in named modules where that instrumentation requires
6847 expanding the set of modules that a module reads.
6848 </description>
6849 <origin>new</origin>
6850 <capabilities>
6851 </capabilities>
6852 <parameters>
6853 <param id="module">
6854 <ptrtype><jobject/></ptrtype>
6855 <description>
6856 The module to update.
6857 </description>
6858 </param>
6859 <param id="to_module">
6860 <ptrtype><jobject/></ptrtype>
6861 <description>
6862 The additional module to read.
6863 </description>
6864 </param>
6865 </parameters>
6866 <errors>
6867 <error id="JVMTI_ERROR_INVALID_MODULE">
6868 If <paramlink id="module"></paramlink> is not a module object.
6869 </error>
6870 <error id="JVMTI_ERROR_INVALID_MODULE">
6871 If <paramlink id="to_module"></paramlink> is not a module object.
6872 </error>
6873 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6874 if the module cannot be modified.
6875 See <functionlink id="IsModifiableModule"/>.
6876 </error>
6877 </errors>
6878 </function>
6879
6880 <function id="AddModuleExports" num="95" since="9">
6881 <synopsis>Add Module Exports</synopsis>
6882 <description>
6883 Update a module to export a package to another module.
6884 This function is a no-op when <paramlink id="module"></paramlink>
6885 is an unnamed module or an open module.
6886 This function facilitates the instrumentation of code
6887 in named modules where that instrumentation requires
6888 expanding the set of packages that a module exports.
6889 </description>
6890 <origin>new</origin>
6891 <capabilities>
6892 </capabilities>
6893 <parameters>
6894 <param id="module">
6895 <ptrtype><jobject/></ptrtype>
6896 <description>
6897 The module to update.
6898 </description>
6899 </param>
6900 <param id="pkg_name">
6901 <inbuf><char/></inbuf>
6902 <description>
6903 The exported package name.
6904 </description>
6905 </param>
6906 <param id="to_module">
6907 <ptrtype><jobject/></ptrtype>
6908 <description>
6909 The module the package is exported to.
6910 If the <code>to_module</code> is not a subclass of
6911 <code>java.lang.Module</code> this function returns
6912 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6913 </description>
6914 </param>
6915 </parameters>
6916 <errors>
6917 <error id="JVMTI_ERROR_INVALID_MODULE">
6918 If <paramlink id="module"></paramlink> is not a module object.
6919 </error>
6920 <error id="JVMTI_ERROR_INVALID_MODULE">
6921 If <paramlink id="to_module"></paramlink> is not a module object.
6922 </error>
6923 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6924 If the package <paramlink id="pkg_name"></paramlink>
6925 does not belong to the module.
6926 </error>
6927 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6928 if the module cannot be modified.
6929 See <functionlink id="IsModifiableModule"/>.
6930 </error>
6931 </errors>
6932 </function>
6933
6934 <function id="AddModuleOpens" num="96" since="9">
6935 <synopsis>Add Module Opens</synopsis>
6936 <description>
6937 Update a module to open a package to another module.
6938 This function is a no-op when <paramlink id="module"></paramlink>
6939 is an unnamed module or an open module.
6940 This function facilitates the instrumentation of code
6941 in modules where that instrumentation requires
6942 expanding the set of packages that a module opens to
6943 other modules.
6944 </description>
6945 <origin>new</origin>
6946 <capabilities>
6947 </capabilities>
6948 <parameters>
6949 <param id="module">
6950 <ptrtype><jobject/></ptrtype>
6951 <description>
6952 The module to update.
6953 </description>
6954 </param>
6955 <param id="pkg_name">
6956 <inbuf><char/></inbuf>
6957 <description>
6958 The package name of the package to open.
6959 </description>
6960 </param>
6961 <param id="to_module">
6962 <ptrtype><jobject/></ptrtype>
6963 <description>
6964 The module with the package to open.
6965 If the <code>to_module</code> is not a subclass of
6966 <code>java.lang.Module</code> this function returns
6967 <errorlink id="JVMTI_ERROR_INVALID_MODULE"></errorlink>.
6968 </description>
6969 </param>
6970 </parameters>
6971 <errors>
6972 <error id="JVMTI_ERROR_INVALID_MODULE">
6973 If <paramlink id="module"></paramlink> is not a module object.
6974 </error>
6975 <error id="JVMTI_ERROR_INVALID_MODULE">
6976 If <paramlink id="to_module"></paramlink> is not a module object.
6977 </error>
6978 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
6979 If the package <paramlink id="pkg_name"></paramlink>
6980 does not belong to the module.
6981 </error>
6982 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
6983 if the module cannot be modified.
6984 See <functionlink id="IsModifiableModule"/>.
6985 </error>
6986 </errors>
6987 </function>
6988
6989 <function id="AddModuleUses" num="97" since="9">
6990 <synopsis>Add Module Uses</synopsis>
6991 <description>
6992 Updates a module to add a service to the set of services that
6993 a module uses. This function is a no-op when the module
6994 is an unnamed module.
6995 This function facilitates the instrumentation of code
6996 in named modules where that instrumentation requires
6997 expanding the set of services that a module is using.
6998 </description>
6999 <origin>new</origin>
7000 <capabilities>
7001 </capabilities>
7002 <parameters>
7003 <param id="module">
7004 <ptrtype><jobject/></ptrtype>
7005 <description>
7006 The module to update.
7007 </description>
7008 </param>
7009 <param id="service">
7010 <ptrtype><jclass/></ptrtype>
7011 <description>
7012 The service to use.
7013 </description>
7014 </param>
7015 </parameters>
7016 <errors>
7017 <error id="JVMTI_ERROR_INVALID_MODULE">
7018 If <paramlink id="module"></paramlink> is not a module object.
7019 </error>
7020 <error id="JVMTI_ERROR_INVALID_CLASS">
7021 If <paramlink id="service"></paramlink> is not a class object.
7022 </error>
7023 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7024 if the module cannot be modified.
7025 See <functionlink id="IsModifiableModule"/>.
7026 </error>
7027 </errors>
7028 </function>
7029
7030 <function id="AddModuleProvides" num="98" since="9">
7031 <synopsis>Add Module Provides</synopsis>
7032 <description>
7033 Updates a module to add a service to the set of services that
7034 a module provides. This function is a no-op when the module
7035 is an unnamed module.
7036 This function facilitates the instrumentation of code
7037 in named modules where that instrumentation requires
7038 changes to the services that are provided.
7039 </description>
7040 <origin>new</origin>
7041 <capabilities>
7042 </capabilities>
7043 <parameters>
7044 <param id="module">
7045 <ptrtype><jobject/></ptrtype>
7046 <description>
7047 The module to update.
7048 </description>
7049 </param>
7050 <param id="service">
7051 <ptrtype><jclass/></ptrtype>
7052 <description>
7053 The service to provide.
7054 </description>
7055 </param>
7056 <param id="impl_class">
7057 <ptrtype><jclass/></ptrtype>
7058 <description>
7059 The implementation class for the provided service.
7060 </description>
7061 </param>
7062 </parameters>
7063 <errors>
7064 <error id="JVMTI_ERROR_INVALID_MODULE">
7065 If <paramlink id="module"></paramlink> is not a module object.
7066 </error>
7067 <error id="JVMTI_ERROR_INVALID_CLASS">
7068 If <paramlink id="service"></paramlink> is not a class object.
7069 </error>
7070 <error id="JVMTI_ERROR_INVALID_CLASS">
7071 If <paramlink id="impl_class"></paramlink> is not a class object.
7072 </error>
7073 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
7074 if the module cannot be modified.
7075 See <functionlink id="IsModifiableModule"/>.
7076 </error>
7077 </errors>
7078 </function>
7079
7080 <function id="IsModifiableModule" num="99" since="9">
7081 <synopsis>Is Modifiable Module</synopsis>
7082 <description>
7083 Determines whether a module is modifiable.
7084 If a module is modifiable then this module can be updated with
7085 <functionlink id="AddModuleReads"/>, <functionlink id="AddModuleExports"/>,
7086 <functionlink id="AddModuleOpens"/>, <functionlink id="AddModuleUses"/>,
7087 and <functionlink id="AddModuleProvides"/>. If a module is not modifiable
7088 then the module can not be updated with these functions. The result of
7089 this function is always <code>JNI_TRUE</code> when called to determine
7090 if an unnamed module is modifiable.
7091 </description>
7092 <origin>new</origin>
7093 <capabilities>
7094 </capabilities>
7095 <parameters>
7096 <param id="module">
7097 <ptrtype><jobject/></ptrtype>
7098 <description>
7099 The module to query.
7100 </description>
7101 </param>
7102 <param id="is_modifiable_module_ptr">
7103 <outptr><jboolean/></outptr>
7104 <description>
7105 On return, points to the boolean result of this function.
7106 </description>
7107 </param>
7108 </parameters>
7109 <errors>
7110 <error id="JVMTI_ERROR_INVALID_MODULE">
7111 If <paramlink id="module"></paramlink> is not a module object.
7112 </error>
7113 </errors>
7114 </function>
7115
7116 </category>
7117
7118 <category id="class" label="Class">
7119 <function id="GetLoadedClasses" jkernel="yes" num="78">
7120 <synopsis>Get Loaded Classes</synopsis>
7121 <description>
7122 Return an array of all classes loaded in the virtual machine.
7123 The number of classes in the array is returned via
7124 <code>class_count_ptr</code>, and the array itself via
7125 <code>classes_ptr</code>.
7126 <p/>
7127 A class or interface creation can be triggered by one of the following:
7128 <ul>
7129 <li>By loading and deriving a class from a <code>class</code> file representation
7130 using a class loader (see <vmspec chapter="5.3"/>).</li>
7131 <li>By invoking <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte%5B%5D,boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>
7132 that creates a hidden class or interface from a <code>class</code> file representation.</li>
7133 <li>By invoking methods in certain Java SE Platform APIs such as reflection.</li>
7134 </ul>
7135 <p/>
7136 An array class is created directly by the Java virtual machine. The creation
7137 can be triggered by using class loaders or by invoking methods in certain
7138 Java SE Platform APIs such as reflection.
7139 <p/>
7140 The returned list includes all classes and interfaces, including
7141 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">
7142 hidden classes or interfaces</externallink>,
7143 and also array classes of all types
7144 (including arrays of primitive types).
7145 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>) are
7146 <i>not</i> included in the returned list.
7147 </description>
7148 <origin>jvmdi</origin>
7149 <capabilities>
7150 </capabilities>
7151 <parameters>
7152 <param id="class_count_ptr">
7153 <outptr><jint/></outptr>
7154 <description>
7155 On return, points to the number of classes.
7156 </description>
7157 </param>
7158 <param id="classes_ptr">
7159 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
7160 <description>
7161 On return, points to an array of references, one
7162 for each class.
7163 </description>
7164 </param>
7165 </parameters>
7166 <errors>
7167 </errors>
7168 </function>
7169
7170 <function id="GetClassLoaderClasses" jkernel="yes" num="79">
7171 <synopsis>Get Classloader Classes</synopsis>
7172 <description>
7173 Returns an array of all classes which this class loader
7174 can find by name via
7175 <externallink id="../api/java.base/java/lang/ClassLoader.html#loadClass(java.lang.String,boolean)">ClassLoader::loadClass</externallink>,
7176 <externallink id="../api/java.base/java/lang/Class.html#forName(java.lang.String,boolean,java.lang.ClassLoader)">Class::forName</externallink> and bytecode linkage.
7177 That is, all classes for which <code>initiating_loader</code>
7178 has been recorded as an initiating loader.
7179 Each class in the returned array was created by this class loader,
7180 either by defining it directly or by delegation to another class loader.
7181 See <vmspec chapter="5.3"/>.
7182 <p/>
7183 The returned list does not include
7184 <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden
7185 classes or interfaces</externallink> or array classes whose
7186 element type is a hidden class or interface as they cannot be discovered
7187 by any class loader.
7188 <p/>
7189 The number of classes in the array is returned via
7190 <code>class_count_ptr</code>, and the array itself via
7191 <code>classes_ptr</code>.
7192 <p/>
7193 See <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte%5B%5D,boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>.
7194 </description>
7195 <origin>jvmdi</origin>
7196 <capabilities>
7197 </capabilities>
7198 <parameters>
7199 <param id="initiating_loader">
7200 <ptrtype>
7201 <jobject/>
7202 <nullok>the classes initiated by the bootstrap loader will be returned</nullok>
7203 </ptrtype>
7204 <description>
7205 An initiating class loader.
7206 </description>
7207 </param>
7208 <param id="class_count_ptr">
7209 <outptr><jint/></outptr>
7210 <description>
7211 On return, points to the number of classes.
7212 </description>
7213 </param>
7214 <param id="classes_ptr">
7215 <allocbuf outcount="class_count_ptr"><jclass/></allocbuf>
7216 <description>
7217 On return, points to an array of references, one
7218 for each class.
7219 </description>
7220 </param>
7221 </parameters>
7222 <errors>
7223 </errors>
7224 </function>
7225
7226 <function id="GetClassSignature" phase="start" num="48">
7227 <synopsis>Get Class Signature</synopsis>
7228 <description>
7229 Return the name and the generic signature of the class indicated by <code>klass</code>.
7230 <p/>
7231 If the class is a class or interface, then:
7232 <ul>
7233 <li>If the class or interface is not <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
7234 then the returned name is the <externallink id="jni/types.html#type-signatures">
7235 JNI type signature</externallink>.
7236 For example, java.util.List is "Ljava/util/List;"
7237 </li>
7238 <li>If the class or interface is <externallink id="../api/java.base/java/lang/Class.html#isHidden()">hidden</externallink>,
7239 then the returned name is a string of the form:
7240 <code>"L" + N + "." + S + ";"</code>
7241 where <code>N</code> is the binary name encoded in internal form (JVMS 4.2.1)
7242 indicated by the <code>class</code> file passed to
7243 <externallink id="../api/java.base/java/lang/invoke/MethodHandles.Lookup.html#defineHiddenClass(byte%5B%5D,boolean,java.lang.invoke.MethodHandles.Lookup.ClassOption...)">Lookup::defineHiddenClass</externallink>,
7244 and <code>S</code> is an unqualified name.
7245 The returned name is not a type descriptor and does not conform to JVMS 4.3.2.
7246 For example, com.foo.Foo/AnySuffix is "Lcom/foo/Foo.AnySuffix;"
7247 </li>
7248 </ul>
7249 <p/>
7250 If the class indicated by <code>klass</code> represents an array class, then
7251 the returned name is a string consisting of one or more "<code>[</code>" characters
7252 representing the depth of the array nesting, followed by the class signature
7253 of the element type. For example the class signature of java.lang.String[] is
7254 "[Ljava/lang/String;" and that of int[] is "[I".
7255 <p/>
7256 If the class indicated by <code>klass</code> represents primitive type or <code>void</code>,
7257 then the returned name is the <externallink id="jni/types.html#type-signatures">
7258 type signature character of the corresponding primitive type</externallink>.
7259 For example, java.lang.Integer.TYPE is "I".
7260 </description>
7261 <origin>jvmdiClone</origin>
7262 <capabilities>
7263 </capabilities>
7264 <parameters>
7265 <param id="klass">
7266 <jclass/>
7267 <description>
7268 The class to query.
7269 </description>
7270 </param>
7271 <param id="signature_ptr">
7272 <allocbuf>
7273 <char/>
7274 <nullok>the signature is not returned</nullok>
7275 </allocbuf>
7276 <description>
7277 On return, points to the JNI type signature of the class, encoded as a
7278 <internallink id="mUTF">modified UTF-8</internallink> string.
7279 </description>
7280 </param>
7281 <param id="generic_ptr">
7282 <allocbuf>
7283 <char/>
7284 <nullok>the generic signature is not returned</nullok>
7285 </allocbuf>
7286 <description>
7287 On return, points to the generic signature of the class, encoded as a
7288 <internallink id="mUTF">modified UTF-8</internallink> string.
7289 If there is no generic signature attribute for the class, then,
7290 on return, points to null.
7291 </description>
7292 </param>
7293 </parameters>
7294 <errors>
7295 </errors>
7296 </function>
7297
7298 <function id="GetClassStatus" phase="start" num="49">
7299 <synopsis>Get Class Status</synopsis>
7300 <description>
7301 Get the status of the class. Zero or more of the following bits can be
7302 set.
7303 <constants id="jvmtiClassStatus" label="Class Status Flags" kind="bits">
7304 <constant id="JVMTI_CLASS_STATUS_VERIFIED" num="1">
7305 Class bytecodes have been verified
7306 </constant>
7307 <constant id="JVMTI_CLASS_STATUS_PREPARED" num="2">
7308 Class preparation is complete
7309 </constant>
7310 <constant id="JVMTI_CLASS_STATUS_INITIALIZED" num="4">
7311 Class initialization is complete. Static initializer has been run.
7312 </constant>
7313 <constant id="JVMTI_CLASS_STATUS_ERROR" num="8">
7314 Error during initialization makes class unusable
7315 </constant>
7316 <constant id="JVMTI_CLASS_STATUS_ARRAY" num="16">
7317 Class is an array. If set, all other bits are zero.
7318 </constant>
7319 <constant id="JVMTI_CLASS_STATUS_PRIMITIVE" num="32">
7320 Class is a primitive class (for example, <code>java.lang.Integer.TYPE</code>).
7321 If set, all other bits are zero.
7322 </constant>
7323 </constants>
7324 </description>
7325 <origin>jvmdi</origin>
7326 <capabilities>
7327 </capabilities>
7328 <parameters>
7329 <param id="klass">
7330 <jclass/>
7331 <description>
7332 The class to query.
7333 </description>
7334 </param>
7335 <param id="status_ptr">
7336 <outptr><jint/></outptr>
7337 <description>
7338 On return, points to the current state of this class as one or
7339 more of the <internallink id="jvmtiClassStatus">class status flags</internallink>.
7340 </description>
7341 </param>
7342 </parameters>
7343 <errors>
7344 </errors>
7345 </function>
7346
7347 <function id="GetSourceFileName" phase="start" num="50">
7348 <synopsis>Get Source File Name</synopsis>
7349 <description>
7350 For the class indicated by <code>klass</code>, return the source file
7351 name via <code>source_name_ptr</code>. The returned string
7352 is a file name only and never contains a directory name.
7353 <p/>
7354 For primitive classes (for example, <code>java.lang.Integer.TYPE</code>)
7355 and for arrays this function returns
7356 <errorlink id="JVMTI_ERROR_ABSENT_INFORMATION"></errorlink>.
7357 </description>
7358 <origin>jvmdi</origin>
7359 <capabilities>
7360 <required id="can_get_source_file_name"></required>
7361 </capabilities>
7362 <parameters>
7363 <param id="klass">
7364 <jclass/>
7365 <description>
7366 The class to query.
7367 </description>
7368 </param>
7369 <param id="source_name_ptr">
7370 <allocbuf><char/></allocbuf>
7371 <description>
7372 On return, points to the class's source file name, encoded as a
7373 <internallink id="mUTF">modified UTF-8</internallink> string.
7374 </description>
7375 </param>
7376 </parameters>
7377 <errors>
7378 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7379 Class information does not include a source file name. This includes
7380 cases where the class is an array class or primitive class.
7381 </error>
7382 </errors>
7383 </function>
7384
7385 <function id="GetClassModifiers" phase="start" num="51">
7386 <synopsis>Get Class Modifiers</synopsis>
7387 <description>
7388 For the class indicated by <code>klass</code>, return the Java language
7389 modifiers and class/interface properties of the corresponding
7390 <code>java.lang.Class</code> object, via <code>modifiers_ptr</code>.
7391 <p/>
7392 The modifiers are encoded as a mask of access-flag bit values defined in
7393 <vmspec chapter="4"/>. The returned value is not necessarily the value of the
7394 access_flags item in the class file of <code>klass</code>.
7395 In particular, for member, local, or anonymous classes and interfaces, the result
7396 may include modifiers represented by access flags from the <code>InnerClasses</code>
7397 attribute, such as <code>ACC_STATIC</code>.
7398 <p/>
7399 The modifiers include, as applicable, the Java Virtual Machine constants for
7400 public, private, protected, final, static, abstract, and interface, as well as
7401 access-flag bit values for other class/interface properties encoded in the
7402 result of invoking <code>java.lang.Class.getModifiers()</code> on the
7403 corresponding <code>java.lang.Class</code> object.
7404 <p/>
7405 If <code>klass</code> is an array class, then its public, private, and
7406 protected modifiers are the same as those of its component type. For arrays of
7407 primitives, this component type is represented by one of the primitive
7408 classes, such as <code>java.lang.Integer.TYPE</code>. For array classes, the
7409 abstract and final modifiers are set, and the interface modifier is not set.
7410 <p/>
7411 If <code>klass</code> is a primitive type or void, then its public, abstract,
7412 and final modifiers are always set, and its protected, private, and interface
7413 modifiers are never set.
7414 <p/>
7415 When preview features are enabled, the <code>ACC_IDENTITY</code> access flag
7416 is set if and only if <code>klass</code> is an identity class or an array class.
7417 <p/>
7418 When preview features are disabled, the <code>ACC_SUPER</code> access flag may be
7419 set only if <code>klass</code> is not a primitive type or void. The flag has no
7420 effective meaning.
7421 </description>
7422 <origin>jvmdi</origin>
7423 <capabilities>
7424 </capabilities>
7425 <parameters>
7426 <param id="klass">
7427 <jclass/>
7428 <description>
7429 The class to query.
7430 </description>
7431 </param>
7432 <param id="modifiers_ptr">
7433 <outptr><jint/></outptr>
7434 <description>
7435 On return, points to the modifiers of this class.
7436
7437 </description>
7438 </param>
7439 </parameters>
7440 <errors>
7441 </errors>
7442 </function>
7443
7444 <function id="GetClassMethods" phase="start" num="52">
7445 <synopsis>Get Class Methods</synopsis>
7446 <description>
7447 For the class indicated by <code>klass</code>, return a count of
7448 methods via <code>method_count_ptr</code> and a list of
7449 method IDs via <code>methods_ptr</code>. The method list contains
7450 constructors and static initializers as well as true methods.
7451 Only directly declared methods are returned (not inherited methods).
7452 An empty method list is returned for array classes and primitive classes
7453 (for example, <code>java.lang.Integer.TYPE</code>).
7454 </description>
7455 <origin>jvmdi</origin>
7456 <capabilities>
7457 <capability id="can_maintain_original_method_order"/>
7458 </capabilities>
7459 <parameters>
7460 <param id="klass">
7461 <jclass/>
7462 <description>
7463 The class to query.
7464 </description>
7465 </param>
7466 <param id="method_count_ptr">
7467 <outptr><jint/></outptr>
7468 <description>
7469 On return, points to the number of methods declared in this class.
7470 </description>
7471 </param>
7472 <param id="methods_ptr">
7473 <allocbuf outcount="method_count_ptr"><jmethodID class="klass"/></allocbuf>
7474 <description>
7475 On return, points to the method ID array.
7476 </description>
7477 </param>
7478 </parameters>
7479 <errors>
7480 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7481 <paramlink id="klass"></paramlink> is not prepared.
7482 </error>
7483 </errors>
7484 </function>
7485
7486 <function id="GetClassFields" phase="start" num="53">
7487 <synopsis>Get Class Fields</synopsis>
7488 <description>
7489 For the class indicated by <code>klass</code>, return a count of fields
7490 via <code>field_count_ptr</code> and a list of field IDs via
7491 <code>fields_ptr</code>.
7492 Only directly declared fields are returned (not inherited fields).
7493 Fields are returned in the order they occur in the class file.
7494 An empty field list is returned for array classes and primitive classes
7495 (for example, <code>java.lang.Integer.TYPE</code>).
7496 Use JNI to determine the length of an array.
7497 </description>
7498 <origin>jvmdi</origin>
7499 <capabilities>
7500 </capabilities>
7501 <parameters>
7502 <param id="klass">
7503 <jclass/>
7504 <description>
7505 The class to query.
7506 </description>
7507 </param>
7508 <param id="field_count_ptr">
7509 <outptr><jint/></outptr>
7510 <description>
7511 On return, points to the number of fields declared in this class.
7512 </description>
7513 </param>
7514 <param id="fields_ptr">
7515 <allocbuf outcount="field_count_ptr"><jfieldID/></allocbuf>
7516 <description>
7517 On return, points to the field ID array.
7518 </description>
7519 </param>
7520 </parameters>
7521 <errors>
7522 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7523 <paramlink id="klass"></paramlink> is not prepared.
7524 </error>
7525 </errors>
7526 </function>
7527
7528 <function id="GetImplementedInterfaces" phase="start" num="54">
7529 <synopsis>Get Implemented Interfaces</synopsis>
7530 <description>
7531 Return the direct super-interfaces of this class. For a class, this
7532 function returns the interfaces declared in its <code>implements</code>
7533 clause. For an interface, this function returns the interfaces declared in
7534 its <code>extends</code> clause.
7535 An empty interface list is returned for array classes and primitive classes
7536 (for example, <code>java.lang.Integer.TYPE</code>).
7537 </description>
7538 <origin>jvmdi</origin>
7539 <capabilities>
7540 </capabilities>
7541 <parameters>
7542 <param id="klass">
7543 <jclass/>
7544 <description>
7545 The class to query.
7546 </description>
7547 </param>
7548 <param id="interface_count_ptr">
7549 <outptr><jint/></outptr>
7550 <description>
7551 On return, points to the number of interfaces.
7552 </description>
7553 </param>
7554 <param id="interfaces_ptr">
7555 <allocbuf outcount="interface_count_ptr"><jclass/></allocbuf>
7556 <description>
7557 On return, points to the interface array.
7558 </description>
7559 </param>
7560 </parameters>
7561 <errors>
7562 <error id="JVMTI_ERROR_CLASS_NOT_PREPARED">
7563 <paramlink id="klass"></paramlink> is not prepared.
7564 </error>
7565 </errors>
7566 </function>
7567
7568 <function id="GetClassVersionNumbers" phase="start" num="145" since="1.1">
7569 <synopsis>Get Class Version Numbers</synopsis>
7570 <description>
7571 For the class indicated by <code>klass</code>,
7572 return the minor and major version numbers,
7573 as defined in
7574 <vmspec chapter="4"/>.
7575 </description>
7576 <origin>new</origin>
7577 <capabilities>
7578 </capabilities>
7579 <parameters>
7580 <param id="klass">
7581 <jclass/>
7582 <description>
7583 The class to query.
7584 </description>
7585 </param>
7586 <param id="minor_version_ptr">
7587 <outptr><jint/></outptr>
7588 <description>
7589 On return, points to the value of the
7590 <code>minor_version</code> item of the
7591 Class File Format.
7592 Note: to be consistent with the Class File Format,
7593 the minor version number is the first parameter.
7594 </description>
7595 </param>
7596 <param id="major_version_ptr">
7597 <outptr><jint/></outptr>
7598 <description>
7599 On return, points to the value of the
7600 <code>major_version</code> item of the
7601 Class File Format.
7602 </description>
7603 </param>
7604 </parameters>
7605 <errors>
7606 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7607 The class is a primitive or array class.
7608 </error>
7609 </errors>
7610 </function>
7611
7612 <function id="GetConstantPool" phase="start" num="146" since="1.1">
7613 <synopsis>Get Constant Pool</synopsis>
7614 <description>
7615 For the class indicated by <code>klass</code>,
7616 return the raw bytes of the constant pool in the format of the
7617 <code>constant_pool</code> item of
7618 <vmspec chapter="4"/>.
7619 The format of the constant pool may differ between versions
7620 of the Class File Format, so, the
7621 <functionlink id="GetClassVersionNumbers">minor and major
7622 class version numbers</functionlink> should be checked for
7623 compatibility.
7624 <p/>
7625 The returned constant pool might not have the same layout or
7626 contents as the constant pool in the defining class file.
7627 The constant pool returned by GetConstantPool() may have
7628 more or fewer entries than the defining constant pool.
7629 Entries may be in a different order.
7630 The constant pool returned by GetConstantPool() will match the
7631 constant pool used by
7632 <functionlink id="GetBytecodes">GetBytecodes()</functionlink>.
7633 That is, the bytecodes returned by GetBytecodes() will have
7634 constant pool indices which refer to constant pool entries returned
7635 by GetConstantPool().
7636 Note that since <functionlink id="RetransformClasses"/>
7637 and <functionlink id="RedefineClasses"/> can change
7638 the constant pool, the constant pool returned by this function
7639 can change accordingly. Thus, the correspondence between
7640 GetConstantPool() and GetBytecodes() does not hold if there
7641 is an intervening class retransformation or redefinition.
7642 The value of a constant pool entry used by a given bytecode will
7643 match that of the defining class file (even if the indices don't match).
7644 Constant pool entries which are not used directly or indirectly by
7645 bytecodes (for example, UTF-8 strings associated with annotations) are
7646 not required to exist in the returned constant pool.
7647 </description>
7648 <origin>new</origin>
7649 <capabilities>
7650 <required id="can_get_constant_pool"></required>
7651 </capabilities>
7652 <parameters>
7653 <param id="klass">
7654 <jclass/>
7655 <description>
7656 The class to query.
7657 </description>
7658 </param>
7659 <param id="constant_pool_count_ptr">
7660 <outptr><jint/></outptr>
7661 <description>
7662 On return, points to the number of entries
7663 in the constant pool table plus one.
7664 This corresponds to the <code>constant_pool_count</code>
7665 item of the Class File Format.
7666 </description>
7667 </param>
7668 <param id="constant_pool_byte_count_ptr">
7669 <outptr><jint/></outptr>
7670 <description>
7671 On return, points to the number of bytes
7672 in the returned raw constant pool.
7673 </description>
7674 </param>
7675 <param id="constant_pool_bytes_ptr">
7676 <allocbuf outcount="constant_pool_byte_count_ptr"><uchar/></allocbuf>
7677 <description>
7678 On return, points to the raw constant pool, that is the bytes
7679 defined by the <code>constant_pool</code> item of the
7680 Class File Format
7681 </description>
7682 </param>
7683 </parameters>
7684 <errors>
7685 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7686 The class is a primitive or array class.
7687 </error>
7688 </errors>
7689 </function>
7690
7691 <function id="IsInterface" phase="start" num="55">
7692 <synopsis>Is Interface</synopsis>
7693 <description>
7694 Determines whether a class object reference represents an interface.
7695 The <code>jboolean</code> result is
7696 <code>JNI_TRUE</code> if the "class" is actually an interface,
7697 <code>JNI_FALSE</code> otherwise.
7698 </description>
7699 <origin>jvmdi</origin>
7700 <capabilities>
7701 </capabilities>
7702 <parameters>
7703 <param id="klass">
7704 <jclass/>
7705 <description>
7706 The class to query.
7707 </description>
7708 </param>
7709 <param id="is_interface_ptr">
7710 <outptr><jboolean/></outptr>
7711 <description>
7712 On return, points to the boolean result of this function.
7713
7714 </description>
7715 </param>
7716 </parameters>
7717 <errors>
7718 </errors>
7719 </function>
7720
7721 <function id="IsArrayClass" phase="start" num="56">
7722 <synopsis>Is Array Class</synopsis>
7723 <description>
7724 Determines whether a class object reference represents an array.
7725 The <code>jboolean</code> result is
7726 <code>JNI_TRUE</code> if the class is an array,
7727 <code>JNI_FALSE</code> otherwise.
7728 </description>
7729 <origin>jvmdi</origin>
7730 <capabilities>
7731 </capabilities>
7732 <parameters>
7733 <param id="klass">
7734 <jclass/>
7735 <description>
7736 The class to query.
7737 </description>
7738 </param>
7739 <param id="is_array_class_ptr">
7740 <outptr><jboolean/></outptr>
7741 <description>
7742 On return, points to the boolean result of this function.
7743
7744 </description>
7745 </param>
7746 </parameters>
7747 <errors>
7748 </errors>
7749 </function>
7750
7751 <function id="IsModifiableClass" jkernel="yes" phase="start" num="45" since="1.1">
7752 <synopsis>Is Modifiable Class</synopsis>
7753 <description>
7754 Determines whether a class is modifiable.
7755 If a class is modifiable (<paramlink id="is_modifiable_class_ptr"/>
7756 returns <code>JNI_TRUE</code>) the class can be
7757 redefined with <functionlink id="RedefineClasses"/> (assuming
7758 the agent possesses the
7759 <fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
7760 capability) or
7761 retransformed with <functionlink id="RetransformClasses"/> (assuming
7762 the agent possesses the
7763 <fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
7764 capability).
7765 If a class is not modifiable (<paramlink id="is_modifiable_class_ptr"/>
7766 returns <code>JNI_FALSE</code>) the class can be neither
7767 redefined nor retransformed.
7768 <p/>
7769 Primitive classes (for example, <code>java.lang.Integer.TYPE</code>),
7770 array classes, and some implementation defined classes are never modifiable.
7771 <p/>
7772 </description>
7773 <origin>new</origin>
7774 <capabilities>
7775 <capability id="can_redefine_any_class">
7776 If possessed then all classes (except primitive, array, and some implementation defined
7777 classes) are modifiable with <functionlink id="RedefineClasses"/>.
7778 </capability>
7779 <capability id="can_retransform_any_class">
7780 If possessed then all classes (except primitive, array, and some implementation defined
7781 classes) are modifiable with <functionlink id="RetransformClasses"/>.
7782 </capability>
7783 <capability id="can_redefine_classes">
7784 No effect on the result of the function.
7785 But must additionally be possessed to modify the class with
7786 <functionlink id="RedefineClasses"/>.
7787 </capability>
7788 <capability id="can_retransform_classes">
7789 No effect on the result of the function.
7790 But must additionally be possessed to modify the class with
7791 <functionlink id="RetransformClasses"/>.
7792 </capability>
7793 </capabilities>
7794 <parameters>
7795 <param id="klass">
7796 <jclass/>
7797 <description>
7798 The class to query.
7799 </description>
7800 </param>
7801 <param id="is_modifiable_class_ptr">
7802 <outptr><jboolean/></outptr>
7803 <description>
7804 On return, points to the boolean result of this function.
7805 </description>
7806 </param>
7807 </parameters>
7808 <errors>
7809 </errors>
7810 </function>
7811
7812 <function id="GetClassLoader" phase="start" num="57">
7813 <synopsis>Get Class Loader</synopsis>
7814 <description>
7815 For the class indicated by <code>klass</code>, return via
7816 <code>classloader_ptr</code> a reference to the class loader for the
7817 class.
7818 </description>
7819 <origin>jvmdi</origin>
7820 <capabilities>
7821 </capabilities>
7822 <parameters>
7823 <param id="klass">
7824 <jclass/>
7825 <description>
7826 The class to query.
7827 </description>
7828 </param>
7829 <param id="classloader_ptr">
7830 <outptr><jobject/></outptr>
7831 <description>
7832 On return, points to the class loader that loaded
7833 this class.
7834 If the class was not created by a class loader
7835 or if the class loader is the bootstrap class loader,
7836 points to null.
7837 </description>
7838 </param>
7839 </parameters>
7840 <errors>
7841 </errors>
7842
7843 </function>
7844
7845 <function id="GetSourceDebugExtension" phase="start" num="90">
7846 <synopsis>Get Source Debug Extension</synopsis>
7847 <description>
7848 For the class indicated by <code>klass</code>, return the debug
7849 extension via <code>source_debug_extension_ptr</code>.
7850 The returned string
7851 contains exactly the debug extension information present in the
7852 class file of <code>klass</code>.
7853 </description>
7854 <origin>jvmdi</origin>
7855 <capabilities>
7856 <required id="can_get_source_debug_extension"></required>
7857 </capabilities>
7858 <parameters>
7859 <param id="klass">
7860 <jclass/>
7861 <description>
7862 The class to query.
7863 </description>
7864 </param>
7865 <param id="source_debug_extension_ptr">
7866 <allocbuf><char/></allocbuf>
7867 <description>
7868 On return, points to the class's debug extension, encoded as a
7869 <internallink id="mUTF">modified UTF-8</internallink> string.
7870 </description>
7871 </param>
7872 </parameters>
7873 <errors>
7874 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
7875 Class information does not include a debug extension.
7876 </error>
7877 </errors>
7878 </function>
7879
7880 <function id="RetransformClasses" jkernel="yes" num="152" since="1.1">
7881 <synopsis>Retransform Classes</synopsis>
7882 <description>
7883 This function facilitates the
7884 <internallink id="bci">bytecode instrumentation</internallink>
7885 of already loaded classes.
7886 To replace the class definition without reference to the existing
7887 bytecodes, as one might do when recompiling from source for
7888 fix-and-continue debugging, <functionlink id="RedefineClasses"/>
7889 function should be used instead.
7890 <p/>
7891 When classes are initially loaded or when they are
7892 <functionlink id="RedefineClasses">redefined</functionlink>,
7893 the initial class file bytes can be transformed with the
7894 <eventlink id="ClassFileLoadHook"/> event.
7895 This function reruns the transformation process
7896 (whether or not a transformation has previously occurred).
7897 This retransformation follows these steps:
7898 <ul>
7899 <li>starting from the initial class file bytes
7900 </li>
7901 <li>for each <fieldlink id="can_retransform_classes"
7902 struct="jvmtiCapabilities">retransformation
7903 incapable</fieldlink>
7904 agent which received a
7905 <code>ClassFileLoadHook</code> event during the previous
7906 load or redefine, the bytes it returned
7907 (via the <code>new_class_data</code> parameter)
7908 are reused as the output of the transformation;
7909 note that this is equivalent to reapplying
7910 the previous transformation, unaltered. except that
7911 the <code>ClassFileLoadHook</code> event
7912 is <b>not</b> sent to these agents
7913 </li>
7914 <li>for each <fieldlink id="can_retransform_classes"
7915 struct="jvmtiCapabilities">retransformation
7916 capable</fieldlink>
7917 agent, the <code>ClassFileLoadHook</code> event is sent,
7918 allowing a new transformation to be applied
7919 </li>
7920 <li>the transformed class file bytes are installed as the new
7921 definition of the class
7922 </li>
7923 </ul>
7924 See the <eventlink id="ClassFileLoadHook"/> event for more details.
7925 <p/>
7926 The initial class file bytes represent the bytes passed to
7927 <code>ClassLoader.defineClass</code>
7928 or <code>RedefineClasses</code> (before any transformations
7929 were applied), however they may not exactly match them.
7930 The constant pool may differ in ways described in
7931 <functionlink id="GetConstantPool"/>.
7932 Constant pool indices in the bytecodes of methods will correspond.
7933 Some attributes may not be present.
7934 Where order is not meaningful, for example the order of methods,
7935 order may not be preserved.
7936 <p/>
7937 Retransformation can cause new versions of methods to be installed.
7938 Old method versions may become
7939 <internallink id="obsoleteMethods">obsolete</internallink>
7940 The new method version will be used on new invokes.
7941 If a method has active stack frames, those active frames continue to
7942 run the bytecodes of the original method version.
7943 <p/>
7944 This function does not cause any initialization except that which
7945 would occur under the customary JVM semantics.
7946 In other words, retransforming a class does not cause its initializers to be
7947 run. The values of static fields will remain as they were
7948 prior to the call.
7949 <p/>
7950 Threads need not be suspended.
7951 <p/>
7952 All breakpoints in the class are cleared.
7953 <p/>
7954 All attributes are updated.
7955 <p/>
7956 Instances of the retransformed class are not affected -- fields retain their
7957 previous values.
7958 <functionlink id="GetTag">Tags</functionlink> on the instances are
7959 also unaffected.
7960 <p/>
7961 In response to this call, no events other than the
7962 <eventlink id="ClassFileLoadHook"/> event
7963 will be sent.
7964 <p/>
7965 The retransformation may change method bodies, the constant pool and attributes
7966 (unless explicitly prohibited).
7967 The retransformation must not add, remove or rename fields or methods, change the
7968 signatures of methods, change modifiers, or change inheritance.
7969 The retransformation must not change the <code>NestHost</code>,
7970 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
7971 attributes.
7972 These restrictions may be lifted in future versions.
7973 See the error return description below for information on error codes
7974 returned if an unsupported retransformation is attempted.
7975 The class file bytes are not verified or installed until they have passed
7976 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
7977 returned error code reflects the result of the transformations.
7978 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
7979 none of the classes to be retransformed will have a new definition installed.
7980 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
7981 all of the classes to be retransformed will have their new definitions installed.
7982 </description>
7983 <origin>new</origin>
7984 <capabilities>
7985 <required id="can_retransform_classes"></required>
7986 <capability id="can_retransform_any_class"></capability>
7987 </capabilities>
7988 <parameters>
7989 <param id="class_count">
7990 <jint min="0"/>
7991 <description>
7992 The number of classes to be retransformed.
7993 </description>
7994 </param>
7995 <param id="classes">
7996 <inbuf incount="class_count"><jclass/></inbuf>
7997 <description>
7998 The array of classes to be retransformed.
7999 </description>
8000 </param>
8001 </parameters>
8002 <errors>
8003 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
8004 One of the <paramlink id="classes"/> cannot be modified.
8005 See <functionlink id="IsModifiableClass"/>.
8006 </error>
8007 <error id="JVMTI_ERROR_INVALID_CLASS">
8008 One of the <paramlink id="classes"/> is not a valid class.
8009 </error>
8010 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
8011 A retransformed class file has a version number not supported by this VM.
8012 </error>
8013 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
8014 A retransformed class file is malformed (The VM would return a <code>ClassFormatError</code>).
8015 </error>
8016 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
8017 The retransformed class file definitions would lead to a circular definition
8018 (the VM would return a <code>ClassCircularityError</code>).
8019 </error>
8020 <error id="JVMTI_ERROR_FAILS_VERIFICATION">
8021 The retransformed class file bytes fail verification.
8022 </error>
8023 <error id="JVMTI_ERROR_NAMES_DONT_MATCH">
8024 The class name defined in a retransformed class file is
8025 different from the name in the old class object.
8026 </error>
8027 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
8028 A retransformed class file would require adding a method.
8029 </error>
8030 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
8031 A retransformed class file changes a field.
8032 </error>
8033 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
8034 A direct superclass is different for a retransformed class file,
8035 or the set of directly implemented
8036 interfaces is different.
8037 </error>
8038 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
8039 A retransformed class file does not declare a method
8040 declared in the old class version.
8041 </error>
8042 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
8043 A retransformed class file has unsupported differences in class attributes.
8044 </error>
8045 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
8046 A retransformed class file has different class modifiers.
8047 </error>
8048 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
8049 A method in the retransformed class file has different modifiers
8050 than its counterpart in the old class version.
8051 </error>
8052 </errors>
8053 </function>
8054
8055 <function id="RedefineClasses" jkernel="yes" num="87">
8056 <synopsis>Redefine Classes</synopsis>
8057 <typedef id="jvmtiClassDefinition" label="Class redefinition description">
8058 <field id="klass">
8059 <jclass/>
8060 <description>
8061 Class object for this class
8062 </description>
8063 </field>
8064 <field id="class_byte_count">
8065 <jint/>
8066 <description>
8067 Number of bytes defining class (below)
8068 </description>
8069 </field>
8070 <field id="class_bytes">
8071 <inbuf incount="class_byte_count"><uchar/></inbuf>
8072 <description>
8073 Bytes defining class (in <vmspec chapter="4"/>)
8074 </description>
8075 </field>
8076 </typedef>
8077 <description>
8078 All classes given are redefined according to the definitions
8079 supplied.
8080 This function is used to replace the definition of a class
8081 with a new definition, as might be needed in fix-and-continue
8082 debugging.
8083 Where the existing class file bytes are to be transformed, for
8084 example in
8085 <internallink id="bci">bytecode instrumentation</internallink>,
8086 <functionlink id="RetransformClasses"/> should be used.
8087 <p/>
8088 Redefinition can cause new versions of methods to be installed.
8089 Old method versions may become
8090 <internallink id="obsoleteMethods">obsolete</internallink>
8091 The new method version will be used on new invokes.
8092 If a method has active stack frames, those active frames continue to
8093 run the bytecodes of the original method version.
8094 If resetting of stack frames is desired, use
8095 <functionlink id="PopFrame"></functionlink>
8096 to pop frames with obsolete method versions.
8097 <p/>
8098 This function does not cause any initialization except that which
8099 would occur under the customary JVM semantics.
8100 In other words, redefining a class does not cause its initializers to be
8101 run. The values of static fields will remain as they were
8102 prior to the call.
8103 <p/>
8104 Threads need not be suspended.
8105 <p/>
8106 All breakpoints in the class are cleared.
8107 <p/>
8108 All attributes are updated.
8109 <p/>
8110 Instances of the redefined class are not affected -- fields retain their
8111 previous values.
8112 <functionlink id="GetTag">Tags</functionlink> on the instances are
8113 also unaffected.
8114 <p/>
8115 In response to this call, the <jvmti/> event
8116 <eventlink id="ClassFileLoadHook">Class File Load Hook</eventlink>
8117 will be sent (if enabled), but no other <jvmti/> events will be sent.
8118 <p/>
8119 The redefinition may change method bodies, the constant pool and attributes
8120 (unless explicitly prohibited).
8121 The redefinition must not add, remove or rename fields or methods, change the
8122 signatures of methods, change modifiers, or change inheritance.
8123 The redefinition must not change the <code>NestHost</code>,
8124 <code>NestMembers</code>, <code>Record</code>, or <code>PermittedSubclasses</code>
8125 attributes.
8126 These restrictions may be lifted in future versions.
8127 See the error return description below for information on error codes
8128 returned if an unsupported redefinition is attempted.
8129 The class file bytes are not verified or installed until they have passed
8130 through the chain of <eventlink id="ClassFileLoadHook"/> events, thus the
8131 returned error code reflects the result of the transformations applied
8132 to the bytes passed into <paramlink id="class_definitions"/>.
8133 If any error code is returned other than <code>JVMTI_ERROR_NONE</code>,
8134 none of the classes to be redefined will have a new definition installed.
8135 When this function returns (with the error code of <code>JVMTI_ERROR_NONE</code>)
8136 all of the classes to be redefined will have their new definitions installed.
8137 </description>
8138 <origin>jvmdi</origin>
8139 <capabilities>
8140 <required id="can_redefine_classes"></required>
8141 <capability id="can_redefine_any_class"></capability>
8142 </capabilities>
8143 <parameters>
8144 <param id="class_count">
8145 <jint min="0"/>
8146 <description>
8147 The number of classes specified in <code>class_definitions</code>
8148 </description>
8149 </param>
8150 <param id="class_definitions">
8151 <inbuf incount="class_count"><struct>jvmtiClassDefinition</struct></inbuf>
8152 <description>
8153 The array of new class definitions
8154 </description>
8155 </param>
8156 </parameters>
8157 <errors>
8158 <error id="JVMTI_ERROR_NULL_POINTER">
8159 One of <code>class_bytes</code> is null.
8160 </error>
8161 <error id="JVMTI_ERROR_UNMODIFIABLE_CLASS">
8162 An element of <code>class_definitions</code> cannot be modified.
8163 See <functionlink id="IsModifiableClass"/>.
8164 </error>
8165 <error id="JVMTI_ERROR_INVALID_CLASS">
8166 An element of <code>class_definitions</code> is not a valid class.
8167 </error>
8168 <error id="JVMTI_ERROR_UNSUPPORTED_VERSION">
8169 A new class file has a version number not supported by this VM.
8170 </error>
8171 <error id="JVMTI_ERROR_INVALID_CLASS_FORMAT">
8172 A new class file is malformed (The VM would return a <code>ClassFormatError</code>).
8173 </error>
8174 <error id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION">
8175 The new class file definitions would lead to a circular definition
8176 (the VM would return a <code>ClassCircularityError</code>).
8177 </error>
8178 <error id="JVMTI_ERROR_FAILS_VERIFICATION">
8179 The class bytes fail verification.
8180 </error>
8181 <error id="JVMTI_ERROR_NAMES_DONT_MATCH">
8182 The class name defined in a new class file is
8183 different from the name in the old class object.
8184 </error>
8185 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED">
8186 A new class file would require adding a method.
8187 </error>
8188 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED">
8189 A new class version changes a field.
8190 </error>
8191 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED">
8192 A direct superclass is different for a new class
8193 version, or the set of directly implemented
8194 interfaces is different.
8195 </error>
8196 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED">
8197 A new class version does not declare a method
8198 declared in the old class version.
8199 </error>
8200 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED">
8201 A new class version has unsupported differences in class attributes.
8202 </error>
8203 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED">
8204 A new class version has different modifiers.
8205 </error>
8206 <error id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED">
8207 A method in the new class version has different modifiers
8208 than its counterpart in the old class version.
8209 </error>
8210 <error id="JVMTI_ERROR_UNMODIFIABLE_MODULE">
8211 A module cannot be modified.
8212 See <functionlink id="IsModifiableModule"/>.
8213 </error>
8214 </errors>
8215 </function>
8216
8217 </category>
8218
8219 <category id="object" label="Object">
8220
8221 <function id="GetObjectSize" jkernel="yes" phase="start" num="154">
8222 <synopsis>Get Object Size</synopsis>
8223 <description>
8224 For the object indicated by <code>object</code>,
8225 return via <code>size_ptr</code> the size of the object.
8226 This size is an implementation-specific approximation of
8227 the amount of storage consumed by this object.
8228 It may include some or all of the object's overhead, and thus
8229 is useful for comparison within an implementation but not
8230 between implementations.
8231 The estimate may change during a single invocation of the JVM.
8232 </description>
8233 <origin>new</origin>
8234 <capabilities>
8235 </capabilities>
8236 <parameters>
8237 <param id="object">
8238 <jobject/>
8239 <description>
8240 The object to query.
8241 </description>
8242 </param>
8243 <param id="size_ptr">
8244 <outptr><jlong/></outptr>
8245 <description>
8246 On return, points to the object's size in bytes.
8247 </description>
8248 </param>
8249 </parameters>
8250 <errors>
8251 </errors>
8252 </function>
8253
8254 <function id="GetObjectHashCode" phase="start" num="58">
8255 <synopsis>Get Object Hash Code</synopsis>
8256 <description>
8257 For the object indicated by <code>object</code>,
8258 return via <code>hash_code_ptr</code> a hash code.
8259 This hash code could be used to maintain a hash table of object references,
8260 however, on some implementations this can cause significant performance
8261 impacts--in most cases
8262 <internallink id="Heap">tags</internallink>
8263 will be a more efficient means of associating information with objects.
8264 This function guarantees
8265 the same hash code value for a particular object throughout its life
8266 </description>
8267 <origin>jvmdi</origin>
8268 <capabilities>
8269 </capabilities>
8270 <parameters>
8271 <param id="object">
8272 <jobject/>
8273 <description>
8274 The object to query.
8275 </description>
8276 </param>
8277 <param id="hash_code_ptr">
8278 <outptr><jint/></outptr>
8279 <description>
8280 On return, points to the object's hash code.
8281 </description>
8282 </param>
8283 </parameters>
8284 <errors>
8285 </errors>
8286 </function>
8287
8288 <function id="GetObjectMonitorUsage" num="59">
8289 <synopsis>Get Object Monitor Usage</synopsis>
8290 <typedef id="jvmtiMonitorUsage" label="Object monitor usage information">
8291 <field id="owner">
8292 <jthread/>
8293 <description>
8294 The platform thread owning this monitor, or null if owned
8295 by a virtual thread or not owned
8296 </description>
8297 </field>
8298 <field id="entry_count">
8299 <jint/>
8300 <description>
8301 The number of times the platform thread owning this monitor has entered it,
8302 or <code>0</code> if owned by a virtual thread or not owned
8303 </description>
8304 </field>
8305 <field id="waiter_count">
8306 <jint/>
8307 <description>
8308 The number of platform threads waiting to own this monitor, or <code>0</code>
8309 if only virtual threads are waiting or no threads are waiting
8310 </description>
8311 </field>
8312 <field id="waiters">
8313 <allocfieldbuf><jthread/></allocfieldbuf>
8314 <description>
8315 The <code>waiter_count</code> waiting platform threads
8316 </description>
8317 </field>
8318 <field id="notify_waiter_count">
8319 <jint/>
8320 <description>
8321 The number of platform threads waiting to own this monitor, or <code>0</code>
8322 if only virtual threads are waiting to be notified or no threads are waiting
8323 to be notified
8324 </description>
8325 </field>
8326 <field id="notify_waiters">
8327 <allocfieldbuf><jthread/></allocfieldbuf>
8328 <description>
8329 The <code>notify_waiter_count</code> platform threads waiting to be notified
8330 </description>
8331 </field>
8332 </typedef>
8333 <description>
8334 Get information about the object's monitor.
8335 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
8336 are filled in with information about usage of the monitor.
8337 <p/>
8338 When preview features are enabled, the object to query may be a value object.
8339 It is not possible to synchronize on a value object, so there is no monitor
8340 usage information to return. The fields of the returned
8341 <functionlink id="jvmtiMonitorUsage"></functionlink> structure will always
8342 be filled in with null values and zeros.
8343 <p/>
8344 <b> This function does not support getting information about an object's monitor
8345 when it is owned by a virtual thread. It also does not support returning a
8346 reference to virtual threads that are waiting to own a monitor or waiting to
8347 be notified.
8348 </b>
8349 <todo>
8350 Decide and then clarify suspend requirements.
8351 </todo>
8352 </description>
8353 <origin>jvmdi</origin>
8354 <capabilities>
8355 <required id="can_get_monitor_info"></required>
8356 </capabilities>
8357 <parameters>
8358 <param id="object">
8359 <jobject/>
8360 <description>
8361 The object to query.
8362 </description>
8363 </param>
8364 <param id="info_ptr">
8365 <outptr><struct>jvmtiMonitorUsage</struct></outptr>
8366 <description>
8367 On return, filled with monitor information for the
8368 specified object.
8369 </description>
8370 </param>
8371 </parameters>
8372 <errors>
8373 </errors>
8374 </function>
8375
8376 <elide>
8377 <function id="GetObjectMonitors" num="116">
8378 <synopsis>Get Object Monitors</synopsis>
8379 <description>
8380 Return the list of object monitors.
8381 <p/>
8382 Note: details about each monitor can be examined with
8383 <functionlink id="GetObjectMonitorUsage"></functionlink>.
8384 </description>
8385 <origin>new</origin>
8386 <capabilities>
8387 <required id="can_get_monitor_info"></required>
8388 </capabilities>
8389 <parameters>
8390 <param id="monitorCnt">
8391 <outptr><jint/></outptr>
8392 <description>
8393 On return, pointer to the number
8394 of monitors returned in <code>monitors_ptr</code>.
8395 </description>
8396 </param>
8397 <param id="monitors_ptr">
8398 <allocbuf outcount="monitorCnt"><jobject/></allocbuf>
8399 <description>
8400 On return, pointer to the monitor list.
8401 </description>
8402 </param>
8403 </parameters>
8404 <errors>
8405 </errors>
8406 </function>
8407 </elide>
8408
8409 </category>
8410
8411 <category id="fieldCategory" label="Field">
8412
8413 <intro>
8414 </intro>
8415
8416 <function id="GetFieldName" phase="start" num="60">
8417 <synopsis>Get Field Name (and Signature)</synopsis>
8418 <description>
8419 For the field indicated by <paramlink id="klass"/> and <paramlink id="field"/>,
8420 return the field name via <paramlink id="name_ptr"/> and field signature via
8421 <paramlink id="signature_ptr"/>.
8422 <p/>
8423 Field signatures are defined in the
8424 <externallink id="jni/index.html">JNI Specification</externallink>
8425 and are referred to as <code>field descriptors</code> in
8426 <vmspec chapter="4.3.2"/>.
8427 </description>
8428 <origin>jvmdiClone</origin>
8429 <capabilities>
8430 </capabilities>
8431 <parameters>
8432 <param id="klass">
8433 <jclass field="field"/>
8434 <description>
8435 The class of the field to query.
8436 </description>
8437 </param>
8438 <param id="field">
8439 <jfieldID class="klass"/>
8440 <description>
8441 The field to query.
8442 </description>
8443 </param>
8444 <param id="name_ptr">
8445 <allocbuf>
8446 <char/>
8447 <nullok>the name is not returned</nullok>
8448 </allocbuf>
8449 <description>
8450 On return, points to the field name, encoded as a
8451 <internallink id="mUTF">modified UTF-8</internallink> string.
8452 </description>
8453 </param>
8454 <param id="signature_ptr">
8455 <allocbuf>
8456 <char/>
8457 <nullok>the signature is not returned</nullok>
8458 </allocbuf>
8459 <description>
8460 On return, points to the field signature, encoded as a
8461 <internallink id="mUTF">modified UTF-8</internallink> string.
8462 </description>
8463 </param>
8464 <param id="generic_ptr">
8465 <allocbuf>
8466 <char/>
8467 <nullok>the generic signature is not returned</nullok>
8468 </allocbuf>
8469 <description>
8470 On return, points to the generic signature of the field, encoded as a
8471 <internallink id="mUTF">modified UTF-8</internallink> string.
8472 If there is no generic signature attribute for the field, then,
8473 on return, points to null.
8474 </description>
8475 </param>
8476 </parameters>
8477 <errors>
8478 </errors>
8479 </function>
8480
8481 <function id="GetFieldDeclaringClass" phase="start" num="61">
8482 <synopsis>Get Field Declaring Class</synopsis>
8483 <description>
8484 For the field indicated by <code>klass</code> and <code>field</code>
8485 return the class that defined it via <code>declaring_class_ptr</code>.
8486 The declaring class will either be <code>klass</code>, a superclass, or
8487 an implemented interface.
8488 </description>
8489 <origin>jvmdi</origin>
8490 <capabilities>
8491 </capabilities>
8492 <parameters>
8493 <param id="klass">
8494 <jclass field="field"/>
8495 <description>
8496 The class to query.
8497 </description>
8498 </param>
8499 <param id="field">
8500 <jfieldID class="klass"/>
8501 <description>
8502 The field to query.
8503 </description>
8504 </param>
8505 <param id="declaring_class_ptr">
8506 <outptr><jclass/></outptr>
8507 <description>
8508 On return, points to the declaring class
8509 </description>
8510 </param>
8511 </parameters>
8512 <errors>
8513 </errors>
8514 </function>
8515
8516 <function id="GetFieldModifiers" phase="start" num="62">
8517 <synopsis>Get Field Modifiers</synopsis>
8518 <description>
8519 For the field indicated by <code>klass</code> and <code>field</code>
8520 return the access flags via <code>modifiers_ptr</code>.
8521 Access flags are defined in <vmspec chapter="4"/>.
8522 </description>
8523 <origin>jvmdi</origin>
8524 <capabilities>
8525 </capabilities>
8526 <parameters>
8527 <param id="klass">
8528 <jclass field="field"/>
8529 <description>
8530 The class to query.
8531 </description>
8532 </param>
8533 <param id="field">
8534 <jfieldID class="klass"/>
8535 <description>
8536 The field to query.
8537 </description>
8538 </param>
8539 <param id="modifiers_ptr">
8540 <outptr><jint/></outptr>
8541 <description>
8542 On return, points to the access flags.
8543 </description>
8544 </param>
8545 </parameters>
8546 <errors>
8547 </errors>
8548 </function>
8549
8550 <function id="IsFieldSynthetic" phase="start" num="63">
8551 <synopsis>Is Field Synthetic</synopsis>
8552 <description>
8553 For the field indicated by <code>klass</code> and <code>field</code>, return a
8554 value indicating whether the field is synthetic via <code>is_synthetic_ptr</code>.
8555 Synthetic fields are generated by the compiler but not present in the
8556 original source code.
8557 </description>
8558 <origin>jvmdi</origin>
8559 <capabilities>
8560 <required id="can_get_synthetic_attribute"></required>
8561 </capabilities>
8562 <parameters>
8563 <param id="klass">
8564 <jclass field="field"/>
8565 <description>
8566 The class of the field to query.
8567 </description>
8568 </param>
8569 <param id="field">
8570 <jfieldID class="klass"/>
8571 <description>
8572 The field to query.
8573 </description>
8574 </param>
8575 <param id="is_synthetic_ptr">
8576 <outptr><jboolean/></outptr>
8577 <description>
8578 On return, points to the boolean result of this function.
8579 </description>
8580 </param>
8581 </parameters>
8582 <errors>
8583 </errors>
8584 </function>
8585
8586 </category>
8587
8588 <category id="method" label="Method">
8589
8590 <intro>
8591 These functions provide information about a method (represented as a
8592 <typelink id="jmethodID"/>) and set how methods are processed.
8593 </intro>
8594
8595 <intro id="obsoleteMethods" label="Obsolete Methods">
8596 The functions <functionlink id="RetransformClasses"/> and
8597 <functionlink id="RedefineClasses"/> can cause new versions
8598 of methods to be installed.
8599 An original version of a method is considered equivalent
8600 to the new version if:
8601 <ul>
8602 <li>their bytecodes are the same except for indices into the
8603 constant pool and </li>
8604 <li>the referenced constants are equal.</li>
8605 </ul>
8606 An original method version which is not equivalent to the
8607 new method version is called obsolete and is assigned a new method ID;
8608 the original method ID now refers to the new method version.
8609 A method ID can be tested for obsolescence with
8610 <functionlink id="IsMethodObsolete"/>.
8611 </intro>
8612
8613 <function id="GetMethodName" phase="start" num="64">
8614 <synopsis>Get Method Name (and Signature)</synopsis>
8615 <description>
8616 For the method indicated by <code>method</code>,
8617 return the method name via <code>name_ptr</code> and method signature via
8618 <code>signature_ptr</code>.
8619 <p/>
8620 Method signatures are defined in the
8621 <externallink id="jni/index.html">JNI Specification</externallink>
8622 and are referred to as <code>method descriptors</code> in
8623 <vmspec chapter="4.3.3"/>.
8624 Note this is different
8625 than method signatures as defined in the <i>Java Language Specification</i>.
8626 </description>
8627 <origin>jvmdiClone</origin>
8628 <capabilities>
8629 </capabilities>
8630 <parameters>
8631 <param id="method">
8632 <jmethodID/>
8633 <description>
8634 The method to query.
8635 </description>
8636 </param>
8637 <param id="name_ptr">
8638 <allocbuf>
8639 <char/>
8640 <nullok>the name is not returned</nullok>
8641 </allocbuf>
8642 <description>
8643 On return, points to the method name, encoded as a
8644 <internallink id="mUTF">modified UTF-8</internallink> string.
8645 </description>
8646 </param>
8647 <param id="signature_ptr">
8648 <allocbuf>
8649 <char/>
8650 <nullok>the signature is not returned</nullok>
8651 </allocbuf>
8652 <description>
8653 On return, points to the method signature, encoded as a
8654 <internallink id="mUTF">modified UTF-8</internallink> string.
8655 </description>
8656 </param>
8657 <param id="generic_ptr">
8658 <allocbuf>
8659 <char/>
8660 <nullok>the generic signature is not returned</nullok>
8661 </allocbuf>
8662 <description>
8663 On return, points to the generic signature of the method, encoded as a
8664 <internallink id="mUTF">modified UTF-8</internallink> string.
8665 If there is no generic signature attribute for the method, then,
8666 on return, points to null.
8667 </description>
8668 </param>
8669 </parameters>
8670 <errors>
8671 </errors>
8672 </function>
8673
8674 <function id="GetMethodDeclaringClass" phase="start" num="65">
8675 <synopsis>Get Method Declaring Class</synopsis>
8676 <description>
8677 For the method indicated by <code>method</code>,
8678 return the class that defined it via <code>declaring_class_ptr</code>.
8679 </description>
8680 <origin>jvmdi</origin>
8681 <capabilities>
8682 </capabilities>
8683 <parameters>
8684 <param id="klass">
8685 <jclass method="method"/>
8686 <description>
8687 The class to query.
8688 </description>
8689 </param>
8690 <param id="method">
8691 <jmethodID class="klass"/>
8692 <description>
8693 The method to query.
8694 </description>
8695 </param>
8696 <param id="declaring_class_ptr">
8697 <outptr><jclass/></outptr>
8698 <description>
8699 On return, points to the declaring class
8700 </description>
8701 </param>
8702 </parameters>
8703 <errors>
8704 </errors>
8705 </function>
8706
8707 <function id="GetMethodModifiers" phase="start" num="66">
8708 <synopsis>Get Method Modifiers</synopsis>
8709 <description>
8710 For the method indicated by <code>method</code>,
8711 return the access flags via <code>modifiers_ptr</code>.
8712 Access flags are defined in <vmspec chapter="4"/>.
8713 </description>
8714 <origin>jvmdi</origin>
8715 <capabilities>
8716 </capabilities>
8717 <parameters>
8718 <param id="klass">
8719 <jclass method="method"/>
8720 <description>
8721 The class to query.
8722 </description>
8723 </param>
8724 <param id="method">
8725 <jmethodID class="klass"/>
8726 <description>
8727 The method to query.
8728 </description>
8729 </param>
8730 <param id="modifiers_ptr">
8731 <outptr><jint/></outptr>
8732 <description>
8733 On return, points to the access flags.
8734 </description>
8735 </param>
8736 </parameters>
8737 <errors>
8738 </errors>
8739 </function>
8740
8741 <function id="GetMaxLocals" phase="start" num="68">
8742 <synopsis>Get Max Locals</synopsis>
8743 <description>
8744 For the method indicated by <code>method</code>,
8745 return the number of local variable slots used by the method,
8746 including the local variables used to pass parameters to the
8747 method on its invocation.
8748 <p/>
8749 See <code>max_locals</code> in <vmspec chapter="4.7.3"/>.
8750 </description>
8751 <origin>jvmdi</origin>
8752 <capabilities>
8753 </capabilities>
8754 <parameters>
8755 <param id="klass">
8756 <jclass method="method"/>
8757 <description>
8758 The class to query.
8759 </description>
8760 </param>
8761 <param id="method">
8762 <jmethodID class="klass" native="error"/>
8763 <description>
8764 The method to query.
8765 </description>
8766 </param>
8767 <param id="max_ptr">
8768 <outptr><jint/></outptr>
8769 <description>
8770 On return, points to the maximum number of local slots
8771 </description>
8772 </param>
8773 </parameters>
8774 <errors>
8775 </errors>
8776 </function>
8777
8778 <function id="GetArgumentsSize" phase="start" num="69">
8779 <synopsis>Get Arguments Size</synopsis>
8780 <description>
8781 For the method indicated by <code>method</code>,
8782 return via <code>max_ptr</code> the number of local variable slots used
8783 by the method's arguments.
8784 Note that two-word arguments use two slots.
8785 </description>
8786 <origin>jvmdi</origin>
8787 <capabilities>
8788 </capabilities>
8789 <parameters>
8790 <param id="klass">
8791 <jclass method="method"/>
8792 <description>
8793 The class to query.
8794 </description>
8795 </param>
8796 <param id="method">
8797 <jmethodID class="klass" native="error"/>
8798 <description>
8799 The method to query.
8800 </description>
8801 </param>
8802 <param id="size_ptr">
8803 <outptr><jint/></outptr>
8804 <description>
8805 On return, points to the number of argument slots
8806 </description>
8807 </param>
8808 </parameters>
8809 <errors>
8810 </errors>
8811 </function>
8812
8813 <function id="GetLineNumberTable" phase="start" num="70">
8814 <synopsis>Get Line Number Table</synopsis>
8815 <typedef id="jvmtiLineNumberEntry" label="Line number table entry">
8816 <field id="start_location">
8817 <jlocation/>
8818 <description>
8819 the <datalink id="jlocation"></datalink> where the line begins
8820 </description>
8821 </field>
8822 <field id="line_number">
8823 <jint/>
8824 <description>
8825 the line number
8826 </description>
8827 </field>
8828 </typedef>
8829 <description>
8830 For the method indicated by <code>method</code>,
8831 return a table of source line number entries. The size of the table is
8832 returned via <code>entry_count_ptr</code> and the table itself is
8833 returned via <code>table_ptr</code>.
8834 </description>
8835 <origin>jvmdi</origin>
8836 <capabilities>
8837 <required id="can_get_line_numbers"></required>
8838 </capabilities>
8839 <parameters>
8840 <param id="klass">
8841 <jclass method="method"/>
8842 <description>
8843 The class to query.
8844 </description>
8845 </param>
8846 <param id="method">
8847 <jmethodID class="klass" native="error"/>
8848 <description>
8849 The method to query.
8850 </description>
8851 </param>
8852 <param id="entry_count_ptr">
8853 <outptr><jint/></outptr>
8854 <description>
8855 On return, points to the number of entries in the table
8856 </description>
8857 </param>
8858 <param id="table_ptr">
8859 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLineNumberEntry</struct></allocbuf>
8860 <description>
8861 On return, points to the line number table pointer.
8862 </description>
8863 </param>
8864 </parameters>
8865 <errors>
8866 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8867 Class information does not include line numbers.
8868 </error>
8869 </errors>
8870 </function>
8871
8872 <function id="GetMethodLocation" phase="start" num="71">
8873 <synopsis>Get Method Location</synopsis>
8874 <description>
8875 For the method indicated by <code>method</code>,
8876 return the beginning and ending addresses through
8877 <code>start_location_ptr</code> and <code>end_location_ptr</code>. In a
8878 conventional bytecode indexing scheme,
8879 <code>start_location_ptr</code> will always point to zero
8880 and <code>end_location_ptr</code>
8881 will always point to the bytecode count minus one.
8882 </description>
8883 <origin>jvmdi</origin>
8884 <capabilities>
8885 </capabilities>
8886 <parameters>
8887 <param id="klass">
8888 <jclass method="method"/>
8889 <description>
8890 The class to query.
8891 </description>
8892 </param>
8893 <param id="method">
8894 <jmethodID class="klass" native="error"/>
8895 <description>
8896 The method to query.
8897 </description>
8898 </param>
8899 <param id="start_location_ptr">
8900 <outptr><jlocation/></outptr>
8901 <description>
8902 On return, points to the first location, or
8903 <code>-1</code> if location information is not available.
8904 If the information is available and
8905 <functionlink id="GetJLocationFormat"></functionlink>
8906 returns <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>
8907 then this will always be zero.
8908 </description>
8909 </param>
8910 <param id="end_location_ptr">
8911 <outptr><jlocation/></outptr>
8912 <description>
8913 On return, points to the last location,
8914 or <code>-1</code> if location information is not available.
8915 </description>
8916 </param>
8917 </parameters>
8918 <errors>
8919 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
8920 Class information does not include method sizes.
8921 </error>
8922 </errors>
8923 </function>
8924
8925 <function id="GetLocalVariableTable" num="72">
8926 <synopsis>Get Local Variable Table</synopsis>
8927 <typedef id="jvmtiLocalVariableEntry" label="Local variable table entry">
8928 <field id="start_location">
8929 <jlocation/>
8930 <description>
8931 The code array index where the local variable is first valid
8932 (that is, where it must have a value).
8933 </description>
8934 </field>
8935 <field id="length">
8936 <jint/>
8937 <description>
8938 The length of the valid section for this local variable.
8939 The last code array index where the local variable is valid
8940 is <code>start_location + length</code>.
8941 </description>
8942 </field>
8943 <field id="name">
8944 <allocfieldbuf><char/></allocfieldbuf>
8945 <description>
8946 The local variable name, encoded as a
8947 <internallink id="mUTF">modified UTF-8</internallink> string.
8948 </description>
8949 </field>
8950 <field id="signature">
8951 <allocfieldbuf><char/></allocfieldbuf>
8952 <description>
8953 The local variable's type signature, encoded as a
8954 <internallink id="mUTF">modified UTF-8</internallink> string.
8955 The signature format is the same as that defined in
8956 <vmspec chapter="4.3.2"/>.
8957 </description>
8958 </field>
8959 <field id="generic_signature">
8960 <allocfieldbuf><char/></allocfieldbuf>
8961 <description>
8962 The local variable's generic signature, encoded as a
8963 <internallink id="mUTF">modified UTF-8</internallink> string.
8964 The value of this field will be null for any local
8965 variable which does not have a generic type.
8966 </description>
8967 </field>
8968 <field id="slot">
8969 <jint/>
8970 <description>
8971 The local variable's slot. See <internallink id="local">Local Variables</internallink>.
8972 </description>
8973 </field>
8974 </typedef>
8975 <description>
8976 Return local variable information.
8977 </description>
8978 <origin>jvmdiClone</origin>
8979 <capabilities>
8980 <required id="can_access_local_variables"></required>
8981 </capabilities>
8982 <parameters>
8983 <param id="method">
8984 <jmethodID native="error"/>
8985 <description>
8986 The method to query.
8987 </description>
8988 </param>
8989 <param id="entry_count_ptr">
8990 <outptr><jint/></outptr>
8991 <description>
8992 On return, points to the number of entries in the table
8993 </description>
8994 </param>
8995 <param id="table_ptr">
8996 <allocbuf outcount="entry_count_ptr"><struct>jvmtiLocalVariableEntry</struct></allocbuf>
8997 <description>
8998 On return, points to an array of local variable table entries.
8999 </description>
9000 </param>
9001 </parameters>
9002 <errors>
9003 <error id="JVMTI_ERROR_ABSENT_INFORMATION">
9004 Class information does not include local variable
9005 information.
9006 </error>
9007 </errors>
9008 </function>
9009
9010 <function id="GetBytecodes" phase="start" num="75">
9011 <synopsis>Get Bytecodes</synopsis>
9012 <description>
9013 For the method indicated by <code>method</code>,
9014 return the bytecodes that implement the method. The number of
9015 bytecodes is returned via <code>bytecode_count_ptr</code>. The bytecodes
9016 themselves are returned via <code>bytecodes_ptr</code>.
9017 </description>
9018 <origin>jvmdi</origin>
9019 <capabilities>
9020 <required id="can_get_bytecodes"></required>
9021 </capabilities>
9022 <parameters>
9023 <param id="klass">
9024 <jclass method="method"/>
9025 <description>
9026 The class to query.
9027 </description>
9028 </param>
9029 <param id="method">
9030 <jmethodID class="klass" native="error"/>
9031 <description>
9032 The method to query.
9033 </description>
9034 </param>
9035 <param id="bytecode_count_ptr">
9036 <outptr><jint/></outptr>
9037 <description>
9038 On return, points to the length of the bytecode array
9039 </description>
9040 </param>
9041 <param id="bytecodes_ptr">
9042 <allocbuf outcount="bytecode_count_ptr"><uchar/></allocbuf>
9043 <description>
9044 On return, points to the pointer to the bytecode array
9045 </description>
9046 </param>
9047 </parameters>
9048 <errors>
9049 </errors>
9050 </function>
9051
9052 <function id="IsMethodNative" phase="start" num="76">
9053 <synopsis>Is Method Native</synopsis>
9054 <description>
9055 For the method indicated by <code>method</code>, return a
9056 value indicating whether the method is native via <code>is_native_ptr</code>
9057 </description>
9058 <origin>jvmdi</origin>
9059 <capabilities>
9060 </capabilities>
9061 <parameters>
9062 <param id="klass">
9063 <jclass method="method"/>
9064 <description>
9065 The class to query.
9066 </description>
9067 </param>
9068 <param id="method">
9069 <jmethodID class="klass"/>
9070 <description>
9071 The method to query.
9072 </description>
9073 </param>
9074 <param id="is_native_ptr">
9075 <outptr><jboolean/></outptr>
9076 <description>
9077 On return, points to the boolean result of this function.
9078 </description>
9079 </param>
9080 </parameters>
9081 <errors>
9082 </errors>
9083 </function>
9084
9085 <function id="IsMethodSynthetic" phase="start" num="77">
9086 <synopsis>Is Method Synthetic</synopsis>
9087 <description>
9088 For the method indicated by <code>method</code>, return a
9089 value indicating whether the method is synthetic via <code>is_synthetic_ptr</code>.
9090 Synthetic methods are generated by the compiler but not present in the
9091 original source code.
9092 </description>
9093 <origin>jvmdi</origin>
9094 <capabilities>
9095 <required id="can_get_synthetic_attribute"></required>
9096 </capabilities>
9097 <parameters>
9098 <param id="klass">
9099 <jclass method="method"/>
9100 <description>
9101 The class to query.
9102 </description>
9103 </param>
9104 <param id="method">
9105 <jmethodID class="klass"/>
9106 <description>
9107 The method to query.
9108 </description>
9109 </param>
9110 <param id="is_synthetic_ptr">
9111 <outptr><jboolean/></outptr>
9112 <description>
9113 On return, points to the boolean result of this function.
9114 </description>
9115 </param>
9116 </parameters>
9117 <errors>
9118 </errors>
9119 </function>
9120
9121 <function id="IsMethodObsolete" phase="start" num="91">
9122 <synopsis>Is Method Obsolete</synopsis>
9123 <description>
9124 Determine if a method ID refers to an
9125 <internallink id="obsoleteMethods">obsolete</internallink>
9126 method version.
9127 </description>
9128 <origin>jvmdi</origin>
9129 <capabilities>
9130 </capabilities>
9131 <parameters>
9132 <param id="klass">
9133 <jclass method="method"/>
9134 <description>
9135 The class to query.
9136 </description>
9137 </param>
9138 <param id="method">
9139 <jmethodID class="klass"/>
9140 <description>
9141 The method ID to query.
9142 </description>
9143 </param>
9144 <param id="is_obsolete_ptr">
9145 <outptr><jboolean/></outptr>
9146 <description>
9147 On return, points to the boolean result of this function.
9148 </description>
9149 </param>
9150 </parameters>
9151 <errors>
9152 </errors>
9153 </function>
9154
9155 <function id="SetNativeMethodPrefix" jkernel="yes" phase="any" num="73" since="1.1">
9156 <synopsis>Set Native Method Prefix</synopsis>
9157 <description>
9158 This function modifies the failure handling of
9159 native method resolution by allowing retry
9160 with a prefix applied to the name.
9161 When used with the
9162 <eventlink id="ClassFileLoadHook">ClassFileLoadHook
9163 event</eventlink>, it enables native methods to be
9164 <internallink id="bci">instrumented</internallink>.
9165 <p/>
9166 Since native methods cannot be directly instrumented
9167 (they have no bytecodes), they must be wrapped with
9168 a non-native method which can be instrumented.
9169 For example, if we had:
9170 <example>
9171 native boolean foo(int x);</example>
9172 <p/>
9173 We could transform the class file (with the
9174 ClassFileLoadHook event) so that this becomes:
9175 <example>
9176 boolean foo(int x) {
9177 <i>... record entry to foo ...</i>
9178 return wrapped_foo(x);
9179 }
9180
9181 native boolean wrapped_foo(int x);</example>
9182 <p/>
9183 Where foo becomes a wrapper for the actual native method
9184 with the appended prefix "wrapped_". Note that
9185 "wrapped_" would be a poor choice of prefix since it
9186 might conceivably form the name of an existing method
9187 thus something like "$$$MyAgentWrapped$$$_" would be
9188 better but would make these examples less readable.
9189 <p/>
9190 The wrapper will allow data to be collected on the native
9191 method call, but now the problem becomes linking up the
9192 wrapped method with the native implementation.
9193 That is, the method <code>wrapped_foo</code> needs to be
9194 resolved to the native implementation of <code>foo</code>,
9195 which might be:
9196 <example>
9197 Java_somePackage_someClass_foo(JNIEnv* env, jint x)</example>
9198 <p/>
9199 This function allows the prefix to be specified and the
9200 proper resolution to occur.
9201 Specifically, when the standard resolution fails, the
9202 resolution is retried taking the prefix into consideration.
9203 There are two ways that resolution occurs, explicit
9204 resolution with the JNI function <code>RegisterNatives</code>
9205 and the normal automatic resolution. For
9206 <code>RegisterNatives</code>, the VM will attempt this
9207 association:
9208 <example>
9209 method(foo) -> nativeImplementation(foo)</example>
9210 <p/>
9211 When this fails, the resolution will be retried with
9212 the specified prefix prepended to the method name,
9213 yielding the correct resolution:
9214 <example>
9215 method(wrapped_foo) -> nativeImplementation(foo)</example>
9216 <p/>
9217 For automatic resolution, the VM will attempt:
9218 <example>
9219 method(wrapped_foo) -> nativeImplementation(wrapped_foo)</example>
9220 <p/>
9221 When this fails, the resolution will be retried with
9222 the specified prefix deleted from the implementation name,
9223 yielding the correct resolution:
9224 <example>
9225 method(wrapped_foo) -> nativeImplementation(foo)</example>
9226 <p/>
9227 Note that since the prefix is only used when standard
9228 resolution fails, native methods can be wrapped selectively.
9229 <p/>
9230 Since each <jvmti/> environment is independent and
9231 can do its own transformation of the bytecodes, more
9232 than one layer of wrappers may be applied. Thus each
9233 environment needs its own prefix. Since transformations
9234 are applied in order, the prefixes, if applied, will
9235 be applied in the same order.
9236 The order of transformation application is described in
9237 the <eventlink id="ClassFileLoadHook"/> event.
9238 Thus if three environments applied
9239 wrappers, <code>foo</code> might become
9240 <code>$env3_$env2_$env1_foo</code>. But if, say,
9241 the second environment did not apply a wrapper to
9242 <code>foo</code> it would be just
9243 <code>$env3_$env1_foo</code>. To be able to
9244 efficiently determine the sequence of prefixes,
9245 an intermediate prefix is only applied if its non-native
9246 wrapper exists. Thus, in the last example, even though
9247 <code>$env1_foo</code> is not a native method, the
9248 <code>$env1_</code> prefix is applied since
9249 <code>$env1_foo</code> exists.
9250 <p/>
9251 Since the prefixes are used at resolution time
9252 and since resolution may be arbitrarily delayed, a
9253 native method prefix must remain set as long as there
9254 are corresponding prefixed native methods.
9255 </description>
9256 <origin>new</origin>
9257 <capabilities>
9258 <required id="can_set_native_method_prefix"></required>
9259 </capabilities>
9260 <parameters>
9261 <param id="prefix">
9262 <inbuf>
9263 <char/>
9264 <nullok>
9265 any existing prefix in this environment is cancelled
9266 </nullok>
9267 </inbuf>
9268 <description>
9269 The prefix to apply, encoded as a
9270 <internallink id="mUTF">modified UTF-8</internallink> string.
9271 </description>
9272 </param>
9273 </parameters>
9274 <errors>
9275 </errors>
9276 </function>
9277
9278 <function id="SetNativeMethodPrefixes" jkernel="yes" phase="any" num="74" since="1.1">
9279 <synopsis>Set Native Method Prefixes</synopsis>
9280 <description>
9281 For a normal agent, <functionlink id="SetNativeMethodPrefix"/>
9282 will provide all needed native method prefixing.
9283 For a meta-agent that performs multiple independent class
9284 file transformations (for example as a proxy for another
9285 layer of agents) this function allows each transformation
9286 to have its own prefix.
9287 The prefixes are applied in the order supplied and are
9288 processed in the same manner as described for the
9289 application of prefixes from multiple <jvmti/> environments
9290 in <functionlink id="SetNativeMethodPrefix"/>.
9291 <p/>
9292 Any previous prefixes are replaced. Thus, calling this
9293 function with a <paramlink id="prefix_count"/> of <code>0</code>
9294 disables prefixing in this environment.
9295 <p/>
9296 <functionlink id="SetNativeMethodPrefix"/> and this function
9297 are the two ways to set the prefixes.
9298 Calling <code>SetNativeMethodPrefix</code> with
9299 a prefix is the same as calling this function with
9300 <paramlink id="prefix_count"/> of <code>1</code>.
9301 Calling <code>SetNativeMethodPrefix</code> with
9302 a null pointer is the same as calling this function with
9303 <paramlink id="prefix_count"/> of <code>0</code>.
9304 </description>
9305 <origin>new</origin>
9306 <capabilities>
9307 <required id="can_set_native_method_prefix"></required>
9308 </capabilities>
9309 <parameters>
9310 <param id="prefix_count">
9311 <jint min="0"/>
9312 <description>
9313 The number of prefixes to apply.
9314 </description>
9315 </param>
9316 <param id="prefixes">
9317 <agentbuf>
9318 <char/>
9319 </agentbuf>
9320 <description>
9321 The prefixes to apply for this environment, each encoded as a
9322 <internallink id="mUTF">modified UTF-8</internallink> string.
9323 </description>
9324 </param>
9325 </parameters>
9326 <errors>
9327 </errors>
9328 </function>
9329
9330 </category>
9331
9332 <category id="RawMonitors" label="Raw Monitor">
9333
9334 <function id="CreateRawMonitor" phase="onload" callbacksafe="safe" num="31">
9335 <synopsis>Create Raw Monitor</synopsis>
9336 <description>
9337 Create a raw monitor.
9338 </description>
9339 <origin>jvmdi</origin>
9340 <capabilities>
9341 </capabilities>
9342 <parameters>
9343 <param id="name">
9344 <inbuf><char/></inbuf>
9345 <description>
9346 A name to identify the monitor, encoded as a
9347 <internallink id="mUTF">modified UTF-8</internallink> string.
9348 </description>
9349 </param>
9350 <param id="monitor_ptr">
9351 <outptr><jrawMonitorID/></outptr>
9352 <description>
9353 On return, points to the created monitor.
9354 </description>
9355 </param>
9356 </parameters>
9357 <errors>
9358 </errors>
9359 </function>
9360
9361 <function id="DestroyRawMonitor" phase="onload" callbacksafe="safe" num="32">
9362 <synopsis>Destroy Raw Monitor</synopsis>
9363 <description>
9364 Destroy the raw monitor.
9365 If the monitor being destroyed has been entered by this thread, it will be
9366 exited before it is destroyed.
9367 If the monitor being destroyed has been entered by another thread,
9368 an error will be returned and the monitor will not be destroyed.
9369 </description>
9370 <origin>jvmdi</origin>
9371 <capabilities>
9372 </capabilities>
9373 <parameters>
9374 <param id="monitor">
9375 <jrawMonitorID/>
9376 <description>
9377 The monitor
9378 </description>
9379 </param>
9380 </parameters>
9381 <errors>
9382 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9383 Not monitor owner
9384 </error>
9385 </errors>
9386 </function>
9387
9388 <function id="RawMonitorEnter" phase="any" callbacksafe="safe" impl="innative notrace" num="33">
9389 <synopsis>Raw Monitor Enter</synopsis>
9390 <description>
9391 Gain exclusive ownership of a raw monitor.
9392 The same thread may enter a monitor more then once.
9393 The thread must
9394 <functionlink id="RawMonitorExit">exit</functionlink>
9395 the monitor the same number of times as it is entered.
9396 If a monitor is entered during <code>OnLoad</code> (before attached threads exist)
9397 and has not exited when attached threads come into existence, the enter
9398 is considered to have occurred on the main thread.
9399 </description>
9400 <origin>jvmdi</origin>
9401 <capabilities>
9402 </capabilities>
9403 <parameters>
9404 <param id="monitor">
9405 <jrawMonitorID/>
9406 <description>
9407 The monitor
9408 </description>
9409 </param>
9410 </parameters>
9411 <errors>
9412 </errors>
9413 </function>
9414
9415 <function id="RawMonitorExit" phase="any" callbacksafe="safe" impl="innative notrace" num="34">
9416 <synopsis>Raw Monitor Exit</synopsis>
9417 <description>
9418 Release exclusive ownership of a raw monitor.
9419 </description>
9420 <origin>jvmdi</origin>
9421 <capabilities>
9422 </capabilities>
9423 <parameters>
9424 <param id="monitor">
9425 <jrawMonitorID/>
9426 <description>
9427 The monitor
9428 </description>
9429 </param>
9430 </parameters>
9431 <errors>
9432 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9433 Not monitor owner
9434 </error>
9435 </errors>
9436 </function>
9437
9438 <function id="RawMonitorWait" phase="any" callbacksafe="safe" impl="innative notrace" num="35">
9439 <synopsis>Raw Monitor Wait</synopsis>
9440 <description>
9441 Wait for notification of the raw monitor.
9442 <p/>
9443 Causes the current thread to wait until either another thread calls
9444 <functionlink id="RawMonitorNotify"/> or
9445 <functionlink id="RawMonitorNotifyAll"/>
9446 for the specified raw monitor, or the specified
9447 <paramlink id="millis">timeout</paramlink>
9448 has elapsed.
9449 </description>
9450 <origin>jvmdi</origin>
9451 <capabilities>
9452 </capabilities>
9453 <parameters>
9454 <param id="monitor">
9455 <jrawMonitorID/>
9456 <description>
9457 The monitor
9458 </description>
9459 </param>
9460 <param id="millis">
9461 <jlong/>
9462 <description>
9463 The timeout, in milliseconds. If the timeout is
9464 zero, then real time is not taken into consideration
9465 and the thread simply waits until notified.
9466 </description>
9467 </param>
9468 </parameters>
9469 <errors>
9470 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9471 Not monitor owner
9472 </error>
9473 <error id="JVMTI_ERROR_INTERRUPT">
9474 Wait was interrupted, try again
9475 </error>
9476 </errors>
9477 </function>
9478
9479 <function id="RawMonitorNotify" phase="any" callbacksafe="safe" impl="notrace" num="36">
9480 <synopsis>Raw Monitor Notify</synopsis>
9481 <description>
9482 Notify a single thread waiting on the raw monitor.
9483 </description>
9484 <origin>jvmdi</origin>
9485 <capabilities>
9486 </capabilities>
9487 <parameters>
9488 <param id="monitor">
9489 <jrawMonitorID/>
9490 <description>
9491 The monitor
9492 </description>
9493 </param>
9494 </parameters>
9495 <errors>
9496 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9497 Not monitor owner
9498 </error>
9499 </errors>
9500 </function>
9501
9502 <function id="RawMonitorNotifyAll" phase="any" callbacksafe="safe" impl="notrace" num="37">
9503 <synopsis>Raw Monitor Notify All</synopsis>
9504 <description>
9505 Notify all threads waiting on the raw monitor.
9506 </description>
9507 <origin>jvmdi</origin>
9508 <capabilities>
9509 </capabilities>
9510 <parameters>
9511 <param id="monitor">
9512 <jrawMonitorID/>
9513 <description>
9514 The monitor
9515 </description>
9516 </param>
9517 </parameters>
9518 <errors>
9519 <error id="JVMTI_ERROR_NOT_MONITOR_OWNER">
9520 Not monitor owner
9521 </error>
9522 </errors>
9523 </function>
9524
9525 <elide>
9526 <function id="GetRawMonitorUse" num="118">
9527 <synopsis>Get Raw Monitor Use</synopsis>
9528 <description>
9529 The fields of the <functionlink id="jvmtiMonitorUsage"></functionlink> structure
9530 are filled in with information about usage of the raw monitor.
9531 </description>
9532 <origin>new</origin>
9533 <capabilities>
9534 <required id="can_get_raw_monitor_usage"></required>
9535 </capabilities>
9536 <parameters>
9537 <param id="monitor">
9538 <jrawMonitorID/>
9539 <description>
9540 the raw monitor to query.
9541 </description>
9542 </param>
9543 <param id="info_ptr">
9544 <outptr><struct>jvmtiMonitorUsage</struct></outptr>
9545 <description>
9546 On return, filled with monitor information for the
9547 specified raw monitor.
9548 </description>
9549 </param>
9550 </parameters>
9551 <errors>
9552 </errors>
9553 </function>
9554
9555 <function id="GetRawMonitors" num="119">
9556 <synopsis>Get Raw Monitors</synopsis>
9557 <description>
9558 Return the list of raw monitors.
9559 <p/>
9560 Note: details about each monitor can be examined with
9561 <functionlink id="GetRawMonitorUse"></functionlink>.
9562 </description>
9563 <origin>new</origin>
9564 <capabilities>
9565 <required id="can_get_raw_monitor_usage"></required>
9566 </capabilities>
9567 <parameters>
9568 <param id="monitorCnt">
9569 <outptr><jint/></outptr>
9570 <description>
9571 On return, pointer to the number
9572 of monitors returned in <code>monitors_ptr</code>.
9573 </description>
9574 </param>
9575 <param id="monitors_ptr">
9576 <allocbuf outcount="monitorCnt"><jrawMonitorID/></allocbuf>
9577 <description>
9578 On return, pointer to the monitor list.
9579 </description>
9580 </param>
9581 </parameters>
9582 <errors>
9583 </errors>
9584 </function>
9585 </elide>
9586 </category>
9587
9588 <category id="jniIntercept" label="JNI Function Interception">
9589
9590 <intro>
9591 Provides the ability to intercept and resend
9592 Java Native Interface (JNI) function calls
9593 by manipulating the JNI function table.
9594 See <externallink id="jni/functions.html">JNI
9595 Functions</externallink> in the <i>Java Native Interface Specification</i>.
9596 <p/>
9597 The following example illustrates intercepting the
9598 <code>NewGlobalRef</code> JNI call in order to count reference
9599 creation.
9600 <example>
9601 JNIEnv original_jni_Functions;
9602 JNIEnv redirected_jni_Functions;
9603 int my_global_ref_count = 0;
9604
9605 jobject
9606 MyNewGlobalRef(JNIEnv *jni_env, jobject lobj) {
9607 ++my_global_ref_count;
9608 return originalJNIFunctions->NewGlobalRef(env, lobj);
9609 }
9610
9611 void
9612 myInit() {
9613 jvmtiError err;
9614
9615 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &original_jni_Functions);
9616 if (err != JVMTI_ERROR_NONE) {
9617 die();
9618 }
9619 err = (*jvmti_env)->GetJNIFunctionTable(jvmti_env, &redirected_jni_Functions);
9620 if (err != JVMTI_ERROR_NONE) {
9621 die();
9622 }
9623 redirectedJNIFunctions->NewGlobalRef = MyNewGlobalRef;
9624 err = (*jvmti_env)->SetJNIFunctionTable(jvmti_env, redirected_jni_Functions);
9625 if (err != JVMTI_ERROR_NONE) {
9626 die();
9627 }
9628 }
9629 </example>
9630 Sometime after <code>myInit</code> is called the user's JNI
9631 code is executed which makes the call to create a new global
9632 reference. Instead of going to the normal JNI implementation
9633 the call goes to <code>myNewGlobalRef</code>. Note that a
9634 copy of the original function table is kept so that the normal
9635 JNI function can be called after the data is collected.
9636 Note also that any JNI functions which are not overwritten
9637 will behave normally.
9638 <todo>
9639 check that the example compiles and executes.
9640 </todo>
9641 </intro>
9642
9643 <function id="SetJNIFunctionTable" phase="start" num="120">
9644 <synopsis>Set JNI Function Table</synopsis>
9645 <description>
9646 Set the JNI function table
9647 in all current and future JNI environments.
9648 As a result, all future JNI calls are directed to the specified functions.
9649 Use <functionlink id="GetJNIFunctionTable"></functionlink> to get the
9650 function table to pass to this function.
9651 For this function to take effect the updated table entries must be
9652 used by the JNI clients.
9653 Since the table is defined <code>const</code> some compilers may optimize
9654 away the access to the table, thus preventing this function from taking
9655 effect.
9656 The table is copied--changes to the local copy of the
9657 table have no effect.
9658 This function affects only the function table, all other aspects of the environment are
9659 unaffected.
9660 See the examples <internallink id="jniIntercept">above</internallink>.
9661 </description>
9662 <origin>new</origin>
9663 <capabilities>
9664 </capabilities>
9665 <parameters>
9666 <param id="function_table">
9667 <inptr>
9668 <struct>jniNativeInterface</struct>
9669 </inptr>
9670 <description>
9671 Points to the new JNI function table.
9672 </description>
9673 </param>
9674 </parameters>
9675 <errors>
9676 </errors>
9677 </function>
9678
9679 <function id="GetJNIFunctionTable" phase="start" num="121">
9680 <synopsis>Get JNI Function Table</synopsis>
9681 <description>
9682 Get the JNI function table.
9683 The JNI function table is copied into allocated memory.
9684 If <functionlink id="SetJNIFunctionTable"></functionlink>
9685 has been called, the modified (not the original) function
9686 table is returned.
9687 Only the function table is copied, no other aspects of the environment
9688 are copied.
9689 See the examples <internallink id="jniIntercept">above</internallink>.
9690 </description>
9691 <origin>new</origin>
9692 <capabilities>
9693 </capabilities>
9694 <parameters>
9695 <param id="function_table">
9696 <allocbuf>
9697 <struct>jniNativeInterface</struct>
9698 </allocbuf>
9699 <description>
9700 On return, <code>*function_table</code>
9701 points a newly allocated copy of the JNI function table.
9702 </description>
9703 </param>
9704 </parameters>
9705 <errors>
9706 </errors>
9707 </function>
9708
9709 </category>
9710
9711 <category id="eventManagement" label="Event Management">
9712
9713 <function id="SetEventCallbacks" jkernel="yes" phase="onload" num="122">
9714 <synopsis>Set Event Callbacks</synopsis>
9715 <description>
9716 Set the functions to be called for each event.
9717 The callbacks are specified by supplying a replacement function table.
9718 The function table is copied--changes to the local copy of the
9719 table have no effect.
9720 This is an atomic action, all callbacks are set at once.
9721 No events are sent before this function is called.
9722 When an entry is null or when the event is beyond
9723 <paramlink id="size_of_callbacks"></paramlink> no event is sent.
9724 Details on events are
9725 described <internallink id="EventSection">later</internallink> in this document.
9726 An event must be enabled and have a callback in order to be
9727 sent--the order in which this function and
9728 <functionlink id="SetEventNotificationMode"></functionlink>
9729 are called does not affect the result.
9730 </description>
9731 <origin>new</origin>
9732 <capabilities>
9733 </capabilities>
9734 <parameters>
9735 <param id="callbacks">
9736 <inptr>
9737 <struct>jvmtiEventCallbacks</struct>
9738 <nullok>remove the existing callbacks</nullok>
9739 </inptr>
9740 <description>
9741 The new event callbacks.
9742 </description>
9743 </param>
9744 <param id="size_of_callbacks">
9745 <jint min="0"/>
9746 <description>
9747 <code>sizeof(jvmtiEventCallbacks)</code>--for version
9748 compatibility.
9749 </description>
9750 </param>
9751 </parameters>
9752 <errors>
9753 </errors>
9754 </function>
9755
9756 <function id="SetEventNotificationMode" jkernel="yes" phase="onload" num="2">
9757 <synopsis>Set Event Notification Mode</synopsis>
9758 <description>
9759 Control the generation of events.
9760 <constants id="jvmtiEventMode" label="Event Enable/Disable" kind="enum">
9761 <constant id="JVMTI_ENABLE" num="1">
9762 If <paramlink id="mode"></paramlink> is <code>JVMTI_ENABLE</code>,
9763 the event <paramlink id="event_type"></paramlink> will be enabled
9764 </constant>
9765 <constant id="JVMTI_DISABLE" num="0">
9766 If <paramlink id="mode"></paramlink> is <code>JVMTI_DISABLE</code>,
9767 the event <paramlink id="event_type"></paramlink> will be disabled
9768 </constant>
9769 </constants>
9770 If <code>event_thread</code> is null,
9771 the event is enabled or disabled globally; otherwise, it is
9772 enabled or disabled for a particular thread.
9773 An event is generated for
9774 a particular thread if it is enabled either at the thread or global
9775 levels.
9776 <p/>
9777 See <internallink id="EventIndex">below</internallink> for information on specific events.
9778 <p/>
9779 The following events cannot be controlled at the thread
9780 level through this function.
9781 <ul>
9782 <li><eventlink id="VMInit"></eventlink></li>
9783 <li><eventlink id="VMStart"></eventlink></li>
9784 <li><eventlink id="VMDeath"></eventlink></li>
9785 <li><eventlink id="ThreadStart"></eventlink></li>
9786 <li><eventlink id="VirtualThreadStart"></eventlink></li>
9787 <li><eventlink id="CompiledMethodLoad"></eventlink></li>
9788 <li><eventlink id="CompiledMethodUnload"></eventlink></li>
9789 <li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9790 <li><eventlink id="DataDumpRequest"></eventlink></li>
9791 </ul>
9792 <p/>
9793 Initially, no events are enabled at either the thread level
9794 or the global level.
9795 <p/>
9796 Any needed capabilities (see Event Enabling Capabilities below) must be possessed
9797 before calling this function.
9798 <p/>
9799 Details on events are
9800 described <internallink id="EventSection">below</internallink>.
9801 </description>
9802 <origin>jvmdiClone</origin>
9803 <eventcapabilities></eventcapabilities>
9804 <parameters>
9805 <param id="mode">
9806 <enum>jvmtiEventMode</enum>
9807 <description>
9808 <code>JVMTI_ENABLE</code> or <code>JVMTI_DISABLE</code>
9809 </description>
9810 </param>
9811 <param id="event_type">
9812 <enum>jvmtiEvent</enum>
9813 <description>
9814 the event to control
9815 </description>
9816 </param>
9817 <param id="event_thread">
9818 <ptrtype>
9819 <jthread impl="noconvert"/>
9820 <nullok>event is controlled at the global level</nullok>
9821 </ptrtype>
9822 <description>
9823 The thread to control
9824 </description>
9825 </param>
9826 <param id="...">
9827 <varargs/>
9828 <description>
9829 for future expansion
9830 </description>
9831 </param>
9832 </parameters>
9833 <errors>
9834 <error id="JVMTI_ERROR_INVALID_THREAD">
9835 <paramlink id="event_thread"/> is non-null and is not a valid thread.
9836 </error>
9837 <error id="JVMTI_ERROR_THREAD_NOT_ALIVE">
9838 <paramlink id="event_thread"/> is non-null and is not alive
9839 (has not been started or has terminated).
9840 </error>
9841 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9842 thread level control was attempted on events which do not
9843 permit thread level control.
9844 </error>
9845 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9846 The Required Event Enabling Capability is not possessed.
9847 </error>
9848 </errors>
9849 </function>
9850
9851 <function id="GenerateEvents" num="123">
9852 <synopsis>Generate Events</synopsis>
9853 <description>
9854 Generate events to represent the current state of the VM.
9855 For example, if <paramlink id="event_type"/> is
9856 <code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code>,
9857 a <eventlink id="CompiledMethodLoad"></eventlink> event will be
9858 sent for each currently compiled method.
9859 Methods that were loaded and now have been unloaded are not sent.
9860 The history of what events have previously been sent does not
9861 effect what events are sent by this function--for example,
9862 all currently compiled methods
9863 will be sent each time this function is called.
9864 <p/>
9865 This function is useful when
9866 events may have been missed due to the agent attaching after program
9867 execution begins; this function generates the missed events.
9868 <p/>
9869 Attempts to execute Java programming language code or
9870 JNI functions may be paused until this function returns -
9871 so neither should be called from the thread sending the event.
9872 This function returns only after the missed events have been
9873 sent, processed and have returned.
9874 The event may be sent on a different thread than the thread
9875 on which the event occurred.
9876 The callback for the event must be set with
9877 <functionlink id="SetEventCallbacks"></functionlink>
9878 and the event must be enabled with
9879 <functionlink id="SetEventNotificationMode"></functionlink>
9880 or the events will not occur.
9881 If the VM no longer has the information to generate some or
9882 all of the requested events, the events are simply not sent -
9883 no error is returned.
9884 <p/>
9885 Only the following events are supported:
9886 <ul>
9887 <li><eventlink id="CompiledMethodLoad"></eventlink></li>
9888 <li><eventlink id="DynamicCodeGenerated"></eventlink></li>
9889 </ul>
9890 </description>
9891 <origin>new</origin>
9892 <capabilities>
9893 <capability id="can_generate_compiled_method_load_events"></capability>
9894 </capabilities>
9895 <parameters>
9896 <param id="event_type">
9897 <enum>jvmtiEvent</enum>
9898 <description>
9899 The type of event to generate. Must be one of these:
9900 <ul>
9901 <li><eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink></li>
9902 <li><eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink></li>
9903 </ul>
9904 </description>
9905 </param>
9906 </parameters>
9907 <errors>
9908 <error id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY">
9909 <paramlink id="event_type"/> is
9910 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9911 and <fieldlink id="can_generate_compiled_method_load_events" struct="jvmtiCapabilities"></fieldlink>
9912 is <code>false</code>.
9913 </error>
9914 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
9915 <paramlink id="event_type"/> is other than
9916 <eventlink id="CompiledMethodLoad"><code>JVMTI_EVENT_COMPILED_METHOD_LOAD</code></eventlink>
9917 or <eventlink id="DynamicCodeGenerated"><code>JVMTI_EVENT_DYNAMIC_CODE_GENERATED</code></eventlink>.
9918 </error>
9919 </errors>
9920 </function>
9921
9922 </category>
9923
9924 <category id="extension" label="Extension Mechanism">
9925
9926 <intro>
9927 These functions
9928 allow a <jvmti/> implementation to provide functions and events
9929 beyond those defined in this specification.
9930 <p/>
9931 Both extension functions and extension events have parameters
9932 each of which has a 'type' and 'kind' chosen from the following tables:
9933
9934 <constants id="jvmtiParamTypes" label="Extension Function/Event Parameter Types" kind="enum">
9935 <constant id="JVMTI_TYPE_JBYTE" num="101">
9936 Java programming language primitive type - <code>byte</code>.
9937 JNI type <code>jbyte</code>.
9938 </constant>
9939 <constant id="JVMTI_TYPE_JCHAR" num="102">
9940 Java programming language primitive type - <code>char</code>.
9941 JNI type <code>jchar</code>.
9942 </constant>
9943 <constant id="JVMTI_TYPE_JSHORT" num="103">
9944 Java programming language primitive type - <code>short</code>.
9945 JNI type <code>jshort</code>.
9946 </constant>
9947 <constant id="JVMTI_TYPE_JINT" num="104">
9948 Java programming language primitive type - <code>int</code>.
9949 JNI type <datalink id="jint"></datalink>.
9950 </constant>
9951 <constant id="JVMTI_TYPE_JLONG" num="105">
9952 Java programming language primitive type - <code>long</code>.
9953 JNI type <datalink id="jlong"></datalink>.
9954 </constant>
9955 <constant id="JVMTI_TYPE_JFLOAT" num="106">
9956 Java programming language primitive type - <code>float</code>.
9957 JNI type <datalink id="jfloat"></datalink>.
9958 </constant>
9959 <constant id="JVMTI_TYPE_JDOUBLE" num="107">
9960 Java programming language primitive type - <code>double</code>.
9961 JNI type <datalink id="jdouble"></datalink>.
9962 </constant>
9963 <constant id="JVMTI_TYPE_JBOOLEAN" num="108">
9964 Java programming language primitive type - <code>boolean</code>.
9965 JNI type <datalink id="jboolean"></datalink>.
9966 </constant>
9967 <constant id="JVMTI_TYPE_JOBJECT" num="109">
9968 Java programming language object type - <code>java.lang.Object</code>.
9969 JNI type <datalink id="jobject"></datalink>.
9970 Returned values are JNI local references and must be managed.
9971 </constant>
9972 <constant id="JVMTI_TYPE_JTHREAD" num="110">
9973 Java programming language object type - <code>java.lang.Thread</code>.
9974 <jvmti/> type <datalink id="jthread"></datalink>.
9975 Returned values are JNI local references and must be managed.
9976 </constant>
9977 <constant id="JVMTI_TYPE_JCLASS" num="111">
9978 Java programming language object type - <code>java.lang.Class</code>.
9979 JNI type <datalink id="jclass"></datalink>.
9980 Returned values are JNI local references and must be managed.
9981 </constant>
9982 <constant id="JVMTI_TYPE_JVALUE" num="112">
9983 Union of all Java programming language primitive and object types -
9984 JNI type <datalink id="jvalue"></datalink>.
9985 Returned values which represent object types are JNI local references and must be managed.
9986 </constant>
9987 <constant id="JVMTI_TYPE_JFIELDID" num="113">
9988 Java programming language field identifier -
9989 JNI type <datalink id="jfieldID"></datalink>.
9990 </constant>
9991 <constant id="JVMTI_TYPE_JMETHODID" num="114">
9992 Java programming language method identifier -
9993 JNI type <datalink id="jmethodID"></datalink>.
9994 </constant>
9995 <constant id="JVMTI_TYPE_CCHAR" num="115">
9996 C programming language type - <code>char</code>.
9997 </constant>
9998 <constant id="JVMTI_TYPE_CVOID" num="116">
9999 C programming language type - <code>void</code>.
10000 </constant>
10001 <constant id="JVMTI_TYPE_JNIENV" num="117">
10002 JNI environment - <code>JNIEnv</code>.
10003 Should be used with the correct <datalink id="jvmtiParamKind"/> to make it a pointer type.
10004 </constant>
10005 </constants>
10006
10007 <constants id="jvmtiParamKind" label="Extension Function/Event Parameter Kinds" kind="enum">
10008 <constant id="JVMTI_KIND_IN" num="91">
10009 Ingoing argument - <code>foo</code>.
10010 </constant>
10011 <constant id="JVMTI_KIND_IN_PTR" num="92">
10012 Ingoing pointer argument - <code>const foo*</code>.
10013 </constant>
10014 <constant id="JVMTI_KIND_IN_BUF" num="93">
10015 Ingoing array argument - <code>const foo*</code>.
10016 </constant>
10017 <constant id="JVMTI_KIND_ALLOC_BUF" num="94">
10018 Outgoing allocated array argument - <code>foo**</code>.
10019 Free with <code>Deallocate</code>.
10020 </constant>
10021 <constant id="JVMTI_KIND_ALLOC_ALLOC_BUF" num="95">
10022 Outgoing allocated array of allocated arrays argument - <code>foo***</code>.
10023 Free with <code>Deallocate</code>.
10024 </constant>
10025 <constant id="JVMTI_KIND_OUT" num="96">
10026 Outgoing argument - <code>foo*</code>.
10027 </constant>
10028 <constant id="JVMTI_KIND_OUT_BUF" num="97">
10029 Outgoing array argument (pre-allocated by agent) - <code>foo*</code>.
10030 Do not <code>Deallocate</code>.
10031 </constant>
10032 </constants>
10033
10034 </intro>
10035
10036 <typedef id="jvmtiParamInfo" label="Extension Function/Event Parameter Info">
10037 <field id="name">
10038 <allocfieldbuf><char/></allocfieldbuf>
10039 <description>
10040 The parameter name, encoded as a
10041 <internallink id="mUTF">modified UTF-8</internallink> string
10042 </description>
10043 </field>
10044 <field id="kind">
10045 <enum>jvmtiParamKind</enum>
10046 <description>
10047 The kind of the parameter - type modifiers
10048 </description>
10049 </field>
10050 <field id="base_type">
10051 <enum>jvmtiParamTypes</enum>
10052 <description>
10053 The base type of the parameter - modified by <code>kind</code>
10054 </description>
10055 </field>
10056 <field id="null_ok">
10057 <jboolean/>
10058 <description>
10059 Is a null pointer argument permitted? Applies only to pointer and object types.
10060 </description>
10061 </field>
10062 </typedef>
10063
10064 <callback id="jvmtiExtensionFunction">
10065 <enum>jvmtiError</enum>
10066 <synopsis>Extension Function</synopsis>
10067 <description>
10068 This is the implementation-specific extension function.
10069 </description>
10070 <parameters>
10071 <param id="jvmti_env">
10072 <outptr>
10073 <struct>jvmtiEnv</struct>
10074 </outptr>
10075 <description>
10076 The <jvmti/> environment is the only fixed parameter for extension functions.
10077 </description>
10078 </param>
10079 <param id="...">
10080 <varargs/>
10081 <description>
10082 The extension function-specific parameters
10083 </description>
10084 </param>
10085 </parameters>
10086 </callback>
10087
10088 <function id="GetExtensionFunctions" phase="onload" num="124">
10089 <synopsis>Get Extension Functions</synopsis>
10090
10091 <typedef id="jvmtiExtensionFunctionInfo" label="Extension Function Info">
10092 <field id="func">
10093 <ptrtype>
10094 <struct>jvmtiExtensionFunction</struct>
10095 </ptrtype>
10096 <description>
10097 The actual function to call
10098 </description>
10099 </field>
10100 <field id="id">
10101 <allocfieldbuf><char/></allocfieldbuf>
10102 <description>
10103 The identifier for the extension function, encoded as a
10104 <internallink id="mUTF">modified UTF-8</internallink> string.
10105 Uses package name conventions.
10106 For example, <code>com.sun.hotspot.bar</code>
10107 </description>
10108 </field>
10109 <field id="short_description">
10110 <allocfieldbuf><char/></allocfieldbuf>
10111 <description>
10112 A one sentence description of the function, encoded as a
10113 <internallink id="mUTF">modified UTF-8</internallink> string.
10114 </description>
10115 </field>
10116 <field id="param_count">
10117 <jint/>
10118 <description>
10119 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
10120 </description>
10121 </field>
10122 <field id="params">
10123 <allocfieldbuf outcount="param_count">
10124 <struct>jvmtiParamInfo</struct>
10125 </allocfieldbuf>
10126 <description>
10127 Array of
10128 <fieldlink id="param_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
10129 parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
10130 </description>
10131 </field>
10132 <field id="error_count">
10133 <jint/>
10134 <description>
10135 The number of possible error returns (excluding universal errors)
10136 </description>
10137 </field>
10138 <field id="errors">
10139 <allocfieldbuf outcount="error_count">
10140 <enum>jvmtiError</enum>
10141 </allocfieldbuf>
10142 <description>
10143 Array of <fieldlink id="error_count" struct="jvmtiExtensionFunctionInfo"></fieldlink>
10144 possible errors
10145 </description>
10146 </field>
10147 </typedef>
10148
10149 <description>
10150 Returns the set of extension functions.
10151 </description>
10152 <origin>new</origin>
10153 <capabilities>
10154 </capabilities>
10155 <parameters>
10156 <param id="extension_count_ptr">
10157 <outptr><jint/></outptr>
10158 <description>
10159 On return, points to the number of extension functions
10160 </description>
10161 </param>
10162 <param id="extensions">
10163 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionFunctionInfo</struct></allocbuf>
10164 <description>
10165 Returns an array of extension function info, one per function
10166 </description>
10167 </param>
10168 </parameters>
10169 <errors>
10170 </errors>
10171 </function>
10172
10173 <function id="GetExtensionEvents" phase="onload" num="125">
10174 <synopsis>Get Extension Events</synopsis>
10175
10176 <typedef id="jvmtiExtensionEventInfo" label="Extension Event Info">
10177 <field id="extension_event_index">
10178 <jint/>
10179 <description>
10180 The identifying index of the event
10181 </description>
10182 </field>
10183 <field id="id">
10184 <allocfieldbuf><char/></allocfieldbuf>
10185 <description>
10186 The identifier for the extension event, encoded as a
10187 <internallink id="mUTF">modified UTF-8</internallink> string.
10188 Uses package name conventions.
10189 For example, <code>com.sun.hotspot.bar</code>
10190 </description>
10191 </field>
10192 <field id="short_description">
10193 <allocfieldbuf><char/></allocfieldbuf>
10194 <description>
10195 A one sentence description of the event, encoded as a
10196 <internallink id="mUTF">modified UTF-8</internallink> string.
10197 </description>
10198 </field>
10199 <field id="param_count">
10200 <jint/>
10201 <description>
10202 The number of parameters excluding <code>jvmtiEnv *jvmti_env</code>
10203 </description>
10204 </field>
10205 <field id="params">
10206 <allocfieldbuf outcount="param_count">
10207 <struct>jvmtiParamInfo</struct>
10208 </allocfieldbuf>
10209 <description>
10210 Array of
10211 <fieldlink id="param_count" struct="jvmtiExtensionEventInfo"></fieldlink>
10212 parameters (<code>jvmtiEnv *jvmti_env</code> excluded)
10213 </description>
10214 </field>
10215 </typedef>
10216
10217 <description>
10218 Returns the set of extension events.
10219 </description>
10220 <origin>new</origin>
10221 <capabilities>
10222 </capabilities>
10223 <parameters>
10224 <param id="extension_count_ptr">
10225 <outptr><jint/></outptr>
10226 <description>
10227 On return, points to the number of extension events
10228 </description>
10229 </param>
10230 <param id="extensions">
10231 <allocbuf outcount="extension_count_ptr"><struct>jvmtiExtensionEventInfo</struct></allocbuf>
10232 <description>
10233 Returns an array of extension event info, one per event
10234 </description>
10235 </param>
10236 </parameters>
10237 <errors>
10238 </errors>
10239 </function>
10240
10241 <callback id="jvmtiExtensionEvent">
10242 <void/>
10243 <synopsis>Extension Event</synopsis>
10244 <description>
10245 This is the implementation-specific event.
10246 The event handler is set with
10247 <functionlink id="SetExtensionEventCallback"/>.
10248 <p/>
10249 Event handlers for extension events must be declared varargs to match this definition.
10250 Failure to do so could result in calling convention mismatch and undefined behavior
10251 on some platforms.
10252 <p/>
10253 For example, if the <code>jvmtiParamInfo</code>
10254 returned by <functionlink id="GetExtensionEvents"/> indicates that
10255 there is a <code>jint</code> parameter, the event handler should be
10256 declared:
10257 <example>
10258 void JNICALL myHandler(jvmtiEnv* jvmti_env, ...)
10259 </example>
10260 Note the terminal "<code>...</code>" which indicates varargs.
10261 The <code>jint</code> argument inside <code>myHandler</code> needs to be extracted using
10262 the <code>va_*</code> syntax of the C programming language.
10263 </description>
10264 <parameters>
10265 <param id="jvmti_env">
10266 <outptr>
10267 <struct>jvmtiEnv</struct>
10268 </outptr>
10269 <description>
10270 The <jvmti/> environment is the only fixed parameter for extension events.
10271 </description>
10272 </param>
10273 <param id="...">
10274 <varargs/>
10275 <description>
10276 The extension event-specific parameters
10277 </description>
10278 </param>
10279 </parameters>
10280 </callback>
10281
10282 <function id="SetExtensionEventCallback" phase="onload" num="126">
10283 <synopsis>Set Extension Event Callback</synopsis>
10284
10285 <description>
10286 Sets the callback function for an extension event and
10287 enables the event. Or, if the callback is null, disables
10288 the event. Note that unlike standard events, setting
10289 the callback and enabling the event are a single operation.
10290 </description>
10291 <origin>new</origin>
10292 <capabilities>
10293 </capabilities>
10294 <parameters>
10295 <param id="extension_event_index">
10296 <jint/>
10297 <description>
10298 Identifies which callback to set.
10299 This index is the
10300 <fieldlink id="extension_event_index" struct="jvmtiExtensionEventInfo"></fieldlink>
10301 field of
10302 <datalink id="jvmtiExtensionEventInfo"/>.
10303 </description>
10304 </param>
10305 <param id="callback">
10306 <ptrtype>
10307 <struct>jvmtiExtensionEvent</struct>
10308 <nullok>disable the event</nullok>
10309 </ptrtype>
10310 <description>
10311 If <code>callback</code> is non-null,
10312 set <code>callback</code> to be the event callback function
10313 and enable the event.
10314 </description>
10315 </param>
10316 </parameters>
10317 <errors>
10318 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
10319 <paramlink id="extension_event_index"/> is not an
10320 <fieldlink id="extension_event_index"
10321 struct="jvmtiExtensionEventInfo"/>
10322 returned by
10323 <functionlink id="GetExtensionEvents"/>
10324 </error>
10325 </errors>
10326 </function>
10327
10328 </category>
10329
10330 <category id="capability" label="Capability">
10331
10332 <intro>
10333 The capabilities functions allow you to change the
10334 functionality available to <jvmti/>--that is,
10335 which <jvmti/>
10336 functions can be called, what events can be generated,
10337 and what functionality these events and functions can
10338 provide.
10339 <p/>
10340 The "Capabilities" section of each function and event describe which
10341 capabilities, if any, they are associated with. "Required Functionality"
10342 means it is available for use and no capabilities must be added to use it.
10343 "Optional Functionality" means the agent must possess the capability
10344 before it can be used.
10345 To possess a capability, the agent must
10346 <functionlink id="AddCapabilities">add the capability</functionlink>.
10347 "Optional Features" describe capabilities which,
10348 if added, extend the feature set.
10349 <p/>
10350 The potentially available capabilities of each <jvmti/> implementation are different.
10351 Depending on the implementation, a capability:
10352 <ul>
10353 <li>may never be added</li>
10354 <li>may be added in either the <code>OnLoad</code> or live phase in any environment</li>
10355 <li>may be added only during the <code>OnLoad</code> phase</li>
10356 <li>may be possessed by only one environment at a time</li>
10357 <li>may be possessed by only one environment at a time,
10358 and only during the <code>OnLoad</code> phase</li>
10359 <li>and so on ...</li>
10360 </ul>
10361 Frequently, the addition of a capability may incur a cost in execution speed, start up
10362 time, and/or memory footprint. Note that the overhead of using a capability
10363 is completely different than the overhead of possessing a capability.
10364 Take single stepping as an example. When single stepping is on (that
10365 is, when the event is enabled and thus actively sending events)
10366 the overhead of sending and processing an event
10367 on each instruction is huge in any implementation.
10368 However, the overhead of possessing the capability may be small or large,
10369 depending on the implementation. Also, when and if a capability is potentially
10370 available depends on the implementation. Some examples:
10371 <ul>
10372 <li>One VM might perform all execution by compiling bytecodes into
10373 native code and be unable to generate single step instructions.
10374 In this implementation the capability can not be added.</li>
10375 <li>Another VM may be able to switch execution to a single stepping
10376 interpreter at any time. In this implementation, having the capability has no
10377 overhead and could be added at any time.</li>
10378 <li>Yet another VM might be able to choose a bytecode compiling or single stepping capable interpreted
10379 execution engine at start up, but be unable to switch between them.
10380 In this implementation the capability would need to be added
10381 during the <code>OnLoad</code> phase (before bytecode
10382 execution begins) and would have a large impact on execution speed
10383 even if single stepping was never used.</li>
10384 <li>Still another VM might be able to add an "is single stepping on" check
10385 into compiled bytecodes or a generated interpreter. Again in this implementation
10386 the capability would need to be added during the <code>OnLoad</code> phase but the overhead (a test
10387 and branch on each instruction) would be considerably less.</li>
10388 </ul>
10389 <p/>
10390 Each <jvmti/> <internallink id="environments">environment</internallink>
10391 has its own set of capabilities.
10392 Initially, that set is empty.
10393 Any desired capability must be added.
10394 If possible, capabilities should be added during the <code>OnLoad</code> phase. For most
10395 virtual machines certain capabilities require special set up for
10396 the virtual machine and this set up must happen
10397 during the <code>OnLoad</code> phase, before the virtual machine begins execution.
10398 Once a capability is added, it can
10399 only be removed if explicitly relinquished by the environment.
10400 <p/>
10401 The agent can,
10402 <functionlink id="GetPotentialCapabilities">determine what
10403 capabilities this VM can potentially provide</functionlink>,
10404 <functionlink id="AddCapabilities">add the capabilities
10405 to be used</functionlink>,
10406 <functionlink id="RelinquishCapabilities">release capabilities
10407 which are no longer needed</functionlink>, and
10408 <functionlink id="GetCapabilities">examine the currently available
10409 capabilities</functionlink>.
10410 </intro>
10411
10412 <intro id="capabilityExamples" label="Capability Examples">
10413 For example, a freshly started agent (in the <code>OnLoad</code> function)
10414 wants to enable all possible capabilities.
10415 Note that, in general, this is not advisable as the agent may suffer
10416 a performance penalty for functionality it is not using.
10417 The code might look like this in C:
10418 <example>
10419 jvmtiCapabilities capa;
10420 jvmtiError err;
10421
10422 err = (*jvmti)->GetPotentialCapabilities(jvmti, &capa);
10423 if (err == JVMTI_ERROR_NONE) {
10424 err = (*jvmti)->AddCapabilities(jvmti, &capa);
10425 </example>
10426 For example, if an agent wants to check if it can get
10427 the bytecodes of a method (that is, it wants to check
10428 if it previously added this capability and has not
10429 relinquished it), the code might
10430 look like this in C:
10431 <example>
10432 jvmtiCapabilities capa;
10433 jvmtiError err;
10434
10435 err = (*jvmti)->GetCapabilities(jvmti, &capa);
10436 if (err == JVMTI_ERROR_NONE) {
10437 if (capa.can_get_bytecodes) { ... } }
10438 </example>
10439 </intro>
10440
10441 <capabilitiestypedef id="jvmtiCapabilities" label="The Capabilities Structure">
10442 <description>
10443 The functions in this category use this capabilities structure
10444 which contains boolean flags corresponding to each capability:
10445 </description>
10446 <capabilityfield id="can_tag_objects">
10447 <description>
10448 Can set and get tags, as described in the
10449 <internallink id="Heap">Heap category</internallink>.
10450 </description>
10451 </capabilityfield>
10452 <capabilityfield id="can_generate_field_modification_events">
10453 <description>
10454 Can set watchpoints on field modification -
10455 <functionlink id="SetFieldModificationWatch"></functionlink>
10456 </description>
10457 </capabilityfield>
10458 <capabilityfield id="can_generate_field_access_events">
10459 <description>
10460 Can set watchpoints on field access -
10461 <functionlink id="SetFieldAccessWatch"></functionlink>
10462 </description>
10463 </capabilityfield>
10464 <capabilityfield id="can_get_bytecodes">
10465 <description>
10466 Can get bytecodes of a method <functionlink id="GetBytecodes"></functionlink>
10467 </description>
10468 </capabilityfield>
10469 <capabilityfield id="can_get_synthetic_attribute">
10470 <description>
10471 Can test if a field or method is synthetic -
10472 <functionlink id="IsFieldSynthetic"></functionlink> and
10473 <functionlink id="IsMethodSynthetic"></functionlink>
10474 </description>
10475 </capabilityfield>
10476 <capabilityfield id="can_get_owned_monitor_info">
10477 <description>
10478 Can get information about ownership of monitors -
10479 <functionlink id="GetOwnedMonitorInfo"></functionlink>
10480 </description>
10481 </capabilityfield>
10482 <capabilityfield id="can_get_current_contended_monitor">
10483 <description>
10484 Can <functionlink id="GetCurrentContendedMonitor"></functionlink>
10485 </description>
10486 </capabilityfield>
10487 <capabilityfield id="can_get_monitor_info">
10488 <description>
10489 Can <functionlink id="GetObjectMonitorUsage"></functionlink>
10490 </description>
10491 </capabilityfield>
10492 <capabilityfield id="can_pop_frame">
10493 <description>
10494 Can pop frames off the stack - <functionlink id="PopFrame"></functionlink>
10495 </description>
10496 </capabilityfield>
10497 <capabilityfield id="can_redefine_classes">
10498 <description>
10499 Can redefine classes with <functionlink id="RedefineClasses"/>.
10500 </description>
10501 </capabilityfield>
10502 <capabilityfield id="can_signal_thread">
10503 <description>
10504 Can send stop or interrupt to threads
10505 </description>
10506 </capabilityfield>
10507 <capabilityfield id="can_get_source_file_name">
10508 <description>
10509 Can get the source file name of a class
10510 </description>
10511 </capabilityfield>
10512 <capabilityfield id="can_get_line_numbers">
10513 <description>
10514 Can get the line number table of a method
10515 </description>
10516 </capabilityfield>
10517 <capabilityfield id="can_get_source_debug_extension">
10518 <description>
10519 Can get the source debug extension of a class
10520 </description>
10521 </capabilityfield>
10522 <capabilityfield id="can_access_local_variables">
10523 <description>
10524 Can set and get local variables
10525 </description>
10526 </capabilityfield>
10527 <capabilityfield id="can_maintain_original_method_order">
10528 <description>
10529 Can return methods in the order they occur in the class file
10530 </description>
10531 </capabilityfield>
10532 <capabilityfield id="can_generate_single_step_events">
10533 <description>
10534 Can get <eventlink id="SingleStep">single step</eventlink> events
10535 </description>
10536 </capabilityfield>
10537 <capabilityfield id="can_generate_exception_events">
10538 <description>
10539 Can get <eventlink id="Exception">exception thrown</eventlink> and
10540 <eventlink id="ExceptionCatch">exception catch</eventlink> events
10541 </description>
10542 </capabilityfield>
10543 <capabilityfield id="can_generate_frame_pop_events">
10544 <description>
10545 Can <functionlink id="NotifyFramePop">set</functionlink> and thus get
10546 <eventlink id="FramePop"></eventlink> events
10547 </description>
10548 </capabilityfield>
10549 <capabilityfield id="can_generate_breakpoint_events">
10550 <description>
10551 Can <functionlink id="SetBreakpoint">set</functionlink> and thus get
10552 <eventlink id="Breakpoint"></eventlink> events
10553 </description>
10554 </capabilityfield>
10555 <capabilityfield id="can_suspend">
10556 <description>
10557 Can suspend and resume threads
10558 </description>
10559 </capabilityfield>
10560 <capabilityfield id="can_redefine_any_class">
10561 <description>
10562 <functionlink id="RedefineClasses"/> can be called on any modifiable class.
10563 See <functionlink id="IsModifiableClass"/>.
10564 (<fieldlink id="can_redefine_classes" struct="jvmtiCapabilities"/>
10565 must also be set)
10566 </description>
10567 </capabilityfield>
10568 <capabilityfield id="can_get_current_thread_cpu_time">
10569 <description>
10570 Can <functionlink id="GetCurrentThreadCpuTime">get</functionlink>
10571 current thread CPU time
10572 </description>
10573 </capabilityfield>
10574 <capabilityfield id="can_get_thread_cpu_time">
10575 <description>
10576 Can <functionlink id="GetThreadCpuTime">get</functionlink>
10577 thread CPU time
10578 </description>
10579 </capabilityfield>
10580 <capabilityfield id="can_generate_method_entry_events"
10581 disp1="can_generate" disp2="_method_entry_events"
10582 >
10583 <description>
10584 Can generate method entry events on entering a method
10585 </description>
10586 </capabilityfield>
10587 <capabilityfield id="can_generate_method_exit_events"
10588 disp1="can_generate" disp2="_method_exit_events"
10589 >
10590 <description>
10591 Can generate method exit events on leaving a method
10592 </description>
10593 </capabilityfield>
10594 <capabilityfield id="can_generate_all_class_hook_events"
10595 disp1="can_generate" disp2="_all_class_hook_events"
10596 >
10597 <description>
10598 Can generate ClassFileLoadHook events for every loaded class.
10599 </description>
10600 </capabilityfield>
10601 <capabilityfield id="can_generate_compiled_method_load_events"
10602 disp1="can_generate" disp2="_compiled_method_load_events"
10603 >
10604 <description>
10605 Can generate events when a method is compiled or unloaded
10606 </description>
10607 </capabilityfield>
10608 <capabilityfield id="can_generate_monitor_events"
10609 disp1="can_generate" disp2="_monitor_events"
10610 >
10611 <description>
10612 Can generate events on monitor activity
10613 </description>
10614 </capabilityfield>
10615 <capabilityfield id="can_generate_vm_object_alloc_events"
10616 disp1="can_generate" disp2="_vm_object_alloc_events"
10617 >
10618 <description>
10619 Can generate events on VM allocation of an object
10620 </description>
10621 </capabilityfield>
10622 <capabilityfield id="can_generate_native_method_bind_events"
10623 disp1="can_generate" disp2="_native_method_bind_events"
10624 >
10625 <description>
10626 Can generate events when a native method is bound to its
10627 implementation
10628 </description>
10629 </capabilityfield>
10630 <capabilityfield id="can_generate_garbage_collection_events"
10631 disp1="can_generate" disp2="_garbage_collection_events"
10632 >
10633 <description>
10634 Can generate events when garbage collection begins or ends
10635 </description>
10636 </capabilityfield>
10637 <capabilityfield id="can_generate_object_free_events"
10638 disp1="can_generate" disp2="_object_free_events"
10639 >
10640 <description>
10641 Can generate events when the garbage collector frees an object
10642 </description>
10643 </capabilityfield>
10644 <capabilityfield id="can_force_early_return" since="1.1">
10645 <description>
10646 Can return early from a method, as described in the
10647 <internallink id="ForceEarlyReturn">Force Early Return category</internallink>.
10648 </description>
10649 </capabilityfield>
10650 <capabilityfield id="can_get_owned_monitor_stack_depth_info" since="1.1">
10651 <description>
10652 Can get information about owned monitors with stack depth -
10653 <functionlink id="GetOwnedMonitorStackDepthInfo"></functionlink>
10654 </description>
10655 </capabilityfield>
10656 <capabilityfield id="can_get_constant_pool" since="1.1">
10657 <description>
10658 Can get the constant pool of a class -
10659 <functionlink id="GetConstantPool"></functionlink>
10660 </description>
10661 </capabilityfield>
10662 <capabilityfield id="can_set_native_method_prefix" since="1.1">
10663 <description>
10664 Can set prefix to be applied when native method cannot be resolved -
10665 <functionlink id="SetNativeMethodPrefix"/> and
10666 <functionlink id="SetNativeMethodPrefixes"/>
10667 </description>
10668 </capabilityfield>
10669 <capabilityfield id="can_retransform_classes" since="1.1">
10670 <description>
10671 Can retransform classes with <functionlink id="RetransformClasses"/>.
10672 In addition to the restrictions imposed by the specific
10673 implementation on this capability (see the
10674 <internallink id="capability">Capability</internallink> section),
10675 this capability must be set before the
10676 <eventlink id="ClassFileLoadHook"/> event is enabled for the
10677 first time in this environment.
10678 An environment that possesses this capability at the time that
10679 <code>ClassFileLoadHook</code> is enabled for the first time is
10680 said to be <i>retransformation capable</i>.
10681 An environment that does not possess this capability at the time that
10682 <code>ClassFileLoadHook</code> is enabled for the first time is
10683 said to be <i>retransformation incapable</i>.
10684 </description>
10685 </capabilityfield>
10686 <capabilityfield id="can_retransform_any_class" since="1.1">
10687 <description>
10688 <functionlink id="RetransformClasses"/> can be called on any modifiable class.
10689 See <functionlink id="IsModifiableClass"/>.
10690 (<fieldlink id="can_retransform_classes" struct="jvmtiCapabilities"/>
10691 must also be set)
10692 </description>
10693 </capabilityfield>
10694 <capabilityfield id="can_generate_resource_exhaustion_heap_events" since="1.1">
10695 <description>
10696 Can generate events when the VM is unable to allocate memory from
10697 the <tm>Java</tm> platform heap.
10698 See <eventlink id="ResourceExhausted"/>.
10699 </description>
10700 </capabilityfield>
10701 <capabilityfield id="can_generate_resource_exhaustion_threads_events" since="1.1">
10702 <description>
10703 Can generate events when the VM is unable to create a thread.
10704 See <eventlink id="ResourceExhausted"/>.
10705 </description>
10706 </capabilityfield>
10707 <capabilityfield id="can_generate_early_vmstart" since="9">
10708 <description>
10709 Can generate the <code>VMStart</code> event early.
10710 See <eventlink id="VMStart"/>.
10711 </description>
10712 </capabilityfield>
10713 <capabilityfield id="can_generate_early_class_hook_events" since="9">
10714 <description>
10715 Can generate the <eventlink id="ClassFileLoadHook"/> events
10716 in the primordial phase. If this capability and
10717 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
10718 <code>can_generate_all_class_hook_events</code></internallink>
10719 are enabled then the <eventlink id="ClassFileLoadHook"/> events
10720 can be posted for classes loaded in the primordial phase.
10721 See <eventlink id="ClassFileLoadHook"/>.
10722 </description>
10723 </capabilityfield>
10724 <capabilityfield id="can_generate_sampled_object_alloc_events" since="11">
10725 <description>
10726 Can generate sampled allocation events.
10727 If this capability is enabled then the heap sampling method
10728 <functionlink id="SetHeapSamplingInterval"></functionlink> can be
10729 called and <eventlink id="SampledObjectAlloc"></eventlink> events can be generated.
10730 </description>
10731 </capabilityfield>
10732 <capabilityfield id="can_support_virtual_threads" since="21">
10733 <description>
10734 Can support virtual threads.
10735 If this capability is enabled then the following functions can be called:
10736 <functionlink id="SuspendAllVirtualThreads"></functionlink>,
10737 <functionlink id="ResumeAllVirtualThreads"></functionlink>,
10738 and the following events can be enabled:
10739 <eventlink id="VirtualThreadStart"></eventlink>,
10740 <eventlink id="VirtualThreadEnd"></eventlink>.
10741 </description>
10742 </capabilityfield>
10743 <capabilityfield id="can_support_value_objects" since="28">
10744 <description>
10745 Can support value objects.
10746 When preview features are enabled and this capability is enabled, then
10747 events are sent for value objects when the following two events are enabled:
10748 <eventlink id="VMObjectAlloc"></eventlink>,
10749 <eventlink id="SampledObjectAlloc"></eventlink>.
10750 <b> can_support_value_objects is a preview API of the Java platform. </b>
10751 <i>Preview features may be removed in a future release, or upgraded to
10752 permanent features of the Java platform.</i>
10753 </description>
10754 </capabilityfield>
10755 </capabilitiestypedef>
10756
10757 <function id="GetPotentialCapabilities" jkernel="yes" phase="onload" num="140">
10758 <synopsis>Get Potential Capabilities</synopsis>
10759 <description>
10760 Returns via <paramlink id="capabilities_ptr"></paramlink> the <jvmti/>
10761 features that can potentially be possessed by this environment
10762 at this time.
10763 The returned capabilities differ from the complete set of capabilities
10764 implemented by the VM in two cases: another environment possesses
10765 capabilities that can only be possessed by one environment, or the
10766 current <functionlink id="GetPhase">phase</functionlink> is live,
10767 and certain capabilities can only be added during the <code>OnLoad</code> phase.
10768 The <functionlink id="AddCapabilities"></functionlink> function
10769 may be used to set any or all or these capabilities.
10770 Currently possessed capabilities are included.
10771 <p/>
10772 Typically this function is used in the <code>OnLoad</code> function.
10773 Some virtual machines may allow a limited set of capabilities to be
10774 added in the live phase.
10775 In this case, the set of potentially available capabilities
10776 will likely differ from the <code>OnLoad</code> phase set.
10777 <p/>
10778 See the
10779 <internallink id="capabilityExamples">Capability Examples</internallink>.
10780 </description>
10781 <origin>new</origin>
10782 <capabilities>
10783 </capabilities>
10784 <parameters>
10785 <param id="capabilities_ptr">
10786 <outptr><struct>jvmtiCapabilities</struct></outptr>
10787 <description>
10788 On return, points to the <jvmti/> capabilities that may be added.
10789 </description>
10790 </param>
10791 </parameters>
10792 <errors>
10793 </errors>
10794 </function>
10795
10796 <elide>
10797 <function id="EstimateCostOfCapabilities" phase="onload" num="141">
10798 <synopsis>Estimate Cost Of Capabilities</synopsis>
10799 <description>
10800 <issue>There is strong opposition to this function. The concern is
10801 that it would be difficult or impossible to provide meaningful
10802 numbers, as the amount of impact is conditional on many factors
10803 that a single number could not represent. There is doubt that
10804 conditional implementations would be used or are even a good idea.
10805 The thought is that release documentation for the implementation
10806 would be the best means of exposing this information.
10807 Unless new arguments are presented, I intend to remove this
10808 function in the next revision.
10809 </issue>
10810 <p/>
10811 Return via the <paramlink id="time_impact_ptr"></paramlink> and
10812 <paramlink id="space_impact_ptr"></paramlink> an estimate of the impact
10813 of adding the capabilities pointed to by
10814 <paramlink id="capabilities_ptr"></paramlink>.
10815 The returned estimates are in percentage of additional overhead, thus
10816 a time impact of 100 mean the application might run
10817 at half the speed.
10818 The estimates are very rough approximations and are not guaranteed.
10819 Note also, that the estimates are of the impact of having the
10820 capability available--when and if it is used the impact may be
10821 much greater.
10822 Estimates can be for a single capability or for a set of
10823 capabilities. Note that the costs are not necessarily additive,
10824 adding support for one capability might make another available
10825 for free or conversely having two capabilities at once may
10826 have multiplicative impact.
10827 Estimates are relative to the current set of capabilities -
10828 that is, how much more impact given the currently possessed capabilities.
10829 <p/>
10830 Typically this function is used in the OnLoad function,
10831 some virtual machines may allow a limited set of capabilities to be
10832 added in the live phase.
10833 In this case, the set of potentially available capabilities
10834 will likely differ from the OnLoad phase set.
10835 <p/>
10836 See the
10837 <internallink id="capabilityExamples">Capability Examples</internallink>.
10838 </description>
10839 <origin>new</origin>
10840 <capabilities>
10841 </capabilities>
10842 <parameters>
10843 <param id="capabilities_ptr">
10844 <inptr><struct>jvmtiCapabilities</struct></inptr>
10845 <description>
10846 points to the <jvmti/> capabilities to evaluate.
10847 </description>
10848 </param>
10849 <param id="time_impact_ptr">
10850 <outptr><jint/></outptr>
10851 <description>
10852 On return, points to the estimated percentage increase in
10853 run time if this capability was added.
10854 </description>
10855 </param>
10856 <param id="space_impact_ptr">
10857 <outptr><jint/></outptr>
10858 <description>
10859 On return, points to the estimated percentage increase in
10860 memory space used if this capability was added.
10861 </description>
10862 </param>
10863 </parameters>
10864 <errors>
10865 <error id="JVMTI_ERROR_NOT_AVAILABLE">
10866 The desired capabilities are not even potentially available.
10867 </error>
10868 </errors>
10869 </function>
10870 </elide>
10871
10872 <function id="AddCapabilities" jkernel="yes" phase="onload" num="142">
10873 <synopsis>Add Capabilities</synopsis>
10874 <description>
10875 Set new capabilities by adding the capabilities
10876 whose values are set to one (<code>1</code>) in
10877 <code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10878 All previous capabilities are retained.
10879 Typically this function is used in the <code>OnLoad</code> function.
10880 Some virtual machines may allow a limited set of capabilities to be
10881 added in the live phase.
10882 <p/>
10883 See the
10884 <internallink id="capabilityExamples">Capability Examples</internallink>.
10885 </description>
10886 <origin>new</origin>
10887 <capabilities>
10888 </capabilities>
10889 <parameters>
10890 <param id="capabilities_ptr">
10891 <inptr><struct>jvmtiCapabilities</struct></inptr>
10892 <description>
10893 Points to the <jvmti/> capabilities to add.
10894 </description>
10895 </param>
10896 </parameters>
10897 <errors>
10898 <error id="JVMTI_ERROR_NOT_AVAILABLE">
10899 The desired capabilities are not even potentially available.
10900 </error>
10901 </errors>
10902 </function>
10903
10904
10905 <function id="RelinquishCapabilities" phase="onload" num="143">
10906 <synopsis>Relinquish Capabilities</synopsis>
10907 <description>
10908 Relinquish the capabilities
10909 whose values are set to one (<code>1</code>) in
10910 <code>*</code><paramlink id="capabilities_ptr"></paramlink>.
10911 Some implementations may allow only one environment to have a capability
10912 (see the <internallink id="capability">capability introduction</internallink>).
10913 This function releases capabilities
10914 so that they may be used by other agents.
10915 All other capabilities are retained.
10916 The capability will no longer be present in <functionlink id="GetCapabilities"></functionlink>.
10917 Attempting to relinquish a capability that the agent does not possess is not an error.
10918 <issue>
10919 It is possible for the agent to be actively using capabilities
10920 which are being relinquished. For example, a thread is currently
10921 suspended and can_suspend is being relinquished or an event is currently
10922 enabled and can_generate_whatever is being relinquished.
10923 There are three possible ways we could spec this:
10924 <ul>
10925 <li>relinquish automatically releases them</li>
10926 <li>relinquish checks and returns some error code if held</li>
10927 <li>it is the agent's responsibility and it is not checked</li>
10928 </ul>
10929 One of these should be chosen.
10930 </issue>
10931 </description>
10932 <origin>new</origin>
10933 <capabilities>
10934 </capabilities>
10935 <parameters>
10936 <param id="capabilities_ptr">
10937 <inptr><struct>jvmtiCapabilities</struct></inptr>
10938 <description>
10939 Points to the <jvmti/> capabilities to relinquish.
10940 </description>
10941 </param>
10942 </parameters>
10943 <errors>
10944 </errors>
10945 </function>
10946
10947
10948
10949 <function id="GetCapabilities" jkernel="yes" phase="any" num="89">
10950 <synopsis>Get Capabilities</synopsis>
10951 <description>
10952 Returns via <paramlink id="capabilities_ptr"></paramlink> the optional <jvmti/>
10953 features which this environment currently possesses.
10954 Each possessed capability is indicated by a one (<code>1</code>) in the
10955 corresponding field of the <internallink id="jvmtiCapabilities">capabilities
10956 structure</internallink>.
10957 An environment does not possess a capability unless it has been successfully added with
10958 <functionlink id="AddCapabilities"/>.
10959 An environment only loses possession of a capability if it has been relinquished with
10960 <functionlink id="RelinquishCapabilities"/>. Thus, this function returns the net result
10961 of the <code>AddCapabilities</code> and <code>RelinquishCapabilities</code> calls which
10962 have been made.
10963 <p/>
10964 See the
10965 <internallink id="capabilityExamples">Capability Examples</internallink>.
10966 </description>
10967 <origin>jvmdiClone</origin>
10968 <capabilities>
10969 </capabilities>
10970 <parameters>
10971 <param id="capabilities_ptr">
10972 <outptr><struct>jvmtiCapabilities</struct></outptr>
10973 <description>
10974 On return, points to the <jvmti/> capabilities.
10975 </description>
10976 </param>
10977 </parameters>
10978 <errors>
10979 </errors>
10980 </function>
10981
10982 </category>
10983
10984
10985 <category id="timers" label="Timers">
10986
10987 <intro>
10988 These functions provide timing information.
10989 The resolution at which the time is updated is not specified.
10990 They provides nanosecond precision, but not necessarily nanosecond accuracy.
10991 Details about the timers, such as their maximum values, can be accessed with
10992 the timer information functions.
10993 </intro>
10994
10995 <typedef id="jvmtiTimerInfo" label="Timer Info">
10996 <description>
10997 The information function for each timer returns this data structure.
10998 </description>
10999 <field id="max_value">
11000 <jlong/>
11001 <description>
11002 The maximum value the timer can reach.
11003 After this value is reached the timer wraps back to zero.
11004 This is an unsigned value. If tested or printed as a jlong (signed value)
11005 it may appear to be a negative number.
11006 </description>
11007 </field>
11008 <field id="may_skip_forward">
11009 <jboolean/>
11010 <description>
11011 If true, the timer can be externally adjusted and as a result skip forward.
11012 If false, the timer value will never increase faster than real time.
11013 </description>
11014 </field>
11015 <field id="may_skip_backward">
11016 <jboolean/>
11017 <description>
11018 If true, the timer can be externally adjusted and as a result skip backward.
11019 If false, the timer value will be monotonically increasing.
11020 </description>
11021 </field>
11022 <field id="kind">
11023 <enum>jvmtiTimerKind</enum>
11024 <description>
11025 The kind of timer.
11026 On a platform that does not distinguish between user and system time, <datalink
11027 id="JVMTI_TIMER_TOTAL_CPU"><code>JVMTI_TIMER_TOTAL_CPU</code></datalink>
11028 is returned.
11029 </description>
11030 </field>
11031 <field id="reserved1">
11032 <jlong/>
11033 <description>
11034 Reserved for future use.
11035 </description>
11036 </field>
11037 <field id="reserved2">
11038 <jlong/>
11039 <description>
11040 Reserved for future use.
11041 </description>
11042 </field>
11043 </typedef>
11044
11045 <intro>
11046 Where the timer kind is --
11047
11048 <constants id="jvmtiTimerKind" label="Timer Kinds" kind="enum">
11049 <constant id="JVMTI_TIMER_USER_CPU" num="30">
11050 CPU time that a thread is in user mode.
11051 </constant>
11052 <constant id="JVMTI_TIMER_TOTAL_CPU" num="31">
11053 CPU time that a thread is in user or system mode.
11054 </constant>
11055 <constant id="JVMTI_TIMER_ELAPSED" num="32">
11056 Elapsed time.
11057 </constant>
11058 </constants>
11059 </intro>
11060
11061 <function id="GetCurrentThreadCpuTimerInfo" callbacksafe="safe" impl="innative notrace" phase="start" num="134">
11062 <synopsis>Get Current Thread CPU Timer Information</synopsis>
11063 <description>
11064 Get information about the
11065 <functionlink id="GetCurrentThreadCpuTime"/> timer.
11066 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11067 are filled in with details about the timer.
11068 This information is specific to the platform and the implementation of
11069 <functionlink id="GetCurrentThreadCpuTime"/> and thus
11070 does not vary by thread nor does it vary
11071 during a particular invocation of the VM.
11072 <p/>
11073 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
11074 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
11075 returned by <code>GetCurrentThreadCpuTimerInfo</code>
11076 and <functionlink id="GetThreadCpuTimerInfo"/>
11077 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
11078 </description>
11079 <origin>new</origin>
11080 <capabilities>
11081 <required id="can_get_current_thread_cpu_time">
11082 Can get current thread CPU time.
11083 </required>
11084 </capabilities>
11085 <parameters>
11086 <param id="info_ptr">
11087 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11088 <description>
11089 On return, filled with information describing the time
11090 returned by <functionlink id="GetCurrentThreadCpuTime"/>.
11091 </description>
11092 </param>
11093 </parameters>
11094 <errors>
11095 </errors>
11096 </function>
11097
11098 <function id="GetCurrentThreadCpuTime" callbacksafe="safe" impl="innative notrace" phase="start" num="135">
11099 <synopsis>Get Current Thread CPU Time</synopsis>
11100 <description>
11101 Return the CPU time utilized by the current thread.
11102 <p/>
11103 Note that the <functionlink id="GetThreadCpuTime"/>
11104 function provides CPU time for any thread, including
11105 the current thread. <code>GetCurrentThreadCpuTime</code>
11106 exists to support platforms which cannot
11107 supply CPU time for threads other than the current
11108 thread or which have more accurate information for
11109 the current thread (see
11110 <functionlink id="GetCurrentThreadCpuTimerInfo"/> vs
11111 <functionlink id="GetThreadCpuTimerInfo"/>).
11112 An implementation is not required to support this function
11113 when the current thread is a virtual thread, in which case
11114 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
11115 On many platforms this call will be equivalent to:
11116 <example>
11117 GetThreadCpuTime(env, NULL, nanos_ptr)
11118 </example>
11119 </description>
11120 <origin>new</origin>
11121 <capabilities>
11122 <required id="can_get_current_thread_cpu_time">
11123 Can get current thread CPU time.
11124 <p/>
11125 If this capability is enabled after threads have started,
11126 the implementation may choose any time up
11127 to and including the time that the capability is enabled
11128 as the point where CPU time collection starts.
11129 <p/>
11130 This capability must be potentially available on any
11131 platform where
11132 <internallink id="jvmtiCapabilities.can_get_thread_cpu_time"><code>can_get_thread_cpu_time</code></internallink>
11133 is potentially available.
11134 </required>
11135 </capabilities>
11136 <parameters>
11137 <param id="nanos_ptr">
11138 <outptr><jlong/></outptr>
11139 <description>
11140 On return, points to the CPU time used by this thread
11141 in nanoseconds.
11142 This is an unsigned value. If tested or printed as a jlong (signed value)
11143 it may appear to be a negative number.
11144 </description>
11145 </param>
11146 </parameters>
11147 <errors>
11148 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
11149 The current thread is a virtual thread and the implementation does not support
11150 getting the current thread CPU time when the current thread is a virtual thread.
11151 </error>
11152 </errors>
11153 </function>
11154
11155 <function id="GetThreadCpuTimerInfo" num="136">
11156 <synopsis>Get Thread CPU Timer Information</synopsis>
11157 <description>
11158 Get information about the
11159 <functionlink id="GetThreadCpuTime"/> timer.
11160 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11161 are filled in with details about the timer.
11162 This information is specific to the platform and the implementation of
11163 <functionlink id="GetThreadCpuTime"/> and thus
11164 does not vary by thread nor does it vary
11165 during a particular invocation of the VM.
11166 <p/>
11167 Note that the implementations of <functionlink id="GetCurrentThreadCpuTime"/>
11168 and <functionlink id="GetThreadCpuTime"/> may differ, and thus the values
11169 returned by <functionlink id="GetCurrentThreadCpuTimerInfo"/>
11170 and <code>GetThreadCpuTimerInfo</code>
11171 may differ -- see <functionlink id="GetCurrentThreadCpuTime"/> for more information.
11172 </description>
11173 <origin>new</origin>
11174 <capabilities>
11175 <required id="can_get_thread_cpu_time">
11176 Can get thread CPU time.
11177 </required>
11178 </capabilities>
11179 <parameters>
11180 <param id="info_ptr">
11181 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11182 <description>
11183 On return, filled with information describing the time
11184 returned by <functionlink id="GetThreadCpuTime"/>.
11185 </description>
11186 </param>
11187 </parameters>
11188 <errors>
11189 </errors>
11190 </function>
11191
11192 <function id="GetThreadCpuTime" num="137">
11193 <synopsis>Get Thread CPU Time</synopsis>
11194 <description>
11195 Return the CPU time utilized by the specified thread.
11196 <p/>
11197 Get information about this timer with
11198 <functionlink id="GetThreadCpuTimerInfo"/>.
11199 </description>
11200 <origin>new</origin>
11201 <capabilities>
11202 <required id="can_get_thread_cpu_time">
11203 Can get thread CPU time.
11204 <p/>
11205 If this capability is enabled after threads have started,
11206 the implementation may choose any time up
11207 to and including the time that the capability is enabled
11208 as the point where CPU time collection starts.
11209 </required>
11210 </capabilities>
11211 <parameters>
11212 <param id="thread">
11213 <jthread null="current" impl="noconvert"/>
11214 <description>
11215 The thread to query.
11216 An implementation is not required to support this function
11217 when the given thread is a virtual thread, in which case
11218 <errorlink id="JVMTI_ERROR_UNSUPPORTED_OPERATION"></errorlink> will be returned.
11219 </description>
11220 </param>
11221 <param id="nanos_ptr">
11222 <outptr impl="nonullcheck"><jlong/></outptr>
11223 <description>
11224 On return, points to the CPU time used by the specified thread
11225 in nanoseconds.
11226 This is an unsigned value. If tested or printed as a jlong (signed value)
11227 it may appear to be a negative number.
11228 </description>
11229 </param>
11230 </parameters>
11231 <errors>
11232 <error id="JVMTI_ERROR_UNSUPPORTED_OPERATION">
11233 <paramlink id="thread"/> is a virtual thread and the implementation does not
11234 support getting the thread CPU time of a virtual thread.
11235 </error>
11236 </errors>
11237 </function>
11238
11239 <function id="GetTimerInfo" phase="any" callbacksafe="safe" num="138">
11240 <synopsis>Get Timer Information</synopsis>
11241 <description>
11242 Get information about the
11243 <functionlink id="GetTime"/> timer.
11244 The fields of the <datalink id="jvmtiTimerInfo"/> structure
11245 are filled in with details about the timer.
11246 This information will not change during a particular invocation of the VM.
11247 </description>
11248 <origin>new</origin>
11249 <capabilities>
11250 </capabilities>
11251 <parameters>
11252 <param id="info_ptr">
11253 <outptr><struct>jvmtiTimerInfo</struct></outptr>
11254 <description>
11255 On return, filled with information describing the time
11256 returned by <functionlink id="GetTime"/>.
11257 </description>
11258 </param>
11259 </parameters>
11260 <errors>
11261 </errors>
11262 </function>
11263
11264 <function id="GetTime" phase="any" callbacksafe="safe" num="139">
11265 <synopsis>Get Time</synopsis>
11266 <description>
11267 Return the current value of the system timer, in nanoseconds.
11268 <p/>
11269 The value returned represents nanoseconds since some fixed but
11270 arbitrary time (perhaps in the future, so values may be
11271 negative). This function provides nanosecond precision, but not
11272 necessarily nanosecond accuracy. No guarantees are made about
11273 how frequently values change.
11274 <p/>
11275 Get information about this timer with
11276 <functionlink id="GetTimerInfo"/>.
11277 </description>
11278 <origin>new</origin>
11279 <capabilities>
11280 </capabilities>
11281 <parameters>
11282 <param id="nanos_ptr">
11283 <outptr><jlong/></outptr>
11284 <description>
11285 On return, points to the time in nanoseconds.
11286 This is an unsigned value. If tested or printed as a jlong (signed value)
11287 it may appear to be a negative number.
11288 </description>
11289 </param>
11290 </parameters>
11291 <errors>
11292 </errors>
11293 </function>
11294
11295 <function id="GetAvailableProcessors" phase="any" num="144">
11296 <synopsis>Get Available Processors</synopsis>
11297 <description>
11298 Returns the number of processors available to the Java virtual machine.
11299 <p/>
11300 This value may change during a particular invocation of the virtual machine.
11301 Applications that are sensitive to the number of available processors should
11302 therefore occasionally poll this property.
11303 </description>
11304 <origin>new</origin>
11305 <capabilities>
11306 </capabilities>
11307 <parameters>
11308 <param id="processor_count_ptr">
11309 <outptr><jint/></outptr>
11310 <description>
11311 On return, points to the maximum number of processors available to the
11312 virtual machine; never smaller than one.
11313 </description>
11314 </param>
11315 </parameters>
11316 <errors>
11317 </errors>
11318 </function>
11319
11320 </category>
11321
11322
11323 <category id="classLoaderSearch" label="Class Loader Search">
11324
11325 <intro>
11326 These functions allow the agent to add to the locations that a class loader searches for a class.
11327 This is useful for installing instrumentation under the correct class loader.
11328 </intro>
11329
11330 <function id="AddToBootstrapClassLoaderSearch" jkernel="yes" phase="onload" num="149">
11331 <synopsis>Add To Bootstrap Class Loader Search</synopsis>
11332 <description>
11333 This function can be used to cause instrumentation classes to be defined by the
11334 bootstrap class loader. See <vmspec chapter="5.3.1"/>.
11335 After the bootstrap
11336 class loader unsuccessfully searches for a class, the specified platform-dependent
11337 search path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in
11338 the <paramlink id="segment"/>. This function may be called multiple times to add multiple segments,
11339 the segments will be searched in the order that this function was called.
11340 <p/>
11341 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11342 search path segment to be searched after the bootstrap class loader unsuccessfully searches
11343 for a class. The segment is typically a directory or JAR file.
11344 <p/>
11345 In the live phase the <paramlink id="segment"/> may be used to specify any platform-dependent
11346 path to a <externallink id="jar/jar.html">
11347 JAR file</externallink>. The agent should take care that the JAR file does not
11348 contain any classes or resources other than those to be defined by the bootstrap
11349 class loader for the purposes of instrumentation.
11350 <p/>
11351 <vmspec/> specifies that a subsequent attempt to resolve a symbolic
11352 reference that the Java virtual machine has previously unsuccessfully attempted
11353 to resolve always fails with the same error that was thrown as a result of the
11354 initial resolution attempt. Consequently, if the JAR file contains an entry
11355 that corresponds to a class for which the Java virtual machine has
11356 unsuccessfully attempted to resolve a reference, then subsequent attempts to
11357 resolve that reference will fail with the same error as the initial attempt.
11358 </description>
11359 <origin>new</origin>
11360 <capabilities>
11361 </capabilities>
11362 <parameters>
11363 <param id="segment">
11364 <inbuf><char/></inbuf>
11365 <description>
11366 The platform-dependent search path segment, encoded as a
11367 <internallink id="mUTF">modified UTF-8</internallink> string.
11368 </description>
11369 </param>
11370 </parameters>
11371 <errors>
11372 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11373 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11374 existing JAR file is an invalid path.
11375 </error>
11376 </errors>
11377 </function>
11378
11379 <function id="AddToSystemClassLoaderSearch" jkernel="yes" phase="onload" num="151" since="1.1">
11380 <synopsis>Add To System Class Loader Search</synopsis>
11381 <description>
11382 This function can be used to cause instrumentation classes to be
11383 defined by the system class loader. See <vmspec chapter="5.3.2"/>.
11384 After the class loader unsuccessfully searches for a class, the specified platform-dependent search
11385 path <paramlink id="segment"/> will be searched as well. Only one segment may be specified in the
11386 <paramlink id="segment"/>. This function may be called multiple times to add multiple segments, the
11387 segments will be searched in the order that this function was called.
11388 <p/>
11389 In the <code>OnLoad</code> phase the function may be used to specify any platform-dependent
11390 search path segment to be searched after the system class loader unsuccessfully searches
11391 for a class. The segment is typically a directory or JAR file.
11392 <p/>
11393 In the live phase the <paramlink id="segment"/> is a platform-dependent path to a
11394 <externallink id="jar/jar.html">JAR file</externallink> to be
11395 searched after the system class loader unsuccessfully searches for a class. The agent should
11396 take care that the JAR file does not contain any classes or resources other than those to be
11397 defined by the system class loader for the purposes of instrumentation.
11398 <p/>
11399 In the live phase the system class loader supports adding a JAR file to be searched if
11400 the system class loader implements a method name <code>appendToClassPathForInstrumentation</code>
11401 which takes a single parameter of type <code>java.lang.String</code>. The method is not required
11402 to have <code>public</code> access.
11403 <p/>
11404 <vmspec/> specifies that a subsequent attempt to resolve a symbolic
11405 reference that the Java virtual machine has previously unsuccessfully attempted
11406 to resolve always fails with the same error that was thrown as a result of the
11407 initial resolution attempt. Consequently, if the JAR file contains an entry
11408 that corresponds to a class for which the Java virtual machine has
11409 unsuccessfully attempted to resolve a reference, then subsequent attempts to
11410 resolve that reference will fail with the same error as the initial attempt.
11411 </description>
11412 <origin>new</origin>
11413 <capabilities>
11414 </capabilities>
11415 <parameters>
11416 <param id="segment">
11417 <inbuf><char/></inbuf>
11418 <description>
11419 The platform-dependent search path segment, encoded as a
11420 <internallink id="mUTF">modified UTF-8</internallink> string.
11421 </description>
11422 </param>
11423 </parameters>
11424 <errors>
11425 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11426 <paramlink id="segment"/> is an invalid path. In the live phase, anything other than an
11427 existing JAR file is an invalid path.
11428 </error>
11429 <error id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED">
11430 Operation not supported by the system class loader.
11431 </error>
11432 </errors>
11433 </function>
11434
11435 </category>
11436
11437
11438 <category id="props" label="System Properties">
11439
11440 <intro>
11441 These functions get and set system properties.
11442 </intro>
11443
11444 <function id="GetSystemProperties" phase="onload" num="130">
11445 <synopsis>Get System Properties</synopsis>
11446 <description>
11447 The list of VM system property keys which may be used with
11448 <functionlink id="GetSystemProperty"/> is returned.
11449 It is strongly recommended that virtual machines provide the
11450 following property keys:
11451 <ul>
11452 <li><code>java.vm.vendor</code></li>
11453 <li><code>java.vm.version</code></li>
11454 <li><code>java.vm.name</code></li>
11455 <li><code>java.vm.info</code></li>
11456 <li><code>java.library.path</code></li>
11457 <li><code>java.class.path</code></li>
11458 </ul>
11459 Provides access to system properties defined by and used
11460 by the VM.
11461 Properties set on the command-line are included.
11462 This allows getting and setting of these properties
11463 before the VM even begins executing bytecodes.
11464 Since this is a VM view of system properties, the set of available
11465 properties will usually be different than that
11466 in <code>java.lang.System.getProperties</code>.
11467 JNI method invocation may be used to access
11468 <code>java.lang.System.getProperties</code>.
11469 <p/>
11470 The set of properties may grow during execution.
11471 </description>
11472 <origin>new</origin>
11473 <capabilities>
11474 </capabilities>
11475 <parameters>
11476 <param id="count_ptr">
11477 <outptr><jint/></outptr>
11478 <description>
11479 On return, points to the number of property keys returned.
11480 </description>
11481 </param>
11482 <param id="property_ptr">
11483 <allocallocbuf outcount="count_ptr"><char/></allocallocbuf>
11484 <description>
11485 On return, points to an array of property keys, encoded as
11486 <internallink id="mUTF">modified UTF-8</internallink> strings.
11487 </description>
11488 </param>
11489 </parameters>
11490 <errors>
11491 </errors>
11492 </function>
11493
11494 <function id="GetSystemProperty" phase="onload" num="131">
11495 <synopsis>Get System Property</synopsis>
11496 <description>
11497 Return a VM system property value given the property key.
11498 <p/>
11499 The function <functionlink id="GetSystemProperties"/>
11500 returns the set of property keys which may be used.
11501 The properties which can be retrieved may grow during
11502 execution.
11503 <p/>
11504 Since this is a VM view of system properties, the values
11505 of properties may differ from that returned by
11506 <code>java.lang.System.getProperty(String)</code>.
11507 A typical VM might copy the values of the VM system
11508 properties into the <code>Properties</code> held by
11509 <code>java.lang.System</code> during the initialization
11510 of that class. Thereafter any changes to the VM system
11511 properties (with <functionlink id="SetSystemProperty"/>)
11512 or the <code>java.lang.System</code> system properties
11513 (with <code>java.lang.System.setProperty(String,String)</code>)
11514 would cause the values to diverge.
11515 JNI method invocation may be used to access
11516 <code>java.lang.System.getProperty(String)</code>.
11517 </description>
11518 <origin>new</origin>
11519 <capabilities>
11520 </capabilities>
11521 <parameters>
11522 <param id="property">
11523 <inbuf><char/></inbuf>
11524 <description>
11525 The key of the property to retrieve, encoded as a
11526 <internallink id="mUTF">modified UTF-8</internallink> string.
11527 </description>
11528 </param>
11529 <param id="value_ptr">
11530 <allocbuf><char/></allocbuf>
11531 <description>
11532 On return, points to the property value, encoded as a
11533 <internallink id="mUTF">modified UTF-8</internallink> string.
11534 </description>
11535 </param>
11536 </parameters>
11537 <errors>
11538 <error id="JVMTI_ERROR_NOT_AVAILABLE">
11539 This property is not available.
11540 Use <functionlink id="GetSystemProperties"/> to find available properties.
11541 </error>
11542 </errors>
11543 </function>
11544
11545 <function id="SetSystemProperty" phase="onloadOnly" num="132">
11546 <synopsis>Set System Property</synopsis>
11547 <description>
11548 Set a VM system property value.
11549 <p/>
11550 The function <functionlink id="GetSystemProperties"/>
11551 returns the set of property keys, some of these may be settable.
11552 See <functionlink id="GetSystemProperty"/>.
11553 </description>
11554 <origin>new</origin>
11555 <capabilities>
11556 </capabilities>
11557 <parameters>
11558 <param id="property">
11559 <inbuf><char/></inbuf>
11560 <description>
11561 The key of the property, encoded as a
11562 <internallink id="mUTF">modified UTF-8</internallink> string.
11563 </description>
11564 </param>
11565 <param id="value_ptr">
11566 <inbuf>
11567 <char/>
11568 <nullok>
11569 do not set the value, but return <errorlink id="JVMTI_ERROR_NOT_AVAILABLE"/>
11570 if the property is not writeable
11571 </nullok>
11572 </inbuf>
11573 <description>
11574 The property value to set, encoded as a
11575 <internallink id="mUTF">modified UTF-8</internallink> string.
11576 </description>
11577 </param>
11578 </parameters>
11579 <errors>
11580 <error id="JVMTI_ERROR_NOT_AVAILABLE">
11581 This property is not available or is not writeable.
11582 </error>
11583 </errors>
11584 </function>
11585
11586 </category>
11587
11588 <category id="general" label="General">
11589
11590 <intro>
11591 </intro>
11592
11593 <function id="GetPhase" jkernel="yes" phase="any" num="133">
11594 <synopsis>Get Phase</synopsis>
11595 <description>
11596 Return the current phase of VM execution.
11597 The phases proceed in sequence:
11598 <constants id="jvmtiPhase" label="Phases of execution" kind="enum">
11599 <constant id="JVMTI_PHASE_ONLOAD" num="1">
11600 <code>OnLoad</code> phase: while in the
11601 <internallink id="onload"><code>Agent_OnLoad</code></internallink>
11602 or, for statically linked agents, the <internallink id="onload">
11603 <code>Agent_OnLoad_<agent-lib-name>
11604 </code></internallink> function.
11605 </constant>
11606 <constant id="JVMTI_PHASE_PRIMORDIAL" num="2">
11607 Primordial phase: between return from <code>Agent_OnLoad</code>
11608 or <code>Agent_OnLoad_<agent-lib-name></code> and the
11609 <code>VMStart</code> event.
11610 </constant>
11611 <constant id="JVMTI_PHASE_START" num="6">
11612 Start phase: when the <eventlink id="VMStart"><code>VMStart</code></eventlink> event
11613 is sent and until the <code>VMInit</code> event is sent.
11614 </constant>
11615 <constant id="JVMTI_PHASE_LIVE" num="4">
11616 Live phase: when the <eventlink id="VMInit"><code>VMInit</code></eventlink> event is sent
11617 and until the <eventlink id="VMDeath"></eventlink> event returns.
11618 </constant>
11619 <constant id="JVMTI_PHASE_DEAD" num="8">
11620 Dead phase: after the <eventlink id="VMDeath"></eventlink> event returns or after
11621 start-up failure.
11622 </constant>
11623 </constants>
11624 In the case of start-up failure the VM will proceed directly to the dead
11625 phase skipping intermediate phases and neither a <code>VMInit</code> nor
11626 <code>VMDeath</code> event will be sent.
11627 <p/>
11628 Most <jvmti/> functions operate only in the live phase.
11629 The following functions operate in either the <code>OnLoad</code> or live phases:
11630 <functionphaselist phase="onload"/>
11631 The following functions operate in only the <code>OnLoad</code> phase:
11632 <functionphaselist phase="onloadOnly"/>
11633 The following functions operate in the start or live phases:
11634 <functionphaselist phase="start"/>
11635 The following functions operate in any phase:
11636 <functionphaselist phase="any"/>
11637 JNI functions (except the Invocation API) must only be used in the start or live phases.
11638 <p/>
11639 Most <jvmti/> events are sent only in the live phase.
11640 The following events operate in others phases:
11641 <eventphaselist phase="start"/>
11642 <eventphaselist phase="any"/>
11643 </description>
11644 <origin>new</origin>
11645 <capabilities>
11646 </capabilities>
11647 <parameters>
11648 <param id="phase_ptr">
11649 <outptr><enum>jvmtiPhase</enum></outptr>
11650 <description>
11651 On return, points to the phase.
11652 </description>
11653 </param>
11654 </parameters>
11655 <errors>
11656 </errors>
11657 </function>
11658
11659 <function id="DisposeEnvironment" jkernel="yes" phase="any" num="127">
11660 <synopsis>Dispose Environment</synopsis>
11661 <description>
11662 Shutdown a <jvmti/> connection created with JNI <code>GetEnv</code>
11663 (see <internallink id="environments"><jvmti/> Environments</internallink>).
11664 Dispose of any resources held by the environment.
11665 <issue>
11666 What resources are reclaimed? What is undone?
11667 Breakpoints,watchpoints removed?
11668 </issue>
11669 Threads suspended by this environment are not resumed by this call,
11670 this must be done explicitly by the agent.
11671 Memory allocated by this environment via calls to <jvmti/> functions
11672 is not released, this can be done explicitly by the agent
11673 by calling <functionlink id="Deallocate"/>.
11674 Raw monitors created by this environment are not destroyed,
11675 this can be done explicitly by the agent
11676 by calling <functionlink id="DestroyRawMonitor"/>.
11677 The state of threads waiting on raw monitors created by this environment
11678 are not affected.
11679 <p/>
11680 Any <functionlink id="SetNativeMethodPrefix">native method
11681 prefixes</functionlink> for this environment will be unset;
11682 the agent must remove any prefixed native methods before
11683 dispose is called.
11684 <p/>
11685 Any <internallink id="capability">capabilities</internallink>
11686 held by this environment are relinquished.
11687 <p/>
11688 Events enabled by this environment will no longer be sent, however
11689 event handlers currently running will continue to run. Caution must
11690 be exercised in the design of event handlers whose environment may
11691 be disposed and thus become invalid during their execution.
11692 <p/>
11693 This environment may not be used after this call.
11694 This call returns to the caller.
11695 </description>
11696 <origin>new</origin>
11697 <capabilities>
11698 </capabilities>
11699 <parameters>
11700 </parameters>
11701 <errors>
11702 </errors>
11703 </function>
11704
11705 <function id="SetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="148">
11706 <synopsis>Set Environment Local Storage</synopsis>
11707 <description>
11708 The VM stores a pointer value associated with each environment.
11709 This pointer value is called <i>environment-local storage</i>.
11710 This value is null unless set with this function.
11711 Agents can allocate memory in which they store environment specific
11712 information. By setting environment-local storage it can then be
11713 accessed with
11714 <functionlink id="GetEnvironmentLocalStorage"></functionlink>.
11715 <p/>
11716 Called by the agent to set the value of the <jvmti/>
11717 environment-local storage. <jvmti/> supplies to the agent a pointer-size
11718 environment-local storage that can be used to record per-environment
11719 information.
11720 </description>
11721 <origin>new</origin>
11722 <capabilities>
11723 </capabilities>
11724 <parameters>
11725 <param id="data">
11726 <inbuf>
11727 <void/>
11728 <nullok>value is set to null</nullok>
11729 </inbuf>
11730 <description>
11731 The value to be entered into the environment-local storage.
11732 </description>
11733 </param>
11734 </parameters>
11735 <errors>
11736 </errors>
11737 </function>
11738
11739 <function id="GetEnvironmentLocalStorage" jkernel="yes" phase="any" callbacksafe="safe" impl="innative notrace" num="147">
11740 <synopsis>Get Environment Local Storage</synopsis>
11741 <description>
11742 Called by the agent to get the value of the <jvmti/> environment-local
11743 storage.
11744 </description>
11745 <origin>new</origin>
11746 <capabilities>
11747 </capabilities>
11748 <parameters>
11749 <param id="data_ptr">
11750 <agentbuf><void/></agentbuf>
11751 <description>
11752 Pointer through which the value of the environment local
11753 storage is returned.
11754 If environment-local storage has not been set with
11755 <functionlink id="SetEnvironmentLocalStorage"></functionlink> returned
11756 pointer is null.
11757 </description>
11758 </param>
11759 </parameters>
11760 <errors>
11761 </errors>
11762 </function>
11763
11764 <function id="GetVersionNumber" jkernel="yes" phase="any" num="88">
11765 <synopsis>Get Version Number</synopsis>
11766 <description>
11767 Return the <jvmti/> version via <code>version_ptr</code>.
11768 The return value is the version identifier.
11769 The version identifier includes major, minor and micro
11770 version as well as the interface type.
11771 <constants id="jvmtiVersionInterfaceTypes" label="Version Interface Types" kind="bits">
11772 <constant id="JVMTI_VERSION_INTERFACE_JNI" num="0x00000000">
11773 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for JNI.
11774 </constant>
11775 <constant id="JVMTI_VERSION_INTERFACE_JVMTI" num="0x30000000">
11776 Value of <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> for <jvmti/>.
11777 </constant>
11778 </constants>
11779 <constants id="jvmtiVersionMasks" label="Version Masks" kind="bits">
11780 <constant id="JVMTI_VERSION_MASK_INTERFACE_TYPE" num="0x70000000">
11781 Mask to extract interface type.
11782 The value of the version returned by this function masked with
11783 <code>JVMTI_VERSION_MASK_INTERFACE_TYPE</code> is always
11784 <code>JVMTI_VERSION_INTERFACE_JVMTI</code>
11785 since this is a <jvmti/> function.
11786 </constant>
11787 <constant id="JVMTI_VERSION_MASK_MAJOR" num="0x0FFF0000">
11788 Mask to extract major version number.
11789 </constant>
11790 <constant id="JVMTI_VERSION_MASK_MINOR" num="0x0000FF00">
11791 Mask to extract minor version number.
11792 </constant>
11793 <constant id="JVMTI_VERSION_MASK_MICRO" num="0x000000FF">
11794 Mask to extract micro version number.
11795 </constant>
11796 </constants>
11797 <constants id="jvmtiVersionShifts" label="Version Shifts" kind="bits">
11798 <constant id="JVMTI_VERSION_SHIFT_MAJOR" num="16">
11799 Shift to extract major version number.
11800 </constant>
11801 <constant id="JVMTI_VERSION_SHIFT_MINOR" num="8">
11802 Shift to extract minor version number.
11803 </constant>
11804 <constant id="JVMTI_VERSION_SHIFT_MICRO" num="0">
11805 Shift to extract micro version number.
11806 </constant>
11807 </constants>
11808 </description>
11809 <origin>jvmdi</origin>
11810 <capabilities>
11811 </capabilities>
11812 <parameters>
11813 <param id="version_ptr">
11814 <outptr><jint/></outptr>
11815 <description>
11816 On return, points to the <jvmti/> version.
11817 </description>
11818 </param>
11819 </parameters>
11820 <errors>
11821 </errors>
11822 </function>
11823
11824
11825 <function id="GetErrorName" phase="any" num="128">
11826 <synopsis>Get Error Name</synopsis>
11827 <description>
11828 Return the symbolic name for an
11829 <internallink id="ErrorSection">error code</internallink>.
11830 <p/>
11831 For example
11832 <code>GetErrorName(env, JVMTI_ERROR_NONE, &err_name)</code>
11833 would return in <code>err_name</code> the string
11834 <code>"JVMTI_ERROR_NONE"</code>.
11835 </description>
11836 <origin>new</origin>
11837 <capabilities>
11838 </capabilities>
11839 <parameters>
11840 <param id="error">
11841 <enum>jvmtiError</enum>
11842 <description>
11843 The error code.
11844 </description>
11845 </param>
11846 <param id="name_ptr">
11847 <allocbuf><char/></allocbuf>
11848 <description>
11849 On return, points to the error name.
11850 The name is encoded as a
11851 <internallink id="mUTF">modified UTF-8</internallink> string,
11852 but is restricted to the ASCII subset.
11853 </description>
11854 </param>
11855 </parameters>
11856 <errors>
11857 </errors>
11858 </function>
11859
11860 <function id="SetVerboseFlag" phase="any" num="150">
11861 <synopsis>Set Verbose Flag</synopsis>
11862 <description>
11863 <constants id="jvmtiVerboseFlag" label="Verbose Flag Enumeration" kind="enum">
11864 <constant id="JVMTI_VERBOSE_OTHER" num="0">
11865 Verbose output other than the below.
11866 </constant>
11867 <constant id="JVMTI_VERBOSE_GC" num="1">
11868 Verbose garbage collector output, like that specified with <code>-verbose:gc</code>.
11869 </constant>
11870 <constant id="JVMTI_VERBOSE_CLASS" num="2">
11871 Verbose class loading output, like that specified with <code>-verbose:class</code>.
11872 </constant>
11873 <constant id="JVMTI_VERBOSE_JNI" num="4">
11874 Verbose JNI output, like that specified with <code>-verbose:jni</code>.
11875 </constant>
11876 </constants>
11877 Control verbose output.
11878 This is the output which typically is sent to <code>stderr</code>.
11879 </description>
11880 <origin>new</origin>
11881 <capabilities>
11882 </capabilities>
11883 <parameters>
11884 <param id="flag">
11885 <enum>jvmtiVerboseFlag</enum>
11886 <description>
11887 Which verbose flag to set.
11888 </description>
11889 </param>
11890 <param id="value">
11891 <jboolean/>
11892 <description>
11893 New value of the flag.
11894 </description>
11895 </param>
11896 </parameters>
11897 <errors>
11898 </errors>
11899 </function>
11900
11901
11902 <function id="GetJLocationFormat" phase="any" num="129">
11903 <synopsis>Get JLocation Format</synopsis>
11904 <description>
11905 Although the greatest functionality is achieved with location information
11906 referencing the virtual machine bytecode index, the definition of
11907 <code>jlocation</code> has intentionally been left unconstrained to allow VM
11908 implementations that do not have this information.
11909 <p/>
11910 This function describes the representation of <code>jlocation</code> used in this VM.
11911 If the returned format is <datalink id="JVMTI_JLOCATION_JVMBCI"></datalink>,
11912 <code>jlocation</code>s can
11913 be used as in indices into the array returned by
11914 <functionlink id="GetBytecodes"></functionlink>.
11915 <constants id="jvmtiJlocationFormat" label="JLocation Format Enumeration" kind="enum">
11916 <constant id="JVMTI_JLOCATION_JVMBCI" num="1">
11917 <code>jlocation</code> values represent virtual machine
11918 bytecode indices--that is, offsets into the
11919 virtual machine code for a method.
11920 </constant>
11921 <constant id="JVMTI_JLOCATION_MACHINEPC" num="2">
11922 <code>jlocation</code> values represent native machine
11923 program counter values.
11924 </constant>
11925 <constant id="JVMTI_JLOCATION_OTHER" num="0">
11926 <code>jlocation</code> values have some other representation.
11927 </constant>
11928 </constants>
11929 </description>
11930 <origin>new</origin>
11931 <capabilities>
11932 </capabilities>
11933 <parameters>
11934 <param id="format_ptr">
11935 <outptr><enum>jvmtiJlocationFormat</enum></outptr>
11936 <description>
11937 On return, points to the format identifier for <code>jlocation</code> values.
11938 </description>
11939 </param>
11940 </parameters>
11941 <errors>
11942 </errors>
11943 </function>
11944
11945 </category>
11946
11947 <category id="heap_monitoring" label="Heap Monitoring">
11948 <function id="SetHeapSamplingInterval" phase="onload" num="156" since="11">
11949 <synopsis>Set Heap Sampling Interval</synopsis>
11950 <description>
11951 Generate a <eventlink id="SampledObjectAlloc"/> event when objects are allocated.
11952 Each thread keeps a counter of bytes allocated. The event will only be generated
11953 when that counter exceeds an average of <paramlink id="sampling_interval"></paramlink>
11954 since the last sample.
11955 <p/>
11956 Setting <paramlink id="sampling_interval"></paramlink> to 0 will cause an event to be
11957 generated by each allocation supported by the system once the new interval is taken into account.
11958 <p/>
11959 Note that updating the new sampling interval might take various number of allocations
11960 to provoke internal data structure updates. Therefore it is important to
11961 consider the sampling interval as an average. This includes the interval 0, where events
11962 might not be generated straight away for each allocation.
11963 </description>
11964 <origin>new</origin>
11965 <capabilities>
11966 <required id="can_generate_sampled_object_alloc_events"></required>
11967 </capabilities>
11968 <parameters>
11969 <param id="sampling_interval">
11970 <jint/>
11971 <description>
11972 The sampling interval in bytes. The sampler uses a statistical approach to
11973 generate an event, on average, once for every <paramlink id="sampling_interval"/> bytes of
11974 memory allocated by a given thread.
11975 <p/>
11976 Once the new sampling interval is taken into account, 0 as a sampling interval will generate
11977 a sample for every allocation.
11978 <p/>
11979 Note: The overhead of this feature is directly correlated with the sampling interval.
11980 A high sampling interval, such as 1024 bytes, will incur a high overhead.
11981 A lower interval, such as 1024KB, will have a much lower overhead. Sampling should only
11982 be used with an understanding that it may impact performance.
11983 </description>
11984 </param>
11985 </parameters>
11986 <errors>
11987 <error id="JVMTI_ERROR_ILLEGAL_ARGUMENT">
11988 <paramlink id="sampling_interval"></paramlink> is less than zero.
11989 </error>
11990 </errors>
11991 </function>
11992 </category>
11993
11994 </functionsection>
11995
11996 <errorsection label="Error Reference">
11997 <intro>
11998 Every <jvmti/> function returns a <b><code>jvmtiError</code></b> error code.
11999 <p/>
12000 It is the responsibility of the agent to call <jvmti/> functions with
12001 valid parameters and in the proper context (calling thread is attached,
12002 phase is correct, etc.).
12003 Detecting some error conditions may be difficult, inefficient, or
12004 impossible for an implementation.
12005 The errors listed in
12006 <internallink id="reqerrors">Function Specific Required Errors</internallink>
12007 must be detected by the implementation.
12008 All other errors represent the recommended response to the error
12009 condition.
12010 </intro>
12011
12012 <errorcategory id="universal-error" label="Universal Errors">
12013 <intro>
12014 The following errors may be returned by any function
12015 </intro>
12016
12017 <errorid id="JVMTI_ERROR_NONE" num="0">
12018 No error has occurred. This is the error code that is returned
12019 on successful completion of the function.
12020 </errorid>
12021 <errorid id="JVMTI_ERROR_NULL_POINTER" num="100">
12022 Pointer is unexpectedly null.
12023 </errorid>
12024 <errorid id="JVMTI_ERROR_OUT_OF_MEMORY" num="110">
12025 The function attempted to allocate memory and no more memory was
12026 available for allocation.
12027 </errorid>
12028 <errorid id="JVMTI_ERROR_ACCESS_DENIED" num="111">
12029 The desired functionality has not been enabled in this virtual machine.
12030 </errorid>
12031 <errorid id="JVMTI_ERROR_UNATTACHED_THREAD" num="115">
12032 The thread being used to call this function is not attached
12033 to the virtual machine. Calls must be made from attached threads.
12034 See <code>AttachCurrentThread</code> in the JNI invocation API.
12035 </errorid>
12036 <errorid id="JVMTI_ERROR_INVALID_ENVIRONMENT" num="116">
12037 The <jvmti/> environment provided is no longer connected or is
12038 not an environment.
12039 </errorid>
12040 <errorid id="JVMTI_ERROR_WRONG_PHASE" num="112">
12041 The desired functionality is not available in the current
12042 <functionlink id="GetPhase">phase</functionlink>.
12043 Always returned if the virtual machine has completed running.
12044 </errorid>
12045 <errorid id="JVMTI_ERROR_INTERNAL" num="113">
12046 An unexpected internal error has occurred.
12047 </errorid>
12048 </errorcategory>
12049
12050 <errorcategory id="reqerrors" label="Function Specific Required Errors">
12051 <intro>
12052 The following errors are returned by some <jvmti/> functions and must
12053 be returned by the implementation when the condition occurs.
12054 </intro>
12055
12056 <errorid id="JVMTI_ERROR_INVALID_PRIORITY" num="12">
12057 Invalid priority.
12058 </errorid>
12059 <errorid id="JVMTI_ERROR_THREAD_NOT_SUSPENDED" num="13">
12060 Thread was not suspended.
12061 </errorid>
12062 <errorid id="JVMTI_ERROR_THREAD_SUSPENDED" num="14">
12063 Thread already suspended.
12064 </errorid>
12065 <errorid id="JVMTI_ERROR_THREAD_NOT_ALIVE" num="15">
12066 This operation requires the thread to be alive--that is,
12067 it must be started and not yet terminated.
12068 </errorid>
12069 <errorid id="JVMTI_ERROR_CLASS_NOT_PREPARED" num="22">
12070 The class has been loaded but not yet prepared.
12071 </errorid>
12072 <errorid id="JVMTI_ERROR_NO_MORE_FRAMES" num="31">
12073 There are no Java programming language or JNI stack frames at the specified depth.
12074 </errorid>
12075 <errorid id="JVMTI_ERROR_OPAQUE_FRAME" num="32">
12076 Information about the frame is not available (e.g. for native frames),
12077 or the implementation is unable to provide this functionality on this frame.
12078 </errorid>
12079 <errorid id="JVMTI_ERROR_DUPLICATE" num="40">
12080 Item already set.
12081 </errorid>
12082 <errorid id="JVMTI_ERROR_NOT_FOUND" num="41">
12083 Desired element (e.g. field or breakpoint) not found
12084 </errorid>
12085 <errorid id="JVMTI_ERROR_NOT_MONITOR_OWNER" num="51">
12086 This thread doesn't own the raw monitor.
12087 </errorid>
12088 <errorid id="JVMTI_ERROR_INTERRUPT" num="52">
12089 The call has been interrupted before completion.
12090 </errorid>
12091 <errorid id="JVMTI_ERROR_UNMODIFIABLE_CLASS" num="79">
12092 The class cannot be modified.
12093 </errorid>
12094 <errorid id="JVMTI_ERROR_UNMODIFIABLE_MODULE" num="80">
12095 The module cannot be modified.
12096 </errorid>
12097 <errorid id="JVMTI_ERROR_NOT_AVAILABLE" num="98">
12098 The functionality is not available in this virtual machine.
12099 </errorid>
12100 <errorid id="JVMTI_ERROR_ABSENT_INFORMATION" num="101">
12101 The requested information is not available.
12102 </errorid>
12103 <errorid id="JVMTI_ERROR_INVALID_EVENT_TYPE" num="102">
12104 The specified event type ID is not recognized.
12105 </errorid>
12106 <errorid id="JVMTI_ERROR_NATIVE_METHOD" num="104">
12107 The requested information is not available for native method.
12108 </errorid>
12109 <errorid id="JVMTI_ERROR_CLASS_LOADER_UNSUPPORTED" num="106">
12110 The class loader does not support this operation.
12111 </errorid>
12112 </errorcategory>
12113
12114 <errorcategory id="function-specific-errors" label="Function Specific Agent Errors">
12115 <intro>
12116 The following errors are returned by some <jvmti/> functions.
12117 They are returned in the event of invalid parameters passed by the
12118 agent or usage in an invalid context.
12119 An implementation is not required to detect these errors.
12120 </intro>
12121
12122 <errorid id="JVMTI_ERROR_INVALID_THREAD" num="10">
12123 The passed thread is not a valid thread.
12124 </errorid>
12125 <errorid id="JVMTI_ERROR_INVALID_FIELDID" num="25">
12126 Invalid field.
12127 </errorid>
12128 <errorid id="JVMTI_ERROR_INVALID_MODULE" num="26">
12129 Invalid module.
12130 </errorid>
12131 <errorid id="JVMTI_ERROR_INVALID_METHODID" num="23">
12132 Invalid method.
12133 </errorid>
12134 <errorid id="JVMTI_ERROR_INVALID_LOCATION" num="24">
12135 Invalid location.
12136 </errorid>
12137 <errorid id="JVMTI_ERROR_INVALID_OBJECT" num="20">
12138 Invalid object.
12139 </errorid>
12140 <errorid id="JVMTI_ERROR_INVALID_CLASS" num="21">
12141 Invalid class.
12142 </errorid>
12143 <errorid id="JVMTI_ERROR_TYPE_MISMATCH" num="34">
12144 The variable is not an appropriate type for the function used.
12145 </errorid>
12146 <errorid id="JVMTI_ERROR_INVALID_SLOT" num="35">
12147 Invalid slot.
12148 </errorid>
12149 <errorid id="JVMTI_ERROR_MUST_POSSESS_CAPABILITY" num="99">
12150 The capability being used is false in this environment.
12151 </errorid>
12152 <errorid id="JVMTI_ERROR_INVALID_THREAD_GROUP" num="11">
12153 Thread group invalid.
12154 </errorid>
12155 <errorid id="JVMTI_ERROR_INVALID_MONITOR" num="50">
12156 Invalid raw monitor.
12157 </errorid>
12158 <errorid id="JVMTI_ERROR_ILLEGAL_ARGUMENT" num="103">
12159 Illegal argument.
12160 </errorid>
12161 <errorid id="JVMTI_ERROR_INVALID_TYPESTATE" num="65">
12162 The state of the thread has been modified, and is now inconsistent.
12163 </errorid>
12164 <errorid id="JVMTI_ERROR_UNSUPPORTED_VERSION" num="68">
12165 A new class file has a version number not supported by this VM.
12166 </errorid>
12167 <errorid id="JVMTI_ERROR_INVALID_CLASS_FORMAT" num="60">
12168 A new class file is malformed (the VM would return a <code>ClassFormatError</code>).
12169 </errorid>
12170 <errorid id="JVMTI_ERROR_CIRCULAR_CLASS_DEFINITION" num="61">
12171 The new class file definitions would lead to a circular
12172 definition (the VM would return a <code>ClassCircularityError</code>).
12173 </errorid>
12174 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_ADDED" num="63">
12175 A new class file would require adding a method.
12176 </errorid>
12177 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_SCHEMA_CHANGED" num="64">
12178 A new class version changes a field.
12179 </errorid>
12180 <errorid id="JVMTI_ERROR_FAILS_VERIFICATION" num="62">
12181 The class bytes fail verification.
12182 </errorid>
12183 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_HIERARCHY_CHANGED" num="66">
12184 A direct superclass is different for the new class
12185 version, or the set of directly implemented
12186 interfaces is different.
12187 </errorid>
12188 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_DELETED" num="67">
12189 A new class version does not declare a method
12190 declared in the old class version.
12191 </errorid>
12192 <errorid id="JVMTI_ERROR_NAMES_DONT_MATCH" num="69">
12193 The class name defined in the new class file is
12194 different from the name in the old class object.
12195 </errorid>
12196 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_MODIFIERS_CHANGED" num="70">
12197 A new class version has different modifiers.
12198 </errorid>
12199 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_METHOD_MODIFIERS_CHANGED" num="71">
12200 A method in the new class version has different modifiers
12201 than its counterpart in the old class version.
12202 </errorid>
12203 <errorid id="JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED" num="72">
12204 A new class version has unsupported differences in class attributes.
12205 </errorid>
12206 <errorid id="JVMTI_ERROR_UNSUPPORTED_OPERATION" num="73">
12207 Functionality is unsupported in this implementation.
12208 </errorid>
12209 </errorcategory>
12210 </errorsection>
12211
12212 <eventsection label="Events">
12213 <intro label="Handling Events" id="eventIntro">
12214 Agents can be informed of many events that occur in application
12215 programs.
12216 <p/>
12217 To handle events, designate a set of callback functions with
12218 <functionlink id="SetEventCallbacks"></functionlink>.
12219 For each event the corresponding callback function will be
12220 called.
12221 Arguments to the callback function provide additional
12222 information about the event.
12223 <p/>
12224 The callback function is usually called from within an application
12225 thread. The <jvmti/> implementation does not
12226 queue events in any way. This means
12227 that event callback functions must be written
12228 carefully. Here are some general guidelines. See
12229 the individual event descriptions for further
12230 suggestions.
12231 <p/>
12232 <ul>
12233 <li>Any exception thrown during the execution of an event callback can
12234 overwrite any current pending exception in the current application thread.
12235 Care must be taken to preserve a pending exception
12236 when an event callback makes a JNI call that might generate an exception.
12237 </li>
12238 <li>Event callback functions must be re-entrant. The <jvmti/> implementation does
12239 not queue events. If an agent needs to process events one at a time, it
12240 can use a raw monitor inside the
12241 event callback functions to serialize event processing.
12242 </li>
12243 <li>Event callback functions that execute JNI's FindClass function to load
12244 classes need to note that FindClass locates the class loader associated
12245 with the current native method. For the purposes of class loading, an
12246 event callback that includes a JNI environment as a parameter to the
12247 callback will treated as if it is a native call, where the native method
12248 is in the class of the event thread's current frame.
12249 </li>
12250 </ul>
12251 <p/>
12252 Some <jvmti/> events identify objects with JNI references.
12253 All references
12254 in <jvmti/> events are JNI local references and will become invalid
12255 after the event callback returns.
12256 Unless stated otherwise, memory referenced by pointers sent in event
12257 callbacks may not be referenced after the event callback returns.
12258 <p/>
12259 Except where stated otherwise, events are delivered on the thread
12260 that caused the event.
12261 Events are sent at the time they occur.
12262 The specification for each event includes the set of
12263 <functionlink id="GetPhase">phases</functionlink> in which it can be sent;
12264 if an event triggering activity occurs during another phase, no event
12265 is sent.
12266 <p/>
12267 A thread that generates an event does not change its execution status
12268 (for example, the event does not cause the thread to be suspended).
12269 If an agent wishes the event to result in suspension, then the agent
12270 is responsible for explicitly suspending the thread with
12271 <functionlink id="SuspendThread"></functionlink>.
12272 <p/>
12273 If an event is enabled in multiple environments, the event will be sent
12274 to each agent in the order that the environments were created.
12275 </intro>
12276
12277 <intro label="Enabling Events" id="enablingevents">
12278 All events are initially disabled. In order to receive any
12279 event:
12280 <ul>
12281 <li>
12282 If the event requires a capability, that capability must
12283 be added with
12284 <functionlink id="AddCapabilities"></functionlink>.
12285 </li>
12286 <li>
12287 A callback for the event must be set with
12288 <functionlink id="SetEventCallbacks"></functionlink>.
12289 </li>
12290 <li>
12291 The event must be enabled with
12292 <functionlink id="SetEventNotificationMode"></functionlink>.
12293 </li>
12294 </ul>
12295 </intro>
12296
12297 <intro label="Multiple Co-located Events" id="eventorder">
12298 In many situations it is possible for multiple events to occur
12299 at the same location in one thread. When this happens, all the events
12300 are reported through the event callbacks in the order specified in this section.
12301 <p/>
12302 If the current location is at the entry point of a method, the
12303 <eventlink id="MethodEntry"></eventlink> event is reported before
12304 any other event at the current location in the same thread.
12305 <p/>
12306 If an exception catch has been detected at the current location,
12307 either because it is the beginning of a catch clause or a native method
12308 that cleared a pending exception has returned, the
12309 <code>exceptionCatch</code> event is reported before
12310 any other event at the current location in the same thread.
12311 <p/>
12312 If a <code>singleStep</code> event or
12313 <code>breakpoint</code> event is triggered at the
12314 current location, the event is defined to occur
12315 immediately before the code at the current location is executed.
12316 These events are reported before any events which are triggered
12317 by the execution of code at the current location in the same
12318 thread (specifically:
12319 <code>exception</code>,
12320 <code>fieldAccess</code>, and
12321 <code>fieldModification</code>).
12322 If both a step and breakpoint event are triggered for the same thread and
12323 location, the step event is reported before the breakpoint event.
12324 <p/>
12325 If the current location is the exit point of a method (that is, the last
12326 location before returning to the caller), the
12327 <eventlink id="MethodExit"></eventlink> event and
12328 the <eventlink id="FramePop"></eventlink> event (if requested)
12329 are reported after all other events at the current location in the same
12330 thread. There is no specified ordering of these two events
12331 with respect to each other.
12332 <p/>
12333 Co-located events can be triggered during the processing of some other
12334 event by the agent at the same location in the same thread.
12335 If such an event, of type <i>y</i>, is triggered during the processing of
12336 an event of type <i>x</i>, and if <i>x</i>
12337 precedes <i>y</i> in the ordering specified above, the co-located event
12338 <i>y</i> is reported for the current thread and location. If <i>x</i> does not precede
12339 <i>y</i>, <i>y</i> is not reported for the current thread and location.
12340 For example, if a breakpoint is set at the current location
12341 during the processing of <eventlink id="SingleStep"></eventlink>,
12342 that breakpoint will be reported before the thread moves off the current
12343 location.
12344 <p/>The following events are never considered to be co-located with
12345 other events.
12346 <ul>
12347 <li><eventlink id="VMStart"></eventlink></li>
12348 <li><eventlink id="VMInit"></eventlink></li>
12349 <li><eventlink id="VMDeath"></eventlink></li>
12350 <li><eventlink id="ThreadStart"></eventlink></li>
12351 <li><eventlink id="ThreadEnd"></eventlink></li>
12352 <li><eventlink id="VirtualThreadStart"></eventlink></li>
12353 <li><eventlink id="VirtualThreadEnd"></eventlink></li>
12354 <li><eventlink id="ClassLoad"></eventlink></li>
12355 <li><eventlink id="ClassPrepare"></eventlink></li>
12356 </ul>
12357 </intro>
12358
12359 <intro label="Event Callbacks" id="jvmtiEventCallbacks">
12360 The event callback structure below is used to specify the handler function
12361 for events. It is set with the
12362 <functionlink id="SetEventCallbacks"></functionlink> function.
12363 </intro>
12364
12365 <event label="Single Step"
12366 id="SingleStep" const="JVMTI_EVENT_SINGLE_STEP" filtered="thread" num="60">
12367 <description>
12368 Single step events allow the agent to trace thread execution
12369 at the finest granularity allowed by the VM. A single step event is
12370 generated whenever a thread reaches a new location.
12371 Typically, single step events represent the completion of one VM
12372 instruction as defined in <vmspec/>. However, some implementations
12373 may define locations differently. In any case the
12374 <code>method</code> and <code>location</code>
12375 parameters uniquely identify the current location and allow
12376 the mapping to source file and line number when that information is
12377 available.
12378 <p/>
12379 No single step events are generated from within native methods.
12380 </description>
12381 <origin>jvmdi</origin>
12382 <capabilities>
12383 <required id="can_generate_single_step_events"></required>
12384 </capabilities>
12385 <parameters>
12386 <param id="jni_env">
12387 <outptr>
12388 <struct>JNIEnv</struct>
12389 </outptr>
12390 <description>
12391 The JNI environment of the event (current) thread
12392 </description>
12393 </param>
12394 <param id="thread">
12395 <jthread/>
12396 <description>
12397 Thread about to execution a new instruction
12398 </description>
12399 </param>
12400 <param id="klass">
12401 <jclass method="method"/>
12402 <description>
12403 Class of the method about to execute a new instruction
12404 </description>
12405 </param>
12406 <param id="method">
12407 <jmethodID class="klass"/>
12408 <description>
12409 Method about to execute a new instruction
12410 </description>
12411 </param>
12412 <param id="location">
12413 <jlocation/>
12414 <description>
12415 Location of the new instruction
12416 </description>
12417 </param>
12418 </parameters>
12419 </event>
12420
12421 <event label="Breakpoint"
12422 id="Breakpoint" const="JVMTI_EVENT_BREAKPOINT" filtered="thread" num="62">
12423 <description>
12424 Breakpoint events are generated whenever a thread reaches a location
12425 designated as a breakpoint with <functionlink id="SetBreakpoint"></functionlink>.
12426 The <code>method</code> and <code>location</code>
12427 parameters uniquely identify the current location and allow
12428 the mapping to source file and line number when that information is
12429 available.
12430 </description>
12431 <origin>jvmdi</origin>
12432 <capabilities>
12433 <required id="can_generate_breakpoint_events"></required>
12434 </capabilities>
12435 <parameters>
12436 <param id="jni_env">
12437 <outptr>
12438 <struct>JNIEnv</struct>
12439 </outptr>
12440 <description>
12441 The JNI environment of the event (current) thread.
12442 </description>
12443 </param>
12444 <param id="thread">
12445 <jthread/>
12446 <description>
12447 Thread that hit the breakpoint
12448 </description>
12449 </param>
12450 <param id="klass">
12451 <jclass method="method"/>
12452 <description>
12453 Class of the method that hit the breakpoint
12454 </description>
12455 </param>
12456 <param id="method">
12457 <jmethodID class="klass"/>
12458 <description>
12459 Method that hit the breakpoint
12460 </description>
12461 </param>
12462 <param id="location">
12463 <jlocation/>
12464 <description>
12465 location of the breakpoint
12466 </description>
12467 </param>
12468 </parameters>
12469 </event>
12470
12471 <event label="Field Access"
12472 id="FieldAccess" const="JVMTI_EVENT_FIELD_ACCESS" filtered="thread" num="63">
12473 <description>
12474 Field access events are generated whenever a thread accesses
12475 a field that was designated as a watchpoint
12476 with <functionlink id="SetFieldAccessWatch"></functionlink>.
12477 The <code>method</code> and <code>location</code>
12478 parameters uniquely identify the current location and allow
12479 the mapping to source file and line number when that information is
12480 available.
12481 </description>
12482 <origin>jvmdi</origin>
12483 <capabilities>
12484 <required id="can_generate_field_access_events"></required>
12485 </capabilities>
12486 <parameters>
12487 <param id="jni_env">
12488 <outptr>
12489 <struct>JNIEnv</struct>
12490 </outptr>
12491 <description>
12492 The JNI environment of the event (current) thread
12493 </description>
12494 </param>
12495 <param id="thread">
12496 <jthread/>
12497 <description>
12498 Thread accessing the field
12499 </description>
12500 </param>
12501 <param id="klass">
12502 <jclass method="method"/>
12503 <description>
12504 Class of the method where the access is occurring
12505 </description>
12506 </param>
12507 <param id="method">
12508 <jmethodID class="klass"/>
12509 <description>
12510 Method where the access is occurring
12511 </description>
12512 </param>
12513 <param id="location">
12514 <jlocation/>
12515 <description>
12516 Location where the access is occurring
12517 </description>
12518 </param>
12519 <param id="field_klass">
12520 <jclass field="field"/>
12521 <description>
12522 Class of the field being accessed
12523 </description>
12524 </param>
12525 <param id="object">
12526 <jobject/>
12527 <description>
12528 Object with the field being accessed if the field is an
12529 instance field; a null pointer otherwise
12530 </description>
12531 </param>
12532 <param id="field">
12533 <jfieldID class="field_klass"/>
12534 <description>
12535 Field being accessed
12536 </description>
12537 </param>
12538 </parameters>
12539 </event>
12540
12541 <event label="Field Modification"
12542 id="FieldModification" const="JVMTI_EVENT_FIELD_MODIFICATION" filtered="thread" num="64">
12543 <description>
12544 Field modification events are generated whenever a thread modifies
12545 a field that was designated as a watchpoint
12546 with <functionlink id="SetFieldModificationWatch"></functionlink>.
12547 The <code>method</code> and <code>location</code>
12548 parameters uniquely identify the current location and allow
12549 the mapping to source file and line number when that information is
12550 available.
12551 </description>
12552 <origin>jvmdi</origin>
12553 <capabilities>
12554 <required id="can_generate_field_modification_events"></required>
12555 </capabilities>
12556 <parameters>
12557 <param id="jni_env">
12558 <outptr>
12559 <struct>JNIEnv</struct>
12560 </outptr>
12561 <description>
12562 The JNI environment of the event (current) thread
12563 </description>
12564 </param>
12565 <param id="thread">
12566 <jthread/>
12567 <description>
12568 Thread modifying the field
12569 </description>
12570 </param>
12571 <param id="klass">
12572 <jclass method="method"/>
12573 <description>
12574 Class of the method where the modification is occurring
12575 </description>
12576 </param>
12577 <param id="method">
12578 <jmethodID class="klass"/>
12579 <description>
12580 Method where the modification is occurring
12581 </description>
12582 </param>
12583 <param id="location">
12584 <jlocation/>
12585 <description>
12586 Location where the modification is occurring
12587 </description>
12588 </param>
12589 <param id="field_klass">
12590 <jclass field="field"/>
12591 <description>
12592 Class of the field being modified
12593 </description>
12594 </param>
12595 <param id="object">
12596 <jobject/>
12597 <description>
12598 Object with the field being modified if the field is an
12599 instance field; a null pointer otherwise
12600 </description>
12601 </param>
12602 <param id="field">
12603 <jfieldID class="field_klass"/>
12604 <description>
12605 Field being modified
12606 </description>
12607 </param>
12608 <param id="signature_type">
12609 <char/>
12610 <description>
12611 Signature type of the new value
12612 </description>
12613 </param>
12614 <param id="new_value">
12615 <jvalue/>
12616 <description>
12617 The new value
12618 </description>
12619 </param>
12620 </parameters>
12621 </event>
12622
12623 <event label="Frame Pop"
12624 id="FramePop" const="JVMTI_EVENT_FRAME_POP" filtered="thread" num="61">
12625 <description>
12626 Frame pop events are generated upon exit from a single method
12627 in a single frame as specified
12628 in a call to <functionlink id="NotifyFramePop"></functionlink>.
12629 This is true whether termination is caused by
12630 executing its return instruction
12631 or by throwing an exception to its caller
12632 (see <paramlink id="was_popped_by_exception"></paramlink>).
12633 However, frame pops caused by the <functionlink id="PopFrame"/>
12634 function are not reported.
12635 <p/>
12636 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12637 for the depth 0 identifies the executable location in the returning method,
12638 immediately prior to the return.
12639 </description>
12640 <origin>jvmdi</origin>
12641 <capabilities>
12642 <required id="can_generate_frame_pop_events"></required>
12643 </capabilities>
12644 <parameters>
12645 <param id="jni_env">
12646 <outptr>
12647 <struct>JNIEnv</struct>
12648 </outptr>
12649 <description>
12650 The JNI environment of the event (current) thread
12651 </description>
12652 </param>
12653 <param id="thread">
12654 <jthread/>
12655 <description>
12656 Thread that is popping the frame
12657 </description>
12658 </param>
12659 <param id="klass">
12660 <jclass method="method"/>
12661 <description>
12662 Class of the method being popped
12663 </description>
12664 </param>
12665 <param id="method">
12666 <jmethodID class="klass"/>
12667 <description>
12668 Method being popped
12669 </description>
12670 </param>
12671 <param id="was_popped_by_exception">
12672 <jboolean/>
12673 <description>
12674 True if frame was popped by a thrown exception.
12675 False if method exited through its return instruction.
12676 </description>
12677 </param>
12678 </parameters>
12679 </event>
12680
12681 <event label="Method Entry"
12682 id="MethodEntry" const="JVMTI_EVENT_METHOD_ENTRY" filtered="thread" num="65">
12683 <description>
12684 Method entry events are generated upon entry of Java
12685 programming language methods (including native methods).
12686 <p/>
12687 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12688 for the depth 0 identifies the initial executable location in the method.
12689 <p/>
12690 Enabling method
12691 entry or exit events will significantly degrade performance on many platforms and is thus
12692 not advised for performance critical usage (such as profiling).
12693 <internallink id="bci">Bytecode instrumentation</internallink> should be
12694 used in these cases.
12695 </description>
12696 <origin>jvmdi</origin>
12697 <capabilities>
12698 <required id="can_generate_method_entry_events"></required>
12699 </capabilities>
12700 <parameters>
12701 <param id="jni_env">
12702 <outptr>
12703 <struct>JNIEnv</struct>
12704 </outptr>
12705 <description>
12706 The JNI environment of the event (current) thread
12707 </description>
12708 </param>
12709 <param id="thread">
12710 <jthread/>
12711 <description>
12712 Thread entering the method
12713 </description>
12714 </param>
12715 <param id="klass">
12716 <jclass method="method"/>
12717 <description>
12718 Class of the method being entered
12719 </description>
12720 </param>
12721 <param id="method">
12722 <jmethodID class="klass"/>
12723 <description>
12724 Method being entered
12725 </description>
12726 </param>
12727 </parameters>
12728 </event>
12729
12730 <event label="Method Exit"
12731 id="MethodExit" const="JVMTI_EVENT_METHOD_EXIT" filtered="thread" num="66">
12732 <description>
12733 Method exit events are generated upon exit from Java
12734 programming language methods (including native methods).
12735 This is true whether termination is caused by
12736 executing its return instruction
12737 or by throwing an exception to its caller
12738 (see <paramlink id="was_popped_by_exception"></paramlink>).
12739 <p/>
12740 The location reported by <functionlink id="GetFrameLocation"></functionlink>
12741 for the depth 0 identifies the executable location in the returning method
12742 immediately prior to the return.
12743 <p/>
12744 Enabling method
12745 entry or exit events will significantly degrade performance on many platforms and is thus
12746 not advised for performance critical usage (such as profiling).
12747 <internallink id="bci">Bytecode instrumentation</internallink> should be
12748 used in these cases.
12749 </description>
12750 <origin>jvmdi</origin>
12751 <capabilities>
12752 <required id="can_generate_method_exit_events"></required>
12753 </capabilities>
12754 <parameters>
12755 <param id="jni_env">
12756 <outptr>
12757 <struct>JNIEnv</struct>
12758 </outptr>
12759 <description>
12760 The JNI environment of the event (current) thread
12761 </description>
12762 </param>
12763 <param id="thread">
12764 <jthread/>
12765 <description>
12766 Thread exiting the method
12767 </description>
12768 </param>
12769 <param id="klass">
12770 <jclass method="method"/>
12771 <description>
12772 Class of the method being exited
12773 </description>
12774 </param>
12775 <param id="method">
12776 <jmethodID class="klass"/>
12777 <description>
12778 Method being exited
12779 </description>
12780 </param>
12781 <param id="was_popped_by_exception">
12782 <jboolean/>
12783 <description>
12784 True if frame was popped by a thrown exception.
12785 False if method exited through its return instruction.
12786 </description>
12787 </param>
12788 <param id="return_value">
12789 <jvalue/>
12790 <description>
12791 The return value of the method being exited.
12792 Undefined and should not be used if
12793 <paramlink id="was_popped_by_exception"></paramlink>
12794 is true.
12795 </description>
12796 </param>
12797 </parameters>
12798 </event>
12799
12800 <event label="Native Method Bind" phase="any"
12801 id="NativeMethodBind" const="JVMTI_EVENT_NATIVE_METHOD_BIND" num="67">
12802 <description>
12803 A Native Method Bind event is sent when a VM binds a
12804 Java programming language native method
12805 to the address of a function that implements the native method.
12806 This will occur when the native method is called for the first time
12807 and also occurs when the JNI function <code>RegisterNatives</code> is called.
12808 This event allows the bind to be redirected to an agent-specified
12809 proxy function.
12810 This event is not sent when the native method is unbound.
12811 Typically, this proxy function will need to be specific to a
12812 particular method or, to handle the general case, automatically
12813 generated assembly code, since after instrumentation code is
12814 executed the function at the original binding
12815 address will usually be invoked.
12816 The original binding can be restored or the redirection changed
12817 by use of the JNI function <code>RegisterNatives</code>.
12818 Some events may be sent during the primordial phase, JNI and
12819 most of <jvmti/> cannot be used at this time but the method and
12820 address can be saved for use later.
12821 </description>
12822 <origin>new</origin>
12823 <capabilities>
12824 <required id="can_generate_native_method_bind_events"></required>
12825 </capabilities>
12826 <parameters>
12827 <param id="jni_env">
12828 <outptr>
12829 <struct>JNIEnv</struct>
12830 </outptr>
12831 <description>
12832 The JNI environment of the event (current) thread
12833 Will be null if sent during the primordial
12834 <functionlink id="GetPhase">phase</functionlink>.
12835 </description>
12836 </param>
12837 <param id="thread">
12838 <jthread/>
12839 <description>
12840 Thread requesting the bind
12841 </description>
12842 </param>
12843 <param id="klass">
12844 <jclass method="method"/>
12845 <description>
12846 Class of the method being bound
12847 </description>
12848 </param>
12849 <param id="method">
12850 <jmethodID class="klass"/>
12851 <description>
12852 Native method being bound
12853 </description>
12854 </param>
12855 <param id="address">
12856 <outptr><void/></outptr>
12857 <description>
12858 The address the VM is about to bind to--that is, the
12859 address of the implementation of the native method
12860 </description>
12861 </param>
12862 <param id="new_address_ptr">
12863 <agentbuf><void/></agentbuf>
12864 <description>
12865 if the referenced address is changed (that is, if
12866 <code>*new_address_ptr</code> is set), the binding
12867 will instead be made to the supplied address.
12868 </description>
12869 </param>
12870 </parameters>
12871 </event>
12872
12873 <event label="Exception"
12874 id="Exception" const="JVMTI_EVENT_EXCEPTION" filtered="thread" num="58">
12875 <description>
12876 Exception events are generated whenever an exception is first detected
12877 in a Java programming language method.
12878 Where "exception" means any <code>java.lang.Throwable</code>.
12879 The exception may have been thrown by a Java programming language or native
12880 method, but in the case of native methods, the event is not generated
12881 until the exception is first seen by a Java programming language method. If an exception is
12882 set and cleared in a native method (and thus is never visible to Java programming language code),
12883 no exception event is generated.
12884 <p/>
12885 The <code>method</code> and <code>location</code>
12886 parameters uniquely identify the current location
12887 (where the exception was detected) and allow
12888 the mapping to source file and line number when that information is
12889 available. The <code>exception</code> parameter identifies the thrown
12890 exception object. The <code>catch_method</code>
12891 and <code>catch_location</code> identify the location of the catch clause,
12892 if any, that handles the thrown exception. If there is no such catch clause,
12893 the <code>catch_method</code> is set to null and the <code>catch_location</code>is set to 0.
12894 There is no guarantee that the thread will ever
12895 reach this catch clause. If there are native methods on the call stack
12896 between the throw location and the catch clause, the exception may
12897 be reset by one of those native methods.
12898 Similarly, exceptions that are reported as uncaught (<code>catch_method</code>
12899 set to null) may in fact be caught by native code.
12900 Agents can check for these occurrences by monitoring
12901 <eventlink id="ExceptionCatch"></eventlink> events.
12902 Note that finally clauses are implemented as catch and re-throw. Therefore they
12903 will be reported in the catch location.
12904 </description>
12905 <origin>jvmdi</origin>
12906 <capabilities>
12907 <required id="can_generate_exception_events"></required>
12908 </capabilities>
12909 <parameters>
12910 <param id="jni_env">
12911 <outptr>
12912 <struct>JNIEnv</struct>
12913 </outptr>
12914 <description>
12915 The JNI environment of the event (current) thread
12916 </description>
12917 </param>
12918 <param id="thread">
12919 <jthread/>
12920 <description>
12921 Thread generating the exception
12922 </description>
12923 </param>
12924 <param id="klass">
12925 <jclass method="method"/>
12926 <description>
12927 Class generating the exception
12928 </description>
12929 </param>
12930 <param id="method">
12931 <jmethodID class="klass"/>
12932 <description>
12933 Method generating the exception
12934 </description>
12935 </param>
12936 <param id="location">
12937 <jlocation/>
12938 <description>
12939 Location where exception occurred
12940 </description>
12941 </param>
12942 <param id="exception">
12943 <jobject/>
12944 <description>
12945 The exception being thrown
12946 </description>
12947 </param>
12948 <param id="catch_klass">
12949 <jclass method="catch_method"/>
12950 <description>
12951 Class that will catch the exception, or null if no known catch
12952 </description>
12953 </param>
12954 <param id="catch_method">
12955 <jmethodID class="catch_klass"/>
12956 <description>
12957 Method that will catch the exception, or null if no known catch
12958 </description>
12959 </param>
12960 <param id="catch_location">
12961 <jlocation/>
12962 <description>
12963 location which will catch the exception or zero if no known catch
12964 </description>
12965 </param>
12966 </parameters>
12967 </event>
12968
12969 <event label="Exception Catch"
12970 id="ExceptionCatch" const="JVMTI_EVENT_EXCEPTION_CATCH" filtered="thread" num="59">
12971 <description>
12972 Exception catch events are generated whenever a thrown exception is caught.
12973 Where "exception" means any <code>java.lang.Throwable</code>.
12974 If the exception is caught in a Java programming language method, the event is generated
12975 when the catch clause is reached. If the exception is caught in a native
12976 method, the event is generated as soon as control is returned to a Java programming language
12977 method. Exception catch events are generated for any exception for which
12978 a throw was detected in a Java programming language method.
12979 Note that finally clauses are implemented as catch and re-throw. Therefore they
12980 will generate exception catch events.
12981 <p/>
12982 The <code>method</code> and <code>location</code>
12983 parameters uniquely identify the current location
12984 and allow the mapping to source file and line number when that information is
12985 available. For exceptions caught in a Java programming language method, the
12986 <code>exception</code> object identifies the exception object. Exceptions
12987 caught in native methods are not necessarily available by the time the
12988 exception catch is reported, so the <code>exception</code> parameter is set
12989 to null.
12990 </description>
12991 <origin>jvmdi</origin>
12992 <capabilities>
12993 <required id="can_generate_exception_events"></required>
12994 </capabilities>
12995 <parameters>
12996 <param id="jni_env">
12997 <outptr>
12998 <struct>JNIEnv</struct>
12999 </outptr>
13000 <description>
13001 The JNI environment of the event (current) thread
13002 </description>
13003 </param>
13004 <param id="thread">
13005 <jthread/>
13006 <description>
13007 Thread catching the exception
13008 </description>
13009 </param>
13010 <param id="klass">
13011 <jclass method="method"/>
13012 <description>
13013 Class catching the exception
13014 </description>
13015 </param>
13016 <param id="method">
13017 <jmethodID class="klass"/>
13018 <description>
13019 Method catching the exception
13020 </description>
13021 </param>
13022 <param id="location">
13023 <jlocation/>
13024 <description>
13025 Location where exception is being caught
13026 </description>
13027 </param>
13028 <param id="exception">
13029 <jobject/>
13030 <description>
13031 Exception being caught
13032 </description>
13033 </param>
13034 </parameters>
13035 </event>
13036
13037 <event label="Thread Start"
13038 id="ThreadStart" const="JVMTI_EVENT_THREAD_START" num="52" phase="start">
13039 <description>
13040 A thread start event is generated by a new thread before its initial
13041 method executes.
13042 <p/>
13043 This event is generated by platform thread. It is not generated by virtual threads.
13044 <p/>
13045 Agents with the <code>can_support_virtual_threads</code> capability
13046 can enable the <eventlink id="VirtualThreadStart"></eventlink> event
13047 to be notified by newly started virtual threads.
13048 <p/>
13049 A platform thread may be listed in the array returned by
13050 <functionlink id="GetAllThreads"></functionlink>
13051 before its thread start event is generated.
13052 It is possible for other events to be generated
13053 on a thread before its thread start event.
13054 <p/>
13055 The event is sent on the newly started <paramlink id="thread"></paramlink>.
13056 </description>
13057 <origin>jvmdi</origin>
13058 <capabilities>
13059 </capabilities>
13060 <parameters>
13061 <param id="jni_env">
13062 <outptr>
13063 <struct>JNIEnv</struct>
13064 </outptr>
13065 <description>
13066 The JNI environment of the event (current) thread.
13067 </description>
13068 </param>
13069 <param id="thread">
13070 <jthread/>
13071 <description>
13072 Thread starting
13073 </description>
13074 </param>
13075 </parameters>
13076 </event>
13077
13078 <event label="Thread End"
13079 id="ThreadEnd" const="JVMTI_EVENT_THREAD_END" filtered="thread" num="53" phase="start">
13080 <description>
13081 A thread end event is generated by a terminating thread after its
13082 initial method has finished execution.
13083 <p/>
13084 This event is generated by platform thread. It is not generated by virtual threads.
13085 <p/>
13086 Agents with the <code>can_support_virtual_threads</code> capability
13087 can enable the <eventlink id="VirtualThreadEnd"></eventlink> event
13088 to be notified by terminating virtual threads.
13089 <p/>
13090 A platform thread may be listed in the array returned by
13091 <functionlink id="GetAllThreads"></functionlink>
13092 after its thread end event is generated.
13093 No events are generated on a thread
13094 after its thread end event.
13095 <p/>
13096 The event is sent on the terminating <paramlink id="thread"></paramlink>.
13097 </description>
13098 <origin>jvmdi</origin>
13099 <capabilities>
13100 </capabilities>
13101 <parameters>
13102 <param id="jni_env">
13103 <outptr>
13104 <struct>JNIEnv</struct>
13105 </outptr>
13106 <description>
13107 The JNI environment of the event (current) thread.
13108 </description>
13109 </param>
13110 <param id="thread">
13111 <jthread/>
13112 <description>
13113 Thread ending
13114 </description>
13115 </param>
13116 </parameters>
13117 </event>
13118
13119 <event label="Virtual Thread Start"
13120 id="VirtualThreadStart" const="JVMTI_EVENT_VIRTUAL_THREAD_START" num="87" phase="start" since="21">
13121 <description>
13122 A virtual thread start event is generated before its initial method executes.
13123 <p/>
13124 The event is sent on the newly started <paramlink id="virtual_thread"></paramlink>.
13125 </description>
13126 <origin>new</origin>
13127 <capabilities>
13128 <required id="can_support_virtual_threads">Can support virtual threads</required>
13129 </capabilities>
13130 <parameters>
13131 <param id="jni_env">
13132 <outptr>
13133 <struct>JNIEnv</struct>
13134 </outptr>
13135 <description>
13136 The JNI environment of the event (current) thread.
13137 </description>
13138 </param>
13139 <param id="virtual_thread">
13140 <jthread/>
13141 <description>
13142 Virtual thread started for execution.
13143 </description>
13144 </param>
13145 </parameters>
13146 </event>
13147
13148 <event label="Virtual Thread End"
13149 id="VirtualThreadEnd" const="JVMTI_EVENT_VIRTUAL_THREAD_END" filtered="thread" num="88" phase="start" since="21">
13150 <description>
13151 A virtual thread end event is generated after its initial method has finished execution.
13152 <p/>
13153 The event is sent on the terminating <paramlink id="virtual_thread"></paramlink>.
13154 </description>
13155 <origin>new</origin>
13156 <capabilities>
13157 <required id="can_support_virtual_threads">Can support virtual threads</required>
13158 </capabilities>
13159 <parameters>
13160 <param id="jni_env">
13161 <outptr>
13162 <struct>JNIEnv</struct>
13163 </outptr>
13164 <description>
13165 The JNI environment of the event (current) thread.
13166 </description>
13167 </param>
13168 <param id="virtual_thread">
13169 <jthread/>
13170 <description>
13171 Virtual thread being ended.
13172 </description>
13173 </param>
13174 </parameters>
13175 </event>
13176
13177 <elide>
13178 <event label="Virtual Thread Mount"
13179 id="VirtualThreadMount" const="JVMTI_EVENT_VIRTUAL_THREAD_MOUNT" filtered="thread" num="89" phase="start" since="99">
13180 <description>
13181 A virtual thread mount event is generated before its method continue to execute on the mounted thread.
13182 <p/>
13183 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is mounted to.
13184 </description>
13185 <origin>new</origin>
13186 <capabilities>
13187 <required id="can_support_virtual_threads">Can support virtual threads</required>
13188 </capabilities>
13189 <parameters>
13190 <param id="jni_env">
13191 <outptr>
13192 <struct>JNIEnv</struct>
13193 </outptr>
13194 <description>
13195 The JNI environment of the event (current) thread.
13196 </description>
13197 </param>
13198 <param id="virtual_thread">
13199 <jthread/>
13200 <description>
13201 Virtual thread that is mounted.
13202 </description>
13203 </param>
13204 </parameters>
13205 </event>
13206 </elide>
13207
13208 <elide>
13209 <event label="Virtual Thread Unmount"
13210 id="VirtualThreadUnmount" const="JVMTI_EVENT_VIRTUAL_THREAD_UNMOUNT" filtered="thread" num="90" phase="start" since="99">
13211 <description>
13212 A virtual thread unmount event is generated when the virtual thread is about to be unmounted from the carrier thread.
13213 <p/>
13214 The event is sent on the <paramlink id="thread"></paramlink> the virtual thread is unmounted from.
13215 </description>
13216 <origin>new</origin>
13217 <capabilities>
13218 <required id="can_support_virtual_threads">Can support virtual threads</required>
13219 </capabilities>
13220 <parameters>
13221 <param id="jni_env">
13222 <outptr>
13223 <struct>JNIEnv</struct>
13224 </outptr>
13225 <description>
13226 The JNI environment of the event (current) thread.
13227 </description>
13228 </param>
13229 <param id="virtual_thread">
13230 <jthread/>
13231 <description>
13232 Virtual thread that is unmounted.
13233 </description>
13234 </param>
13235 </parameters>
13236 </event>
13237 </elide>
13238
13239 <event label="Class Load"
13240 id="ClassLoad" const="JVMTI_EVENT_CLASS_LOAD" filtered="thread" phase="start" num="55">
13241 <description>
13242 A class load event is generated
13243 <functionlink id="GetLoadedClasses">when a class or interface is created</functionlink>.
13244 <p/>
13245 Array class creation does not generate a class load event.
13246 The creation of a primitive class (for example, java.lang.Integer.TYPE)
13247 does not generate a class load event.
13248 <p/>
13249 The order of class load events generated by a particular thread is guaranteed
13250 to match the order of class loading within that thread.
13251 <p/>
13252 This event is sent at an early stage in loading the class. As
13253 a result the class should be used carefully. Note, for example,
13254 that methods and fields are not yet loaded, so queries for methods,
13255 fields, subclasses, and so on will not give correct results.
13256 See "Loading of Classes and Interfaces" in the <i>Java Language
13257 Specification</i>. For most
13258 purposes the <eventlink id="ClassPrepare"></eventlink> event will
13259 be more useful.
13260 </description>
13261 <origin>jvmdi</origin>
13262 <capabilities>
13263 </capabilities>
13264 <parameters>
13265 <param id="jni_env">
13266 <outptr>
13267 <struct>JNIEnv</struct>
13268 </outptr>
13269 <description>
13270 The JNI environment of the event (current) thread
13271 </description>
13272 </param>
13273 <param id="thread">
13274 <jthread/>
13275 <description>
13276 Thread loading the class
13277 </description>
13278 </param>
13279 <param id="klass">
13280 <jclass/>
13281 <description>
13282 Class being loaded
13283 </description>
13284 </param>
13285 </parameters>
13286 </event>
13287
13288 <elide>
13289 <event label="Class Unload"
13290 id="ClassUnload" const="JVMTI_EVENT_CLASS_UNLOAD" num="57">
13291 <description>
13292 A class unload event is generated when the class is about to be unloaded.
13293 Class unload events take place during garbage collection and must be
13294 handled extremely carefully. The garbage collector holds many locks
13295 and has suspended all other threads, so the event handler cannot depend
13296 on the ability to acquire any locks. The class unload event handler should
13297 do as little as possible, perhaps by queuing information to be processed
13298 later. In particular, the <code>jclass</code> should be used only in
13299 the JNI function <code>isSameObject</code> or in the following <jvmti/> functions:
13300 <ul>
13301 <li><functionlink id="GetClassSignature"></functionlink></li>
13302 <li><functionlink id="GetSourceFileName"></functionlink></li>
13303 <li><functionlink id="IsInterface"></functionlink></li>
13304 <li><functionlink id="IsArrayClass"></functionlink></li>
13305 </ul>
13306 </description>
13307 <origin>jvmdi</origin>
13308 <capabilities>
13309 </capabilities>
13310 <parameters>
13311 <param id="jni_env">
13312 <outptr>
13313 <struct>JNIEnv</struct>
13314 </outptr>
13315 <description>
13316 The JNI environment of the event (current) thread
13317 </description>
13318 </param>
13319 <param id="thread">
13320 <jthread/>
13321 <description>
13322 Thread generating the class unload
13323 </description>
13324 </param>
13325 <param id="klass">
13326 <jclass/>
13327 <description>
13328 Class being unloaded
13329 </description>
13330 </param>
13331 </parameters>
13332 </event>
13333 </elide>
13334
13335 <event label="Class Prepare"
13336 id="ClassPrepare" const="JVMTI_EVENT_CLASS_PREPARE" filtered="thread" phase="start" num="56">
13337 <description>
13338 A class prepare event is generated when class preparation is complete.
13339 At this point, class fields, methods, and implemented interfaces are
13340 available, and no code from the class has been executed. Since array
13341 classes never have fields or methods, class prepare events are not
13342 generated for them. Class prepare events are not generated for
13343 primitive classes (for example, <code>java.lang.Integer.TYPE</code>).
13344 </description>
13345 <origin>jvmdi</origin>
13346 <capabilities>
13347 </capabilities>
13348 <parameters>
13349 <param id="jni_env">
13350 <outptr>
13351 <struct>JNIEnv</struct>
13352 </outptr>
13353 <description>
13354 The JNI environment of the event (current) thread
13355 </description>
13356 </param>
13357 <param id="thread">
13358 <jthread/>
13359 <description>
13360 Thread generating the class prepare
13361 </description>
13362 </param>
13363 <param id="klass">
13364 <jclass/>
13365 <description>
13366 Class being prepared
13367 </description>
13368 </param>
13369 </parameters>
13370 </event>
13371
13372 <event label="Class File Load Hook" phase="any"
13373 id="ClassFileLoadHook" const="JVMTI_EVENT_CLASS_FILE_LOAD_HOOK" num="54">
13374 <description>
13375 This event is sent when the VM obtains class file data,
13376 but before it constructs
13377 the in-memory representation for that class.
13378 This event is also sent when the class is being modified by the
13379 <functionlink id="RetransformClasses"/> function or
13380 the <functionlink id="RedefineClasses"/> function,
13381 called in any <jvmti/> environment.
13382 The agent can instrument
13383 the existing class file data sent by the VM to include profiling/debugging hooks.
13384 See the description of
13385 <internallink id="bci">bytecode instrumentation</internallink>
13386 for usage information.
13387 <p/>
13388 When the capabilities
13389 <internallink id="jvmtiCapabilities.can_generate_early_class_hook_events">
13390 <code>can_generate_early_class_hook_events</code></internallink> and
13391 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events">
13392 <code>can_generate_all_class_hook_events</code></internallink>
13393 are enabled then this event may be sent in the primordial phase.
13394 Otherwise, this event may be sent before the VM is initialized (the start
13395 <functionlink id="GetPhase">phase</functionlink>).
13396 Some classes might not be compatible
13397 with the function (eg. ROMized classes or implementation defined classes) and this event will
13398 not be generated for these classes.
13399 <p/>
13400 The agent must allocate the space for the modified
13401 class file data buffer
13402 using the memory allocation function
13403 <functionlink id="Allocate"></functionlink> because the
13404 VM is responsible for freeing the new class file data buffer
13405 using <functionlink id="Deallocate"></functionlink>.
13406 <p/>
13407 If the agent wishes to modify the class file, it must set
13408 <code>new_class_data</code> to point
13409 to the newly instrumented class file data buffer and set
13410 <code>new_class_data_len</code> to the length of that
13411 buffer before returning
13412 from this call. If no modification is desired, the agent simply
13413 does not set <code>new_class_data</code>. If multiple agents
13414 have enabled this event the results are chained. That is, if
13415 <code>new_class_data</code> has been set, it becomes the
13416 <code>class_data</code> for the next agent.
13417 <p/>
13418 When handling a class load in the live phase, then the
13419 <functionlink id="GetNamedModule"></functionlink>
13420 function can be used to map class loader and a package name to a module.
13421 When a class is being redefined or retransformed then
13422 <code>class_being_redefined</code> is non-null and so
13423 the JNI <code>GetModule</code> function can also be used
13424 to obtain the Module.
13425 <p/>
13426 The order that this event is sent to each environment differs
13427 from other events.
13428 This event is sent to environments in the following order:
13429 <ul>
13430 <li><fieldlink id="can_retransform_classes"
13431 struct="jvmtiCapabilities">retransformation
13432 incapable</fieldlink>
13433 environments, in the
13434 order in which they were created
13435 </li>
13436 <li><fieldlink id="can_retransform_classes"
13437 struct="jvmtiCapabilities">retransformation
13438 capable</fieldlink>
13439 environments, in the
13440 order in which they were created
13441 </li>
13442 </ul>
13443 When triggered by <functionlink id="RetransformClasses"/>,
13444 this event is sent only to <fieldlink id="can_retransform_classes"
13445 struct="jvmtiCapabilities">retransformation
13446 capable</fieldlink>
13447 environments.
13448 </description>
13449 <origin>jvmpi</origin>
13450 <capabilities>
13451 <capability id="can_generate_all_class_hook_events"></capability>
13452 <capability id="can_generate_early_class_hook_events"></capability>
13453 </capabilities>
13454 <parameters>
13455 <param id="jni_env">
13456 <outptr>
13457 <struct>JNIEnv</struct>
13458 </outptr>
13459 <description>
13460 The JNI environment of the event (current) thread.
13461 </description>
13462 </param>
13463 <param id="class_being_redefined">
13464 <jclass/>
13465 <description>
13466 The class being
13467 <functionlink id="RedefineClasses">redefined</functionlink> or
13468 <functionlink id="RetransformClasses">retransformed</functionlink>.
13469 A null pointer if sent by class load.
13470 </description>
13471 </param>
13472 <param id="loader">
13473 <jobject/>
13474 <description>
13475 The class loader loading the class.
13476 A null pointer if the bootstrap class loader.
13477 </description>
13478 </param>
13479 <param id="name">
13480 <vmbuf><char/></vmbuf>
13481 <description>
13482 Name of class being loaded as a VM internal qualified name
13483 (for example, "java/util/List"), encoded as a
13484 <internallink id="mUTF">modified UTF-8</internallink> string.
13485 Note: if the class is defined with a null pointer name,
13486 <code>name</code> will be null.
13487 </description>
13488 </param>
13489 <param id="protection_domain">
13490 <jobject/>
13491 <description>
13492 The <code>ProtectionDomain</code> of the class.
13493 </description>
13494 </param>
13495 <param id="class_data_len">
13496 <jint/>
13497 <description>
13498 Length of current class file data buffer.
13499 </description>
13500 </param>
13501 <param id="class_data">
13502 <vmbuf><uchar/></vmbuf>
13503 <description>
13504 Pointer to the current class file data buffer.
13505 </description>
13506 </param>
13507 <param id="new_class_data_len">
13508 <outptr><jint/></outptr>
13509 <description>
13510 Pointer to the length of the new class file data buffer.
13511 </description>
13512 </param>
13513 <param id="new_class_data">
13514 <agentbuf incount="new_class_data_len"><uchar/></agentbuf>
13515 <description>
13516 Pointer to the pointer to the instrumented class file data buffer.
13517 </description>
13518 </param>
13519 </parameters>
13520 </event>
13521
13522 <event label="VM Start Event"
13523 id="VMStart" const="JVMTI_EVENT_VM_START" num="57" phase="start">
13524 <description>
13525 The VM start event signals the start of the VM.
13526 At this time JNI is live but the VM is not yet fully initialized.
13527 Once this event is generated, the agent is free to call any JNI function.
13528 This event signals the beginning of the start phase,
13529 <jvmti/> functions permitted in the start phase may be called.
13530 <p/>
13531 The timing of this event may depend on whether the agent has added the
13532 <internallink id="jvmtiCapabilities.can_generate_early_vmstart">
13533 <code>can_generate_early_vmstart</code></internallink> capability or not.
13534 If the capability has been added then the VM posts the event as early
13535 as possible. The VM is capable of executing bytecode but it may not have
13536 initialized to the point where it can load classes in modules other than
13537 <code>java.base</code>, or even arbitrary classes in <code>java.base</code>.
13538 Agents that do load-time instrumentation in this
13539 phase must take great care when instrumenting code that potentially
13540 executes in this phase. Extreme care should also be taken with JNI
13541 <code>FindClass</code> as it may not be possible to load classes and attempts
13542 to do so may result in unpredictable behavior, maybe even stability issues
13543 on some VM implementations.
13544 If the capability has not been added then the VM delays posting this
13545 event until it is capable of loading classes in modules other than
13546 <code>java.base</code> or the VM has completed its initialization.
13547 Agents that create more than one JVM TI environment, where the
13548 capability is added to some but not all environments, may observe the
13549 start phase beginning earlier in the JVM TI environments that possess
13550 the capability.
13551 <p/>
13552 In the case of VM start-up failure, this event will not be sent.
13553 </description>
13554 <origin>jvmdi</origin>
13555 <capabilities>
13556 </capabilities>
13557 <parameters>
13558 <param id="jni_env">
13559 <outptr>
13560 <struct>JNIEnv</struct>
13561 </outptr>
13562 <description>
13563 The JNI environment of the event (current) thread.
13564 </description>
13565 </param>
13566 </parameters>
13567 </event>
13568
13569 <event label="VM Initialization Event"
13570 id="VMInit" const="JVMTI_EVENT_VM_INIT" num="50">
13571 <description>
13572 The VM initialization event signals the completion of VM initialization. Once
13573 this event is generated, the agent is free to call any JNI or <jvmti/>
13574 function. The VM initialization event can be preceded by or can be concurrent
13575 with other events, but
13576 the preceding events should be handled carefully, if at all, because the
13577 VM has not completed its initialization. The thread start event for the
13578 main application thread is guaranteed not to occur until after the
13579 handler for the VM initialization event returns.
13580 <p/>
13581 In the case of VM start-up failure, this event will not be sent.
13582 </description>
13583 <origin>jvmdi</origin>
13584 <capabilities>
13585 </capabilities>
13586 <parameters>
13587 <param id="jni_env">
13588 <outptr>
13589 <struct>JNIEnv</struct>
13590 </outptr>
13591 <description>
13592 The JNI environment of the event (current) thread.
13593 </description>
13594 </param>
13595 <param id="thread">
13596 <jthread/>
13597 <description>
13598 The initial thread
13599 </description>
13600 </param>
13601 </parameters>
13602 </event>
13603
13604 <event label="VM Death Event"
13605 id="VMDeath" const="JVMTI_EVENT_VM_DEATH" num="51">
13606 <description>
13607 The VM death event notifies the agent of the termination of the VM.
13608 No events will occur after the VMDeath event.
13609 <p/>
13610 In the case of VM start-up failure, this event will not be sent.
13611 Note that <internallink id="onunload">Agent_OnUnload</internallink>
13612 will still be called in these cases.
13613 </description>
13614 <origin>jvmdi</origin>
13615 <capabilities>
13616 </capabilities>
13617 <parameters>
13618 <param id="jni_env">
13619 <outptr>
13620 <struct>JNIEnv</struct>
13621 </outptr>
13622 <description>
13623 The JNI environment of the event (current) thread
13624 </description>
13625 </param>
13626 </parameters>
13627 </event>
13628
13629 <event label="Compiled Method Load" phase="start"
13630 id="CompiledMethodLoad" const="JVMTI_EVENT_COMPILED_METHOD_LOAD" num="68">
13631 <description>
13632 Sent when a method is compiled and loaded into memory by the VM.
13633 If it is unloaded, the <eventlink id="CompiledMethodUnload"/> event is sent.
13634 If it is moved, the <eventlink id="CompiledMethodUnload"/> event is sent,
13635 followed by a new <code>CompiledMethodLoad</code> event.
13636 Note that a single method may have multiple compiled forms, and that
13637 this event will be sent for each form.
13638 Note also that several methods may be inlined into a single
13639 address range, and that this event will be sent for each method.
13640 <p/>
13641 These events can be sent after their initial occurrence with
13642 <functionlink id="GenerateEvents"></functionlink>.
13643 </description>
13644 <origin>jvmpi</origin>
13645 <typedef id="jvmtiAddrLocationMap" label="Native address to location entry">
13646 <field id="start_address">
13647 <vmbuf><void/></vmbuf>
13648 <description>
13649 Starting native address of code corresponding to a location
13650 </description>
13651 </field>
13652 <field id="location">
13653 <jlocation/>
13654 <description>
13655 Corresponding location. See
13656 <functionlink id="GetJLocationFormat"></functionlink>
13657 for the meaning of location.
13658 </description>
13659 </field>
13660 </typedef>
13661 <capabilities>
13662 <required id="can_generate_compiled_method_load_events"></required>
13663 </capabilities>
13664 <parameters>
13665 <param id="klass">
13666 <jclass method="method"/>
13667 <description>
13668 Class of the method being compiled and loaded
13669 </description>
13670 </param>
13671 <param id="method">
13672 <jmethodID class="klass"/>
13673 <description>
13674 Method being compiled and loaded
13675 </description>
13676 </param>
13677 <param id="code_size">
13678 <jint/>
13679 <description>
13680 Size of compiled code
13681 </description>
13682 </param>
13683 <param id="code_addr">
13684 <vmbuf><void/></vmbuf>
13685 <description>
13686 Address where compiled method code is loaded
13687 </description>
13688 </param>
13689 <param id="map_length">
13690 <jint/>
13691 <description>
13692 Number of <typelink id="jvmtiAddrLocationMap"></typelink>
13693 entries in the address map.
13694 Zero if mapping information cannot be supplied.
13695 </description>
13696 </param>
13697 <param id="map">
13698 <vmbuf><struct>jvmtiAddrLocationMap</struct></vmbuf>
13699 <description>
13700 Map from native addresses to location.
13701 The native address range of each entry is from
13702 <fieldlink id="start_address" struct="jvmtiAddrLocationMap"></fieldlink>
13703 to <code>start_address-1</code> of the next entry.
13704 A null pointer if mapping information cannot be supplied.
13705 </description>
13706 </param>
13707 <param id="compile_info">
13708 <vmbuf><void/></vmbuf>
13709 <description>
13710 VM-specific compilation information.
13711 The referenced compile information is managed by the VM
13712 and must not depend on the agent for collection.
13713 A VM implementation defines the content and lifetime
13714 of the information.
13715 </description>
13716 </param>
13717 </parameters>
13718 </event>
13719
13720 <event label="Compiled Method Unload" phase="start"
13721 id="CompiledMethodUnload" const="JVMTI_EVENT_COMPILED_METHOD_UNLOAD" num="69">
13722 <description>
13723 Sent when a compiled method is unloaded from memory.
13724 This event might not be sent on the thread which performed the unload.
13725 This event may be sent sometime after the unload occurs, but
13726 will be sent before the memory is reused
13727 by a newly generated compiled method. This event may be sent after
13728 the class is unloaded.
13729 </description>
13730 <origin>jvmpi</origin>
13731 <capabilities>
13732 <required id="can_generate_compiled_method_load_events"></required>
13733 </capabilities>
13734 <parameters>
13735 <param id="klass">
13736 <jclass method="method"/>
13737 <description>
13738 Class of the compiled method being unloaded.
13739 </description>
13740 </param>
13741 <param id="method">
13742 <jmethodID class="klass"/>
13743 <description>
13744 Compiled method being unloaded.
13745 For identification of the compiled method only -- the class
13746 may be unloaded and therefore the method should not be used
13747 as an argument to further JNI or <jvmti/> functions.
13748 </description>
13749 </param>
13750 <param id="code_addr">
13751 <vmbuf><void/></vmbuf>
13752 <description>
13753 Address where compiled method code was loaded.
13754 For identification of the compiled method only --
13755 the space may have been reclaimed.
13756 </description>
13757 </param>
13758 </parameters>
13759 </event>
13760
13761 <event label="Dynamic Code Generated" phase="any"
13762 id="DynamicCodeGenerated" const="JVMTI_EVENT_DYNAMIC_CODE_GENERATED" num="70">
13763 <description>
13764 Sent when a component of the virtual machine is generated dynamically.
13765 This does not correspond to Java programming language code that is
13766 compiled--see <eventlink id="CompiledMethodLoad"></eventlink>.
13767 This is for native code--for example, an interpreter that is generated
13768 differently depending on command-line options.
13769 <p/>
13770 Note that this event has no controlling capability.
13771 If a VM cannot generate these events, it simply does not send any.
13772 <p/>
13773 These events can be sent after their initial occurrence with
13774 <functionlink id="GenerateEvents"></functionlink>.
13775 </description>
13776 <origin>jvmpi</origin>
13777 <capabilities>
13778 </capabilities>
13779 <parameters>
13780 <param id="name">
13781 <vmbuf><char/></vmbuf>
13782 <description>
13783 Name of the code, encoded as a
13784 <internallink id="mUTF">modified UTF-8</internallink> string.
13785 Intended for display to an end-user.
13786 The name might not be unique.
13787 </description>
13788 </param>
13789 <param id="address">
13790 <vmbuf><void/></vmbuf>
13791 <description>
13792 Native address of the code
13793 </description>
13794 </param>
13795 <param id="length">
13796 <jint/>
13797 <description>
13798 Length in bytes of the code
13799 </description>
13800 </param>
13801 </parameters>
13802 </event>
13803
13804 <event label="Data Dump Request"
13805 id="DataDumpRequest" const="JVMTI_EVENT_DATA_DUMP_REQUEST" num="71">
13806 <description>
13807 Sent by the VM to request the agent to dump its data. This
13808 is just a hint and the agent need not react to this event.
13809 This is useful for processing command-line signals from users. For
13810 example, in the Java 2 SDK a CTRL-Break on Win32 and a CTRL-\ on Linux
13811 causes the VM to send this event to the agent.
13812 </description>
13813 <origin>jvmpi</origin>
13814 <capabilities>
13815 </capabilities>
13816 <parameters>
13817 </parameters>
13818 </event>
13819
13820 <event label="Monitor Contended Enter"
13821 id="MonitorContendedEnter" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTER" filtered="thread" num="75">
13822 <description>
13823 Sent when a thread is attempting to enter a Java programming language
13824 monitor already acquired by another thread.
13825 </description>
13826 <origin>jvmpi</origin>
13827 <capabilities>
13828 <required id="can_generate_monitor_events"></required>
13829 </capabilities>
13830 <parameters>
13831 <param id="jni_env">
13832 <outptr>
13833 <struct>JNIEnv</struct>
13834 </outptr>
13835 <description>
13836 The JNI environment of the event (current) thread
13837 </description>
13838 </param>
13839 <param id="thread">
13840 <jthread/>
13841 <description>
13842 JNI local reference to the thread
13843 attempting to enter the monitor
13844 </description>
13845 </param>
13846 <param id="object">
13847 <jobject/>
13848 <description>
13849 JNI local reference to the monitor
13850 </description>
13851 </param>
13852 </parameters>
13853 </event>
13854
13855 <event label="Monitor Contended Entered"
13856 id="MonitorContendedEntered" const="JVMTI_EVENT_MONITOR_CONTENDED_ENTERED" filtered="thread" num="76">
13857 <description>
13858 Sent when a thread enters a Java programming language
13859 monitor after waiting for it to be released by another thread.
13860 </description>
13861 <origin>jvmpi</origin>
13862 <capabilities>
13863 <required id="can_generate_monitor_events"></required>
13864 </capabilities>
13865 <parameters>
13866 <param id="jni_env">
13867 <outptr>
13868 <struct>JNIEnv</struct>
13869 </outptr>
13870 <description>
13871 The JNI environment of the event (current) thread
13872 </description>
13873 </param>
13874 <param id="thread">
13875 <jthread/>
13876 <description>
13877 JNI local reference to the thread entering
13878 the monitor
13879 </description>
13880 </param>
13881 <param id="object">
13882 <jobject/>
13883 <description>
13884 JNI local reference to the monitor
13885 </description>
13886 </param>
13887 </parameters>
13888 </event>
13889
13890 <event label="Monitor Wait"
13891 id="MonitorWait" const="JVMTI_EVENT_MONITOR_WAIT" filtered="thread" num="73">
13892 <description>
13893 Sent when a thread is about to wait on an object.
13894 </description>
13895 <origin>jvmpi</origin>
13896 <capabilities>
13897 <required id="can_generate_monitor_events"></required>
13898 </capabilities>
13899 <parameters>
13900 <param id="jni_env">
13901 <outptr>
13902 <struct>JNIEnv</struct>
13903 </outptr>
13904 <description>
13905 The JNI environment of the event (current) thread
13906 </description>
13907 </param>
13908 <param id="thread">
13909 <jthread/>
13910 <description>
13911 JNI local reference to the thread about to wait
13912 </description>
13913 </param>
13914 <param id="object">
13915 <jobject/>
13916 <description>
13917 JNI local reference to the monitor
13918 </description>
13919 </param>
13920 <param id="timeout">
13921 <jlong/>
13922 <description>
13923 The number of milliseconds the thread will wait
13924 </description>
13925 </param>
13926 </parameters>
13927 </event>
13928
13929 <event label="Monitor Waited"
13930 id="MonitorWaited" const="JVMTI_EVENT_MONITOR_WAITED" filtered="thread" num="74">
13931 <description>
13932 Sent when a thread finishes waiting on an object.
13933 </description>
13934 <origin>jvmpi</origin>
13935 <capabilities>
13936 <required id="can_generate_monitor_events"></required>
13937 </capabilities>
13938 <parameters>
13939 <param id="jni_env">
13940 <outptr>
13941 <struct>JNIEnv</struct>
13942 </outptr>
13943 <description>
13944 The JNI environment of the event (current) thread
13945 </description>
13946 </param>
13947 <param id="thread">
13948 <jthread/>
13949 <description>
13950 JNI local reference to the thread that was finished waiting
13951 </description>
13952 </param>
13953 <param id="object">
13954 <jobject/>
13955 <description>
13956 JNI local reference to the monitor.
13957 </description>
13958 </param>
13959 <param id="timed_out">
13960 <jboolean/>
13961 <description>
13962 True if the monitor timed out
13963 </description>
13964 </param>
13965 </parameters>
13966 </event>
13967
13968 <event label="Resource Exhausted"
13969 id="ResourceExhausted" const="JVMTI_EVENT_RESOURCE_EXHAUSTED" num="80"
13970 since="1.1">
13971 <description>
13972 Sent when a VM resource needed by a running application has been exhausted.
13973 Except as required by the optional capabilities, the set of resources
13974 which report exhaustion is implementation dependent.
13975 <p/>
13976 The following bit flags define the properties of the resource exhaustion:
13977 <constants id="jvmtiResourceExhaustionFlags"
13978 label="Resource Exhaustion Flags"
13979 kind="bits"
13980 since="1.1">
13981 <constant id="JVMTI_RESOURCE_EXHAUSTED_OOM_ERROR" num="0x0001">
13982 After this event returns, the VM will throw a
13983 <code>java.lang.OutOfMemoryError</code>.
13984 </constant>
13985 <constant id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP" num="0x0002">
13986 The VM was unable to allocate memory from the <tm>Java</tm>
13987 platform <i>heap</i>.
13988 The <i>heap</i> is the runtime
13989 data area from which memory for all class instances and
13990 arrays are allocated.
13991 </constant>
13992 <constant id="JVMTI_RESOURCE_EXHAUSTED_THREADS" num="0x0004">
13993 The VM was unable to create a thread.
13994 </constant>
13995 </constants>
13996 </description>
13997 <origin>new</origin>
13998 <capabilities>
13999 <capability id="can_generate_resource_exhaustion_heap_events">
14000 Can generate events when the VM is unable to allocate memory from the
14001 <internallink id="JVMTI_RESOURCE_EXHAUSTED_JAVA_HEAP">heap</internallink>.
14002 </capability>
14003 <capability id="can_generate_resource_exhaustion_threads_events">
14004 Can generate events when the VM is unable to
14005 <internallink id="JVMTI_RESOURCE_EXHAUSTED_THREADS">create
14006 a thread</internallink>.
14007 </capability>
14008 </capabilities>
14009 <parameters>
14010 <param id="jni_env">
14011 <outptr>
14012 <struct>JNIEnv</struct>
14013 </outptr>
14014 <description>
14015 The JNI environment of the event (current) thread
14016 </description>
14017 </param>
14018 <param id="flags">
14019 <jint/>
14020 <description>
14021 Flags defining the properties of the of resource exhaustion
14022 as specified by the
14023 <internallink id="jvmtiResourceExhaustionFlags">Resource
14024 Exhaustion Flags</internallink>.
14025 </description>
14026 </param>
14027 <param id="reserved">
14028 <vmbuf><void/></vmbuf>
14029 <description>
14030 Reserved.
14031 </description>
14032 </param>
14033 <param id="description">
14034 <vmbuf><char/></vmbuf>
14035 <description>
14036 Description of the resource exhaustion, encoded as a
14037 <internallink id="mUTF">modified UTF-8</internallink> string.
14038 </description>
14039 </param>
14040 </parameters>
14041 </event>
14042
14043 <event label="VM Object Allocation"
14044 id="VMObjectAlloc" const="JVMTI_EVENT_VM_OBJECT_ALLOC" num="84">
14045 <description>
14046 Sent when a method causes the virtual machine to directly allocate an
14047 Object visible to Java programming language code.
14048 Generally object allocation should be detected by instrumenting
14049 the bytecodes of allocating methods.
14050 Object allocation generated in native code by JNI function
14051 calls should be detected using
14052 <internallink id="jniIntercept">JNI function interception</internallink>.
14053 Some methods might not have associated bytecodes and are not
14054 native methods, they instead are executed directly by the
14055 VM. These methods should send this event.
14056 Virtual machines which are incapable of bytecode instrumentation
14057 for some or all of their methods can send this event.
14058 <p/>
14059 When preview features are enabled and the capability <code>can_support_value_objects</code>
14060 is enabled, this event is sent for the value object allocations.
14061 <code>null</code> is passed for the <paramlink id="object"></paramlink> parameter in such cases.
14062 <p/>
14063 Note that the <internallink
14064 id="SampledObjectAlloc">SampledObjectAlloc</internallink>
14065 event is triggered on all Java object allocations, including those
14066 caused by bytecode method execution, JNI method execution, and
14067 directly by VM methods.
14068 <p/>
14069 Typical examples where this event might be sent:
14070 <ul>
14071 <li>Reflection -- for example, <code>java.lang.Class.newInstance()</code></li>
14072 <li>Methods not represented by bytecodes -- for example, VM intrinsics and
14073 J2ME preloaded classes</li>
14074 </ul>
14075 Cases where this event would not be generated:
14076 <ul>
14077 <li>Allocation due to bytecodes -- for example, the <code>new</code>
14078 and <code>newarray</code> VM instructions</li>
14079 <li>Allocation due to JNI function calls -- for example,
14080 <code>AllocObject</code></li>
14081 <li>Allocations during VM initialization</li>
14082 <li>VM internal objects</li>
14083 </ul>
14084 </description>
14085 <origin>new</origin>
14086 <capabilities>
14087 <required id="can_generate_vm_object_alloc_events"></required>
14088 <capability id="can_support_value_objects"></capability>
14089 </capabilities>
14090 <parameters>
14091 <param id="jni_env">
14092 <outptr>
14093 <struct>JNIEnv</struct>
14094 </outptr>
14095 <description>
14096 The JNI environment of the event (current) thread
14097 </description>
14098 </param>
14099 <param id="thread">
14100 <jthread/>
14101 <description>
14102 Thread allocating the object.
14103 </description>
14104 </param>
14105 <param id="object">
14106 <jobject/>
14107 <description>
14108 JNI local reference to the object that was allocated.
14109 Null when preview features are enabled, the capability <code>can_support_value_objects</code>
14110 is enabled, and the allocated object has no identity.
14111 </description>
14112 </param>
14113 <param id="object_klass">
14114 <jclass/>
14115 <description>
14116 JNI local reference to the class of the object.
14117 </description>
14118 </param>
14119 <param id="size">
14120 <jlong/>
14121 <description>
14122 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
14123 </description>
14124 </param>
14125 </parameters>
14126 </event>
14127
14128 <event label="Sampled Object Allocation"
14129 id="SampledObjectAlloc" const="JVMTI_EVENT_SAMPLED_OBJECT_ALLOC" filtered="thread" num="86" since="11">
14130 <description>
14131 Sent when an allocated object is sampled.
14132 By default, the sampling interval is set to 512KB. The sampling is semi-random to avoid
14133 pattern-based bias and provides an approximate overall average interval over long periods of
14134 sampling.
14135 <p/>
14136 Each thread tracks how many bytes it has allocated since it sent the last event.
14137 When the number of bytes exceeds the sampling interval, it will send another event.
14138 This implies that, on average, one object will be sampled every time a thread has
14139 allocated 512KB bytes since the last sample.
14140 <p/>
14141 Note that the sampler is pseudo-random: it will not sample every 512KB precisely.
14142 The goal of this is to ensure high quality sampling even if allocation is
14143 happening in a fixed pattern (i.e., the same set of objects are being allocated
14144 every 512KB).
14145 <p/>
14146 If another sampling interval is required, the user can call
14147 <functionlink id="SetHeapSamplingInterval"></functionlink> with a strictly positive integer value,
14148 representing the new sampling interval.
14149 <p/>
14150 This event is sent once the sampled allocation has been performed. It provides the object, stack trace
14151 of the allocation, the thread allocating, the size of allocation, and the object's class.
14152 <p/>
14153 A typical use case of this system is to determine where heap allocations originate.
14154 In conjunction with weak references and the function
14155 <functionlink id="GetStackTrace"></functionlink>, a user can track which objects were allocated from which
14156 stack trace, and which are still live during the execution of the program.
14157 <p/>
14158 When preview features are enabled and the capability <code>can_support_value_objects</code>
14159 is enabled, this event is sent for the allocated objects that have no identity.
14160 <code>null</code> is passed for the <paramlink id="object"></paramlink> parameter in such cases.
14161 </description>
14162 <origin>new</origin>
14163 <capabilities>
14164 <required id="can_generate_sampled_object_alloc_events"></required>
14165 <capability id="can_support_value_objects"></capability>
14166 </capabilities>
14167 <parameters>
14168 <param id="jni_env">
14169 <outptr>
14170 <struct>JNIEnv</struct>
14171 </outptr>
14172 <description>
14173 The JNI environment of the event (current) thread.
14174 </description>
14175 </param>
14176 <param id="thread">
14177 <jthread/>
14178 <description>
14179 Thread allocating the object.
14180 </description>
14181 </param>
14182 <param id="object">
14183 <jobject/>
14184 <description>
14185 JNI local reference to the object that was allocated.
14186 Null when preview features are enabled, the capability <code>can_support_value_objects</code>
14187 is enabled, and the allocated object has no identity.
14188 </description>
14189 </param>
14190 <param id="object_klass">
14191 <jclass/>
14192 <description>
14193 JNI local reference to the class of the object
14194 </description>
14195 </param>
14196 <param id="size">
14197 <jlong/>
14198 <description>
14199 Size of the object (in bytes). See <functionlink id="GetObjectSize"/>.
14200 </description>
14201 </param>
14202 </parameters>
14203 </event>
14204
14205 <event label="Object Free"
14206 id="ObjectFree" const="JVMTI_EVENT_OBJECT_FREE" num="83">
14207 <description>
14208 An Object Free event is sent when the garbage collector frees an object.
14209 Events are only sent for tagged objects--see
14210 <internallink id="Heap">heap functions</internallink>.
14211 <p/>
14212 When preview features are enabled, the Object Free event is only sent for tagged
14213 <externallink id="jni/functions.html#hasidentity">identity objects</externallink>.
14214 <b>The event is not sent for tagged values objects.</b>
14215 <p/>
14216 The event handler must not use JNI functions and
14217 must not use <jvmti/> functions except those which
14218 specifically allow such use (see the raw monitor, memory management,
14219 and environment local storage functions).
14220 </description>
14221 <origin>new</origin>
14222 <capabilities>
14223 <required id="can_generate_object_free_events"></required>
14224 </capabilities>
14225 <parameters>
14226 <param id="tag">
14227 <jlong/>
14228 <description>
14229 The freed object's tag
14230 </description>
14231 </param>
14232 </parameters>
14233 </event>
14234
14235 <event label="Garbage Collection Start"
14236 id="GarbageCollectionStart" const="JVMTI_EVENT_GARBAGE_COLLECTION_START" num="81">
14237 <description>
14238 A Garbage Collection Start event is sent when a
14239 garbage collection pause begins.
14240 Only stop-the-world collections are reported--that is, collections during
14241 which all threads cease to modify the state of the Java virtual machine.
14242 This means that some collectors will never generate these events.
14243 This event is sent while the VM is still stopped, thus
14244 the event handler must not use JNI functions and
14245 must not use <jvmti/> functions except those which
14246 specifically allow such use (see the raw monitor, memory management,
14247 and environment local storage functions).
14248 <p/>
14249 This event is always sent as a matched pair with
14250 <eventlink id="GarbageCollectionFinish"/>
14251 (assuming both events are enabled) and no garbage collection
14252 events will occur between them.
14253 </description>
14254 <origin>new</origin>
14255 <capabilities>
14256 <required id="can_generate_garbage_collection_events"></required>
14257 </capabilities>
14258 <parameters>
14259 </parameters>
14260 </event>
14261
14262 <event label="Garbage Collection Finish"
14263 id="GarbageCollectionFinish" const="JVMTI_EVENT_GARBAGE_COLLECTION_FINISH" num="82">
14264 <description>
14265 A Garbage Collection Finish event is sent when a
14266 garbage collection pause ends.
14267 This event is sent while the VM is still stopped, thus
14268 the event handler must not use JNI functions and
14269 must not use <jvmti/> functions except those which
14270 specifically allow such use (see the raw monitor, memory management,
14271 and environment local storage functions).
14272 <p/>
14273 Some agents may need to do post garbage collection operations that
14274 require the use of the disallowed <jvmti/> or JNI functions. For these
14275 cases an agent thread can be created which waits on a raw monitor,
14276 and the handler for the Garbage Collection Finish event simply
14277 notifies the raw monitor
14278 <p/>
14279 This event is always sent as a matched pair with
14280 <eventlink id="GarbageCollectionStart"/> (assuming both events are enabled).
14281 <issue>
14282 The most important use of this event is to provide timing information,
14283 and thus additional information is not required. However,
14284 information about the collection which is "free" should be included -
14285 what that information is needs to be determined.
14286 </issue>
14287 </description>
14288 <origin>new</origin>
14289 <capabilities>
14290 <required id="can_generate_garbage_collection_events"></required>
14291 </capabilities>
14292 <parameters>
14293 </parameters>
14294 </event>
14295
14296 <elide>
14297 <event label="Verbose Output" phase="any"
14298 id="VerboseOutput" const="JVMTI_EVENT_VERBOSE_OUTPUT" num="85">
14299 <description>
14300 Send verbose messages as strings.
14301 <issue>
14302 This format is extremely fragile, as it can change with each
14303 platform, collector and version. Alternatives include:
14304 <ul>
14305 <li>building off Java programming language M and M APIs</li>
14306 <li>XML</li>
14307 <li>key/value pairs</li>
14308 <li>removing it</li>
14309 </ul>
14310 </issue>
14311 <issue>
14312 Though this seemed trivial to implement.
14313 In the RI it appears this will be quite complex.
14314 </issue>
14315 </description>
14316 <origin>new</origin>
14317 <capabilities>
14318 </capabilities>
14319 <parameters>
14320 <param id="flag">
14321 <enum>jvmtiVerboseFlag</enum>
14322 <description>
14323 Which verbose output is being sent.
14324 </description>
14325 </param>
14326 <param id="message">
14327 <vmbuf><char/></vmbuf>
14328 <description>
14329 Message text, encoded as a
14330 <internallink id="mUTF">modified UTF-8</internallink> string.
14331 </description>
14332 </param>
14333 </parameters>
14334 </event>
14335 </elide>
14336
14337 </eventsection>
14338
14339 <datasection>
14340 <intro>
14341 <jvmti/> extends the data types defined by JNI.
14342 </intro>
14343 <basetypes id="jniTypes" label="JNI Types Used in the JVM Tool Interface">
14344 <basetype id="jboolean">
14345 <description>
14346 Holds a Java programming language <code>boolean</code>.
14347 Unsigned 8 bits.
14348 </description>
14349 </basetype>
14350 <basetype id="jchar">
14351 <description>
14352 Holds a Java programming language <code>char</code>.
14353 Unsigned 16 bits.
14354 </description>
14355 </basetype>
14356 <basetype id="jint">
14357 <description>
14358 Holds a Java programming language <code>int</code>.
14359 Signed 32 bits.
14360 </description>
14361 </basetype>
14362 <basetype id="jlong">
14363 <description>
14364 Holds a Java programming language <code>long</code>.
14365 Signed 64 bits.
14366 </description>
14367 </basetype>
14368 <basetype id="jfloat">
14369 <description>
14370 Holds a Java programming language <code>float</code>.
14371 32 bits.
14372 </description>
14373 </basetype>
14374 <basetype id="jdouble">
14375 <description>
14376 Holds a Java programming language <code>double</code>.
14377 64 bits.
14378 </description>
14379 </basetype>
14380 <basetype id="jobject">
14381 <description>
14382 Holds a Java programming language object.
14383 </description>
14384 </basetype>
14385 <basetype id="jclass">
14386 <description>
14387 Holds a Java programming language class.
14388 </description>
14389 </basetype>
14390 <basetype id="jvalue">
14391 <description>
14392 Is a union of all primitive types and <code>jobject</code>. Thus, holds any Java
14393 programming language value.
14394 </description>
14395 </basetype>
14396 <basetype id="jfieldID">
14397 <description>
14398 Identifies a Java programming language field.
14399 <code>jfieldID</code>s returned by <jvmti/> functions and events may be
14400 safely stored.
14401 </description>
14402 </basetype>
14403 <basetype id="jmethodID">
14404 <description>
14405 Identifies a Java programming language method, initializer, or constructor.
14406 <code>jmethodID</code>s returned by <jvmti/> functions and events may be
14407 safely stored. However, if the class is unloaded, they become invalid
14408 and must not be used.
14409 </description>
14410 </basetype>
14411 <basetype id="JNIEnv">
14412 <description>
14413 Pointer to the JNI function table. Pointer to this (<code>JNIEnv *</code>)
14414 is a JNI environment.
14415 </description>
14416 </basetype>
14417 </basetypes>
14418
14419 <basetypes id="jvmtiTypes" label="JVM Tool Interface Base Types">
14420 <basetype id="jvmtiEnv">
14421 <description>
14422 The <jvmti/> <internallink id="environments">environment</internallink> pointer.
14423 See the <internallink id="FunctionSection">Function Section</internallink>.
14424 <code>jvmtiEnv</code> points to the
14425 <internallink id="FunctionTable">function table</internallink> pointer.
14426 </description>
14427 </basetype>
14428 <basetype id="jthread">
14429 <definition>typedef jobject jthread;</definition>
14430 <description>
14431 Subtype of <datalink id="jobject"></datalink> that holds a thread.
14432 </description>
14433 </basetype>
14434 <basetype id="jthreadGroup">
14435 <definition>typedef jobject jthreadGroup;</definition>
14436 <description>
14437 Subtype of <datalink id="jobject"></datalink> that holds a thread group.
14438 </description>
14439 </basetype>
14440 <basetype id="jlocation">
14441 <definition>typedef jlong jlocation;</definition>
14442 <description>
14443 A 64 bit value, representing a monotonically increasing
14444 executable position within a method.
14445 <code>-1</code> indicates a native method.
14446 See <functionlink id="GetJLocationFormat"></functionlink> for the format on a
14447 given VM.
14448 </description>
14449 </basetype>
14450 <basetype id="jrawMonitorID">
14451 <definition>struct _jrawMonitorID;
14452 typedef struct _jrawMonitorID *jrawMonitorID;</definition>
14453 <description>
14454 A raw monitor.
14455 </description>
14456 </basetype>
14457 <basetype id="jvmtiError">
14458 <description>
14459 Holds an error return code.
14460 See the <internallink id="ErrorSection">Error section</internallink> for possible values.
14461 <example>
14462 typedef enum {
14463 JVMTI_ERROR_NONE = 0,
14464 JVMTI_ERROR_INVALID_THREAD = 10,
14465 ...
14466 } jvmtiError;
14467 </example>
14468 </description>
14469 </basetype>
14470 <basetype id="jvmtiEvent">
14471 <description>
14472 An identifier for an event type.
14473 See the <internallink id="EventSection">Event section</internallink> for possible values.
14474 It is guaranteed that future versions of this specification will
14475 never assign zero as an event type identifier.
14476 <example>
14477 typedef enum {
14478 JVMTI_EVENT_SINGLE_STEP = 1,
14479 JVMTI_EVENT_BREAKPOINT = 2,
14480 ...
14481 } jvmtiEvent;
14482 </example>
14483 </description>
14484 </basetype>
14485 <basetype id="jvmtiEventCallbacks" name="eventCallbacks">
14486 <description>
14487 The callbacks used for events.
14488 <example>
14489 typedef struct {
14490 jvmtiEventVMInit VMInit;
14491 jvmtiEventVMDeath VMDeath;
14492 ...
14493 } jvmtiEventCallbacks;
14494 </example>
14495 See <internallink id="jvmtiEventCallbacks">event callbacks</internallink>
14496 for the complete structure.
14497 <p/>
14498 Where, for example, the VM initialization callback is defined:
14499 <example>
14500 typedef void (JNICALL *jvmtiEventVMInit)
14501 (jvmtiEnv *jvmti_env,
14502 JNIEnv* jni_env,
14503 jthread thread);
14504 </example>
14505 See the individual events for the callback function definition.
14506 </description>
14507 </basetype>
14508 <basetype id="jniNativeInterface">
14509 <definition>typedef struct JNINativeInterface_ jniNativeInterface;</definition>
14510 <description>
14511 Typedef for the JNI function table <code>JNINativeInterface</code>
14512 defined in the
14513 <externallink id="jni/functions.html#interface-function-table">
14514 JNI Specification</externallink>.
14515 The JNI reference implementation defines this with an underscore.
14516 </description>
14517 </basetype>
14518 </basetypes>
14519
14520 </datasection>
14521
14522 <issuessection label="Issues">
14523 <intro id="suspendRequired" label="Resolved Issue: Suspend - Required or Automatic">
14524 JVMDI requires that the agent suspend threads before calling
14525 certain sensitive functions. JVMPI requires garbage collection to be
14526 disabled before calling certain sensitive functions.
14527 It was suggested that rather than have this requirement, that
14528 VM place itself in a suitable state before performing an
14529 operation. This makes considerable sense since each VM
14530 knows its requirements and can most easily arrange a
14531 safe state.
14532 <p/>
14533 The ability to externally suspend/resume threads will, of
14534 course, remain. The ability to enable/disable garbage collection will not.
14535 <p/>
14536 This issue is resolved--suspend will not
14537 be required. The spec has been updated to reflect this.
14538 </intro>
14539
14540 <intro id="stackSampling" label="Resolved Issue: Call Stack Sampling">
14541 There are a variety of approaches to sampling call stacks.
14542 The biggest bifurcation is between VM controlled and agent
14543 controlled.
14544 <p/>
14545 This issue is resolved--agent controlled
14546 sampling will be the approach.
14547 </intro>
14548
14549 <intro id="threadRepresentation" label="Resolved Issue: Thread Representation">
14550 JVMDI represents threads as jthread. JVMPI primarily
14551 uses JNIEnv* to represent threads.
14552 <p/>
14553 The Expert Group has chosen jthread as the representation
14554 for threads in <jvmti/>.
14555 JNIEnv* is sent by
14556 events since it is needed to JNI functions. JNIEnv, per the
14557 JNI spec, are not supposed to be used outside their thread.
14558 </intro>
14559
14560 <intro id="design" label="Resolved Issue: Method Representation">
14561 The JNI spec allows an implementation to depend on jclass/jmethodID
14562 pairs, rather than simply a jmethodID, to reference a method.
14563 JVMDI, for consistency, choose the same representation.
14564 JVMPI, however, specifies that a jmethodID alone maps to a
14565 method. Both of the Sun <tm>J2SE</tm> virtual machines (Classic and <tm>HotSpot</tm>) store
14566 pointers in jmethodIDs, and as a result, a jmethodID is sufficient.
14567 In fact, any JVM implementation that supports JVMPI must have
14568 such a representation.
14569 <jvmti/> will use jmethodID as a unique representation of a method
14570 (no jclass is used).
14571 There should be efficiency gains, particularly in
14572 functionality like stack dumping, to this representation.
14573 <p/>
14574 Note that fields were not used in JVMPI and that the access profile
14575 of fields differs from methods--for implementation efficiency
14576 reasons, a jclass/jfieldID pair will still be needed for field
14577 reference.
14578 </intro>
14579
14580 <intro id="localReferenceIssue" label="Resolved Issue: Local References">
14581 Functions return local references.
14582 </intro>
14583
14584 <intro id="frameRep" label="Resolved Issue: Representation of frames">
14585 In JVMDI, a frame ID is used to represent a frame. Problem with this
14586 is that a VM must track when a frame becomes invalid, a far better
14587 approach, and the one used in <jvmti/>, is to reference frames by depth.
14588 </intro>
14589
14590 <intro id="requiredCapabilities" label="Issue: Required Capabilities">
14591 Currently, having a required capabilities means that the functionality
14592 is optional. Capabilities are useful even for required functionality
14593 since they can inform the VM is needed set-up. Thus, there should be
14594 a set of capabilities that a conformant implementation must provide
14595 (if requested during Agent_OnLoad).
14596 </intro>
14597
14598 <intro id="taghint" label="Proposal: add tag hint function">
14599 A hint of the percentage of objects that will be tagged would
14600 help the VM pick a good implementation.
14601 </intro>
14602
14603 <intro id="moreMonitorQueries" label="Request: More Monitor Quires">
14604 How difficult or easy would be to extend the monitor_info category to include
14605 <pre>
14606 - current number of monitors
14607 - enumeration of monitors
14608 - enumeration of threads waiting on a given monitor
14609 </pre>
14610 The reason for my question is the fact that current get_monitor_info support
14611 requires the agent to specify a given thread to get the info which is probably
14612 OK in the profiling/debugging space, while in the monitoring space the agent
14613 could be watching the monitor list and then decide which thread to ask for
14614 the info. You might ask why is this important for monitoring .... I think it
14615 can aid in the detection/prediction of application contention caused by hot-locks.
14616 </intro>
14617 </issuessection>
14618
14619 <changehistory id="ChangeHistory" update="09/05/07">
14620 <intro>
14621 The <jvmti/> specification is an evolving document with major, minor,
14622 and micro version numbers.
14623 A released version of the specification is uniquely identified
14624 by its major and minor version.
14625 The functions, events, and capabilities in this specification
14626 indicate a "Since" value which is the major and minor version in
14627 which it was introduced.
14628 The version of the specification implemented by the VM can
14629 be retrieved at runtime with the <functionlink id="GetVersionNumber"/>
14630 function.
14631 </intro>
14632 <change date="14 Nov 2002">
14633 Converted to XML document.
14634 </change>
14635 <change date="14 Nov 2002">
14636 Elided heap dump functions (for now) since what was there
14637 was wrong.
14638 </change>
14639 <change date="18 Nov 2002">
14640 Added detail throughout.
14641 </change>
14642 <change date="18 Nov 2002">
14643 Changed JVMTI_THREAD_STATUS_RUNNING to JVMTI_THREAD_STATUS_RUNNABLE.
14644 </change>
14645 <change date="19 Nov 2002">
14646 Added AsyncGetStackTrace.
14647 </change>
14648 <change date="19 Nov 2002">
14649 Added jframeID return to GetStackTrace.
14650 </change>
14651 <change date="19 Nov 2002">
14652 Elided GetCurrentFrame and GetCallingFrame functions (for now) since what was there
14653 since they are redundant with GetStackTrace.
14654 </change>
14655 <change date="19 Nov 2002">
14656 Elided ClearAllBreakpoints since it has always been redundant.
14657 </change>
14658 <change date="19 Nov 2002">
14659 Added GetSystemProperties.
14660 </change>
14661 <change date="19 Nov 2002">
14662 Changed the thread local storage functions to use jthread.
14663 </change>
14664 <change date="20 Nov 2002">
14665 Added GetJLocationFormat.
14666 </change>
14667 <change date="22 Nov 2002">
14668 Added events and introductory text.
14669 </change>
14670 <change date="22 Nov 2002">
14671 Cross reference type and constant definitions.
14672 </change>
14673 <change date="24 Nov 2002">
14674 Added DTD.
14675 </change>
14676 <change date="24 Nov 2002">
14677 Added capabilities function section.
14678 </change>
14679 <change date="29 Nov 2002">
14680 Assign capabilities to each function and event.
14681 </change>
14682 <change date="29 Nov 2002">
14683 Add <internallink id="jniIntercept">JNI interception functions</internallink>.
14684 </change>
14685 <change date="30 Nov 2002">
14686 Auto generate SetEventNotificationMode capabilities.
14687 </change>
14688 <change date="30 Nov 2002">
14689 Add <eventlink id="VMObjectAlloc"></eventlink> event.
14690 </change>
14691 <change date="30 Nov 2002">
14692 Add <eventlink id="DynamicCodeGenerated"></eventlink> event.
14693 </change>
14694 <change date="30 Nov 2002">
14695 Add const to declarations.
14696 </change>
14697 <change date="30 Nov 2002">
14698 Change method exit and frame pop to send on exception.
14699 </change>
14700 <change date="1 Dec 2002">
14701 Add ForceGarbageCollection.
14702 </change>
14703 <change date="2 Dec 2002">
14704 Redo Xrun section; clarify GetStackTrace and add example;
14705 Fix width problems; use "agent" consistently.
14706 </change>
14707 <change date="8 Dec 2002">
14708 Remove previous start-up intro.
14709 Add <internallink id="environments"><jvmti/> Environments</internallink>
14710 section.
14711 </change>
14712 <change date="8 Dec 2002">
14713 Add <functionlink id="DisposeEnvironment"></functionlink>.
14714 </change>
14715 <change date="9 Dec 2002">
14716 Numerous minor updates.
14717 </change>
14718 <change date="15 Dec 2002">
14719 Add heap profiling functions added:
14720 get/set annotation, iterate live objects/heap.
14721 Add heap profiling functions place holder added:
14722 heap roots.
14723 Heap profiling event added: object free.
14724 Heap profiling event redesigned: vm object allocation.
14725 Heap profiling event placeholders added: garbage collection start/finish.
14726 Native method bind event added.
14727 </change>
14728 <change date="19 Dec 2002">
14729 Revamp suspend/resume functions.
14730 Add origin information with jvmdi tag.
14731 Misc fixes.
14732 </change>
14733 <change date="24 Dec 2002">
14734 Add semantics to types.
14735 </change>
14736 <change date="27 Dec 2002">
14737 Add local reference section.
14738 Autogenerate parameter descriptions from types.
14739 </change>
14740 <change date="28 Dec 2002">
14741 Document that RunAgentThread sends threadStart.
14742 </change>
14743 <change date="29 Dec 2002">
14744 Remove redundant local ref and dealloc warning.
14745 Convert GetRawMonitorName to allocated buffer.
14746 Add GenerateEvents.
14747 </change>
14748 <change date="30 Dec 2002">
14749 Make raw monitors a type and rename to "jrawMonitorID".
14750 </change>
14751 <change date="1 Jan 2003">
14752 Include origin information.
14753 Clean-up JVMDI issue references.
14754 Remove Deallocate warnings which are now automatically generated.
14755 </change>
14756 <change date="2 Jan 2003">
14757 Fix representation issues for jthread.
14758 </change>
14759 <change date="3 Jan 2003">
14760 Make capabilities buffered out to 64 bits - and do it automatically.
14761 </change>
14762 <change date="4 Jan 2003">
14763 Make constants which are enumeration into enum types.
14764 Parameters now of enum type.
14765 Clean-up and index type section.
14766 Replace remaining datadef entities with callback.
14767 </change>
14768 <change date="7 Jan 2003">
14769 Correct GenerateEvents description.
14770 More internal semantics work.
14771 </change>
14772 <change date="9 Jan 2003">
14773 Replace previous GetSystemProperties with two functions
14774 which use allocated information instead fixed.
14775 Add SetSystemProperty.
14776 More internal semantics work.
14777 </change>
14778 <change date="12 Jan 2003">
14779 Add varargs to end of SetEventNotificationMode.
14780 </change>
14781 <change date="20 Jan 2003">
14782 Finish fixing spec to reflect that alloc sizes are jlong.
14783 </change>
14784 <change date="22 Jan 2003">
14785 Allow null as RunAgentThread arg.
14786 </change>
14787 <change date="22 Jan 2003">
14788 Fixed names to standardized naming convention
14789 Removed AsyncGetStackTrace.
14790 </change>
14791 <change date="29 Jan 2003">
14792 Since we are using jthread, removed GetThread.
14793 </change>
14794 <change date="31 Jan 2003">
14795 Change GetFieldName to allow null like GetMethodName.
14796 </change>
14797 <change date="29 Feb 2003" version="v40">
14798 Rewrite the introductory text, adding sections on
14799 start-up, environments and bytecode instrumentation.
14800 Change the command line arguments per EG discussions.
14801 Add an introduction to the capabilities section.
14802 Add the extension mechanism category and functions.
14803 Mark for deletion, but clarified anyhow, SuspendAllThreads.
14804 Rename IterateOverLiveObjects to IterateOverReachableObjects and
14805 change the text accordingly.
14806 Clarify IterateOverHeap.
14807 Clarify CompiledMethodLoad.
14808 Discuss prerequisite state for Calling Functions.
14809 Clarify SetAllocationHooks.
14810 Added issues ("To be resolved:") through-out.
14811 And so on...
14812 </change>
14813 <change date="6 Mar 2003" version="v41">
14814 Remove struct from the call to GetOwnedMonitorInfo.
14815 Automatically generate most error documentation, remove
14816 (rather broken) hand written error doc.
14817 Better describe capability use (empty initial set).
14818 Add min value to jint params.
14819 Remove the capability can_access_thread_local_storage.
14820 Rename error JVMTI_ERROR_NOT_IMPLEMENTED to JVMTI_ERROR_MUST_POSSESS_CAPABILITY;
14821 same for *NOT_IMPLEMENTED.
14822 Description fixes.
14823 </change>
14824 <change date="8 Mar 2003" version="v42">
14825 Rename GetClassSignature to GetClassName.
14826 Rename IterateOverClassObjects to IterateOverInstancesOfClass.
14827 Remove GetMaxStack (operand stack isn't used in <jvmti/>).
14828 Description fixes: define launch-time, remove native frame pop
14829 from PopFrame, and assorted clarifications.
14830 </change>
14831 <change date="8 Mar 2003" version="v43">
14832 Fix minor editing problem.
14833 </change>
14834 <change date="10 Mar 2003" version="v44">
14835 Add phase information.
14836 Remap (compact) event numbers.
14837 </change>
14838 <change date="11 Mar 2003" version="v45">
14839 More phase information - allow "any".
14840 Elide raw monitor queries and events.
14841 Minor description fixes.
14842 </change>
14843 <change date="12 Mar 2003" version="v46">
14844 Add GetPhase.
14845 Use "phase" through document.
14846 Elide GetRawMonitorName.
14847 Elide GetObjectMonitors.
14848 </change>
14849 <change date="12 Mar 2003" version="v47">
14850 Fixes from link, XML, and spell checking.
14851 Auto-generate the callback structure.
14852 </change>
14853 <change date="13 Mar 2003" version="v48">
14854 One character XML fix.
14855 </change>
14856 <change date="13 Mar 2003" version="v49">
14857 Change function parameter names to be consistent with
14858 event parameters (fooBarBaz becomes foo_bar_baz).
14859 </change>
14860 <change date="14 Mar 2003" version="v50">
14861 Fix broken link. Fix thread markers.
14862 </change>
14863 <change date="14 Mar 2003" version="v51">
14864 Change constants so they are under 128 to workaround
14865 compiler problems.
14866 </change>
14867 <change date="23 Mar 2003" version="v52">
14868 Overhaul capabilities. Separate GetStackTrace into
14869 GetStackTrace and GetStackFrames.
14870 </change>
14871 <change date="8 Apr 2003" version="v54">
14872 Use depth instead of jframeID to reference frames.
14873 Remove the now irrelevant GetCurrentFrame, GetCallerFrame and GetStackFrames.
14874 Remove frame arg from events.
14875 </change>
14876 <change date="9 Apr 2003" version="v55">
14877 Remove GetObjectWithAnnotation since tests show buffered approach more efficient.
14878 Add missing annotation_count to GetObjectsWithAnnotations
14879 </change>
14880 <change date="10 Apr 2003" version="v56">
14881 Remove confusing parenthetical statement in GetObjectsWithAnnotations
14882 </change>
14883 <change date="13 Apr 2003" version="v58">
14884 Replace jclass/jmethodID representation of method with simply jmethodID;
14885 Pass JvmtiEnv* as first arg of every event; remove JNIEnv* where inappropriate.
14886 Replace can_access_frames with can_access_local_variables; remove from purely stack access.
14887 Use can_get_synthetic_attribute; fix description.
14888 Clarify that zero length arrays must be deallocated.
14889 Clarify RelinquishCapabilities.
14890 Generalize JVMTI_ERROR_VM_DEAD to JVMTI_ERROR_WRONG_PHASE.
14891 </change>
14892 <change date="27 Apr 2003" version="v59">
14893 Remove lingering indirect references to OBSOLETE_METHOD_ID.
14894 </change>
14895 <change date="4 May 2003" version="v60">
14896 Allow DestroyRawMonitor during OnLoad.
14897 </change>
14898 <change date="7 May 2003" version="v61">
14899 Added not monitor owner error return to DestroyRawMonitor.
14900 </change>
14901 <change date="13 May 2003" version="v62">
14902 Clarify semantics of raw monitors.
14903 Change flags on <code>GetThreadStatus</code>.
14904 <code>GetClassLoader</code> return a null pointer for the bootstrap class loader.
14905 Add <code>GetClassName</code> issue.
14906 Define local variable signature.
14907 Disallow zero in annotations array of <code>GetObjectsWithAnnotations</code>.
14908 Remove over specification in <code>GetObjectsWithAnnotations</code>.
14909 Elide <code>SetAllocationHooks</code>.
14910 Elide <code>SuspendAllThreads</code>.
14911 </change>
14912 <change date="14 May 2003" version="v63">
14913 Define the data type <code>jvmtiEventCallbacks</code>.
14914 Zero length allocations return a null pointer.
14915 Keep SetAllocationHooks in JVMDI, but remove from <jvmti/>.
14916 Add JVMTI_THREAD_STATUS_FLAG_INTERRUPTED.
14917 </change>
14918 <change date="15 May 2003" version="v64">
14919 Better wording, per review.
14920 </change>
14921 <change date="15 May 2003" version="v65">
14922 First Alpha.
14923 Make jmethodID and jfieldID unique, jclass not used.
14924 </change>
14925 <change date="27 May 2003" version="v66">
14926 Fix minor XSLT errors.
14927 </change>
14928 <change date="13 June 2003" version="v67">
14929 Undo making jfieldID unique (jmethodID still is).
14930 </change>
14931 <change date="17 June 2003" version="v68">
14932 Changes per June 11th Expert Group meeting --
14933 Overhaul Heap functionality: single callback,
14934 remove GetHeapRoots, add reachable iterators,
14935 and rename "annotation" to "tag".
14936 A null pointer thread parameter on most functions is current
14937 thread.
14938 Add timers.
14939 Remove ForceExit.
14940 Add GetEnvironmentLocalStorage.
14941 Add verbose flag and event.
14942 Add AddToBootstrapClassLoaderSearch.
14943 Update ClassFileLoadHook.
14944 </change>
14945 <change date="18 June 2003" version="v69">
14946 Clean up issues sections.
14947 Rename GetClassName back to GetClassSignature and
14948 fix description.
14949 Add generic signature to GetClassSignature,
14950 GetFieldSignature, GetMethodSignature, and
14951 GetLocalVariableTable.
14952 Elide EstimateCostOfCapabilities.
14953 Clarify that the system property functions operate
14954 on the VM view of system properties.
14955 Clarify Agent_OnLoad.
14956 Remove "const" from JNIEnv* in events.
14957 Add metadata accessors.
14958 </change>
14959 <change date="18 June 2003" version="v70">
14960 Add start_depth to GetStackTrace.
14961 Move system properties to a new category.
14962 Add GetObjectSize.
14963 Remove "X" from command line flags.
14964 XML, HTML, and spell check corrections.
14965 </change>
14966 <change date="19 June 2003" version="v71">
14967 Fix JVMTI_HEAP_ROOT_THREAD to be 6.
14968 Make each synopsis match the function name.
14969 Fix unclear wording.
14970 </change>
14971 <change date="26 June 2003" version="v72">
14972 SetThreadLocalStorage and SetEnvironmentLocalStorage should allow value
14973 to be set to null pointer.
14974 NotifyFramePop, GetFrameLocationm and all the local variable operations
14975 needed to have their wording about frames fixed.
14976 Grammar and clarity need to be fixed throughout.
14977 Capitalization and puntuation need to be consistent.
14978 Need micro version number and masks for accessing major, minor, and micro.
14979 The error code lists should indicate which must be returned by
14980 an implementation.
14981 The command line properties should be visible in the properties functions.
14982 Disallow popping from the current thread.
14983 Allow implementations to return opaque frame error when they cannot pop.
14984 The NativeMethodBind event should be sent during any phase.
14985 The DynamicCodeGenerated event should be sent during any phase.
14986 The following functions should be allowed to operate before VMInit:
14987 Set/GetEnvironmentLocalStorage
14988 GetMethodDeclaringClass
14989 GetClassSignature
14990 GetClassModifiers
14991 IsInterface
14992 IsArrayClass
14993 GetMethodName
14994 GetMethodModifiers
14995 GetMaxLocals
14996 GetArgumentsSize
14997 GetLineNumberTable
14998 GetMethodLocation
14999 IsMethodNative
15000 IsMethodSynthetic.
15001 Other changes (to XSL):
15002 Argument description should show asterisk after not before pointers.
15003 NotifyFramePop, GetFrameLocationm and all the local variable operations
15004 should hsve the NO_MORE_FRAMES error added.
15005 Not alive threads should have a different error return than invalid thread.
15006 </change>
15007 <change date="7 July 2003" version="v73">
15008 VerboseOutput event was missing message parameter.
15009 Minor fix-ups.
15010 </change>
15011 <change date="14 July 2003" version="v74">
15012 Technical Publications Department corrections.
15013 Allow thread and environment local storage to be set to null pointer.
15014 </change>
15015 <change date="23 July 2003" version="v75">
15016 Use new Agent_OnLoad rather than overloaded JVM_OnLoad.
15017 Add JNICALL to callbacks (XSL).
15018 Document JNICALL requirement for both events and callbacks (XSL).
15019 Restrict RedefineClasses to methods and attributes.
15020 Elide the VerboseOutput event.
15021 VMObjectAlloc: restrict when event is sent and remove method parameter.
15022 Finish loose ends from Tech Pubs edit.
15023 </change>
15024 <change date="24 July 2003" version="v76">
15025 Change ClassFileLoadHook event to send the class instead of a boolean of redefine.
15026 </change>
15027 <change date="24 July 2003" version="v77">
15028 XML fixes.
15029 Minor text clarifications and corrections.
15030 </change>
15031 <change date="24 July 2003" version="v78">
15032 Remove GetExceptionHandlerTable and GetThrownExceptions from <jvmti/>.
15033 Clarify that stack frames are JVM Spec frames.
15034 Split can_get_source_info into can_get_source_file_name, can_get_line_numbers,
15035 and can_get_source_debug_extension.
15036 PopFrame cannot have a native calling method.
15037 Removed incorrect statement in GetClassloaderClasses
15038 (see <vmspec chapter="4.4"/>).
15039 </change>
15040 <change date="24 July 2003" version="v79">
15041 XML and text fixes.
15042 Move stack frame description into Stack Frame category.
15043 </change>
15044 <change date="26 July 2003" version="v80">
15045 Allow null pointer (means bootstrap loader) for GetClassloaderClasses.
15046 Add new heap reference kinds for references from classes.
15047 Add timer information struct and query functions.
15048 Add AvailableProcessors.
15049 Rename GetOtherThreadCpuTime to GetThreadCpuTime.
15050 Explicitly add JVMTI_ERROR_INVALID_THREAD and JVMTI_ERROR_THREAD_NOT_ALIVE
15051 to SetEventNotification mode.
15052 Add initial thread to the VM_INIT event.
15053 Remove platform assumptions from AddToBootstrapClassLoaderSearch.
15054 </change>
15055 <change date="26 July 2003" version="v81">
15056 Grammar and clarity changes per review.
15057 </change>
15058 <change date="27 July 2003" version="v82">
15059 More grammar and clarity changes per review.
15060 Add Agent_OnUnload.
15061 </change>
15062 <change date="28 July 2003" version="v83">
15063 Change return type of Agent_OnUnload to void.
15064 </change>
15065 <change date="28 July 2003" version="v84">
15066 Rename JVMTI_REFERENCE_ARRAY to JVMTI_REFERENCE_ARRAY_ELEMENT.
15067 </change>
15068 <change date="28 July 2003" version="v85">
15069 Steal java.lang.Runtime.availableProcessors() wording for
15070 AvailableProcessors().
15071 Guarantee that zero will never be an event ID.
15072 Remove some issues which are no longer issues.
15073 Per review, rename and more completely document the timer
15074 information functions.
15075 </change>
15076 <change date="29 July 2003" version="v86">
15077 Non-spec visible change to XML controlled implementation:
15078 SetThreadLocalStorage must run in VM mode.
15079 </change>
15080 <change date="5 August 2003" version="0.1.87">
15081 Add GetErrorName.
15082 Add varargs warning to jvmtiExtensionEvent.
15083 Remove "const" on the jvmtiEnv* of jvmtiExtensionEvent.
15084 Remove unused can_get_exception_info capability.
15085 Pass jvmtiEnv* and JNIEnv* to the jvmtiStartFunction.
15086 Fix jvmtiExtensionFunctionInfo.func declared type.
15087 Extension function returns error code.
15088 Use new version numbering.
15089 </change>
15090 <change date="5 August 2003" version="0.2.88">
15091 Remove the ClassUnload event.
15092 </change>
15093 <change date="8 August 2003" version="0.2.89">
15094 Heap reference iterator callbacks return an enum that
15095 allows outgoing object references to be ignored.
15096 Allow JNIEnv as a param type to extension events/functions.
15097 </change>
15098 <change date="15 August 2003" version="0.2.90">
15099 Fix a typo.
15100 </change>
15101 <change date="2 September 2003" version="0.2.91">
15102 Remove all metadata functions: GetClassMetadata,
15103 GetFieldMetadata, and GetMethodMetadata.
15104 </change>
15105 <change date="1 October 2003" version="0.2.92">
15106 Mark the functions Allocate. Deallocate, RawMonitor*,
15107 SetEnvironmentLocalStorage, and GetEnvironmentLocalStorage
15108 as safe for use in heap callbacks and GC events.
15109 </change>
15110 <change date="24 November 2003" version="0.2.93">
15111 Add pass through opaque user data pointer to heap iterate
15112 functions and callbacks.
15113 In the CompiledMethodUnload event, send the code address.
15114 Add GarbageCollectionOccurred event.
15115 Add constant pool reference kind.
15116 Mark the functions CreateRawMonitor and DestroyRawMonitor
15117 as safe for use in heap callbacks and GC events.
15118 Clarify: VMDeath, GetCurrentThreadCpuTimerInfo,
15119 GetThreadCpuTimerInfo, IterateOverReachableObjects,
15120 IterateOverObjectsReachableFromObject, GetTime and
15121 JVMTI_ERROR_NULL_POINTER.
15122 Add missing errors to: GenerateEvents and
15123 AddToBootstrapClassLoaderSearch.
15124 Fix description of ClassFileLoadHook name parameter.
15125 In heap callbacks and GC/ObjectFree events, specify
15126 that only explicitly allowed functions can be called.
15127 Allow GetCurrentThreadCpuTimerInfo, GetCurrentThreadCpuTime,
15128 GetTimerInfo, and GetTime during callback.
15129 Allow calling SetTag/GetTag during the onload phase.
15130 SetEventNotificationMode, add: error attempted inappropriate
15131 thread level control.
15132 Remove jvmtiExceptionHandlerEntry.
15133 Fix handling of native methods on the stack --
15134 location_ptr param of GetFrameLocation, remove
15135 JVMTI_ERROR_OPAQUE_FRAME from GetFrameLocation,
15136 jvmtiFrameInfo.location, and jlocation.
15137 Remove typo (from JVMPI) implying that the MonitorWaited
15138 event is sent on sleep.
15139 </change>
15140 <change date="25 November 2003" version="0.2.94">
15141 Clarifications and typos.
15142 </change>
15143 <change date="3 December 2003" version="0.2.95">
15144 Allow null pointer user_data in heap iterators.
15145 </change>
15146 <change date="28 January 2004" version="0.2.97">
15147 Add GetThreadState, deprecate GetThreadStatus.
15148 </change>
15149 <change date="29 January 2004" version="0.2.98">
15150 INVALID_SLOT and TYPE_MISMATCH errors should be optional.
15151 </change>
15152 <change date="12 February 2004" version="0.2.102">
15153 Remove MonitorContendedExit.
15154 Added JNIEnv parameter to VMObjectAlloc.
15155 Clarified definition of class_tag and referrer_index
15156 parameters to heap callbacks.
15157 </change>
15158 <change date="16 February 2004" version="0.2.103">
15159 Document JAVA_TOOL_OPTIONS.
15160 </change>
15161 <change date="17 February 2004" version="0.2.105">
15162 Divide start phase into primordial and start.
15163 Add VMStart event
15164 Change phase associations of functions and events.
15165 </change>
15166 <change date="18 February 2004" version="0.3.6">
15167 Elide deprecated GetThreadStatus.
15168 Bump minor version, subtract 100 from micro version
15169 </change>
15170 <change date="18 February 2004" version="0.3.7">
15171 Document that timer nanosecond values are unsigned.
15172 Clarify text having to do with native methods.
15173 </change>
15174 <change date="19 February 2004" version="0.3.8">
15175 Fix typos.
15176 Remove elided deprecated GetThreadStatus.
15177 </change>
15178 <change date="23 February 2004" version="0.3.9">
15179 Require NotifyFramePop to act on suspended threads.
15180 </change>
15181 <change date="24 February 2004" version="0.3.10">
15182 Add capabilities
15183 (<internallink id="jvmtiCapabilities.can_redefine_any_class"
15184 ><code>can_redefine_any_class</code></internallink>
15185 and
15186 <internallink id="jvmtiCapabilities.can_generate_all_class_hook_events"
15187 ><code>can_generate_all_class_hook_events</code></internallink>)
15188 and an error (<errorlink id="JVMTI_ERROR_UNMODIFIABLE_CLASS"></errorlink>)
15189 which allow some classes to be unmodifiable.
15190 </change>
15191 <change date="28 February 2004" version="0.3.11">
15192 Add JVMTI_ERROR_MUST_POSSESS_CAPABILITY to SetEventNotificationMode.
15193 </change>
15194 <change date="8 March 2004" version="0.3.12">
15195 Clarified CompiledMethodUnload so that it is clear the event
15196 may be posted after the class has been unloaded.
15197 </change>
15198 <change date="5 March 2004" version="0.3.13">
15199 Change the size parameter of VMObjectAlloc to jlong to match GetObjectSize.
15200 </change>
15201 <change date="13 March 2004" version="0.3.14">
15202 Added guideline for the use of the JNI FindClass function in event
15203 callback functions.
15204 </change>
15205 <change date="15 March 2004" version="0.3.15">
15206 Add GetAllStackTraces and GetThreadListStackTraces.
15207 </change>
15208 <change date="19 March 2004" version="0.3.16">
15209 ClassLoad and ClassPrepare events can be posted during start phase.
15210 </change>
15211 <change date="25 March 2004" version="0.3.17">
15212 Add JVMTI_ERROR_NATIVE_METHOD to GetLineNumberTable, GetLocalVariableTable,
15213 GetMaxLocals, GetArgumentsSize, GetMethodLocation, GetBytecodes.
15214 </change>
15215 <change date="29 March 2004" version="0.3.18">
15216 Return the timer kind in the timer information structure.
15217 </change>
15218 <change date="31 March 2004" version="0.3.19">
15219 Spec clarifications:
15220 JVMTI_THREAD_STATE_IN_NATIVE might not include JNI or <jvmti/>.
15221 ForceGarbageCollection does not run finalizers.
15222 The context of the specification is the Java platform.
15223 Warn about early instrumentation.
15224 </change>
15225 <change date="1 April 2004" version="0.3.20">
15226 Refinements to the above clarifications and
15227 Clarify that an error returned by Agent_OnLoad terminates the VM.
15228 </change>
15229 <change date="1 April 2004" version="0.3.21">
15230 Array class creation does not generate a class load event.
15231 </change>
15232 <change date="7 April 2004" version="0.3.22">
15233 Align thread state hierarchy more closely with java.lang.Thread.State.
15234 </change>
15235 <change date="12 April 2004" version="0.3.23">
15236 Clarify the documentation of thread state.
15237 </change>
15238 <change date="19 April 2004" version="0.3.24">
15239 Remove GarbageCollectionOccurred event -- can be done by agent.
15240 </change>
15241 <change date="22 April 2004" version="0.3.25">
15242 Define "command-line option".
15243 </change>
15244 <change date="29 April 2004" version="0.3.26">
15245 Describe the intended use of bytecode instrumentation.
15246 Fix description of extension event first parameter.
15247 </change>
15248 <change date="30 April 2004" version="0.3.27">
15249 Clarification and typos.
15250 </change>
15251 <change date="18 May 2004" version="0.3.28">
15252 Remove DataDumpRequest event.
15253 </change>
15254 <change date="18 May 2004" version="0.3.29">
15255 Clarify RawMonitorWait with zero timeout.
15256 Clarify thread state after RunAgentThread.
15257 </change>
15258 <change date="24 May 2004" version="0.3.30">
15259 Clean-up: fix bad/old links, etc.
15260 </change>
15261 <change date="30 May 2004" version="0.3.31">
15262 Clarifications including:
15263 All character strings are modified UTF-8.
15264 Agent thread visibiity.
15265 Meaning of obsolete method version.
15266 Thread invoking heap callbacks,
15267 </change>
15268 <change date="1 June 2004" version="1.0.32">
15269 Bump major.minor version numbers to "1.0".
15270 </change>
15271 <change date="2 June 2004" version="1.0.33">
15272 Clarify interaction between ForceGarbageCollection
15273 and ObjectFree.
15274 </change>
15275 <change date="6 June 2004" version="1.0.34">
15276 Restrict AddToBootstrapClassLoaderSearch and
15277 SetSystemProperty to the OnLoad phase only.
15278 </change>
15279 <change date="11 June 2004" version="1.0.35">
15280 Fix typo in SetTag.
15281 </change>
15282 <change date="18 June 2004" version="1.0.36">
15283 Fix trademarks.
15284 Add missing parameter in example GetThreadState usage.
15285 </change>
15286 <change date="4 August 2004" version="1.0.37">
15287 Copyright updates.
15288 </change>
15289 <change date="5 November 2004" version="1.0.38">
15290 Add missing function table layout.
15291 Add missing description of C++ member function format of functions.
15292 Clarify that name in CFLH can be null pointer.
15293 Released as part of <tm>J2SE</tm> 5.0.
15294 </change>
15295 <change date="24 April 2005" version="1.1.47">
15296 Bump major.minor version numbers to "1.1".
15297 Add ForceEarlyReturn* functions.
15298 Add GetOwnedMonitorStackDepthInfo function.
15299 Add GetCurrentThread function.
15300 Add "since" version marker.
15301 Add AddToSystemClassLoaderSearch.
15302 Allow AddToBootstrapClassLoaderSearch be used in live phase.
15303 Fix historic rubbish in the descriptions of the heap_object_callback
15304 parameter of IterateOverHeap and IterateOverInstancesOfClass functions;
15305 disallow null pointer for this parameter.
15306 Clarify, correct and make consistent: wording about current thread,
15307 opaque frames and insufficient number of frames in PopFrame.
15308 Consistently use "current frame" rather than "topmost".
15309 Clarify the JVMTI_ERROR_TYPE_MISMATCH errors in GetLocal* and SetLocal*
15310 by making them compatible with those in ForceEarlyReturn*.
15311 Many other clarifications and wording clean ups.
15312 </change>
15313 <change date="25 April 2005" version="1.1.48">
15314 Add GetConstantPool.
15315 Switch references to the first edition of the VM Spec, to the seconds edition.
15316 </change>
15317 <change date="26 April 2005" version="1.1.49">
15318 Clarify minor/major version order in GetConstantPool.
15319 </change>
15320 <change date="26 April 2005" version="1.1.50">
15321 Add SetNativeMethodPrefix and SetNativeMethodPrefixes.
15322 Reassign GetOwnedMonitorStackDepthInfo to position 153.
15323 Break out Class Loader Search in its own documentation category.
15324 Deal with overly long lines in XML source.
15325 </change>
15326 <change date="29 April 2005" version="1.1.51">
15327 Allow agents be started in the live phase.
15328 Added paragraph about deploying agents.
15329 </change>
15330 <change date="30 April 2005" version="1.1.52">
15331 Add specification description to SetNativeMethodPrefix(es).
15332 Better define the conditions on GetConstantPool.
15333 </change>
15334 <change date="30 April 2005" version="1.1.53">
15335 Break out the GetClassVersionNumber function from GetConstantPool.
15336 Clean-up the references to the VM Spec.
15337 </change>
15338 <change date="1 May 2005" version="1.1.54">
15339 Allow SetNativeMethodPrefix(es) in any phase.
15340 Add clarifications about the impact of redefinition on GetConstantPool.
15341 </change>
15342 <change date="2 May 2005" version="1.1.56">
15343 Various clarifications to SetNativeMethodPrefix(es).
15344 </change>
15345 <change date="2 May 2005" version="1.1.57">
15346 Add missing performance warning to the method entry event.
15347 </change>
15348 <change date="5 May 2005" version="1.1.58">
15349 Remove internal JVMDI support.
15350 </change>
15351 <change date="8 May 2005" version="1.1.59">
15352 Add <functionlink id="RetransformClasses"/>.
15353 Revamp the bytecode instrumentation documentation.
15354 Change <functionlink id="IsMethodObsolete"/> to no longer
15355 require the can_redefine_classes capability.
15356 </change>
15357 <change date="11 May 2005" version="1.1.63">
15358 Clarifications for retransformation.
15359 </change>
15360 <change date="11 May 2005" version="1.1.64">
15361 Clarifications for retransformation, per review.
15362 Lock "retransformation (in)capable" at class load enable time.
15363 </change>
15364 <change date="4 June 2005" version="1.1.67">
15365 Add new heap functionity which supports reporting primitive values,
15366 allows setting the referrer tag, and has more powerful filtering:
15367 FollowReferences, IterateThroughHeap, and their associated
15368 callbacks, structs, enums, and constants.
15369 </change>
15370 <change date="4 June 2005" version="1.1.68">
15371 Clarification.
15372 </change>
15373 <change date="6 June 2005" version="1.1.69">
15374 FollowReferences, IterateThroughHeap: Put callbacks in a struct;
15375 Add missing error codes; reduce bits in the visit control flags.
15376 </change>
15377 <change date="14 June 2005" version="1.1.70">
15378 More on new heap functionity: spec clean-up per review.
15379 </change>
15380 <change date="15 June 2005" version="1.1.71">
15381 More on new heap functionity: Rename old heap section to Heap (1.0).
15382 </change>
15383 <change date="21 June 2005" version="1.1.72">
15384 Fix typos.
15385 </change>
15386 <change date="27 June 2005" version="1.1.73">
15387 Make referrer info structure a union.
15388 </change>
15389 <change date="9 September 2005" version="1.1.74">
15390 In new heap functions:
15391 Add missing superclass reference kind.
15392 Use a single scheme for computing field indexes.
15393 Remove outdated references to struct based referrer info.
15394 </change>
15395 <change date="12 September 2005" version="1.1.75">
15396 Don't callback during FollowReferences on frivolous java.lang.Object superclass.
15397 </change>
15398 <change date="13 September 2005" version="1.1.76">
15399 In string primitive callback, length now Unicode length.
15400 In array and string primitive callbacks, value now "const".
15401 Note possible compiler impacts on setting JNI function table.
15402 </change>
15403 <change date="13 September 2005" version="1.1.77">
15404 GetClassVersionNumbers() and GetConstantPool() should return
15405 error on array or primitive class.
15406 </change>
15407 <change date="14 September 2005" version="1.1.78">
15408 Grammar fixes.
15409 </change>
15410 <change date="26 September 2005" version="1.1.79">
15411 Add IsModifiableClass query.
15412 </change>
15413 <change date="9 February 2006" version="1.1.81">
15414 Add referrer_class_tag parameter to jvmtiHeapReferenceCallback.
15415 </change>
15416 <change date="13 February 2006" version="1.1.82">
15417 Doc fixes: update can_redefine_any_class to include retransform.
15418 Clarify that exception events cover all Throwables.
15419 In GetStackTrace, no test is done for start_depth too big if start_depth is zero,
15420 Clarify fields reported in Primitive Field Callback -- static vs instance.
15421 Repair confusing names of heap types, including callback names.
15422 Require consistent usage of stack depth in the face of thread launch methods.
15423 Note incompatibility of <jvmti/> memory management with other systems.
15424 </change>
15425 <change date="14 February 2006" version="1.1.85">
15426 Fix typos and missing renames.
15427 </change>
15428 <change date="13 March 2006" version="1.1.86">
15429 Clarify that jmethodIDs and jfieldIDs can be saved.
15430 Clarify that Iterate Over Instances Of Class includes subclasses.
15431 </change>
15432 <change date="14 March 2006" version="1.1.87">
15433 Better phrasing.
15434 </change>
15435 <change date="16 March 2006" version="1.1.88">
15436 Match the referrer_index for static fields in Object Reference Callback
15437 with the Reference Implementation (and all other known implementations);
15438 that is, make it match the definition for instance fields.
15439 In GetThreadListStackTraces, add JVMTI_ERROR_INVALID_THREAD to cover
15440 an invalid thread in the list; and specify that not started threads
15441 return empty stacks.
15442 </change>
15443 <change date="17 March 2006" version="1.1.89">
15444 Typo.
15445 </change>
15446 <change date="25 March 2006" version="1.1.90">
15447 Typo.
15448 </change>
15449 <change date="6 April 2006" version="1.1.91">
15450 Remove restrictions on AddToBootstrapClassLoaderSearch and
15451 AddToSystemClassLoaderSearch.
15452 </change>
15453 <change date="1 May 2006" version="1.1.93">
15454 Changed spec to return -1 for monitor stack depth for the
15455 implementation which can not determine stack depth.
15456 </change>
15457 <change date="3 May 2006" version="1.1.94">
15458 Corrections for readability and accuracy courtesy of Alan Pratt of IBM.
15459 List the object relationships reported in FollowReferences.
15460 </change>
15461 <change date="5 May 2006" version="1.1.95">
15462 Clarify the object relationships reported in FollowReferences.
15463 </change>
15464 <change date="28 June 2006" version="1.1.98">
15465 Clarify DisposeEnvironment; add warning.
15466 Fix typos in SetLocalXXX "retrieve" => "set".
15467 Clarify that native method prefixes must remain set while used.
15468 Clarify that exactly one Agent_OnXXX is called per agent.
15469 Clarify that library loading is independent from start-up.
15470 Remove ambiguous reference to Agent_OnLoad in the Agent_OnUnload spec.
15471 </change>
15472 <change date="31 July 2006" version="1.1.99">
15473 Clarify the interaction between functions and exceptions.
15474 Clarify and give examples of field indices.
15475 Remove confusing "That is" sentence from MonitorWait and MonitorWaited events.
15476 Update links to point to Java 6.
15477 </change>
15478 <change date="6 August 2006" version="1.1.102">
15479 Add ResourceExhaustedEvent.
15480 </change>
15481 <change date="11 October 2012" version="1.2.2">
15482 Fixed the "HTTP" and "Missing Anchor" errors reported by the LinkCheck tool.
15483 </change>
15484 <change date="19 June 2013" version="1.2.3">
15485 Added support for statically linked agents.
15486 </change>
15487 <change date="13 October 2016" version="9.0.0">
15488 Support for modules:
15489 The majorversion is 9 now.
15490 The ClassFileLoadHook events are not sent during the primordial phase anymore.
15491 Allow CompiledMethodLoad events at start phase.
15492 Add new capabilities: can_generate_early_vmstart, can_generate_early_class_hook_events.
15493 Add new functions: GetAllModules, AddModuleReads, AddModuleExports,
15494 AddModuleOpens, AddModuleUses, AddModuleProvides, IsModifiableModule.
15495 Clarified can_redefine_any_classes, can_retransform_any_classes and
15496 IsModifiableClass API to disallow some implementation defined classes.
15497 </change>
15498 <change date="12 February 2017" version="9.0.0">
15499 Minor update for GetCurrentThread function:
15500 The function may return null pointer in the start phase if the
15501 can_generate_early_vmstart capability is enabled.
15502 </change>
15503 <change date="7 February 2018" version="11.0.0">
15504 Minor update for new class file NestHost and NestMembers attributes:
15505 Specify that RedefineClasses and RetransformClasses are not allowed
15506 to change the class file NestHost and NestMembers attributes;
15507 Add new error JVMTI_ERROR_UNSUPPORTED_REDEFINITION_CLASS_ATTRIBUTE_CHANGED
15508 that can be returned by RedefineClasses and RetransformClasses.
15509 </change>
15510 <change date="15 June 2018" version="11.0.0">
15511 Support for Low Overhead Heap Sampling:
15512 Add new capability: can_generate_sampled_object_alloc_events.
15513 Add new function: SetHeapSamplingInterval.
15514 Add new event type: JVMTI_EVENT_SAMPLED_OBJECT_ALLOC.
15515 </change>
15516 <change date="20 May 2019" version="13.0.0">
15517 Minor spec update for the capability "can_redefine_any_class".
15518 It now says: "RedefineClasses can be called on any modifiable class."
15519 See IsModifiableClass. (can_redefine_classes must also be set)
15520 </change>
15521 <change date="5 June 2019" version="13.0.0">
15522 Minor PopFrame spec update:
15523 The specified thread must be suspended or must be the current thread.
15524 (It was not allowed to be the current thread before.)
15525 </change>
15526 <change date="10 October 2019" version="14.0.0">
15527 Minor update for new class file Record attribute:
15528 Specify that RedefineClasses and RetransformClasses are not allowed
15529 to change the class file Record attribute.
15530 </change>
15531 <change date="13 May 2020" version="15.0.0">
15532 Minor update for new class file PermittedSubclasses attribute:
15533 Specify that RedefineClasses and RetransformClasses are not allowed
15534 to change the class file PermittedSubclasses attribute.
15535 </change>
15536 <change date="15 January 2021" version="17.0.0">
15537 Minor clarification in the section "Agent Shutdown" that says the
15538 implementation may choose to not call the Agent_OnUnload function
15539 if the Agent_OnAttach/Agent_OnAttach_L function reported an error.
15540 </change>
15541 <change date="8 June 2021" version="17.0.0">
15542 Minor update to deprecate Heap functions 1.0.
15543 </change>
15544 <change date="27 April 2022" version="19.0.0">
15545 Support for virtual threads (Preview):
15546 Add new capability: can_support_virtual_threads.
15547 Add new functions: SuspendAllVirtualThreads, ResumeAllVirtualThreads.
15548 Add new event types: JVMTI_EVENT_VIRTUAL_THREAD_START, JVMTI_EVENT_VIRTUAL_THREAD_END.
15549 Add new error code: JVMTI_ERROR_UNSUPPORTED_OPERATION.
15550 </change>
15551 <change date="7 June 2023" version="21.0.0">
15552 Virtual threads finalized to be a permanent feature.
15553 Agent start-up in the live phase now specified to print a warning.
15554 </change>
15555 <change date="10 January 2025" version="25.0.0">
15556 Add new function ClearAllFramePops. Needed to speedup debugger single stepping.
15557 </change>
15558 <change date="30 June 2026" version="28.0.0">
15559 Support for value objects (Preview):
15560 Add new capability: can_support_value_objects which enables
15561 the following events for value objects:
15562 JVMTI_EVENT_VM_OBJECT_ALLOC, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC.
15563 </change>
15564 </changehistory>
15565
15566 </specification>
15567 <!-- Keep this comment at the end of the file
15568 Local variables:
15569 mode: sgml
15570 sgml-omittag:t
15571 sgml-shorttag:t
15572 sgml-namecase-general:t
15573 sgml-general-insert-case:lower
15574 sgml-minimize-attributes:nil
15575 sgml-always-quote-attributes:t
15576 sgml-indent-step:2
15577 sgml-indent-data:t
15578 sgml-parent-document:nil
15579 sgml-exposed-tags:nil
15580 sgml-local-catalogs:nil
15581 sgml-local-ecat-files:nil
15582 End:
15583 -->